summaryrefslogtreecommitdiff
path: root/packages/backend/src/server/web/ClientServerService.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/backend/src/server/web/ClientServerService.ts')
-rw-r--r--packages/backend/src/server/web/ClientServerService.ts67
1 files changed, 2 insertions, 65 deletions
diff --git a/packages/backend/src/server/web/ClientServerService.ts b/packages/backend/src/server/web/ClientServerService.ts
index 437a6802b8..1321cf6338 100644
--- a/packages/backend/src/server/web/ClientServerService.ts
+++ b/packages/backend/src/server/web/ClientServerService.ts
@@ -7,16 +7,12 @@ import { randomUUID } from 'node:crypto';
import { dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
import { Inject, Injectable } from '@nestjs/common';
-import { createBullBoard } from '@bull-board/api';
-import { BullMQAdapter } from '@bull-board/api/bullMQAdapter.js';
-import { FastifyAdapter as BullBoardFastifyAdapter } from '@bull-board/fastify';
import ms from 'ms';
import sharp from 'sharp';
import pug from 'pug';
import { In, IsNull } from 'typeorm';
import fastifyStatic from '@fastify/static';
import fastifyView from '@fastify/view';
-import fastifyCookie from '@fastify/cookie';
import fastifyProxy from '@fastify/http-proxy';
import vary from 'vary';
import htmlSafeJsonStringify from 'htmlescape';
@@ -226,65 +222,6 @@ export class ClientServerService {
@bindThis
public createServer(fastify: FastifyInstance, options: FastifyPluginOptions, done: (err?: Error) => void) {
- fastify.register(fastifyCookie, {});
-
- //#region Bull Dashboard
- const bullBoardPath = '/queue';
-
- // Authenticate
- fastify.addHook('onRequest', async (request, reply) => {
- if (request.routeOptions.url == null) {
- reply.code(404).send('Not found');
- return;
- }
-
- // %71ueueとかでリクエストされたら困るため
- const url = decodeURI(request.routeOptions.url);
- if (url === bullBoardPath || url.startsWith(bullBoardPath + '/')) {
- if (!url.startsWith(bullBoardPath + '/static/')) {
- reply.header('Cache-Control', 'private, max-age=0, must-revalidate');
- }
-
- const token = request.cookies.token;
- if (token == null) {
- reply.code(401).send('Login required');
- return;
- }
- const user = await this.usersRepository.findOneBy({ token });
- if (user == null) {
- reply.code(403).send('No such user');
- return;
- }
- const isAdministrator = await this.roleService.isAdministrator(user);
- if (!isAdministrator) {
- reply.code(403).send('Access denied');
- return;
- }
- }
- });
-
- const bullBoardServerAdapter = new BullBoardFastifyAdapter();
-
- createBullBoard({
- queues: [
- this.systemQueue,
- this.endedPollNotificationQueue,
- this.deliverQueue,
- this.inboxQueue,
- this.dbQueue,
- this.relationshipQueue,
- this.objectStorageQueue,
- this.userWebhookDeliverQueue,
- this.systemWebhookDeliverQueue,
- this.scheduleNotePostQueue,
- ].map(q => new BullMQAdapter(q)),
- serverAdapter: bullBoardServerAdapter,
- });
-
- bullBoardServerAdapter.setBasePath(bullBoardPath);
- (fastify.register as any)(bullBoardServerAdapter.registerPlugin(), { prefix: bullBoardPath });
- //#endregion
-
fastify.register(fastifyView, {
root: _dirname + '/views',
engine: {
@@ -490,7 +427,7 @@ export class ClientServerService {
fastify.get('/robots.txt', async (request, reply) => {
if (this.meta.robotsTxt) {
reply.header('Content-Type', 'text/plain');
- return await reply.send(this.meta.robotsTxt);
+ return reply.send(this.meta.robotsTxt);
} else {
return await reply.sendFile('/robots.txt', staticAssets);
}
@@ -621,7 +558,7 @@ export class ClientServerService {
return await reply.view('user', {
user, profile, me,
- avatarUrl: user.avatarUrl ?? this.userEntityService.getIdenticonUrl(user),
+ avatarUrl: _user.avatarUrl,
sub: request.params.sub,
...await this.generateCommonPugData(this.meta),
clientCtx: htmlSafeJsonStringify({