diff --git a/.gitignore b/.gitignore index d2fe01d..cf8b1ff 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,3 @@ releases collerd.db !docker/collerd.json collerd.json -node_modules diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index 4cf810c..0000000 --- a/package-lock.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "coller", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "dependencies": { - "bootstrap": "^5.3.8" - } - }, - "node_modules/@popperjs/core": { - "version": "2.11.8", - "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz", - "integrity": "sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==", - "peer": true, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/popperjs" - } - }, - "node_modules/bootstrap": { - "version": "5.3.8", - "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.3.8.tgz", - "integrity": "sha512-HP1SZDqaLDPwsNiqRqi5NcP0SSXciX2s9E+RyqJIIqGo+vJeN5AJVM98CXmW/Wux0nQ5L7jeWUdplCEf0Ee+tg==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/twbs" - }, - { - "type": "opencollective", - "url": "https://opencollective.com/bootstrap" - } - ], - "peerDependencies": { - "@popperjs/core": "^2.11.8" - } - } - } -} diff --git a/package.json b/package.json deleted file mode 100644 index 719e5df..0000000 --- a/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "dependencies": { - "bootstrap": "^5.3.8" - } -} diff --git a/src/cmd/collerd/README.md b/src/cmd/collerd/README.md index 4526cef..d99a273 100644 --- a/src/cmd/collerd/README.md +++ b/src/cmd/collerd/README.md @@ -34,7 +34,6 @@ The file format is **JSON**: * **languages** ([]string): List of supported [languages](https://github.com/microsoft/monaco-editor/tree/main/src/basic-languages) * **language** (string): Default language (default "text") * **enable_upload_file_button** (bool): Display the upload file button in the UI (default true) -* **bootstrap_directory** (string): Serve [Bootstrap](https://getbootstrap.com/) assets from this local directory (ex: "./node_modules/bootstrap/dist"). See **Dependencies** for details. The configuration file is not required but the service might not be exposed to the public. @@ -77,27 +76,4 @@ If the note is encrypted, the encrypted value is returned (application/octet-str Errors return **500 Server Internal Error** with the **JSON** payload: * **message** (string): context of the error -* **error** (string): error message - -## Dependencies - -The web interface depends on: - -- [Bootstrap](https://getbootstrap.com/) -- [Monaco Editor](https://github.com/microsoft/monaco-editor/) - -By default, those dependencies are fetched from **remote CDN** services by the client. - -If you would like to download them to serve them locally: - -``` -npm install -``` - -Then configure the local directories: - -```json -{ - "bootstrap_directory": "./node_modules/bootstrap/dist" -} -``` +* **error** (string): error message \ No newline at end of file diff --git a/src/server/config.go b/src/server/config.go index e1ef5e7..8ba51ca 100644 --- a/src/server/config.go +++ b/src/server/config.go @@ -26,7 +26,6 @@ type Config struct { Languages []string `json:"languages"` Language string `json:"language"` EnableUploadFileButton bool `json:"enable_upload_file_button"` - BootstrapDirectory string `json:"bootstrap_directory"` } func NewConfig() *Config { diff --git a/src/server/server.go b/src/server/server.go index ab61605..703714d 100644 --- a/src/server/server.go +++ b/src/server/server.go @@ -195,7 +195,6 @@ type PageData struct { URL string Note *Note EnableUploadFileButton bool - BootstrapDirectory string } type HomeHandler struct { @@ -430,11 +429,10 @@ func (s *Server) Start() error { "string": func(b []byte) string { return string(b) }, } p := PageData{ - Title: s.config.Title, - Expirations: s.config.Expirations, - Expiration: s.config.Expiration, - Languages: s.config.Languages, - BootstrapDirectory: s.config.BootstrapDirectory, + Title: s.config.Title, + Expirations: s.config.Expirations, + Expiration: s.config.Expiration, + Languages: s.config.Languages, } if s.config.ShowVersion { @@ -471,10 +469,6 @@ func (s *Server) Start() error { } r.Path("/{id:[a-zA-Z0-9]+}.html").Handler(webNoteHandler).Methods("GET") - if s.config.BootstrapDirectory != "" { - r.PathPrefix("/static/bootstrap/").Handler(http.StripPrefix("/static/bootstrap/", http.FileServer(http.Dir(s.config.BootstrapDirectory)))) - } - r.Path("/").Handler(&HomeHandler{Templates: templates, PageData: p}).Methods("GET") addr := fmt.Sprintf("%s:%d", s.config.ListenAddress, s.config.ListenPort) diff --git a/src/server/templates/head.html b/src/server/templates/head.html index e5f3544..bd8edba 100644 --- a/src/server/templates/head.html +++ b/src/server/templates/head.html @@ -4,6 +4,6 @@ {{.Title}} - + {{end}} \ No newline at end of file