From fa96e758d66c36ac0b5b328afb5938bd6ec04924 Mon Sep 17 00:00:00 2001 From: Damon Oehlman Date: Sat, 7 Mar 2020 15:30:22 +1100 Subject: [PATCH] remove vivaldi detection (#134) --- src/index.ts | 12 +++++------- test/logic.js | 10 ---------- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/src/index.ts b/src/index.ts index 58d619d..58f6fa1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,7 +5,7 @@ interface DetectedInfo< N extends string, O, V = null -> { + > { readonly type: T; readonly name: N; readonly version: V; @@ -19,7 +19,7 @@ export class BrowserInfo public readonly name: Browser, public readonly version: string, public readonly os: OperatingSystem | null, - ) {} + ) { } } export class NodeInfo @@ -28,19 +28,19 @@ export class NodeInfo public readonly name: 'node' = 'node'; public readonly os: NodeJS.Platform = process.platform; - constructor(public readonly version: string) {} + constructor(public readonly version: string) { } } export class SearchBotDeviceInfo implements - DetectedInfo<'bot-device', Browser, OperatingSystem | null, string> { + DetectedInfo<'bot-device', Browser, OperatingSystem | null, string> { public readonly type = 'bot-device'; constructor( public readonly name: Browser, public readonly version: string, public readonly os: OperatingSystem | null, public readonly bot: string, - ) {} + ) { } } export class BotInfo implements DetectedInfo<'bot', 'bot', null, null> { @@ -56,7 +56,6 @@ export type Browser = | 'edge' | 'edge-ios' | 'yandexbrowser' - | 'vivaldi' | 'kakaotalk' | 'samsung' | 'silk' @@ -120,7 +119,6 @@ const userAgentRules: UserAgentRule[] = [ ['edge', /Edge\/([0-9\._]+)/], ['edge-ios', /EdgiOS\/([0-9\._]+)/], ['yandexbrowser', /YaBrowser\/([0-9\._]+)/], - ['vivaldi', /Vivaldi\/([0-9\.]+)/], ['kakaotalk', /KAKAOTALK\s([0-9\.]+)/], ['samsung', /SamsungBrowser\/([0-9\.]+)/], ['silk', /\bSilk\/([0-9._-]+)\b/], diff --git a/test/logic.js b/test/logic.js index 3f32c77..3e0e57a 100644 --- a/test/logic.js +++ b/test/logic.js @@ -208,16 +208,6 @@ test('detects Yandex Browser', function(t) { t.end(); }); -test('detects Vivaldi Browser', function(t) { - assertAgentString( - t, - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36 Vivaldi/1.2.490.43', - { type: 'browser', name: 'vivaldi', version: '1.2.490', os: 'Mac OS' }, - ); - - t.end(); -}); - test('detects Kakaotalk Browser', function(t) { assertAgentString( t,