diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ce89ba7..5decab27 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ * Add: option [server] script_name for reverse proxy base_prefix handling * Fix: proper base_prefix stripping if running behind reverse proxy * Review: Apache reverse proxy config example +* Add: on-the-fly link activation and default content adjustment in case of bundled InfCloud (tested with 0.13.1) ## 3.4.1 * Add: option [auth] dovecot_connection_type / dovecot_host / dovecot_port diff --git a/DOCUMENTATION.md b/DOCUMENTATION.md index f4e04d8f..32514e79 100644 --- a/DOCUMENTATION.md +++ b/DOCUMENTATION.md @@ -1448,16 +1448,13 @@ It will list your existing address books. #### InfCloud, CalDavZAP and CardDavMATE -You can integrate InfCloud into Radicale's web interface with -[RadicaleInfCloud](https://github.com/Unrud/RadicaleInfCloud). No additional -configuration is required. +You can integrate InfCloud into Radicale's web interface with by simply +download latest package from [InfCloud](https://www.inf-it.com/open-source/clients/infcloud/) +and extract content to new folder `infcloud` in `radicale/web/internal_data/`. -Set the URL of the Radicale server in ``config.js``. If **InfCloud** is not -hosted on the same server and port as Radicale, the browser will deny access to -the Radicale server, because of the -[same-origin policy](https://en.wikipedia.org/wiki/Same-origin_policy). -You have to add additional HTTP header in the `headers` section of Radicale's -configuration. The documentation of **InfCloud** has more details on this. +No further adjustments are required as content is adjusted on the fly (tested with 0.13.1). + +See also [Wiki/Client InfCloud](https://github.com/Kozea/Radicale/wiki/Client-InfCloud). #### Command line diff --git a/radicale/httputils.py b/radicale/httputils.py index 23cc3677..23f10ec1 100644 --- a/radicale/httputils.py +++ b/radicale/httputils.py @@ -196,6 +196,24 @@ def _serve_traversable( "%a, %d %b %Y %H:%M:%S GMT", time.gmtime(traversable.stat().st_mtime)) answer = traversable.read_bytes() + if path == "/.web/index.html" or path == "/.web/": + # enable link on the fly in index.html if InfCloud index.html is existing + # class="infcloudlink-hidden" -> class="infcloudlink" + path_posix = str(traversable) + path_posix_infcloud = path_posix.replace("/internal_data/index.html", "/internal_data/infcloud/index.html") + if os.path.isfile(path_posix_infcloud): + # logger.debug("Enable InfCloud link in served page: %r", path) + answer = answer.replace(b"infcloudlink-hidden", b"infcloud") + elif path == "/.web/infcloud/config.js": + # adjust on the fly default config.js of InfCloud installation + # logger.debug("Adjust on-the-fly default InfCloud config.js in served page: %r", path) + answer = answer.replace(b"location.pathname.replace(RegExp('/+[^/]+/*(index\\.html)?$'),'')+", b"location.pathname.replace(RegExp('/\\.web\\.infcloud/(index\\.html)?$'),'')+") + answer = answer.replace(b"'/caldav.php/',", b"'/',") + answer = answer.replace(b"settingsAccount: true,", b"settingsAccount: false,") + elif path == "/.web/infcloud/main.js": + # adjust on the fly default main.js of InfCloud installation + logger.debug("Adjust on-the-fly default InfCloud main.js in served page: %r", path) + answer = answer.replace(b"'InfCloud - the open source CalDAV/CardDAV web client'", b"'InfCloud - the open source CalDAV/CardDAV web client - served through Radicale CalDAV/CardDAV server'") return client.OK, headers, answer diff --git a/radicale/web/internal_data/css/main.css b/radicale/web/internal_data/css/main.css index a6d7da72..1e2dcef0 100644 --- a/radicale/web/internal_data/css/main.css +++ b/radicale/web/internal_data/css/main.css @@ -39,6 +39,17 @@ main{ color: #484848; } +#loginscene .infcloudlink{ + margin: 0; + width: 100%; + text-align: center; + color: #484848; +} + +#loginscene .infcloudlink-hidden{ + visibility: hidden; +} + #loginscene input{ } diff --git a/radicale/web/internal_data/index.html b/radicale/web/internal_data/index.html index 9ac96795..8d257c92 100644 --- a/radicale/web/internal_data/index.html +++ b/radicale/web/internal_data/index.html @@ -33,8 +33,15 @@