设备识别移除tgbot

This commit is contained in:
mtvpls
2026-07-15 15:19:47 +08:00
parent 93d6c773b8
commit 9f63e18550
4 changed files with 20 additions and 13 deletions
+4 -3
View File
@@ -1,4 +1,4 @@
import { NextResponse } from 'next/server';
import { NextRequest, NextResponse } from 'next/server';
import {
createTelegramLoginSession,
@@ -9,7 +9,7 @@ import {
export const runtime = 'nodejs';
export async function POST() {
export async function POST(request: NextRequest) {
const config = await getTelegramConfig();
const problems = getTelegramConfigProblems(config, 'login');
if (problems.length > 0) {
@@ -25,7 +25,8 @@ export async function POST() {
}, { status: 400 });
}
const session = await createTelegramLoginSession();
const userAgent = request.headers.get('user-agent') || '';
const session = await createTelegramLoginSession(userAgent);
const botUsername = config.botUsername.replace(/^@/, '');
return NextResponse.json({
token: session.token,