summaryrefslogtreecommitdiff
path: root/packages/backend/src/server/api/integration/TwitterServerService.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/backend/src/server/api/integration/TwitterServerService.ts')
-rw-r--r--packages/backend/src/server/api/integration/TwitterServerService.ts14
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 : '';
}