1
0
Fork 0
forked from jriou/coller

feat: Add text editor

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

@ -30,6 +30,7 @@ type NotePayload struct {
Encrypted bool `json:"encrypted"`
Expiration int `json:"expiration,omitempty"`
DeleteAfterRead bool `json:"delete_after_read,omitempty"`
Language string `json:"language"`
}
type NoteResponse struct {
@ -68,6 +69,7 @@ func handleMain() int {
copier := flag.Bool("copier", false, "Print the copier command to decrypt the note")
bearer := flag.String("bearer", os.Getenv("COLLER_BEARER"), "Bearer token")
askBearer := flag.Bool("b", false, "Read bearer token from input")
language := flag.String("language", "", "Language of the note")
flag.Parse()
@ -154,6 +156,9 @@ func handleMain() int {
if *deleteAfterRead {
p.DeleteAfterRead = *deleteAfterRead
}
if *language != "" {
p.Language = *language
}
if *password != "" {
logger.Debug("validating password")

View file

@ -31,6 +31,8 @@ The file format is **JSON**:
* **prometheus_route** (string): Route to expose Prometheus metrics (default "/metrics")
* **prometheus_notes_metric** (string): Name of the notes count metric (default "collerd_notes")
* **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")
The configuration file is not required but the service might not be exposed to the public.
@ -50,6 +52,7 @@ Body (JSON):
* **encrypted** (bool): true if the content has been encrypted by the client
* **expiration** (int): lifetime of the note in seconds (must be supported by the server)
* **delete_after_read** (bool): delete the note after the first read
* **language** (string): language of the note (must be supported by the server)
Response (JSON):
* **id** (string): ID of the note