Compare commits

...

1 Commits

Author SHA1 Message Date
CanbiZ (MickLesk)
360b59a458 fix(docmost): register NoopAuditService globally when EE submodule is missing
Docmost v0.70.0 added audit logging (enterprise feature). The EE code
lives in a private git submodule (apps/server/src/ee) which is NOT
included in GitHub tarballs used by fetch_and_deploy_gh_release.

Without the submodule, AUDIT_SERVICE (Symbol) is provided by CoreModule
via NoopAuditService but only exported – child modules like UserModule
cannot resolve it because NestJS DI is scope-based. The EE module would
normally register the real service as @Global(), making it available
everywhere.

Fix: when the EE submodule is absent, patch CoreModule to be @Global()
before building, so NoopAuditService is available to all modules.

Closes #12548
2026-03-04 09:59:00 +01:00
2 changed files with 22 additions and 0 deletions

View File

@@ -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}"

View File

@@ -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)|" \