summaryrefslogtreecommitdiff
path: root/packages/backend/src/server/api/integration/GithubServerService.ts
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2022-09-19 03:11:50 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2022-09-19 03:11:50 +0900
commita2eac9fff67f811ed4ac1a80a88fd1f0eafae6c8 (patch)
tree9c7190e05fe0ffe085646cd194c6c65d47375f83 /packages/backend/src/server/api/integration/GithubServerService.ts
parentrevert (diff)
downloadsharkey-a2eac9fff67f811ed4ac1a80a88fd1f0eafae6c8.tar.gz
sharkey-a2eac9fff67f811ed4ac1a80a88fd1f0eafae6c8.tar.bz2
sharkey-a2eac9fff67f811ed4ac1a80a88fd1f0eafae6c8.zip
test
Diffstat (limited to 'packages/backend/src/server/api/integration/GithubServerService.ts')
-rw-r--r--packages/backend/src/server/api/integration/GithubServerService.ts14
1 files changed, 7 insertions, 7 deletions
diff --git a/packages/backend/src/server/api/integration/GithubServerService.ts b/packages/backend/src/server/api/integration/GithubServerService.ts
index 6864f21523..58b170d0e4 100644
--- a/packages/backend/src/server/api/integration/GithubServerService.ts
+++ b/packages/backend/src/server/api/integration/GithubServerService.ts
@@ -42,12 +42,12 @@ export class GithubServerService {
const router = new Router();
router.get('/disconnect/github', 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) {
ctx.throw(400, 'signin required');
return;
@@ -91,12 +91,12 @@ export class GithubServerService {
};
router.get('/connect/github', 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) {
ctx.throw(400, 'signin required');
return;
@@ -136,7 +136,7 @@ export class GithubServerService {
});
router.get('/gh/cb', async ctx => {
- const userToken = this.#getUserToken(ctx);
+ const userToken = this.getUserToken(ctx);
const oauth2 = await getOath2();
@@ -271,11 +271,11 @@ export class GithubServerService {
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 : '';
}