feat: Add text editor
All checks were successful
/ pre-commit (push) Successful in 1m45s

Use Monaco Editor to create notes. Support syntax highlighting. Store the
language with the note in the database to later support syntax highlighting in
a note web view.

Signed-off-by: Julien Riou <julien@riou.xyz>
This commit is contained in:
Julien Riou 2025-08-27 22:42:12 +02:00
parent b45c3e3253
commit c54f32495b
Signed by: jriou
GPG key ID: 9A099EDA51316854
9 changed files with 170 additions and 24 deletions

View file

@ -7,22 +7,24 @@ import (
)
type Config struct {
Title string `json:"title"`
DatabaseType string `json:"database_type"`
DatabaseDsn string `json:"database_dsn"`
IDLength int `json:"id_length"`
PasswordLength int `json:"password_length"`
ExpirationInterval int `json:"expiration_interval"`
ListenAddress string `json:"listen_address"`
ListenPort int `json:"listen_port"`
Expirations []int `json:"expirations"`
Expiration int `json:"expiration"`
MaxUploadSize int64 `json:"max_upload_size"`
ShowVersion bool `json:"show_version"`
EnableMetrics bool `json:"enable_metrics"`
PrometheusRoute string `json:"prometheus_route"`
PrometheusNotesMetric string `json:"prometheus_notes_metric"`
ObservationInterval int `json:"observation_internal"`
Title string `json:"title"`
DatabaseType string `json:"database_type"`
DatabaseDsn string `json:"database_dsn"`
IDLength int `json:"id_length"`
PasswordLength int `json:"password_length"`
ExpirationInterval int `json:"expiration_interval"`
ListenAddress string `json:"listen_address"`
ListenPort int `json:"listen_port"`
Expirations []int `json:"expirations"`
Expiration int `json:"expiration"`
MaxUploadSize int64 `json:"max_upload_size"`
ShowVersion bool `json:"show_version"`
EnableMetrics bool `json:"enable_metrics"`
PrometheusRoute string `json:"prometheus_route"`
PrometheusNotesMetric string `json:"prometheus_notes_metric"`
ObservationInterval int `json:"observation_internal"`
Languages []string `json:"languages"`
Language string `json:"language"`
}
func NewConfig() *Config {
@ -49,6 +51,25 @@ func NewConfig() *Config {
PrometheusRoute: "/metrics",
PrometheusNotesMetric: "collerd_notes",
ObservationInterval: 60,
Languages: []string{
"Text",
"CSS",
"Dockerfile",
"Go",
"HCL",
"HTML",
"Javascript",
"JSON",
"Markdown",
"Perl",
"Python",
"Ruby",
"Rust",
"Shell",
"SQL",
"YAML",
},
Language: "text",
}
}