feat: enable cors by default for desktop app (#904)

This commit is contained in:
kolaente
2025-06-10 20:43:13 +02:00
committed by GitHub
parent 3813a3b35c
commit 433b8b9115
2 changed files with 8 additions and 5 deletions

View File

@@ -290,15 +290,18 @@
"children": [
{
"key": "enable",
"default_value": "false",
"comment": "Whether to enable or disable cors headers.\nNote: If you want to put the frontend and the api on separate domains or ports, you will need to enable this.\nOtherwise the frontend won't be able to make requests to the api through the browser."
"default_value": "true",
"comment": "Whether to enable or disable cors headers.\nBy default, this is enabled only for requests from the desktop application running on localhost.\nNote: If you want to put the frontend and the api on separate domains or ports, you will need to adjust this setting accordingly."
},
{
"key": "origins",
"comment": "A list of origins which may access the api. These need to include the protocol (`http://` or `https://`) and port, if any.",
"children": [
{
"default_value": "*"
"default_value": "http://127.0.0.1:*"
},
{
"default_value": "http://localhost:*"
}
]
},

View File

@@ -421,8 +421,8 @@ func InitDefaultConfig() {
FilesBasePath.setDefault("files")
FilesMaxSize.setDefault("20MB")
// Cors
CorsEnable.setDefault(false)
CorsOrigins.setDefault([]string{"*"})
CorsEnable.setDefault(true)
CorsOrigins.setDefault([]string{"http://127.0.0.1:*", "http://localhost:*"})
CorsMaxAge.setDefault(0)
// Migration
MigrationTodoistEnable.setDefault(false)