feature(worker+api): improve buffer

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-09-17 23:37:11 +02:00
parent 32e91959f6
commit 545cbfd520
18 changed files with 1484 additions and 432 deletions

View File

@@ -9,7 +9,9 @@ export function parseUserAgent(ua?: string | null) {
if (!ua) return parsedServerUa;
const res = new UAParser(ua).getResult();
if (isServer(ua)) return parsedServerUa;
if (isServer(ua)) {
return parsedServerUa;
}
return {
os: res.os.name,
@@ -77,7 +79,9 @@ function isServer(userAgent: string) {
return true;
}
return !!userAgent.match(/^([^\s]+\/[\d.]+\s*)+$/);
// Matches user agents like "Go-http-client/1.0" or "Go Http Client/1.0"
// It should just match the first name (with optional spaces) and version
return !!userAgent.match(/^[^\/]+\/[\d.]+$/);
}
export function getDevice(ua: string) {