Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ INSECURE=true
#COMPOSE_FILE=docker-compose.yml:weboffice/collabora.yml:traefik/opencloud.yml:traefik/collabora.yml:idm/ldap-keycloak.yml:traefik/ldap-keycloak.yml
# External IDP
#COMPOSE_FILE=docker-compose.yml:weboffice/collabora.yml:traefik/opencloud.yml:traefik/collabora.yml:idm/external-idp.yml
# Euro Office with traefik and letsencrypt
#COMPOSE_FILE=docker-compose.yml:weboffice/euroffice.yml:traefik/opencloud.yml:traefik/euroffice.yml
# Euro Office with external proxy (Nginx, Caddy, etc.)
#COMPOSE_FILE=docker-compose.yml:weboffice/euroffice.yml:external-proxy/opencloud.yml:external-proxy/euroffice.yml

## Traefik Settings ##
# Note: Traefik is always enabled and can't be disabled.
Expand Down Expand Up @@ -239,6 +243,21 @@ COLLABORA_SSL_VERIFICATION=false
COLLABORA_HOME_MODE=


### Euro Office Settings ###
# Domain of Euro Office, where you can find the document server.
# Defaults to "euro-office.opencloud.test"
EURO_OFFICE_DOMAIN=
# JWT Secret for Euro Office. IMPORTANT: Change this for production!
# Defaults to "changeme"
EURO_OFFICE_JWT_SECRET=
# Euro Office Docker image.
# Defaults to "ghcr.io/euro-office/documentserver"
EURO_OFFICE_DOCKER_IMAGE=
# Euro Office Docker tag.
# Defaults to "latest"
EURO_OFFICE_DOCKER_TAG=


### Virusscanner Settings ###
# IMPORTANT: If you enable antivirus, you also MUST configure the START_ADDITIONAL_SERVICES
# envvar in the OpenCloud Settings above by adding 'antivirus' to the list.
Expand Down
71 changes: 71 additions & 0 deletions config/euro-office/app-registry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
app_registry:
mimetypes:
- mime_type: application/pdf
extension: pdf
name: PDF
description: PDF document
icon: ''
default_app: ''
allow_creation: false
- mime_type: application/vnd.oasis.opendocument.text
extension: odt
name: OpenDocument
description: OpenDocument text document
icon: ''
default_app: Collabora
allow_creation: true
- mime_type: application/vnd.oasis.opendocument.spreadsheet
extension: ods
name: OpenSpreadsheet
description: OpenDocument spreadsheet document
icon: ''
default_app: Collabora
allow_creation: true
- mime_type: application/vnd.oasis.opendocument.presentation
extension: odp
name: OpenPresentation
description: OpenDocument presentation document
icon: ''
default_app: Collabora
- mime_type: application/vnd.oasis.opendocument.graphics
extension: odg
name: OpenGraphics
description: OpenDocument graphics document
icon: ''
default_app: Collabora
allow_creation: true
- mime_type: application/vnd.openxmlformats-officedocument.wordprocessingml.document
extension: docx
name: Microsoft Word
description: Microsoft Word document
icon: ''
default_app: Euro-Office
allow_creation: true
- mime_type: application/vnd.openxmlformats-officedocument.wordprocessingml.form
extension: docxf
name: Form Document
description: Form Document
icon: ''
default_app: Euro-Office
allow_creation: true
- mime_type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
extension: xlsx
name: Microsoft Excel
description: Microsoft Excel document
icon: ''
default_app: Euro-Office
allow_creation: true
- mime_type: application/vnd.openxmlformats-officedocument.presentationml.presentation
extension: pptx
name: Microsoft PowerPoint
description: Microsoft PowerPoint document
icon: ''
default_app: Euro-Office
allow_creation: true
- mime_type: application/vnd.jupyter
extension: ipynb
name: Jupyter Notebook
description: Jupyter Notebook
icon: ''
default_app: ''
allow_creation: true
55 changes: 55 additions & 0 deletions config/euro-office/init-wopi.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/bin/sh
set -e

CONFIG_FILE="/etc/onlyoffice/documentserver/local.json"
DATA_DIR="/var/www/onlyoffice/Data"
WOPI_PRIVATE_KEY="${DATA_DIR}/wopi_private.key"
WOPI_PUBLIC_KEY="${DATA_DIR}/wopi_public.key"

if [ "${WOPI_ENABLED:-false}" = "true" ]; then
mkdir -p "$DATA_DIR"

if [ ! -f "$WOPI_PRIVATE_KEY" ]; then
echo "Generating WOPI private key..."
openssl genpkey -algorithm RSA -outform PEM -out "$WOPI_PRIVATE_KEY" >/dev/null 2>&1
fi

if [ ! -f "$WOPI_PUBLIC_KEY" ]; then
echo "Generating WOPI public key..."
openssl rsa -RSAPublicKey_out -in "$WOPI_PRIVATE_KEY" \
-outform "MS PUBLICKEYBLOB" -out "$WOPI_PUBLIC_KEY" >/dev/null 2>&1
fi

WOPI_PRIVATE_KEY_CONTENT=$(cat "$WOPI_PRIVATE_KEY")
WOPI_PUBLIC_KEY_CONTENT=$(openssl base64 -in "$WOPI_PUBLIC_KEY" -A)
WOPI_MODULUS=$(openssl rsa -pubin -inform "MS PUBLICKEYBLOB" -modulus -noout \
-in "$WOPI_PUBLIC_KEY" | sed 's/Modulus=//' | \
python3 -c "import sys,binascii,base64; print(base64.b64encode(binascii.unhexlify(sys.stdin.read().strip())).decode())")

WOPI_EXPONENT=$(openssl rsa -pubin -inform "MS PUBLICKEYBLOB" -text -noout \
-in "$WOPI_PUBLIC_KEY" | grep -oP '(?<=Exponent: )\d+')

# Merge WOPI config into local.json
jq \
--argjson wopiEnabled "true" \
--arg wopiPrivateKey "$WOPI_PRIVATE_KEY_CONTENT" \
--arg wopiPublicKey "$WOPI_PUBLIC_KEY_CONTENT" \
--arg wopiModulus "$WOPI_MODULUS" \
--arg wopiExponent "$WOPI_EXPONENT" \
'.wopi.enable = $wopiEnabled |
.wopi.privateKey = $wopiPrivateKey |
.wopi.privateKeyOld = $wopiPrivateKey |
.wopi.publicKey = $wopiPublicKey |
.wopi.publicKeyOld = $wopiPublicKey |
.wopi.modulus = $wopiModulus |
.wopi.modulusOld = $wopiModulus |
.wopi.exponent = ($wopiExponent | tonumber) |
.wopi.exponentOld = ($wopiExponent | tonumber)' \
"$CONFIG_FILE" > "${CONFIG_FILE}.tmp"

mv "${CONFIG_FILE}.tmp" "$CONFIG_FILE"
echo "WOPI configuration injected successfully."
fi

# Hand over to the official DocumentServer entrypoint
exec /entrypoint.sh "$@"
Loading