mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
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:
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user