diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index aa7a363..b8e2db7 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -3494,7 +3494,7 @@ dependencies = [ [[package]] name = "tauri-plugin-window-state" version = "0.1.0" -source = "git+https://github.com/tauri-apps/plugins-workspace?branch=dev#dce0f02bc571128308c30278cde3233f341e6a50" +source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v1#0863f800b81925884a6a37c042f3d92d433d4a37" dependencies = [ "bincode", "bitflags 2.3.3", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 5ed72ec..0650930 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -18,7 +18,7 @@ tauri-build = { version = "1.4.0", features = [] } serde_json = "1.0.96" serde = { version = "1.0.163", features = ["derive"] } tauri = { version = "1.4.1", features = ["api-all", "system-tray"] } -tauri-plugin-window-state = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" } +tauri-plugin-window-state = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v1" } [dev-dependencies] cargo-bloat = "0.11.1" diff --git a/src-tauri/icons/wechat.icns b/src-tauri/icons/wechat.icns new file mode 100644 index 0000000..28d3945 Binary files /dev/null and b/src-tauri/icons/wechat.icns differ diff --git a/src-tauri/src/inject/component.js b/src-tauri/src/inject/component.js index f77a975..86e3a4b 100644 --- a/src-tauri/src/inject/component.js +++ b/src-tauri/src/inject/component.js @@ -96,18 +96,18 @@ document.addEventListener('DOMContentLoaded', () => { const urlSubmit = document.getElementById('pakeUrlSubmit'); const urlClose = document.getElementById('pakeUrlClose'); - urlSubmit.onclick = function () { + urlSubmit.onclick = function() { const url = urlInput.value; if (url) { window.location.href = url; } }; - urlClose.onclick = function () { + urlClose.onclick = function() { urlModal.style.display = 'none'; }; - urlInput.addEventListener('keydown', function (event) { + urlInput.addEventListener('keydown', function(event) { if (event.key === 'Enter') { const url = urlInput.value; if (url) { @@ -116,13 +116,13 @@ document.addEventListener('DOMContentLoaded', () => { } }); - document.addEventListener('keydown', function (event) { + document.addEventListener('keydown', function(event) { if (event.key === 'Escape' && urlModal.style.display === 'block') { urlModal.style.display = 'none'; } }); - window.showUrlModal = function () { + window.showUrlModal = function() { urlModal.style.display = 'block'; urlInput.focus(); }; @@ -134,11 +134,11 @@ document.addEventListener('DOMContentLoaded', () => { m.style.cssText = 'max-width:60%;min-width: 80px;padding:0 12px;height: 32px;color: rgb(255, 255, 255);line-height: 32px;text-align: center;border-radius: 8px;position: fixed; bottom:24px;right: 28px;z-index: 999999;background: rgba(0, 0, 0,.8);font-size: 13px;'; document.body.appendChild(m); - setTimeout(function () { + setTimeout(function() { const d = 0.5; m.style.transition = 'transform ' + d + 's ease-in, opacity ' + d + 's ease-in'; m.style.opacity = '0'; - setTimeout(function () { + setTimeout(function() { document.body.removeChild(m); }, d * 1000); }, 3000); @@ -146,35 +146,4 @@ document.addEventListener('DOMContentLoaded', () => { window.pakeToast = pakeToast; - // chatgpt supports unlimited times of GPT4-Mobile - if (window.location.hostname === 'chat.openai.com') { - const originFetch = fetch; - window.fetch = (url, options) => { - return originFetch(url, options).then(async response => { - if (url.indexOf('/backend-api/models') === -1) { - return response; - } - const responseClone = response.clone(); - let res = await responseClone.json(); - res.models = res.models.map(m => { - m.tags = m.tags.filter(t => { - return t !== 'mobile'; - }); - if (m.slug === 'gpt-4-mobile') { - res.categories.push({ - browsing_model: null, - category: 'gpt_4', - code_interpreter_model: null, - default_model: 'gpt-4-mobile', - human_category_name: 'GPT-4-Mobile', - plugins_model: null, - subscription_level: 'plus', - }); - } - return m; - }); - return new Response(JSON.stringify(res), response); - }); - }; - } }); diff --git a/src-tauri/src/inject/event.js b/src-tauri/src/inject/event.js index c327a89..962fda3 100644 --- a/src-tauri/src/inject/event.js +++ b/src-tauri/src/inject/event.js @@ -163,6 +163,12 @@ document.addEventListener('DOMContentLoaded', () => { } catch (e) { console.log(e); } + + // Fix Chinese input method "Enter" on Safari + document.addEventListener('keydown', (e) => { + if (e.keyCode === 229) e.stopPropagation(); + }, true); + }); function setDefaultZoom() {