fix: server init (#14412)

#### PR Dependency Tree


* **PR #14412** 👈

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

* **Refactor**
  * Improved internal code organization for better maintainability.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
DarkSky
2026-02-10 16:18:22 +08:00
committed by GitHub
parent 03b1d15a8f
commit 3ad482351b

View File

@@ -37,12 +37,7 @@ function extractTokenFromHeader(authorization: string) {
@Injectable() @Injectable()
export class AuthService implements OnApplicationBootstrap { export class AuthService implements OnApplicationBootstrap {
readonly cookieOptions: CookieOptions = { readonly cookieOptions: CookieOptions;
sameSite: 'lax',
httpOnly: true,
path: '/',
secure: this.config.server.https,
};
static readonly sessionCookieName = 'affine_session'; static readonly sessionCookieName = 'affine_session';
static readonly userCookieName = 'affine_user_id'; static readonly userCookieName = 'affine_user_id';
static readonly csrfCookieName = 'affine_csrf_token'; static readonly csrfCookieName = 'affine_csrf_token';
@@ -51,7 +46,14 @@ export class AuthService implements OnApplicationBootstrap {
private readonly config: Config, private readonly config: Config,
private readonly models: Models, private readonly models: Models,
private readonly mailer: Mailer private readonly mailer: Mailer
) {} ) {
this.cookieOptions = {
sameSite: 'lax',
httpOnly: true,
path: '/',
secure: this.config.server.https,
};
}
async onApplicationBootstrap() { async onApplicationBootstrap() {
if (env.dev) { if (env.dev) {