Merge pull request #1724 from pbiering/support-for-bundled-InfCloud-client

Support for bundled InfCloud client
This commit is contained in:
Peter Bieringer 2025-03-07 07:38:54 +01:00 committed by GitHub
commit c3c78db8ae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 43 additions and 9 deletions

View file

@ -12,6 +12,7 @@
* Add: option [server] script_name for reverse proxy base_prefix handling * Add: option [server] script_name for reverse proxy base_prefix handling
* Fix: proper base_prefix stripping if running behind reverse proxy * Fix: proper base_prefix stripping if running behind reverse proxy
* Review: Apache reverse proxy config example * 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 ## 3.4.1
* Add: option [auth] dovecot_connection_type / dovecot_host / dovecot_port * Add: option [auth] dovecot_connection_type / dovecot_host / dovecot_port

View file

@ -1448,16 +1448,13 @@ It will list your existing address books.
#### InfCloud, CalDavZAP and CardDavMATE #### InfCloud, CalDavZAP and CardDavMATE
You can integrate InfCloud into Radicale's web interface with You can integrate InfCloud into Radicale's web interface with by simply
[RadicaleInfCloud](https://github.com/Unrud/RadicaleInfCloud). No additional download latest package from [InfCloud](https://www.inf-it.com/open-source/clients/infcloud/)
configuration is required. 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 No further adjustments are required as content is adjusted on the fly (tested with 0.13.1).
hosted on the same server and port as Radicale, the browser will deny access to
the Radicale server, because of the See also [Wiki/Client InfCloud](https://github.com/Kozea/Radicale/wiki/Client-InfCloud).
[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.
#### Command line #### Command line

View file

@ -196,6 +196,24 @@ def _serve_traversable(
"%a, %d %b %Y %H:%M:%S GMT", "%a, %d %b %Y %H:%M:%S GMT",
time.gmtime(traversable.stat().st_mtime)) time.gmtime(traversable.stat().st_mtime))
answer = traversable.read_bytes() 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 return client.OK, headers, answer

View file

@ -39,6 +39,17 @@ main{
color: #484848; color: #484848;
} }
#loginscene .infcloudlink{
margin: 0;
width: 100%;
text-align: center;
color: #484848;
}
#loginscene .infcloudlink-hidden{
visibility: hidden;
}
#loginscene input{ #loginscene input{
} }

View file

@ -33,8 +33,15 @@
</section> </section>
<section id="loginscene" class="container hidden"> <section id="loginscene" class="container hidden">
<div class="infcloudlink-hidden">
<form action="infcloud/" method="get" target="_blank">
<button class="blue" type="submit">Collection content<br>(InfCloud web client)</button>
</form>
</div>
<div class="logocontainer"> <div class="logocontainer">
<img src="css/logo.svg" alt="Radicale"> <img src="css/logo.svg" alt="Radicale">
<br>
Collection management
</div> </div>
<h1>Sign in</h1> <h1>Sign in</h1>
<br> <br>