fix(server): GitHubログインしようとするとreply.setCookie is not a function
fix #9327
This commit is contained in:
parent
9c5dfd2da7
commit
96dda253b0
|
@ -1,11 +1,13 @@
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import cors from '@fastify/cors';
|
import cors from '@fastify/cors';
|
||||||
import multipart from '@fastify/multipart';
|
import multipart from '@fastify/multipart';
|
||||||
|
import fastifyCookie from '@fastify/cookie';
|
||||||
import { ModuleRef, repl } from '@nestjs/core';
|
import { ModuleRef, repl } from '@nestjs/core';
|
||||||
import type { Config } from '@/config.js';
|
import type { Config } from '@/config.js';
|
||||||
import type { UsersRepository, InstancesRepository, AccessTokensRepository } from '@/models/index.js';
|
import type { UsersRepository, InstancesRepository, AccessTokensRepository } from '@/models/index.js';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
||||||
|
import { bindThis } from '@/decorators.js';
|
||||||
import endpoints, { IEndpoint } from './endpoints.js';
|
import endpoints, { IEndpoint } from './endpoints.js';
|
||||||
import { ApiCallService } from './ApiCallService.js';
|
import { ApiCallService } from './ApiCallService.js';
|
||||||
import { SignupApiService } from './SignupApiService.js';
|
import { SignupApiService } from './SignupApiService.js';
|
||||||
|
@ -13,7 +15,6 @@ import { SigninApiService } from './SigninApiService.js';
|
||||||
import { GithubServerService } from './integration/GithubServerService.js';
|
import { GithubServerService } from './integration/GithubServerService.js';
|
||||||
import { DiscordServerService } from './integration/DiscordServerService.js';
|
import { DiscordServerService } from './integration/DiscordServerService.js';
|
||||||
import { TwitterServerService } from './integration/TwitterServerService.js';
|
import { TwitterServerService } from './integration/TwitterServerService.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
|
||||||
import type { FastifyInstance, FastifyPluginOptions } from 'fastify';
|
import type { FastifyInstance, FastifyPluginOptions } from 'fastify';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
|
@ -57,6 +58,8 @@ export class ApiServerService {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
fastify.register(fastifyCookie, {});
|
||||||
|
|
||||||
// Prevent cache
|
// Prevent cache
|
||||||
fastify.addHook('onRequest', (request, reply, done) => {
|
fastify.addHook('onRequest', (request, reply, done) => {
|
||||||
reply.header('Cache-Control', 'private, max-age=0, must-revalidate');
|
reply.header('Cache-Control', 'private, max-age=0, must-revalidate');
|
||||||
|
|
Loading…
Reference in a new issue