Compare commits
1 commit
4944e47e76
...
cfdf653c47
Author | SHA1 | Date | |
---|---|---|---|
![]() |
cfdf653c47 |
4 changed files with 33 additions and 32 deletions
|
@ -33,7 +33,6 @@ The file format is **JSON**:
|
|||
* **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)
|
||||
* **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.
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ type Config struct {
|
|||
ObservationInterval int `json:"observation_internal"`
|
||||
Languages []string `json:"languages"`
|
||||
Language string `json:"language"`
|
||||
EnableUploadFileButton bool `json:"enable_upload_file_button"`
|
||||
UploadFileButton bool `json:"upload_file_button"`
|
||||
}
|
||||
|
||||
func NewConfig() *Config {
|
||||
|
@ -71,7 +71,7 @@ func NewConfig() *Config {
|
|||
"YAML",
|
||||
},
|
||||
Language: "text",
|
||||
EnableUploadFileButton: true,
|
||||
UploadFileButton: true,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -193,7 +193,7 @@ type PageData struct {
|
|||
Err error
|
||||
URL string
|
||||
Note *Note
|
||||
EnableUploadFileButton bool
|
||||
UploadFileButton bool
|
||||
}
|
||||
|
||||
type HomeHandler struct {
|
||||
|
@ -433,7 +433,9 @@ func (s *Server) Start() error {
|
|||
if s.config.ShowVersion {
|
||||
p.Version = s.version
|
||||
}
|
||||
p.EnableUploadFileButton = s.config.EnableUploadFileButton
|
||||
if s.config.UploadFileButton {
|
||||
p.UploadFileButton = true
|
||||
}
|
||||
|
||||
templates, err := template.New("templates").Funcs(funcs).ParseFS(templatesFS, "templates/*.html")
|
||||
if err != nil {
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
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>
|
||||
</div>
|
||||
{{if .EnableUploadFileButton}}
|
||||
{{if .UploadFileButton}}
|
||||
<div class="col">
|
||||
<input type="file" class="form-control" for="file" id="file" name="file" accept="text/plain" />
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue