mirror of
https://github.com/pikami/cosmium.git
synced 2025-12-19 08:50:46 +00:00
Implement state export endpoint
This commit is contained in:
12
api/handlers/cosmium.go
Normal file
12
api/handlers/cosmium.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/pikami/cosmium/internal/repositories"
|
||||
)
|
||||
|
||||
func CosmiumExport(c *gin.Context) {
|
||||
c.IndentedJSON(http.StatusOK, repositories.GetState())
|
||||
}
|
||||
@@ -13,7 +13,9 @@ import (
|
||||
func Authentication() gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
requestUrl := c.Request.URL.String()
|
||||
if config.Config.DisableAuth || strings.HasPrefix(requestUrl, "/_explorer") {
|
||||
if config.Config.DisableAuth ||
|
||||
strings.HasPrefix(requestUrl, "/_explorer") ||
|
||||
strings.HasPrefix(requestUrl, "/cosmium") {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user