Compare commits
1 commit
cfdf653c47
...
4944e47e76
Author | SHA1 | Date | |
---|---|---|---|
![]() |
4944e47e76 |
4 changed files with 32 additions and 33 deletions
|
@ -33,6 +33,7 @@ The file format is **JSON**:
|
||||||
* **observation_internal** (int): Number of seconds to wait between two observations (default 60)
|
* **observation_internal** (int): Number of seconds to wait between two observations (default 60)
|
||||||
* **languages** ([]string): List of supported [languages](https://github.com/microsoft/monaco-editor/tree/main/src/basic-languages)
|
* **languages** ([]string): List of supported [languages](https://github.com/microsoft/monaco-editor/tree/main/src/basic-languages)
|
||||||
* **language** (string): Default language (default "text")
|
* **language** (string): Default language (default "text")
|
||||||
|
* **enable_upload_file_button** (bool): Display the upload file button in the UI (default true)
|
||||||
|
|
||||||
The configuration file is not required but the service might not be exposed to the public.
|
The configuration file is not required but the service might not be exposed to the public.
|
||||||
|
|
||||||
|
|
|
@ -7,25 +7,25 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
Title string `json:"title"`
|
Title string `json:"title"`
|
||||||
DatabaseType string `json:"database_type"`
|
DatabaseType string `json:"database_type"`
|
||||||
DatabaseDsn string `json:"database_dsn"`
|
DatabaseDsn string `json:"database_dsn"`
|
||||||
IDLength int `json:"id_length"`
|
IDLength int `json:"id_length"`
|
||||||
PasswordLength int `json:"password_length"`
|
PasswordLength int `json:"password_length"`
|
||||||
ExpirationInterval int `json:"expiration_interval"`
|
ExpirationInterval int `json:"expiration_interval"`
|
||||||
ListenAddress string `json:"listen_address"`
|
ListenAddress string `json:"listen_address"`
|
||||||
ListenPort int `json:"listen_port"`
|
ListenPort int `json:"listen_port"`
|
||||||
Expirations []int `json:"expirations"`
|
Expirations []int `json:"expirations"`
|
||||||
Expiration int `json:"expiration"`
|
Expiration int `json:"expiration"`
|
||||||
MaxUploadSize int64 `json:"max_upload_size"`
|
MaxUploadSize int64 `json:"max_upload_size"`
|
||||||
ShowVersion bool `json:"show_version"`
|
ShowVersion bool `json:"show_version"`
|
||||||
EnableMetrics bool `json:"enable_metrics"`
|
EnableMetrics bool `json:"enable_metrics"`
|
||||||
PrometheusRoute string `json:"prometheus_route"`
|
PrometheusRoute string `json:"prometheus_route"`
|
||||||
PrometheusNotesMetric string `json:"prometheus_notes_metric"`
|
PrometheusNotesMetric string `json:"prometheus_notes_metric"`
|
||||||
ObservationInterval int `json:"observation_internal"`
|
ObservationInterval int `json:"observation_internal"`
|
||||||
Languages []string `json:"languages"`
|
Languages []string `json:"languages"`
|
||||||
Language string `json:"language"`
|
Language string `json:"language"`
|
||||||
UploadFileButton bool `json:"upload_file_button"`
|
EnableUploadFileButton bool `json:"enable_upload_file_button"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewConfig() *Config {
|
func NewConfig() *Config {
|
||||||
|
@ -70,8 +70,8 @@ func NewConfig() *Config {
|
||||||
"SQL",
|
"SQL",
|
||||||
"YAML",
|
"YAML",
|
||||||
},
|
},
|
||||||
Language: "text",
|
Language: "text",
|
||||||
UploadFileButton: true,
|
EnableUploadFileButton: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -186,14 +186,14 @@ func (h *GetProtectedNoteHandler) ServeHTTP(w http.ResponseWriter, r *http.Reque
|
||||||
}
|
}
|
||||||
|
|
||||||
type PageData struct {
|
type PageData struct {
|
||||||
Title string
|
Title string
|
||||||
Version string
|
Version string
|
||||||
Expirations []int
|
Expirations []int
|
||||||
Languages []string
|
Languages []string
|
||||||
Err error
|
Err error
|
||||||
URL string
|
URL string
|
||||||
Note *Note
|
Note *Note
|
||||||
UploadFileButton bool
|
EnableUploadFileButton bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type HomeHandler struct {
|
type HomeHandler struct {
|
||||||
|
@ -433,9 +433,7 @@ func (s *Server) Start() error {
|
||||||
if s.config.ShowVersion {
|
if s.config.ShowVersion {
|
||||||
p.Version = s.version
|
p.Version = s.version
|
||||||
}
|
}
|
||||||
if s.config.UploadFileButton {
|
p.EnableUploadFileButton = s.config.EnableUploadFileButton
|
||||||
p.UploadFileButton = true
|
|
||||||
}
|
|
||||||
|
|
||||||
templates, err := template.New("templates").Funcs(funcs).ParseFS(templatesFS, "templates/*.html")
|
templates, err := template.New("templates").Funcs(funcs).ParseFS(templatesFS, "templates/*.html")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
value="delete-after-read" name="delete-after-read">
|
value="delete-after-read" name="delete-after-read">
|
||||||
<label class="col-form-label col-form-label-sm" for="delete-after-read">Delete after read</label>
|
<label class="col-form-label col-form-label-sm" for="delete-after-read">Delete after read</label>
|
||||||
</div>
|
</div>
|
||||||
{{if .UploadFileButton}}
|
{{if .EnableUploadFileButton}}
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<input type="file" class="form-control" for="file" id="file" name="file" accept="text/plain" />
|
<input type="file" class="form-control" for="file" id="file" name="file" accept="text/plain" />
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue