识别app ua
This commit is contained in:
@@ -40,6 +40,11 @@ async function generateSignature(
|
|||||||
function getDeviceInfo(userAgent: string): string {
|
function getDeviceInfo(userAgent: string): string {
|
||||||
const ua = userAgent.toLowerCase();
|
const ua = userAgent.toLowerCase();
|
||||||
|
|
||||||
|
// 检查是否为 MoonTVPlus APP
|
||||||
|
if (ua.includes('moontvplus')) {
|
||||||
|
return 'MoonTVPlus APP';
|
||||||
|
}
|
||||||
|
|
||||||
if (ua.includes('mobile') || ua.includes('android') || ua.includes('iphone')) {
|
if (ua.includes('mobile') || ua.includes('android') || ua.includes('iphone')) {
|
||||||
if (ua.includes('android')) return 'Android Mobile';
|
if (ua.includes('android')) return 'Android Mobile';
|
||||||
if (ua.includes('iphone')) return 'iPhone';
|
if (ua.includes('iphone')) return 'iPhone';
|
||||||
|
|||||||
@@ -40,6 +40,11 @@ async function generateSignature(
|
|||||||
function getDeviceInfo(userAgent: string): string {
|
function getDeviceInfo(userAgent: string): string {
|
||||||
const ua = userAgent.toLowerCase();
|
const ua = userAgent.toLowerCase();
|
||||||
|
|
||||||
|
// 检查是否为 MoonTVPlus APP
|
||||||
|
if (ua.includes('moontvplus')) {
|
||||||
|
return 'MoonTVPlus APP';
|
||||||
|
}
|
||||||
|
|
||||||
if (ua.includes('mobile') || ua.includes('android') || ua.includes('iphone')) {
|
if (ua.includes('mobile') || ua.includes('android') || ua.includes('iphone')) {
|
||||||
if (ua.includes('android')) return 'Android Mobile';
|
if (ua.includes('android')) return 'Android Mobile';
|
||||||
if (ua.includes('iphone')) return 'iPhone';
|
if (ua.includes('iphone')) return 'iPhone';
|
||||||
|
|||||||
@@ -147,6 +147,11 @@ async function verifyTurnstileToken(token: string, secretKey: string): Promise<b
|
|||||||
function getDeviceInfo(request: NextRequest): string {
|
function getDeviceInfo(request: NextRequest): string {
|
||||||
const userAgent = request.headers.get('user-agent') || 'Unknown';
|
const userAgent = request.headers.get('user-agent') || 'Unknown';
|
||||||
|
|
||||||
|
// 检查是否为 MoonTVPlus APP
|
||||||
|
if (userAgent.toLowerCase().includes('moontvplus')) {
|
||||||
|
return 'MoonTVPlus APP';
|
||||||
|
}
|
||||||
|
|
||||||
// 简单解析 User-Agent
|
// 简单解析 User-Agent
|
||||||
let browser = 'Unknown Browser';
|
let browser = 'Unknown Browser';
|
||||||
let os = 'Unknown OS';
|
let os = 'Unknown OS';
|
||||||
|
|||||||
Reference in New Issue
Block a user