func optimization

This commit is contained in:
Den Piligrim
2026-01-31 18:44:09 +03:00
parent 6db895bcc7
commit 27310c0bc0
39 changed files with 1989 additions and 539 deletions
+1 -6
View File
@@ -20,13 +20,12 @@ export class ClientController {
) { }
@Public()
@Get('bus/:uuid') // Тот самый путь /bus/UUID
@Get('bus/:uuid')
async getSubscription(
@Param('uuid') uuid: string,
@Req() req: Request,
@Res() res: Response
) {
// 1. Ищем подписку
const sub = await this.subRepo.findOne({
where: { uuid },
relations: ['inbounds']
@@ -36,12 +35,10 @@ export class ClientController {
throw new HttpException('Subscription not found', HttpStatus.NOT_FOUND);
}
// 2. Генерируем список ссылок (Config)
const links = sub.inbounds
?.map(i => i.link)
.filter(l => l && l.length > 0) || [];
// Формируем Base64 строку (это и есть подписка для клиента)
const plainTextList = links.join('\n');
const base64Config = Buffer.from(plainTextList).toString('base64');
@@ -67,7 +64,6 @@ export class ClientController {
console.log(`Взяли QR из кэша для ${uuid}`);
}
// HTML шаблон
const html = `
<!DOCTYPE html>
<html lang="ru">
@@ -190,7 +186,6 @@ export class ClientController {
console.log(`Взяли QR из кэша для ${uuid}`);
}
// HTML шаблон
const html = `
<!DOCTYPE html>
<html lang="ru">