From 5da22eed8e6fc9305d311bd469d03d085c628f62 Mon Sep 17 00:00:00 2001 From: yutent Date: Tue, 12 Sep 2023 14:15:27 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4locale=E7=9A=84=E6=B3=A8?= =?UTF-8?q?=E5=85=A5=E5=8F=8Anavigator.language=E7=9A=84=E9=87=8D=E5=86=99?= =?UTF-8?q?;=20native=E5=AF=B9=E8=B1=A1=E6=94=B9=E4=B8=BA=E5=8F=AA?= =?UTF-8?q?=E8=AF=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- usr/lib/python3/dist-packages/webengine/gtk3/_inject.py | 2 -- usr/lib/python3/dist-packages/webengine/gtk3/inject.js | 5 +---- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/usr/lib/python3/dist-packages/webengine/gtk3/_inject.py b/usr/lib/python3/dist-packages/webengine/gtk3/_inject.py index f6eee37..69e197e 100644 --- a/usr/lib/python3/dist-packages/webengine/gtk3/_inject.py +++ b/usr/lib/python3/dist-packages/webengine/gtk3/_inject.py @@ -18,13 +18,11 @@ class Inject: code = open(self.abspath('./inject.js'), 'r').read() frame = WebKit2.UserContentInjectedFrames.ALL_FRAMES time = WebKit2.UserScriptInjectionTime.END - lang, charset = env['LANG'].split('.') code = code.replace("'{{env}}'", json.dumps(env)) code = code.replace("{{uuid}}", webview.uuid) code = code.replace("{{app_name}}", webview.app_name) code = code.replace("{{app_version}}", webview.app_version) - code = code.replace("{{lang}}", lang) script = WebKit2.UserScript(code, frame, time, None, None) diff --git a/usr/lib/python3/dist-packages/webengine/gtk3/inject.js b/usr/lib/python3/dist-packages/webengine/gtk3/inject.js index df37359..ba80e6d 100644 --- a/usr/lib/python3/dist-packages/webengine/gtk3/inject.js +++ b/usr/lib/python3/dist-packages/webengine/gtk3/inject.js @@ -212,10 +212,7 @@ class EventEmitter { } } -readonly(navigator, 'language', '{{lang}}') -readonly(navigator, 'languages', ['{{lang}}']) - -window.native = new EventEmitter() +readonly(window, 'native', new EventEmitter()) native.$on('opener_message', (data, uuid) => _postMessage(data, uuid))