diff --git a/src/cmd/collerd/README.md b/src/cmd/collerd/README.md index 231c887..01fc7b0 100644 --- a/src/cmd/collerd/README.md +++ b/src/cmd/collerd/README.md @@ -38,6 +38,7 @@ The file format is **JSON**: * **tls_key_file** (string): Path to TLS key file to enable HTTPS * **ace_directory** (string): Serve [Ace](hhttps://ace.c9.io/) assets from this local directory (ex: "./node_modules/ace-builds"). See **Dependencies** for details. * **bootstrap_directory** (string): Serve [Bootstrap](https://getbootstrap.com/) assets from this local directory (ex: "./node_modules/bootstrap/dist"). See **Dependencies** for details. +* **disable_editor** (bool): Disable Ace editor. The configuration file is not required but the service might not be exposed to the public. diff --git a/src/server/config.go b/src/server/config.go index 7a6830e..256104f 100644 --- a/src/server/config.go +++ b/src/server/config.go @@ -30,6 +30,7 @@ type Config struct { TLSKeyFile string `json:"tls_key_file"` AceDirectory string `json:"ace_directory"` BootstrapDirectory string `json:"bootstrap_directory"` + DisableEditor bool `json:"disable_editor"` } func NewConfig() *Config { diff --git a/src/server/handlers_web.go b/src/server/handlers_web.go index caebf9d..2eb9bea 100644 --- a/src/server/handlers_web.go +++ b/src/server/handlers_web.go @@ -29,6 +29,7 @@ type PageData struct { EnableUploadFileButton bool AceDirectory string BootstrapDirectory string + DisableEditor bool } type HomeHandler struct { diff --git a/src/server/server.go b/src/server/server.go index a18f55e..165edab 100644 --- a/src/server/server.go +++ b/src/server/server.go @@ -118,6 +118,7 @@ func (s *Server) Start() error { Languages: s.config.Languages, AceDirectory: s.config.AceDirectory, BootstrapDirectory: s.config.BootstrapDirectory, + DisableEditor: s.config.DisableEditor, } if s.config.ShowVersion { diff --git a/src/server/templates/index.html b/src/server/templates/index.html index fd034fd..9974972 100644 --- a/src/server/templates/index.html +++ b/src/server/templates/index.html @@ -58,11 +58,15 @@
+ {{if .DisableEditor}} + + {{else}}
+ {{end}}
@@ -71,6 +75,7 @@
+ {{if eq false .DisableEditor}} @@ -103,6 +108,7 @@ e.formData.append('content', editor.getValue()); }); + {{end}} {{block "footer" .}}{{end}} diff --git a/src/server/templates/note.html b/src/server/templates/note.html index b31f9ee..571d43e 100644 --- a/src/server/templates/note.html +++ b/src/server/templates/note.html @@ -33,9 +33,16 @@ {{end}} + {{if .DisableEditor}} +
+
+{{string .Note.Content}}
+            
+
+ {{else}}
+ style="min-height: 300px; resize: vertical; overflow: auto;">