Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/auth/auth.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import { InternalAuthController } from 'omniboxd/auth/internal.auth.controller';
import { NamespacesModule } from 'omniboxd/namespaces/namespaces.module';
import { GroupsModule } from 'omniboxd/groups/groups.module';
import { PermissionsModule } from 'omniboxd/permissions/permissions.module';
import { WechatService } from 'omniboxd/auth/wechat.service';
import { WechatController } from 'omniboxd/auth/wechat.controller';
import { GoogleService } from 'omniboxd/auth/google.service';
import { GoogleController } from 'omniboxd/auth/google.controller';
import { WechatService } from 'omniboxd/auth/wechat/wechat.service';
import { WechatController } from 'omniboxd/auth/wechat/wechat.controller';
import { GoogleService } from 'omniboxd/auth/google/google.service';
import { GoogleController } from 'omniboxd/auth/google/google.controller';
import { APIKeyModule } from 'omniboxd/api-key/api-key.module';
import { APIKeyAuthGuard } from 'omniboxd/auth/api-key/api-key-auth.guard';
import { CookieAuthGuard } from 'omniboxd/auth/cookie/cookie-auth.guard';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Request } from 'express';
import { AuthService } from 'omniboxd/auth/auth.service';
import { GoogleService } from 'omniboxd/auth/google.service';
import { GoogleService } from 'omniboxd/auth/google/google.service';
import { Req, Get, Body, Controller, Post } from '@nestjs/common';
import { Public } from 'omniboxd/auth/decorators/public.auth.decorator';
import { SocialController } from 'omniboxd/auth/social.controller';
Expand Down
11 changes: 8 additions & 3 deletions src/auth/google.service.ts → src/auth/google/google.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { SocialService } from 'omniboxd/auth/social.service';
import { UserService } from 'omniboxd/user/user.service';
import { NamespacesService } from 'omniboxd/namespaces/namespaces.service';
import {
Logger,
Injectable,
BadRequestException,
Injectable,
Logger,
UnauthorizedException,
} from '@nestjs/common';

Expand Down Expand Up @@ -39,6 +39,7 @@ export class GoogleService extends SocialService {
private readonly clientId: string;
private readonly clientSecret: string;
private readonly redirectUri: string;
private readonly googleOAuthAPIUrl: string;

constructor(
private readonly configService: ConfigService,
Expand All @@ -57,6 +58,10 @@ export class GoogleService extends SocialService {
'OBB_GOOGLE_REDIRECT_URI',
'',
);
this.googleOAuthAPIUrl = this.configService.get<string>(
'OBB_GOOGLE_OAUTH_API_URL',
'https://oauth2.googleapis.com',
);
}

getGoogleAuthUrl(): string {
Expand All @@ -83,7 +88,7 @@ export class GoogleService extends SocialService {
throw new UnauthorizedException('Invalid state identifier');
}

const tokenResponse = await fetch('https://oauth2.googleapis.com/token', {
const tokenResponse = await fetch(`${this.googleOAuthAPIUrl}/token`, {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Request } from 'express';
import { Get, Post, Query, Controller, Req } from '@nestjs/common';
import { AuthService } from 'omniboxd/auth/auth.service';
import { WechatService } from 'omniboxd/auth/wechat.service';
import { WechatService } from 'omniboxd/auth/wechat/wechat.service';
import { SocialController } from 'omniboxd/auth/social.controller';
import { Public } from 'omniboxd/auth/decorators/public.auth.decorator';
import { UserId } from 'omniboxd/decorators/user-id.decorator';
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/migrations/1755499552000-update-attachment-urls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class UpdateAttachmentUrls1755499552000 implements MigrationInterface {
// Replace /api/v1/attachments/images/{id} and
// /api/v1/attachments/media/{id} with attachments/{id}
const updatedContent = originalContent.replace(
/\/api\/v1\/attachments\/(images|media)\/([a-zA-Z0-9\._-]+)/g,
/\/api\/v1\/attachments\/(images|media)\/([a-zA-Z0-9._-]+)/g,
'attachments/$2',
);

Expand Down
2 changes: 1 addition & 1 deletion src/migrations/1755504936756-scan-resource-attachments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class ScanResourceAttachments1755504936756

// Find all attachment references in the format: attachments/{id}
const attachmentMatches = content.match(
/attachments\/([a-zA-Z0-9\._-]+)/g,
/attachments\/([a-zA-Z0-9._-]+)/g,
);

for (const match of attachmentMatches || []) {
Expand Down