Skip to content

Commit cc77765

Browse files
committed
3.0.3
1 parent ff9629c commit cc77765

File tree

11 files changed

+96
-19
lines changed

11 files changed

+96
-19
lines changed

CHANGELOG

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## 3.0.2 (2024-06-24)
1+
## 3.0.3 (2024-06-26)
22

33
### Break Change:
44

@@ -9,6 +9,7 @@
99

1010
- support multiple instance service
1111
- use javascript plugin system
12+
- enable dev tools
1213

1314
### Bugs fixed:
1415

com.pot_app.pot.metainfo.xml

+23-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,29 @@
5353
</screenshot>
5454
</screenshots>
5555
<releases>
56-
<release version="3.0.2" date="2024-06-24">
56+
<release version="3.0.3" date="2024-06-26">
57+
<url type="details">https://github.com/pot-app/pot-desktop/releases/tag/3.0.3</url>
58+
<description>
59+
<p>Break Change:</p>
60+
<ul>
61+
<li>After version 3.x, old plugins will no longer be available. They will be automatically deleted upon upgrade. Please visit the plugin repository to download and install the new versions. If the plugin developers have not yet updated their plugins, please contact them to request an upgrade.</li>
62+
<li xml:lang="zh-Hans">3.x版本之后旧版插件不再可用,升级后会自动删除旧版插件,请前往插件仓库下载安装新版插件使用,若插件开发者还没适配新版插件,请联系插件开发者升级插件。</li>
63+
</ul>
64+
<p>New feature:</p>
65+
<ul>
66+
<li>Support multiple instance services</li>
67+
<li>Use Javascript plugin system</li>
68+
<li>Enable dev tools</li>
69+
</ul>
70+
<p>Bugs fixed:</p>
71+
<ul>
72+
<li>Recognize failed</li>
73+
<li>TTS failed</li>
74+
<li>Collection failed</li>
75+
</ul>
76+
</description>
77+
</release>
78+
<release version="3.0.2" date="2024-06-24">
5779
<url type="details">https://github.com/pot-app/pot-desktop/releases/tag/3.0.2</url>
5880
<description>
5981
<p>Break Change:</p>

src-tauri/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ tauri-build = { version = "1.5", features = [] }
1414

1515
[dependencies]
1616

17-
tauri = { version = "1.6", features = [ "dialog-save", "dialog-open", "fs-all", "protocol-asset", "shell-all", "clipboard-all", "os-all", "http-all", "http-multipart", "updater", "notification-all", "global-shortcut-all", "window-all", "path-all", "system-tray"] }
17+
tauri = { version = "1.6", features = [ "dialog-save", "dialog-open", "fs-all", "protocol-asset", "shell-all", "clipboard-all", "os-all", "http-all", "http-multipart", "updater", "notification-all", "global-shortcut-all", "window-all", "path-all", "system-tray", "devtools"] }
1818
tauri-plugin-single-instance = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v1" }
1919
tauri-plugin-autostart = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v1" }
2020
tauri-plugin-fs-watch = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v1" }

src-tauri/src/cmd.rs

+9
Original file line numberDiff line numberDiff line change
@@ -216,3 +216,12 @@ pub fn font_list() -> Result<Vec<String>, Error> {
216216

217217
Ok(source.all_families()?)
218218
}
219+
220+
#[tauri::command]
221+
pub fn open_devtools(window: tauri::Window) {
222+
if !window.is_devtools_open() {
223+
window.open_devtools();
224+
} else {
225+
window.close_devtools();
226+
}
227+
}

src-tauri/src/main.rs

