summaryrefslogtreecommitdiff
path: root/system/admin
diff options
context:
space:
mode:
Diffstat (limited to 'system/admin')
-rw-r--r--system/admin/config/config.go12
-rw-r--r--system/admin/handlers.go2
-rw-r--r--system/admin/server.go4
3 files changed, 14 insertions, 4 deletions
diff --git a/system/admin/config/config.go b/system/admin/config/config.go
index 7b57dc0..c83eb32 100644
--- a/system/admin/config/config.go
+++ b/system/admin/config/config.go
@@ -16,6 +16,7 @@ type Config struct {
AdminEmail string `json:"admin_email"`
ClientSecret string `json:"client_secret"`
Etag string `json:"etag"`
+ DisableCORS []string `json:"cors_disabled"`
CacheInvalidate []string `json:"cache"`
}
@@ -49,7 +50,7 @@ func (c *Config) MarshalEditor() ([]byte, error) {
},
editor.Field{
View: editor.Input("AdminEmail", c, map[string]string{
- "label": "Adminstrator Email (will be notified of internal system information)",
+ "label": "Adminstrator Email (notified of internal system information)",
}),
},
editor.Field{
@@ -65,7 +66,7 @@ func (c *Config) MarshalEditor() ([]byte, error) {
},
editor.Field{
View: editor.Input("Etag", c, map[string]string{
- "label": "Etag Header (used for static asset cache)",
+ "label": "Etag Header (used to cache resources)",
"disabled": "true",
}),
},
@@ -75,6 +76,13 @@ func (c *Config) MarshalEditor() ([]byte, error) {
}),
},
editor.Field{
+ View: editor.Checkbox("DisableCORS", c, map[string]string{
+ "label": "Disable CORS (so only " + c.Domain + " can fetch your data)",
+ }, map[string]string{
+ "true": "Disable",
+ }),
+ },
+ editor.Field{
View: editor.Checkbox("CacheInvalidate", c, map[string]string{
"label": "Invalidate cache on save",
}, map[string]string{
diff --git a/system/admin/handlers.go b/system/admin/handlers.go
index c39fee4..59e7a66 100644
--- a/system/admin/handlers.go
+++ b/system/admin/handlers.go
@@ -92,7 +92,7 @@ func initHandler(res http.ResponseWriter, req *http.Request) {
}
// set HTTP port which should be previously added to config cache
- port := db.ConfigCache("http_port")
+ port := db.ConfigCache("http_port").(string)
req.Form.Set("http_port", port)
// set initial user email as admin_email and make config
diff --git a/system/admin/server.go b/system/admin/server.go
index f2bf244..991f2d2 100644
--- a/system/admin/server.go
+++ b/system/admin/server.go
@@ -51,5 +51,7 @@ func Run() {
// even if the API server is not running. Otherwise, images/files uploaded
// through the editor will not load within the admin system.
uploadsDir := filepath.Join(pwd, "uploads")
- http.Handle("/api/uploads/", api.Record(db.CacheControl(http.StripPrefix("/api/uploads/", http.FileServer(restrict(http.Dir(uploadsDir)))))))
+ http.Handle("/api/uploads/", api.Record(api.CORS(db.CacheControl(
+ http.StripPrefix("/api/uploads/", http.FileServer(
+ restrict(http.Dir(uploadsDir))))))))
}