spectrum: Add support for re-hosting shared media

This enables the `web_directory` and `web_url` options for Spectrum,
which has media shared by legacy protocol buddies be re-hosted by
Spectrum, and shared by a dedicated volume.

This, in turn, is served by the `nginx-serve-volume@spectrum-media`
service, which is intended to be proxied under the same host used for
Prosody. Documentation for the integration will be added in future
commits.
This commit is contained in:
Alex Palaistras 2022-05-03 18:18:02 +01:00
parent 6ca42cad7e
commit fff2b222bb
3 changed files with 8 additions and 1 deletions

View File

@ -32,6 +32,10 @@ backend = /usr/bin/spectrum2_libpurple_backend
# So for example: prpl-jabber.hanzz.k%gmail.com@domain.tld # So for example: prpl-jabber.hanzz.k%gmail.com@domain.tld
protocol = ${SPECTRUM_PROTOCOL} protocol = ${SPECTRUM_PROTOCOL}
# Where to re-host files uploaded by legacy protocol buddies, and which URL to return to XMPP.
web_directory=/var/lib/spectrum2-media
web_url=https://${PROSODY_HOST_EXTERNAL}/spectrum
# If enabled, your legacy network buddies will be removed when you unsubscribe from them in the XMPP. # If enabled, your legacy network buddies will be removed when you unsubscribe from them in the XMPP.
# enable_remove_buddy = true # enable_remove_buddy = true

View File

@ -7,3 +7,4 @@ SPECTRUM_REGISTRATION_ENABLED=1
# Options for Prosody component configuration. # Options for Prosody component configuration.
PROSODY_COMPONENT_PASSWORD=${PROSODY_SPECTRUM_PASSWORD} PROSODY_COMPONENT_PASSWORD=${PROSODY_SPECTRUM_PASSWORD}
PROSODY_HOST_EXTERNAL=${PROSODY_HOST_EXTERNAL}

View File

@ -1,7 +1,8 @@
[Unit] [Unit]
Description=Spectrum IM Transport for XMPP (%i) Description=Spectrum IM Transport for XMPP (%i)
Wants=container-build@%p.service container-volume@%p-%i.service prosody.service prosody-component-register@%p-%i.service Wants=container-build@%p.service container-volume@%p-%i.service prosody.service prosody-component-register@%p-%i.service nginx-serve-volume@%p-media.service
After=container-build@%p.service container-volume@%p-%i.service prosody.service prosody-component-register@%p-%i.service After=container-build@%p.service container-volume@%p-%i.service prosody.service prosody-component-register@%p-%i.service
Before=nginx-serve-volume@%p-media.service
[Service] [Service]
Type=notify Type=notify
@ -15,6 +16,7 @@ ExecStart=/bin/podman run --replace --name %p-%i --net internal --sdnotify=conmo
--env SPECTRUM_HOSTNAME=${SPECTRUM_HOSTNAME} \ --env SPECTRUM_HOSTNAME=${SPECTRUM_HOSTNAME} \
--env SPECTRUM_PROTOCOL=${SPECTRUM_PROTOCOL} \ --env SPECTRUM_PROTOCOL=${SPECTRUM_PROTOCOL} \
--volume %p-%i:/var/lib/spectrum2:z \ --volume %p-%i:/var/lib/spectrum2:z \
--volume %p-media:/var/lib/spectrum2-media:z \
localhost/%p:latest localhost/%p:latest
ExecStop=/bin/podman stop --ignore --time 10 %p-%i ExecStop=/bin/podman stop --ignore --time 10 %p-%i
ExecStopPost=/bin/podman rm --ignore --force %p-%i ExecStopPost=/bin/podman rm --ignore --force %p-%i