From 592027cf688bd60ae235e39ddd534a6f4851c463 Mon Sep 17 00:00:00 2001 From: Marie Date: Thu, 28 Dec 2023 09:54:32 +0100 Subject: [PATCH] merge: upstream --- .../backend/src/core/NoteCreateService.ts | 2 +- packages/backend/src/server/ServerService.ts | 1 - .../src/server/oauth/OAuth2ProviderService.ts | 48 ++++++++++++++----- packages/frontend/src/pages/about-sharkey.vue | 8 ++++ pnpm-lock.yaml | 9 ---- 5 files changed, 44 insertions(+), 24 deletions(-) diff --git a/packages/backend/src/core/NoteCreateService.ts b/packages/backend/src/core/NoteCreateService.ts index 6309313f11..3bc4a29b99 100644 --- a/packages/backend/src/core/NoteCreateService.ts +++ b/packages/backend/src/core/NoteCreateService.ts @@ -253,7 +253,7 @@ export class NoteCreateService implements OnApplicationShutdown { if (data.visibility === 'public' && data.channel == null) { const sensitiveWords = meta.sensitiveWords; - if (this.isSensitive(data, sensitiveWords)) { + if (this.utilityService.isSensitiveWordIncluded(data.cw ?? data.text ?? '', sensitiveWords)) { data.visibility = 'home'; } else if ((await this.roleService.getUserPolicies(user.id)).canPublicNote === false) { data.visibility = 'home'; diff --git a/packages/backend/src/server/ServerService.ts b/packages/backend/src/server/ServerService.ts index cf8de4ea56..3b43b931ae 100644 --- a/packages/backend/src/server/ServerService.ts +++ b/packages/backend/src/server/ServerService.ts @@ -111,7 +111,6 @@ export class ServerService implements OnApplicationShutdown { fastify.register(this.nodeinfoServerService.createServer); fastify.register(this.wellKnownServerService.createServer); fastify.register(this.oauth2ProviderService.createServer, { prefix: '/oauth' }); - fastify.register(this.oauth2ProviderService.createTokenServer, { prefix: '/oauth/token' }); fastify.get<{ Params: { path: string }; Querystring: { static?: any; badge?: any; }; }>('/emoji/:path(.*)', async (request, reply) => { const path = request.params.path; diff --git a/packages/backend/src/server/oauth/OAuth2ProviderService.ts b/packages/backend/src/server/oauth/OAuth2ProviderService.ts index 52505ac5bb..d857f0bdd4 100644 --- a/packages/backend/src/server/oauth/OAuth2ProviderService.ts +++ b/packages/backend/src/server/oauth/OAuth2ProviderService.ts @@ -16,6 +16,41 @@ import type { Config } from '@/config.js'; import { DI } from '@/di-symbols.js'; import type { FastifyInstance } from 'fastify'; +const kinds = [ + 'read:account', + 'write:account', + 'read:blocks', + 'write:blocks', + 'read:drive', + 'write:drive', + 'read:favorites', + 'write:favorites', + 'read:following', + 'write:following', + 'read:messaging', + 'write:messaging', + 'read:mutes', + 'write:mutes', + 'write:notes', + 'read:notifications', + 'write:notifications', + 'read:reactions', + 'write:reactions', + 'write:votes', + 'read:pages', + 'write:pages', + 'write:page-likes', + 'read:page-likes', + 'read:user-groups', + 'write:user-groups', + 'read:channels', + 'write:channels', + 'read:gallery', + 'write:gallery', + 'read:gallery-likes', + 'write:gallery-likes', +]; + function getClient(BASE_URL: string, authorization: string | undefined): MegalodonInterface { const accessTokenArr = authorization?.split(' ') ?? [null]; const accessToken = accessTokenArr[accessTokenArr.length - 1]; @@ -167,17 +202,4 @@ export class OAuth2ProviderService { } }); } - - @bindThis - public async createTokenServer(fastify: FastifyInstance): Promise { - fastify.register(fastifyCors); - fastify.post('', async () => { }); - - await fastify.register(fastifyExpress); - // Clients may use JSON or urlencoded - fastify.use('', bodyParser.urlencoded({ extended: false })); - fastify.use('', bodyParser.json({ strict: true })); - fastify.use('', this.#server.token()); - fastify.use('', this.#server.errorHandler()); - } } diff --git a/packages/frontend/src/pages/about-sharkey.vue b/packages/frontend/src/pages/about-sharkey.vue index 4160dcb09c..2e4ff5d041 100644 --- a/packages/frontend/src/pages/about-sharkey.vue +++ b/packages/frontend/src/pages/about-sharkey.vue @@ -78,6 +78,14 @@ SPDX-License-Identifier: AGPL-3.0-only @tai-cha + + + @samunohito + + + + @anatawa12 + diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2db1e628fd..62cf9ef9ad 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -7221,11 +7221,7 @@ packages: ts-dedent: 2.2.0 type-fest: 2.19.0 vue: 3.3.12(typescript@5.3.3) -<<<<<<< HEAD - vue-component-type-helpers: 1.8.26 -======= vue-component-type-helpers: 1.8.27 ->>>>>>> ad346b6f3 (feat(backend/oauth): allow CORS for token endpoint (#12814)) transitivePeerDependencies: - encoding - supports-color @@ -19632,13 +19628,8 @@ packages: /vscode-textmate@8.0.0: resolution: {integrity: sha512-AFbieoL7a5LMqcnOF04ji+rpXadgOXnZsxQr//r83kLPr7biP7am3g9zbaZIaBGwBRWeSvoMD4mgPdX3e4NWBg==} -<<<<<<< HEAD - /vue-component-type-helpers@1.8.26: - resolution: {integrity: sha512-CIwb7s8cqUuPpHDk+0DY8EJ/x8tzdzqw8ycX8hhw1GnbngTgSsIceHAqrrLjmv8zXi+j5XaiqYRQMw8sKyyjkw==} -======= /vue-component-type-helpers@1.8.27: resolution: {integrity: sha512-0vOfAtI67UjeO1G6UiX5Kd76CqaQ67wrRZiOe7UAb9Jm6GzlUr/fC7CV90XfwapJRjpCMaZFhv1V0ajWRmE9Dg==} ->>>>>>> ad346b6f3 (feat(backend/oauth): allow CORS for token endpoint (#12814)) dev: true /vue-component-type-helpers@1.8.4: