summaryrefslogtreecommitdiff
path: root/packages/backend/src/server/api/integration
diff options
context:
space:
mode:
Diffstat (limited to 'packages/backend/src/server/api/integration')
-rw-r--r--packages/backend/src/server/api/integration/DiscordServerService.ts6
-rw-r--r--packages/backend/src/server/api/integration/GithubServerService.ts6
-rw-r--r--packages/backend/src/server/api/integration/TwitterServerService.ts6
3 files changed, 15 insertions, 3 deletions
diff --git a/packages/backend/src/server/api/integration/DiscordServerService.ts b/packages/backend/src/server/api/integration/DiscordServerService.ts
index 93c22a6c0b..a7f39a78d0 100644
--- a/packages/backend/src/server/api/integration/DiscordServerService.ts
+++ b/packages/backend/src/server/api/integration/DiscordServerService.ts
@@ -14,6 +14,7 @@ import { MetaService } from '@/core/MetaService.js';
import { UserEntityService } from '@/core/entities/UserEntityService.js';
import { FastifyReplyError } from '@/misc/fastify-reply-error.js';
import { SigninService } from '../SigninService.js';
+import { bindThis } from '@/decorators.js';
@Injectable()
export class DiscordServerService {
@@ -36,9 +37,10 @@ export class DiscordServerService {
private metaService: MetaService,
private signinService: SigninService,
) {
- this.create = this.create.bind(this);
+ //this.create = this.create.bind(this);
}
+ @bindThis
public create(fastify: FastifyInstance, options: FastifyPluginOptions, done: (err?: Error) => void) {
fastify.get('/disconnect/discord', async (request, reply) => {
if (!this.compareOrigin(request)) {
@@ -288,10 +290,12 @@ export class DiscordServerService {
done();
}
+ @bindThis
private getUserToken(request: FastifyRequest): string | null {
return ((request.headers['cookie'] ?? '').match(/igi=(\w+)/) ?? [null, null])[1];
}
+ @bindThis
private compareOrigin(request: FastifyRequest): boolean {
function normalizeUrl(url?: string): string {
return url ? url.endsWith('/') ? url.substr(0, url.length - 1) : url : '';
diff --git a/packages/backend/src/server/api/integration/GithubServerService.ts b/packages/backend/src/server/api/integration/GithubServerService.ts
index 2fd20bf831..3aa04f72ee 100644
--- a/packages/backend/src/server/api/integration/GithubServerService.ts
+++ b/packages/backend/src/server/api/integration/GithubServerService.ts
@@ -14,6 +14,7 @@ import { MetaService } from '@/core/MetaService.js';
import { UserEntityService } from '@/core/entities/UserEntityService.js';
import { FastifyReplyError } from '@/misc/fastify-reply-error.js';
import { SigninService } from '../SigninService.js';
+import { bindThis } from '@/decorators.js';
@Injectable()
export class GithubServerService {
@@ -36,9 +37,10 @@ export class GithubServerService {
private metaService: MetaService,
private signinService: SigninService,
) {
- this.create = this.create.bind(this);
+ //this.create = this.create.bind(this);
}
+ @bindThis
public create(fastify: FastifyInstance, options: FastifyPluginOptions, done: (err?: Error) => void) {
fastify.get('/disconnect/github', async (request, reply) => {
if (!this.compareOrigin(request)) {
@@ -260,10 +262,12 @@ export class GithubServerService {
done();
}
+ @bindThis
private getUserToken(request: FastifyRequest): string | null {
return ((request.headers['cookie'] ?? '').match(/igi=(\w+)/) ?? [null, null])[1];
}
+ @bindThis
private compareOrigin(request: FastifyRequest): boolean {
function normalizeUrl(url?: string): string {
return url ? url.endsWith('/') ? url.substr(0, url.length - 1) : url : '';
diff --git a/packages/backend/src/server/api/integration/TwitterServerService.ts b/packages/backend/src/server/api/integration/TwitterServerService.ts
index a8447f9d49..7a127fa29a 100644
--- a/packages/backend/src/server/api/integration/TwitterServerService.ts
+++ b/packages/backend/src/server/api/integration/TwitterServerService.ts
@@ -14,6 +14,7 @@ import { MetaService } from '@/core/MetaService.js';
import { UserEntityService } from '@/core/entities/UserEntityService.js';
import { FastifyReplyError } from '@/misc/fastify-reply-error.js';
import { SigninService } from '../SigninService.js';
+import { bindThis } from '@/decorators.js';
@Injectable()
export class TwitterServerService {
@@ -36,9 +37,10 @@ export class TwitterServerService {
private metaService: MetaService,
private signinService: SigninService,
) {
- this.create = this.create.bind(this);
+ //this.create = this.create.bind(this);
}
+ @bindThis
public create(fastify: FastifyInstance, options: FastifyPluginOptions, done: (err?: Error) => void) {
fastify.get('/disconnect/twitter', async (request, reply) => {
if (!this.compareOrigin(request)) {
@@ -205,10 +207,12 @@ export class TwitterServerService {
done();
}
+ @bindThis
private getUserToken(request: FastifyRequest): string | null {
return ((request.headers['cookie'] ?? '').match(/igi=(\w+)/) ?? [null, null])[1];
}
+ @bindThis
private compareOrigin(request: FastifyRequest): boolean {
function normalizeUrl(url?: string): string {
return url ? url.endsWith('/') ? url.substr(0, url.length - 1) : url : '';