mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-07 03:57:06 +03:00
Fix user agent parser lower casing
This commit is contained in:
@@ -1,16 +1,16 @@
|
|||||||
export function parseUserAgent(userAgent: string): string {
|
export function parseUserAgent(userAgent: string): string {
|
||||||
const ua = userAgent.toLowerCase();
|
const ua = userAgent;
|
||||||
|
|
||||||
if (ua.match(/(com.google.android.youtube\/)|(com.vanced.android.youtube\/)|(^YouTube\/)|(^Dalvik\/)/)) {
|
if (ua.match(/(com.google.android.youtube\/)|(com.vanced.android.youtube\/)|(^YouTube\/)|(^Dalvik\/)/i)) {
|
||||||
return `Vanced/${ua.match(/.android.youtube\/([^\s]+)/)[1]}`;
|
return `Vanced/${ua.match(/.android.youtube\/([^\s]+)/i)[1]}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
const revanced = ua.match(/RVX\S+|ReVanced\S+/);
|
const revanced = ua.match(/RVX\S+|ReVanced\S+/i);
|
||||||
if (revanced) {
|
if (revanced) {
|
||||||
return revanced[0];
|
return revanced[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ua.match(/(mpv_sponsorblock)|(^python-requests)|(^GuzzleHttp\/)|(^PostmanRuntime\/)/)) {
|
if (ua.match(/(mpv_sponsorblock)|(^python-requests)|(^GuzzleHttp\/)|(^PostmanRuntime\/)/i)) {
|
||||||
return ua;
|
return ua;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user