Skip to content

Commit d98c8fb

Browse files
authored
Removed UA Detection
1 parent 00b2dc0 commit d98c8fb

File tree

12 files changed

+23
-53
lines changed

12 files changed

+23
-53
lines changed

static/assets/scripts/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
window.addEventListener('load', () => {
2-
navigator.serviceWorker.register('../sw.js?v=1', {
2+
navigator.serviceWorker.register('../sw.js?v=2', {
33
scope: '/a/',
44
})
55
})

static/assets/scripts/main.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,6 @@ document.addEventListener('DOMContentLoaded', function () {
2323
}
2424
}
2525
})
26-
// UA Detection
27-
const isiPhone = /iPhone/i.test(navigator.userAgent)
28-
const isiPad = /iPad/i.test(navigator.userAgent)
29-
30-
if (isiPhone || isiPad) {
31-
if (typeof localStorage !== 'undefined') {
32-
localStorage.setItem('dy', 'auto')
33-
} else {
34-
console.error('localStorage is not available.')
35-
}
36-
}
37-
3826
// Themes
3927
var themeid = localStorage.getItem('theme')
4028
themeEle = document.createElement('link')

static/dy/client.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

static/dy/client.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

static/dy/config.js

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
const isAndroid = () => /Android/i.test(navigator.userAgent);
2-
const isiPhone = () => /iPhone/i.test(navigator.userAgent);
3-
const isiPad = () => /iPad/i.test(navigator.userAgent);
4-
51
self.__dynamic$config = {
62
prefix: '/a/q/',
73
encoding: 'xor',
@@ -14,11 +10,7 @@ self.__dynamic$config = {
1410
tab: {
1511
title: null,
1612
icon: null,
17-
ua: isAndroid()
18-
? 'Mozilla/5.0 (Linux; Android 10; Mobile; rv:68.0) Gecko/68.0 Firefox/68.0'
19-
: isiPad()
20-
? 'Mozilla/5.0 (iPad; CPU OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.0 Safari/604.1'
21-
: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36',
13+
ua: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.3'
2214
},
2315
assets: {
2416
prefix: '/dy/',
@@ -27,18 +19,8 @@ self.__dynamic$config = {
2719
client: 'client.js',
2820
worker: 'worker.js',
2921
config: 'config.js',
30-
inject: function () {
31-
navigator.__defineGetter__('userAgent', () =>
32-
isiPhone()
33-
? 'Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.0 Mobile/15E148 Safari/604.1'
34-
: isiPad()
35-
? 'Mozilla/5.0 (iPad; CPU OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.0 Safari/604.1'
36-
: isAndroid()
37-
? 'Mozilla/5.0 (Linux; Android 10; Mobile; rv:68.0) Gecko/68.0 Firefox/68.0'
38-
: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36'
39-
);
40-
},
41-
},
22+
inject: ''
23+
}
4224
},
43-
block: [],
25+
block: []
4426
};

static/dy/handler.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

static/dy/handler.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

static/dy/worker.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

static/dy/worker.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

static/m/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ self.__uv$config = {
66
handler: '/m/handler.js',
77
bundle: '/m/bundle.js',
88
config: '/m/config.js',
9-
sw: '/m/sw.js?v=1',
9+
sw: '/m/sw.js?v=2',
1010
};

0 commit comments

Comments
 (0)