merge: upstream

This commit is contained in:
Marie 2023-12-28 09:54:32 +01:00
parent c4534b20bb
commit 592027cf68
No known key found for this signature in database
GPG Key ID: 56569BBE47D2C828
5 changed files with 44 additions and 24 deletions

View File

@ -253,7 +253,7 @@ export class NoteCreateService implements OnApplicationShutdown {
if (data.visibility === 'public' && data.channel == null) { if (data.visibility === 'public' && data.channel == null) {
const sensitiveWords = meta.sensitiveWords; const sensitiveWords = meta.sensitiveWords;
if (this.isSensitive(data, sensitiveWords)) { if (this.utilityService.isSensitiveWordIncluded(data.cw ?? data.text ?? '', sensitiveWords)) {
data.visibility = 'home'; data.visibility = 'home';
} else if ((await this.roleService.getUserPolicies(user.id)).canPublicNote === false) { } else if ((await this.roleService.getUserPolicies(user.id)).canPublicNote === false) {
data.visibility = 'home'; data.visibility = 'home';

View File

@ -111,7 +111,6 @@ export class ServerService implements OnApplicationShutdown {
fastify.register(this.nodeinfoServerService.createServer); fastify.register(this.nodeinfoServerService.createServer);
fastify.register(this.wellKnownServerService.createServer); fastify.register(this.wellKnownServerService.createServer);
fastify.register(this.oauth2ProviderService.createServer, { prefix: '/oauth' }); 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) => { fastify.get<{ Params: { path: string }; Querystring: { static?: any; badge?: any; }; }>('/emoji/:path(.*)', async (request, reply) => {
const path = request.params.path; const path = request.params.path;

View File

@ -16,6 +16,41 @@ import type { Config } from '@/config.js';
import { DI } from '@/di-symbols.js'; import { DI } from '@/di-symbols.js';
import type { FastifyInstance } from 'fastify'; 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 { function getClient(BASE_URL: string, authorization: string | undefined): MegalodonInterface {
const accessTokenArr = authorization?.split(' ') ?? [null]; const accessTokenArr = authorization?.split(' ') ?? [null];
const accessToken = accessTokenArr[accessTokenArr.length - 1]; const accessToken = accessTokenArr[accessTokenArr.length - 1];
@ -167,17 +202,4 @@ export class OAuth2ProviderService {
} }
}); });
} }
@bindThis
public async createTokenServer(fastify: FastifyInstance): Promise<void> {
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());
}
} }

View File

@ -78,6 +78,14 @@ SPDX-License-Identifier: AGPL-3.0-only
<img src="https://avatars.githubusercontent.com/u/40626578?v=4" :class="$style.contributorAvatar"> <img src="https://avatars.githubusercontent.com/u/40626578?v=4" :class="$style.contributorAvatar">
<span :class="$style.contributorUsername">@tai-cha</span> <span :class="$style.contributorUsername">@tai-cha</span>
</a> </a>
<a href="https://github.com/samunohito" target="_blank" :class="$style.contributor">
<img src="https://avatars.githubusercontent.com/u/46447427?v=4" :class="$style.contributorAvatar">
<span :class="$style.contributorUsername">@samunohito</span>
</a>
<a href="https://github.com/anatawa12" target="_blank" :class="$style.contributor">
<img src="https://avatars.githubusercontent.com/u/22656849?v=4" :class="$style.contributorAvatar">
<span :class="$style.contributorUsername">@anatawa12</span>
</a>
</div> </div>
</FormSection> </FormSection>
<FormSection> <FormSection>

View File

@ -7221,11 +7221,7 @@ packages:
ts-dedent: 2.2.0 ts-dedent: 2.2.0
type-fest: 2.19.0 type-fest: 2.19.0
vue: 3.3.12(typescript@5.3.3) vue: 3.3.12(typescript@5.3.3)
<<<<<<< HEAD
vue-component-type-helpers: 1.8.26
=======
vue-component-type-helpers: 1.8.27 vue-component-type-helpers: 1.8.27
>>>>>>> ad346b6f3 (feat(backend/oauth): allow CORS for token endpoint (#12814))
transitivePeerDependencies: transitivePeerDependencies:
- encoding - encoding
- supports-color - supports-color
@ -19632,13 +19628,8 @@ packages:
/vscode-textmate@8.0.0: /vscode-textmate@8.0.0:
resolution: {integrity: sha512-AFbieoL7a5LMqcnOF04ji+rpXadgOXnZsxQr//r83kLPr7biP7am3g9zbaZIaBGwBRWeSvoMD4mgPdX3e4NWBg==} 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: /vue-component-type-helpers@1.8.27:
resolution: {integrity: sha512-0vOfAtI67UjeO1G6UiX5Kd76CqaQ67wrRZiOe7UAb9Jm6GzlUr/fC7CV90XfwapJRjpCMaZFhv1V0ajWRmE9Dg==} resolution: {integrity: sha512-0vOfAtI67UjeO1G6UiX5Kd76CqaQ67wrRZiOe7UAb9Jm6GzlUr/fC7CV90XfwapJRjpCMaZFhv1V0ajWRmE9Dg==}
>>>>>>> ad346b6f3 (feat(backend/oauth): allow CORS for token endpoint (#12814))
dev: true dev: true
/vue-component-type-helpers@1.8.4: /vue-component-type-helpers@1.8.4: