fix: getHighEntropyValuesが使用できない場合は生のUAを返すように
This commit is contained in:
parent
f891e95d3e
commit
10b078c865
|
@ -33,7 +33,6 @@
|
||||||
"aiscript-vscode": "github:aiscript-dev/aiscript-vscode#v0.1.15",
|
"aiscript-vscode": "github:aiscript-dev/aiscript-vscode#v0.1.15",
|
||||||
"analytics": "0.8.19",
|
"analytics": "0.8.19",
|
||||||
"astring": "1.9.0",
|
"astring": "1.9.0",
|
||||||
"bowser": "2.12.1",
|
|
||||||
"broadcast-channel": "7.1.0",
|
"broadcast-channel": "7.1.0",
|
||||||
"buraha": "0.0.1",
|
"buraha": "0.0.1",
|
||||||
"canvas-confetti": "1.9.3",
|
"canvas-confetti": "1.9.3",
|
||||||
|
@ -106,7 +105,6 @@
|
||||||
"@storybook/vue3-vite": "9.1.8",
|
"@storybook/vue3-vite": "9.1.8",
|
||||||
"@tabler/icons-webfont": "3.35.0",
|
"@tabler/icons-webfont": "3.35.0",
|
||||||
"@testing-library/vue": "8.1.0",
|
"@testing-library/vue": "8.1.0",
|
||||||
"@types/bowser": "1.1.5",
|
|
||||||
"@types/canvas-confetti": "1.9.0",
|
"@types/canvas-confetti": "1.9.0",
|
||||||
"@types/estree": "1.0.8",
|
"@types/estree": "1.0.8",
|
||||||
"@types/matter-js": "0.20.2",
|
"@types/matter-js": "0.20.2",
|
||||||
|
|
|
@ -3,19 +3,17 @@
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Type Reference Only import (実物はlazy-loadされる)
|
|
||||||
import type * as BowserTypeReferenceOnly from 'bowser';
|
|
||||||
|
|
||||||
type BowserTypeTypeReferenceOnly = typeof BowserTypeReferenceOnly;
|
|
||||||
|
|
||||||
let Bowser: BowserTypeTypeReferenceOnly | null = null;
|
|
||||||
|
|
||||||
export type UserEnvironment = {
|
export type UserEnvironment = {
|
||||||
os: string;
|
os: string;
|
||||||
browser: string;
|
browser: string;
|
||||||
screenWidth: number;
|
screenWidth: number;
|
||||||
screenHeight: number;
|
screenHeight: number;
|
||||||
viaGetHighEntropyValues: boolean;
|
viaGetHighEntropyValues: true;
|
||||||
|
} | {
|
||||||
|
userAgent: string;
|
||||||
|
screenWidth: number;
|
||||||
|
screenHeight: number;
|
||||||
|
viaGetHighEntropyValues: false;
|
||||||
};
|
};
|
||||||
|
|
||||||
export async function getUserEnvironment(): Promise<UserEnvironment> {
|
export async function getUserEnvironment(): Promise<UserEnvironment> {
|
||||||
|
@ -56,14 +54,9 @@ export async function getUserEnvironment(): Promise<UserEnvironment> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getViaUa(): Promise<UserEnvironment> {
|
function getViaUa(): UserEnvironment {
|
||||||
if (Bowser == null) {
|
|
||||||
Bowser = (await import('bowser')).default;
|
|
||||||
}
|
|
||||||
const parsed = Bowser.parse(navigator.userAgent);
|
|
||||||
return {
|
return {
|
||||||
os: `${parsed.os.name ?? 'Unknown'} ${parsed.os.version ?? ''} ${parsed.os.versionName ? `(${parsed.os.versionName})` : ''}`.trim(),
|
userAgent: navigator.userAgent,
|
||||||
browser: `${parsed.browser.name ?? 'Unknown'} ${parsed.browser.version ?? ''}`.trim(),
|
|
||||||
screenWidth: window.innerWidth,
|
screenWidth: window.innerWidth,
|
||||||
screenHeight: window.innerHeight,
|
screenHeight: window.innerHeight,
|
||||||
viaGetHighEntropyValues: false,
|
viaGetHighEntropyValues: false,
|
||||||
|
|
|
@ -757,9 +757,6 @@ importers:
|
||||||
astring:
|
astring:
|
||||||
specifier: 1.9.0
|
specifier: 1.9.0
|
||||||
version: 1.9.0
|
version: 1.9.0
|
||||||
bowser:
|
|
||||||
specifier: 2.12.1
|
|
||||||
version: 2.12.1
|
|
||||||
broadcast-channel:
|
broadcast-channel:
|
||||||
specifier: 7.1.0
|
specifier: 7.1.0
|
||||||
version: 7.1.0
|
version: 7.1.0
|
||||||
|
@ -971,9 +968,6 @@ importers:
|
||||||
'@testing-library/vue':
|
'@testing-library/vue':
|
||||||
specifier: 8.1.0
|
specifier: 8.1.0
|
||||||
version: 8.1.0(@vue/compiler-sfc@3.5.22)(@vue/server-renderer@3.5.22(vue@3.5.22(typescript@5.9.2)))(vue@3.5.22(typescript@5.9.2))
|
version: 8.1.0(@vue/compiler-sfc@3.5.22)(@vue/server-renderer@3.5.22(vue@3.5.22(typescript@5.9.2)))(vue@3.5.22(typescript@5.9.2))
|
||||||
'@types/bowser':
|
|
||||||
specifier: 1.1.5
|
|
||||||
version: 1.1.5
|
|
||||||
'@types/canvas-confetti':
|
'@types/canvas-confetti':
|
||||||
specifier: 1.9.0
|
specifier: 1.9.0
|
||||||
version: 1.9.0
|
version: 1.9.0
|
||||||
|
@ -4598,10 +4592,6 @@ packages:
|
||||||
'@types/body-parser@1.19.6':
|
'@types/body-parser@1.19.6':
|
||||||
resolution: {integrity: sha512-HLFeCYgz89uk22N5Qg3dvGvsv46B8GLvKKo1zKG4NybA8U2DiEO3w9lqGg29t/tfLRJpJ6iQxnVw4OnB7MoM9g==}
|
resolution: {integrity: sha512-HLFeCYgz89uk22N5Qg3dvGvsv46B8GLvKKo1zKG4NybA8U2DiEO3w9lqGg29t/tfLRJpJ6iQxnVw4OnB7MoM9g==}
|
||||||
|
|
||||||
'@types/bowser@1.1.5':
|
|
||||||
resolution: {integrity: sha512-7qUcVaL3NZ40tLPPlbk9fKL++vT/BBT0vbq+R97KH1lnZQmcZwvqa3rnAcCE48ai2dZm9ETr9TnQXhztGsvPIw==}
|
|
||||||
deprecated: This is a stub types definition. bowser provides its own type definitions, so you do not need this installed.
|
|
||||||
|
|
||||||
'@types/braces@3.0.1':
|
'@types/braces@3.0.1':
|
||||||
resolution: {integrity: sha512-+euflG6ygo4bn0JHtn4pYqcXwRtLvElQ7/nnjDu7iYG56H0+OhCd7d6Ug0IE3WcFpZozBKW2+80FUbv5QGk5AQ==}
|
resolution: {integrity: sha512-+euflG6ygo4bn0JHtn4pYqcXwRtLvElQ7/nnjDu7iYG56H0+OhCd7d6Ug0IE3WcFpZozBKW2+80FUbv5QGk5AQ==}
|
||||||
|
|
||||||
|
@ -15405,10 +15395,6 @@ snapshots:
|
||||||
'@types/connect': 3.4.36
|
'@types/connect': 3.4.36
|
||||||
'@types/node': 22.18.6
|
'@types/node': 22.18.6
|
||||||
|
|
||||||
'@types/bowser@1.1.5':
|
|
||||||
dependencies:
|
|
||||||
bowser: 2.12.1
|
|
||||||
|
|
||||||
'@types/braces@3.0.1': {}
|
'@types/braces@3.0.1': {}
|
||||||
|
|
||||||
'@types/canvas-confetti@1.9.0': {}
|
'@types/canvas-confetti@1.9.0': {}
|
||||||
|
@ -15758,7 +15744,7 @@ snapshots:
|
||||||
'@typescript-eslint/types': 8.44.1
|
'@typescript-eslint/types': 8.44.1
|
||||||
'@typescript-eslint/typescript-estree': 8.44.1(typescript@5.9.2)
|
'@typescript-eslint/typescript-estree': 8.44.1(typescript@5.9.2)
|
||||||
'@typescript-eslint/visitor-keys': 8.44.1
|
'@typescript-eslint/visitor-keys': 8.44.1
|
||||||
debug: 4.4.1(supports-color@10.2.0)
|
debug: 4.4.1(supports-color@5.5.0)
|
||||||
eslint: 9.36.0
|
eslint: 9.36.0
|
||||||
typescript: 5.9.2
|
typescript: 5.9.2
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
|
@ -15787,7 +15773,7 @@ snapshots:
|
||||||
'@typescript-eslint/types': 8.44.1
|
'@typescript-eslint/types': 8.44.1
|
||||||
'@typescript-eslint/typescript-estree': 8.44.1(typescript@5.9.2)
|
'@typescript-eslint/typescript-estree': 8.44.1(typescript@5.9.2)
|
||||||
'@typescript-eslint/utils': 8.44.1(eslint@9.36.0)(typescript@5.9.2)
|
'@typescript-eslint/utils': 8.44.1(eslint@9.36.0)(typescript@5.9.2)
|
||||||
debug: 4.4.1(supports-color@10.2.0)
|
debug: 4.4.1(supports-color@5.5.0)
|
||||||
eslint: 9.36.0
|
eslint: 9.36.0
|
||||||
ts-api-utils: 2.1.0(typescript@5.9.2)
|
ts-api-utils: 2.1.0(typescript@5.9.2)
|
||||||
typescript: 5.9.2
|
typescript: 5.9.2
|
||||||
|
@ -15802,7 +15788,7 @@ snapshots:
|
||||||
'@typescript-eslint/tsconfig-utils': 8.44.1(typescript@5.9.2)
|
'@typescript-eslint/tsconfig-utils': 8.44.1(typescript@5.9.2)
|
||||||
'@typescript-eslint/types': 8.44.1
|
'@typescript-eslint/types': 8.44.1
|
||||||
'@typescript-eslint/visitor-keys': 8.44.1
|
'@typescript-eslint/visitor-keys': 8.44.1
|
||||||
debug: 4.4.1(supports-color@10.2.0)
|
debug: 4.4.1(supports-color@5.5.0)
|
||||||
fast-glob: 3.3.3
|
fast-glob: 3.3.3
|
||||||
is-glob: 4.0.3
|
is-glob: 4.0.3
|
||||||
minimatch: 9.0.5
|
minimatch: 9.0.5
|
||||||
|
@ -15841,7 +15827,7 @@ snapshots:
|
||||||
'@ampproject/remapping': 2.3.0
|
'@ampproject/remapping': 2.3.0
|
||||||
'@bcoe/v8-coverage': 1.0.2
|
'@bcoe/v8-coverage': 1.0.2
|
||||||
ast-v8-to-istanbul: 0.3.3
|
ast-v8-to-istanbul: 0.3.3
|
||||||
debug: 4.4.1(supports-color@10.2.0)
|
debug: 4.4.1(supports-color@5.5.0)
|
||||||
istanbul-lib-coverage: 3.2.2
|
istanbul-lib-coverage: 3.2.2
|
||||||
istanbul-lib-report: 3.0.1
|
istanbul-lib-report: 3.0.1
|
||||||
istanbul-lib-source-maps: 5.0.6
|
istanbul-lib-source-maps: 5.0.6
|
||||||
|
@ -17671,7 +17657,7 @@ snapshots:
|
||||||
|
|
||||||
esbuild-register@3.5.0(esbuild@0.25.10):
|
esbuild-register@3.5.0(esbuild@0.25.10):
|
||||||
dependencies:
|
dependencies:
|
||||||
debug: 4.4.1(supports-color@10.2.0)
|
debug: 4.4.1(supports-color@5.5.0)
|
||||||
esbuild: 0.25.10
|
esbuild: 0.25.10
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
|
@ -18647,7 +18633,7 @@ snapshots:
|
||||||
http-proxy-agent@7.0.2:
|
http-proxy-agent@7.0.2:
|
||||||
dependencies:
|
dependencies:
|
||||||
agent-base: 7.1.3
|
agent-base: 7.1.3
|
||||||
debug: 4.4.1(supports-color@10.2.0)
|
debug: 4.4.3
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
|
@ -18680,6 +18666,13 @@ snapshots:
|
||||||
- supports-color
|
- supports-color
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
|
https-proxy-agent@7.0.6:
|
||||||
|
dependencies:
|
||||||
|
agent-base: 7.1.3
|
||||||
|
debug: 4.4.3
|
||||||
|
transitivePeerDependencies:
|
||||||
|
- supports-color
|
||||||
|
|
||||||
https-proxy-agent@7.0.6(supports-color@10.2.0):
|
https-proxy-agent@7.0.6(supports-color@10.2.0):
|
||||||
dependencies:
|
dependencies:
|
||||||
agent-base: 7.1.3
|
agent-base: 7.1.3
|
||||||
|
@ -19022,7 +19015,7 @@ snapshots:
|
||||||
istanbul-lib-source-maps@5.0.6:
|
istanbul-lib-source-maps@5.0.6:
|
||||||
dependencies:
|
dependencies:
|
||||||
'@jridgewell/trace-mapping': 0.3.29
|
'@jridgewell/trace-mapping': 0.3.29
|
||||||
debug: 4.4.1(supports-color@10.2.0)
|
debug: 4.4.1(supports-color@5.5.0)
|
||||||
istanbul-lib-coverage: 3.2.2
|
istanbul-lib-coverage: 3.2.2
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
|
@ -19411,7 +19404,7 @@ snapshots:
|
||||||
decimal.js: 10.5.0
|
decimal.js: 10.5.0
|
||||||
html-encoding-sniffer: 4.0.0
|
html-encoding-sniffer: 4.0.0
|
||||||
http-proxy-agent: 7.0.2
|
http-proxy-agent: 7.0.2
|
||||||
https-proxy-agent: 7.0.6(supports-color@10.2.0)
|
https-proxy-agent: 7.0.6
|
||||||
is-potential-custom-element-name: 1.0.1
|
is-potential-custom-element-name: 1.0.1
|
||||||
nwsapi: 2.2.16
|
nwsapi: 2.2.16
|
||||||
parse5: 7.3.0
|
parse5: 7.3.0
|
||||||
|
@ -22731,7 +22724,7 @@ snapshots:
|
||||||
vite-node@3.2.4(@types/node@22.18.6)(sass@1.93.2)(terser@5.44.0)(tsx@4.20.6):
|
vite-node@3.2.4(@types/node@22.18.6)(sass@1.93.2)(terser@5.44.0)(tsx@4.20.6):
|
||||||
dependencies:
|
dependencies:
|
||||||
cac: 6.7.14
|
cac: 6.7.14
|
||||||
debug: 4.4.1(supports-color@10.2.0)
|
debug: 4.4.1(supports-color@5.5.0)
|
||||||
es-module-lexer: 1.7.0
|
es-module-lexer: 1.7.0
|
||||||
pathe: 2.0.3
|
pathe: 2.0.3
|
||||||
vite: 7.1.7(@types/node@22.18.6)(sass@1.93.2)(terser@5.44.0)(tsx@4.20.6)
|
vite: 7.1.7(@types/node@22.18.6)(sass@1.93.2)(terser@5.44.0)(tsx@4.20.6)
|
||||||
|
@ -22787,7 +22780,7 @@ snapshots:
|
||||||
'@vitest/spy': 3.2.4
|
'@vitest/spy': 3.2.4
|
||||||
'@vitest/utils': 3.2.4
|
'@vitest/utils': 3.2.4
|
||||||
chai: 5.2.0
|
chai: 5.2.0
|
||||||
debug: 4.4.1(supports-color@10.2.0)
|
debug: 4.4.1(supports-color@5.5.0)
|
||||||
expect-type: 1.2.1
|
expect-type: 1.2.1
|
||||||
magic-string: 0.30.19
|
magic-string: 0.30.19
|
||||||
pathe: 2.0.3
|
pathe: 2.0.3
|
||||||
|
@ -22875,7 +22868,7 @@ snapshots:
|
||||||
|
|
||||||
vue-eslint-parser@10.2.0(eslint@9.36.0):
|
vue-eslint-parser@10.2.0(eslint@9.36.0):
|
||||||
dependencies:
|
dependencies:
|
||||||
debug: 4.4.1(supports-color@10.2.0)
|
debug: 4.4.1(supports-color@5.5.0)
|
||||||
eslint: 9.36.0
|
eslint: 9.36.0
|
||||||
eslint-scope: 8.4.0
|
eslint-scope: 8.4.0
|
||||||
eslint-visitor-keys: 4.2.1
|
eslint-visitor-keys: 4.2.1
|
||||||
|
|
Loading…
Reference in New Issue