diff options
| author | Marie <marie@kaifa.ch> | 2023-12-28 09:54:32 +0100 |
|---|---|---|
| committer | Marie <marie@kaifa.ch> | 2023-12-28 09:54:32 +0100 |
| commit | 592027cf688bd60ae235e39ddd534a6f4851c463 (patch) | |
| tree | 42998c3f28b12727f53ece3067139ca3f46ccb15 /packages/backend/src/server/oauth | |
| parent | chore(misskey-js): `build-misskey-js-with-types`時に`api-extractor`を走... (diff) | |
| download | sharkey-592027cf688bd60ae235e39ddd534a6f4851c463.tar.gz sharkey-592027cf688bd60ae235e39ddd534a6f4851c463.tar.bz2 sharkey-592027cf688bd60ae235e39ddd534a6f4851c463.zip | |
merge: upstream
Diffstat (limited to 'packages/backend/src/server/oauth')
| -rw-r--r-- | packages/backend/src/server/oauth/OAuth2ProviderService.ts | 48 |
1 files changed, 35 insertions, 13 deletions
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<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()); - } } |