diff --git a/ct/docmost.sh b/ct/docmost.sh index 407e15fd0..15d09cceb 100644 --- a/ct/docmost.sh +++ b/ct/docmost.sh @@ -48,6 +48,17 @@ function update_script() { cd /opt/docmost mv /opt/.env /opt/docmost/.env mv /opt/data /opt/docmost/data + + # Fix: Docmost EE (audit logs etc.) lives in a git submodule that is NOT + # included in GitHub tarballs. The community NoopAuditService exists but + # is only exported by CoreModule – child modules such as UserModule cannot + # resolve it. Making CoreModule @Global() exposes the token app-wide. + if [[ ! -f /opt/docmost/apps/server/src/ee/ee.module.ts ]] \ + && ! grep -q '@Global()' /opt/docmost/apps/server/src/core/core.module.ts 2>/dev/null; then + sed -i '/^ Module,$/a\ Global,' /opt/docmost/apps/server/src/core/core.module.ts + sed -i '/^@Module({$/i @Global()' /opt/docmost/apps/server/src/core/core.module.ts + fi + $STD pnpm install --force $STD pnpm build msg_ok "Updated ${APP}" diff --git a/install/docmost-install.sh b/install/docmost-install.sh index 2d1d643f2..2c1d92522 100644 --- a/install/docmost-install.sh +++ b/install/docmost-install.sh @@ -26,6 +26,17 @@ fetch_and_deploy_gh_release "docmost" "docmost/docmost" "tarball" msg_info "Configuring Docmost (Patience)" cd /opt/docmost + +# Fix: Docmost EE (audit logs etc.) lives in a git submodule that is NOT +# included in GitHub tarballs. The community NoopAuditService exists but +# is only exported by CoreModule – child modules such as UserModule cannot +# resolve it. Making CoreModule @Global() exposes the token app-wide. +if [[ ! -f /opt/docmost/apps/server/src/ee/ee.module.ts ]] \ + && ! grep -q '@Global()' /opt/docmost/apps/server/src/core/core.module.ts 2>/dev/null; then + sed -i '/^ Module,$/a\ Global,' /opt/docmost/apps/server/src/core/core.module.ts + sed -i '/^@Module({$/i @Global()' /opt/docmost/apps/server/src/core/core.module.ts +fi + mv .env.example .env mkdir data sed -i -e "s|APP_SECRET=.*|APP_SECRET=$(openssl rand -base64 32 | tr -dc 'a-zA-Z0-9' | cut -c1-32)|" \