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) {
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';

View file

@ -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;

View file

@ -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<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">
<span :class="$style.contributorUsername">@tai-cha</span>
</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>
</FormSection>
<FormSection>

View file

@ -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: