diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2022-09-19 03:11:50 +0900 |
|---|---|---|
| committer | syuilo <Syuilotan@yahoo.co.jp> | 2022-09-19 03:11:50 +0900 |
| commit | a2eac9fff67f811ed4ac1a80a88fd1f0eafae6c8 (patch) | |
| tree | 9c7190e05fe0ffe085646cd194c6c65d47375f83 /packages/backend/src/server/api/integration/TwitterServerService.ts | |
| parent | revert (diff) | |
| download | sharkey-a2eac9fff67f811ed4ac1a80a88fd1f0eafae6c8.tar.gz sharkey-a2eac9fff67f811ed4ac1a80a88fd1f0eafae6c8.tar.bz2 sharkey-a2eac9fff67f811ed4ac1a80a88fd1f0eafae6c8.zip | |
test
Diffstat (limited to 'packages/backend/src/server/api/integration/TwitterServerService.ts')
| -rw-r--r-- | packages/backend/src/server/api/integration/TwitterServerService.ts | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/packages/backend/src/server/api/integration/TwitterServerService.ts b/packages/backend/src/server/api/integration/TwitterServerService.ts index 14b5f40ea5..a4a67f6c8c 100644 --- a/packages/backend/src/server/api/integration/TwitterServerService.ts +++ b/packages/backend/src/server/api/integration/TwitterServerService.ts @@ -42,12 +42,12 @@ export class TwitterServerService { const router = new Router(); router.get('/disconnect/twitter', async ctx => { - if (!this.#compareOrigin(ctx)) { + if (!this.compareOrigin(ctx)) { ctx.throw(400, 'invalid origin'); return; } - const userToken = this.#getUserToken(ctx); + const userToken = this.getUserToken(ctx); if (userToken == null) { ctx.throw(400, 'signin required'); return; @@ -90,12 +90,12 @@ export class TwitterServerService { }; router.get('/connect/twitter', async ctx => { - if (!this.#compareOrigin(ctx)) { + if (!this.compareOrigin(ctx)) { ctx.throw(400, 'invalid origin'); return; } - const userToken = this.#getUserToken(ctx); + const userToken = this.getUserToken(ctx); if (userToken == null) { ctx.throw(400, 'signin required'); return; @@ -125,7 +125,7 @@ export class TwitterServerService { }); router.get('/tw/cb', async ctx => { - const userToken = this.#getUserToken(ctx); + const userToken = this.getUserToken(ctx); const twAuth = await getTwAuth(); @@ -214,11 +214,11 @@ export class TwitterServerService { return router; } - #getUserToken(ctx: Koa.BaseContext): string | null { + private getUserToken(ctx: Koa.BaseContext): string | null { return ((ctx.headers['cookie'] ?? '').match(/igi=(\w+)/) ?? [null, null])[1]; } - #compareOrigin(ctx: Koa.BaseContext): boolean { + private compareOrigin(ctx: Koa.BaseContext): boolean { function normalizeUrl(url?: string): string { return url ? url.endsWith('/') ? url.substr(0, url.length - 1) : url : ''; } |