I installed nextcloud and collabora from the nethforge repository, and integrated both according to the documentation Nextcloud — NS8 documentation
However, I am unable to install custom fonts: I tried to upload additional fonts in nextcloud Admin Settings / Office, but they are not used by collabora. Nextcloud states
Make sure to set this URL: https://NEXTCLOUD.URL/apps/richdocuments/settings/fonts.json in the coolwsd.xml file of your Collabora Online server to ensure the added fonts get loaded automatically. Please note that http:// will only work for debug builds of Collabora Online. In production you must use https:// for remote font config.
<remote_font_config>
<url>https://NEXTCLOUD.URL/apps/richdocuments/settings/fonts.json</url>
</remote_font_config>
Can this configuration be added to the collabora application? Or is there another way to add custom fonts?
I think we need to add it as there’s the option to upload fonts in Nextcloud so Collabora should use them.
This one should work but it will be overwritten by next update, it could be done with a systemd override like here to make it persistent but I think it’s better to add the option to the app by default. @stephdl What do you think? Should I open an issue and a PR?
EDIT:
It’s not that simple, collabora doesn’t know about the nextcloud FQDN…maybe we would need another dropdown field in the collabora settings to choose the right NC instance for the fonts.
Enable Nextcloud uploaded fonts in Collabora
Enter collabora:
runagent -m collabora1
Edit the collabora service:
systemctl --user edit --full collabora
At line 18 add the extra param --o:remote_font_config.url=https://nextcloud.yourdomain.tld/apps/richdocuments/settings/fonts.json
It should look like
the use case is complicated with manual steps inside nextcloud (eg, upload custom fonts), so we cannot put a widget inside the UI of collabora, but this should, could be documented
It’s a challenge because both apps would need to be configured to each other to work together.
And it should be possible to leave it unconfigured to be able to use non-NS8 Nextcloud or Collabora too. So from that point of view documentation maybe is the best and fastest solution.
I thought that a dropdown in collabora that can be left empty (unconfigured) would do the job. One selects the NC instance so we have a variable holding the URL and can use it to configure collabora. If the field is left empty, it’s like it is now.
BTW, ExecStartPost using coolconfig would work too and is maybe easier to manage than with --env:
ExecStartPost=/usr/bin/podman exec collabora coolconfig set remote_font_config.url "https://nextcloud.ns8rockytest.com/apps/richdocuments/settings/fonts.json"
It seems the URL https://somenextcloudurl/apps/richdocuments/settings/fonts.json is provided by the richdocuments (Office) app even if no fonts are installed so that shouldn’t be an issue.
We could document it using a systemd override for persistence but I hope for a better solution.
Couldn’t we do that for collabora too?
Currently one can use the WOPI allow list in the Nextcloud Office app settings but adding the nextcloud instance automatically would improve security.
When we configure nextcloud to use collabora
Trigger an event in nextcloud with the nextcloud fqdn and the module_id of collabora as argument
When the collabora see the event, if the module_id in argument is the module_id of collabora, then :
we can set in environment the fqdn of nextcloud
we can restart the collabora container
in the post action we trigger a script with a condition if the fqdn of nextcloud exists then set the custom fonts to nextcloud
Why not. We could also get the idea to remove the link between collabora and nextcloud when we remove collabora. This time we could use an event because several nextcloud could use the same colabora instance IIRC
In the imapsync example one selects the mail server in UI so there’s the MAIL_SERVER env var that holds the right mail instance. How can we find the right Nextcloud module id for Collabora?
EDIT:
Maybe reverse it like allow Nextcloud to use a Collabora action “set-fonts-url”?
Unfortunately Nextcloud only knows the URL but not the module id of the collabora instance. (COLLABORA_HOST=collabora.ns8rockytest.com)
Is there a way to get the module ID out of the URL? Maybe via traefik or redis?
The task is working. Next step is the event and then I’d open issue/PRs.
../actions/create-module/30grants
#!/bin/bash
set -e # exit immediately if an error occurs
exec 1>&2 # ensure any output is sent to stderr
redis-exec SADD "${AGENT_ID}/roles/collaboraadm" "set-fonts-url"