fix and update
This commit is contained in:
@@ -2,6 +2,7 @@ import { BadRequestException, Injectable, UnauthorizedException } from '@nestjs/
|
||||
import { PrismaService } from '../infra/prisma.service';
|
||||
import { OAuthCoreService } from './oauth-core.service';
|
||||
import { SessionService } from './session.service';
|
||||
import { SettingsService } from './settings.service';
|
||||
import { assertHumanAccount, HUMAN_USER_WHERE } from './system-account.util';
|
||||
|
||||
@Injectable()
|
||||
@@ -9,7 +10,8 @@ export class FedcmService {
|
||||
constructor(
|
||||
private readonly prisma: PrismaService,
|
||||
private readonly session: SessionService,
|
||||
private readonly oauthCore: OAuthCoreService
|
||||
private readonly oauthCore: OAuthCoreService,
|
||||
private readonly settings: SettingsService
|
||||
) {}
|
||||
|
||||
async getAccounts(userId: string, sessionId: string) {
|
||||
@@ -81,12 +83,21 @@ export class FedcmService {
|
||||
throw new BadRequestException('OAuth-приложение не найдено или отключено');
|
||||
}
|
||||
|
||||
const frontendUrl = (await this.settings.getValue('PUBLIC_FRONTEND_URL', 'http://localhost:3002')).replace(/\/+$/, '');
|
||||
const privacyFallback = `${frontendUrl}/data`;
|
||||
const privacy = (await this.settings.getValue('FEDCM_PRIVACY_POLICY_URL', '')).trim();
|
||||
const terms = (await this.settings.getValue('FEDCM_TERMS_URL', '')).trim();
|
||||
|
||||
return {
|
||||
privacy_policy_url: 'https://id.lendry.ru/data',
|
||||
terms_of_service_url: 'https://id.lendry.ru/data'
|
||||
privacy_policy_url: privacy || privacyFallback,
|
||||
terms_of_service_url: terms || privacyFallback
|
||||
};
|
||||
}
|
||||
|
||||
async isOneTapEnabled() {
|
||||
return this.settings.getBoolean('ONE_TAP_ENABLED', true);
|
||||
}
|
||||
|
||||
private async assertUnlockedSession(userId: string, sessionId: string) {
|
||||
const state = await this.session.resolveSessionState(sessionId);
|
||||
if (!state || state.userId !== userId) {
|
||||
|
||||
Reference in New Issue
Block a user