Browse Source

Closes #71: Allow cross-origine for Google calendar compatibility

Bastien Sevajol (Algoo) 8 years ago
parent
commit
395cf5bd59
3 changed files with 12 additions and 0 deletions
  1. 1 0
      tracim/development.ini.base
  2. 4 0
      tracim/tracim/config/app_cfg.py
  3. 7 0
      tracim/tracim/lib/daemons.py

+ 1 - 0
tracim/development.ini.base View File

@@ -193,6 +193,7 @@ email.notification.smtp.password = your_smtp_password
193 193
 # radicale.server.port = 5232
194 194
 # radicale.server.ssl = false
195 195
 # radicale.server.filesystem.folder = ~/.config/radicale/collections
196
+# radicale.server.allow_origin = *
196 197
 ## url can be extended like http://127.0.0.1:5232/calendar
197 198
 ## in this case, you have to create your own proxy behind this url.
198 199
 # radicale.client.base_url = http://127.0.0.1:5232

+ 4 - 0
tracim/tracim/config/app_cfg.py View File

@@ -249,6 +249,10 @@ class CFG(object):
249 249
             'radicale.server.filesystem.folder',
250 250
             '~/.config/radicale/collections'
251 251
         )
252
+        self.RADICALE_SERVER_ALLOW_ORIGIN = tg.config.get(
253
+            'radicale.server.allow_origin',
254
+            '*',
255
+        )
252 256
 
253 257
         self.RADICALE_CLIENT_BASE_URL_TEMPLATE = \
254 258
             tg.config.get('radicale.client.base_url', None)

+ 7 - 0
tracim/tracim/lib/daemons.py View File

@@ -177,6 +177,7 @@ class RadicaleDaemon(Daemon):
177 177
         tracim_rights = 'tracim.lib.radicale.rights'
178 178
         tracim_storage = 'tracim.lib.radicale.storage'
179 179
         fs_path = cfg.RADICALE_SERVER_FILE_SYSTEM_FOLDER
180
+        allow_origin = cfg.RADICALE_SERVER_ALLOW_ORIGIN
180 181
 
181 182
         radicale_config.set('auth', 'type', 'custom')
182 183
         radicale_config.set('auth', 'custom_handler', tracim_auth)
@@ -188,6 +189,12 @@ class RadicaleDaemon(Daemon):
188 189
         radicale_config.set('storage', 'custom_handler', tracim_storage)
189 190
         radicale_config.set('storage', 'filesystem_folder', fs_path)
190 191
 
192
+        radicale_config.set(
193
+            'header',
194
+            'Access-Control-Allow-Origin',
195
+            allow_origin,
196
+        )
197
+
191 198
     def _get_server(self):
192 199
         from tracim.config.app_cfg import CFG
193 200
         cfg = CFG.get_instance()