mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-20 15:57:06 +08:00
#### PR Dependency Tree * **PR #14426** 👈 This tree was auto-generated by [Charcoal](https://github.com/danerwilliams/charcoal) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Admin dashboard: view workspace analytics (storage, sync activity, top shared links) with charts and configurable windows. * Document analytics tab: see total/unique/guest views and trends over selectable time windows. * Last-accessed members: view who last accessed a document, with pagination. * Shared links analytics: browse and paginate all shared links with view/unique/guest metrics and share URLs. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
34 lines
774 B
TypeScript
34 lines
774 B
TypeScript
import { Injectable } from '@nestjs/common';
|
|
|
|
import { Config, OnEvent, URLHelper } from '../../base';
|
|
import { fixUrl, OriginRules } from './utils';
|
|
|
|
@Injectable()
|
|
export class WorkerService {
|
|
allowedOrigins: OriginRules;
|
|
|
|
constructor(
|
|
private readonly config: Config,
|
|
private readonly url: URLHelper
|
|
) {
|
|
this.allowedOrigins = [...this.url.allowedOrigins];
|
|
}
|
|
|
|
@OnEvent('config.init')
|
|
onConfigInit() {
|
|
this.allowedOrigins = [
|
|
...this.config.worker.allowedOrigin
|
|
.map(u => fixUrl(u)?.origin as string)
|
|
.filter(v => !!v),
|
|
...this.url.allowedOrigins,
|
|
];
|
|
}
|
|
|
|
@OnEvent('config.changed')
|
|
onConfigChanged(event: Events['config.changed']) {
|
|
if ('worker' in event.updates) {
|
|
this.onConfigInit();
|
|
}
|
|
}
|
|
}
|