+1
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ fn main() {
137137
set_proxy,
138138
unset_proxy,
139139
run_binary,
140+
open_devtools,
140141
register_shortcut_by_frontend,
141142
update_tray,
142143
updater_window,

src-tauri/tauri.conf.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"package": {
1010
"productName": "pot",
11-
"version": "3.0.2"
11+
"version": "3.0.3"
1212
},
1313
"tauri": {
1414
"allowlist": {

src/App.jsx

+45-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { warn } from 'tauri-plugin-log-api';
55
import React, { useEffect } from 'react';
66
import { useTheme } from 'next-themes';
77

8+
import { invoke } from '@tauri-apps/api/tauri';
89
import Screenshot from './window/Screenshot';
910
import Translate from './window/Translate';
1011
import Recognize from './window/Recognize';
@@ -24,6 +25,7 @@ const windowMap = {
2425
};
2526

2627
export default function App() {
28+
const [devMode] = useConfig('dev_mode', false);
2729
const [appTheme] = useConfig('app_theme', 'system');
2830
const [appLanguage] = useConfig('app_language', 'en');
2931
const [appFont] = useConfig('app_font', 'default');
@@ -34,6 +36,42 @@ export default function App() {
3436

3537
useEffect(() => {
3638
store.load();
39+
}, []);
40+
41+
useEffect(() => {
42+
if (devMode !== null && devMode) {
43+
document.addEventListener('keydown', async (e) => {
44+
let allowKeys = ['c', 'v', 'x', 'a', 'z', 'y'];
45+
if (e.ctrlKey && !allowKeys.includes(e.key.toLowerCase())) {
46+
e.preventDefault();
47+
}
48+
if (e.key === 'F12') {
49+
await invoke('open_devtools');
50+
}
51+
if (e.key.startsWith('F') && e.key.length > 1) {
52+
e.preventDefault();
53+
}
54+
if (e.key === 'Escape') {
55+
await appWindow.close();
56+
}
57+
});
58+
} else {
59+
document.addEventListener('keydown', async (e) => {
60+
let allowKeys = ['c', 'v', 'x', 'a', 'z', 'y'];
61+
if (e.ctrlKey && !allowKeys.includes(e.key.toLowerCase())) {
62+
e.preventDefault();
63+
}
64+
if (e.key.startsWith('F') && e.key.length > 1) {
65+
e.preventDefault();
66+
}
67+
if (e.key === 'Escape') {
68+
await appWindow.close();
69+
}
70+
});
71+
}
72+
}, [devMode]);
73+
74+
useEffect(() => {
3775
if (appTheme !== null) {
3876
if (appTheme !== 'system') {
3977
setTheme(appTheme);
@@ -56,9 +94,15 @@ export default function App() {
5694
}
5795
}
5896
}
97+
}, [appTheme]);
98+
99+
useEffect(() => {
59100
if (appLanguage !== null) {
60101
i18n.changeLanguage(appLanguage);
61102
}
103+
}, [appLanguage]);
104+
105+
useEffect(() => {
62106
if (appFont !== null && appFallbackFont !== null) {
63107
document.documentElement.style.fontFamily = `"${appFont === 'default' ? 'sans-serif' : appFont}","${
64108
appFallbackFont === 'default' ? 'sans-serif' : appFallbackFont
@@ -67,7 +111,7 @@ export default function App() {
67111
if (appFontSize !== null) {
68112
document.documentElement.style.fontSize = `${appFontSize}px`;
69113
}
70-
}, [appTheme, appLanguage, appFont, appFallbackFont, appFontSize]);
114+
}, [appFont, appFallbackFont, appFontSize]);
71115

72116
return <BrowserRouter>{windowMap[appWindow.label]}</BrowserRouter>;
73117
}

src/i18n/locales/en_US.json

+1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
"system": "System"
7171
},
7272
"transparent": "Transparent Effect",
73+
"dev_mode": "Developer Mode",
7374
"proxy": {
7475
"title": "Proxy",
7576
"host": "Host",

src/i18n/locales/zh_CN.json

+1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
"system": "跟随系统"
7171
},
7272
"transparent": "透明效果",
73+
"dev_mode": "开发模式",
7374
"proxy": {
7475
"title": "网络代理",
7576
"host": "代理地址",

src/main.jsx

-13
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,6 @@ if (import.meta.env.PROD) {
1414
});
1515
}
1616

17-
document.addEventListener('keydown', async (e) => {
18-
let allowKeys = ['c', 'v', 'x', 'a', 'z', 'y'];
19-
if (e.ctrlKey && !allowKeys.includes(e.key.toLowerCase())) {
20-
e.preventDefault();
21-
}
22-
if (e.key.startsWith('F') && e.key.length > 1) {
23-
e.preventDefault();
24-
}
25-
if (e.key === 'Escape') {
26-
await appWindow.close();
27-
}
28-
});
29-
3017
initStore().then(async () => {
3118
await initEnv();
3219
const rootElement = document.getElementById('root');

src/window/Config/pages/General/index.jsx

+12-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export default function General() {
3434
const [appFallbackFont, setAppFallbackFont] = useConfig('app_fallback_font', 'default');
3535
const [appFontSize, setAppFontSize] = useConfig('app_font_size', 16);
3636
const [transparent, setTransparent] = useConfig('transparent', true);
37+
const [devMode, setDevMode] = useConfig('dev_mode', false);
3738
const [trayClickEvent, setTrayClickEvent] = useConfig('tray_click_event', 'config');
3839
const [proxyEnable, setProxyEnable] = useConfig('proxy_enable', false);
3940
const [proxyHost, setProxyHost] = useConfig('proxy_host', '');
@@ -128,7 +129,6 @@ export default function General() {
128129
});
129130
}, 1000);
130131
}
131-
console.log(v);
132132
if (v === '') {
133133
setServerPort(0);
134134
} else if (parseInt(v) > 65535) {
@@ -465,6 +465,17 @@ export default function General() {
465465
/>
466466
)}
467467
</div>
468+
<div className='config-item'>
469+
<h3>{t('config.general.dev_mode')}</h3>
470+
{devMode !== null && (
471+
<Switch
472+
isSelected={devMode}
473+
onValueChange={(v) => {
474+
setDevMode(v);
475+
}}
476+
/>
477+
)}
478+
</div>
468479
</CardBody>
469480
</Card>
470481
<Card>

0 commit comments

Comments
 (0)