From 2b4d3ef088303248fc433bf9ec1b1a1cbe95c38e Mon Sep 17 00:00:00 2001 From: Tlntin Date: Sat, 24 Dec 2022 11:21:20 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E6=9B=B4=E6=96=B0git=20actions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/pake_build.yaml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pake_build.yaml b/.github/workflows/pake_build.yaml index 7dbd21f..aac097d 100644 --- a/.github/workflows/pake_build.yaml +++ b/.github/workflows/pake_build.yaml @@ -78,9 +78,15 @@ jobs: # files: | # output/*/*.* - - uses: ncipollo/release-action@v1 - if: startsWith(github.ref, 'refs/tags/v') - with: - allowUpdates: true - artifacts: "output/*/*.*" - token: ${{ secrets.GITHUB_TOKEN }} + # - uses: ncipollo/release-action@v1 + # if: startsWith(github.ref, 'refs/tags/v') + # with: + # allowUpdates: true + # artifacts: "output/*/*.*" + # token: ${{ secrets.GITHUB_TOKEN }} + - name: Upload files + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + curl -L https://github.com/probonopd/uploadtool/raw/master/upload.sh --output upload.sh + bash upload.sh output/*/*.* From 3da780f33a772ca988159af3f72175a5a27e7fc9 Mon Sep 17 00:00:00 2001 From: Tlntin Date: Sat, 24 Dec 2022 12:11:07 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E5=A2=9E=E5=8A=A0Linux=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E5=8C=85=E5=90=8D=E6=AD=A3=E5=88=99=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/builders/common.ts | 11 +++++++++++ dist/cli.js | 12 +++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/bin/builders/common.ts b/bin/builders/common.ts index b081e35..d2819d8 100644 --- a/bin/builders/common.ts +++ b/bin/builders/common.ts @@ -37,6 +37,17 @@ export async function mergeTauriConfig( transparent, resizable, }; + // Package name is valid ? + // for Linux, package name must be a-z, 0-9 or "-", not allow to A-Z and other + if (process.platform === "linux") { + const reg = new RegExp("/[0-9]*[a-z]+[0-9]*\-?[0-9]*[a-z]*[0-9]*\-?[0-9]*[a-z]*[0-9]*/"); + if (!reg.test(name)) { + logger.error("package name is illegal, it must be lowercase, numbers, dashes.") + logger.error("E.g com-123-xxx, 123pan, pan123,weread, we-read"); + process.exit(); + } + } + Object.assign(tauriConf.tauri.windows[0], { url, ...tauriConfWindowOptions }); tauriConf.package.productName = name; diff --git a/dist/cli.js b/dist/cli.js index 0415c56..09f4e5b 100644 --- a/dist/cli.js +++ b/dist/cli.js @@ -1632,6 +1632,16 @@ function mergeTauriConfig(url, options, tauriConf) { transparent, resizable, }; + // Package name is valid ? + // for Linux, package name must be a-z, 0-9 or "-", not allow to A-Z and other + if (process.platform === "linux") { + const reg = new RegExp("/[0-9]*[a-z]+[0-9]*\-?[0-9]*[a-z]*[0-9]*\-?[0-9]*[a-z]*[0-9]*/"); + if (!reg.test(name)) { + logger.error("package name is illegal, it must be lowercase, numbers, dashes."); + logger.error("E.g com-123-xxx, 123pan, pan123,weread, we-read"); + process.exit(); + } + } Object.assign(tauriConf.tauri.windows[0], Object.assign({ url }, tauriConfWindowOptions)); tauriConf.package.productName = name; tauriConf.tauri.bundle.identifier = identifier; @@ -2209,7 +2219,7 @@ var scripts = { tauri: "tauri", cli: "rollup -c rollup.config.js --watch", "cli:build": "cross-env NODE_ENV=production rollup -c rollup.config.js", - "cli:publish": "npm run cli:build && npm publish" + prepublishOnly: "npm run cli:build" }; var type = "module"; var exports = "./dist/pake.js"; From fbe9d7b01f07b9cf1be693fbad30694115f8e417 Mon Sep 17 00:00:00 2001 From: Tlntin Date: Sat, 24 Dec 2022 12:14:45 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E5=A2=9E=E5=8A=A0Linux=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E5=8C=85=E5=90=8D=E6=AD=A3=E5=88=99=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/builders/common.ts | 2 +- dist/cli.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/builders/common.ts b/bin/builders/common.ts index d2819d8..47e060e 100644 --- a/bin/builders/common.ts +++ b/bin/builders/common.ts @@ -40,7 +40,7 @@ export async function mergeTauriConfig( // Package name is valid ? // for Linux, package name must be a-z, 0-9 or "-", not allow to A-Z and other if (process.platform === "linux") { - const reg = new RegExp("/[0-9]*[a-z]+[0-9]*\-?[0-9]*[a-z]*[0-9]*\-?[0-9]*[a-z]*[0-9]*/"); + const reg = new RegExp(/[0-9]*[a-z]+[0-9]*\-?[0-9]*[a-z]*[0-9]*\-?[0-9]*[a-z]*[0-9]*/); if (!reg.test(name)) { logger.error("package name is illegal, it must be lowercase, numbers, dashes.") logger.error("E.g com-123-xxx, 123pan, pan123,weread, we-read"); diff --git a/dist/cli.js b/dist/cli.js index 09f4e5b..3b4b3ce 100644 --- a/dist/cli.js +++ b/dist/cli.js @@ -1635,7 +1635,7 @@ function mergeTauriConfig(url, options, tauriConf) { // Package name is valid ? // for Linux, package name must be a-z, 0-9 or "-", not allow to A-Z and other if (process.platform === "linux") { - const reg = new RegExp("/[0-9]*[a-z]+[0-9]*\-?[0-9]*[a-z]*[0-9]*\-?[0-9]*[a-z]*[0-9]*/"); + const reg = new RegExp(/[0-9]*[a-z]+[0-9]*\-?[0-9]*[a-z]*[0-9]*\-?[0-9]*[a-z]*[0-9]*/); if (!reg.test(name)) { logger.error("package name is illegal, it must be lowercase, numbers, dashes."); logger.error("E.g com-123-xxx, 123pan, pan123,weread, we-read"); From 59a605b087163db2b54880dcd5d999423b2e1183 Mon Sep 17 00:00:00 2001 From: Tlntin Date: Sat, 24 Dec 2022 12:30:18 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E5=A2=9E=E5=8A=A0Linux=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E5=8C=85=E5=90=8D=E6=AD=A3=E5=88=99=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/builders/common.ts | 2 +- dist/cli.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/builders/common.ts b/bin/builders/common.ts index 47e060e..1ce9cfc 100644 --- a/bin/builders/common.ts +++ b/bin/builders/common.ts @@ -41,7 +41,7 @@ export async function mergeTauriConfig( // for Linux, package name must be a-z, 0-9 or "-", not allow to A-Z and other if (process.platform === "linux") { const reg = new RegExp(/[0-9]*[a-z]+[0-9]*\-?[0-9]*[a-z]*[0-9]*\-?[0-9]*[a-z]*[0-9]*/); - if (!reg.test(name)) { + if (!reg.test(name) || reg.exec(name)[0].length != name.length) { logger.error("package name is illegal, it must be lowercase, numbers, dashes.") logger.error("E.g com-123-xxx, 123pan, pan123,weread, we-read"); process.exit(); diff --git a/dist/cli.js b/dist/cli.js index 3b4b3ce..a0676a6 100644 --- a/dist/cli.js +++ b/dist/cli.js @@ -1636,7 +1636,7 @@ function mergeTauriConfig(url, options, tauriConf) { // for Linux, package name must be a-z, 0-9 or "-", not allow to A-Z and other if (process.platform === "linux") { const reg = new RegExp(/[0-9]*[a-z]+[0-9]*\-?[0-9]*[a-z]*[0-9]*\-?[0-9]*[a-z]*[0-9]*/); - if (!reg.test(name)) { + if (!reg.test(name) || reg.exec(name)[0].length != name.length) { logger.error("package name is illegal, it must be lowercase, numbers, dashes."); logger.error("E.g com-123-xxx, 123pan, pan123,weread, we-read"); process.exit(); From 32f968b992867824e916a3428daa5d782ba1676e Mon Sep 17 00:00:00 2001 From: Tlntin Date: Sat, 24 Dec 2022 12:49:20 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E5=A2=9E=E5=8A=A0Windows,Mac=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0=E5=8C=85=E5=90=8D=E6=AD=A3=E5=88=99=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/builders/common.ts | 10 +++++++++- dist/cli.js | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/bin/builders/common.ts b/bin/builders/common.ts index 1ce9cfc..06b2d19 100644 --- a/bin/builders/common.ts +++ b/bin/builders/common.ts @@ -42,11 +42,19 @@ export async function mergeTauriConfig( if (process.platform === "linux") { const reg = new RegExp(/[0-9]*[a-z]+[0-9]*\-?[0-9]*[a-z]*[0-9]*\-?[0-9]*[a-z]*[0-9]*/); if (!reg.test(name) || reg.exec(name)[0].length != name.length) { - logger.error("package name is illegal, it must be lowercase, numbers, dashes.") + logger.error("package name is illegal, it must be lowercase letters, numbers, dashes, and it must contain the lowercase letters.") logger.error("E.g com-123-xxx, 123pan, pan123,weread, we-read"); process.exit(); } } + if (process.platform === "win32" || process.platform === "darwin" ) { + const reg = new RegExp(/([0-9]*[a-zA-Z]+[0-9]*)+/); + if (!reg.test(name) || reg.exec(name)[0].length != name.length) { + logger.error("package name is illegal, it must be letters, numbers, and it must contain the letters") + logger.error("E.g 123pan,123Pan Pan123,weread, WeRead, WERead"); + process.exit(); + } + } Object.assign(tauriConf.tauri.windows[0], { url, ...tauriConfWindowOptions }); diff --git a/dist/cli.js b/dist/cli.js index a0676a6..468a13b 100644 --- a/dist/cli.js +++ b/dist/cli.js @@ -1637,11 +1637,19 @@ function mergeTauriConfig(url, options, tauriConf) { if (process.platform === "linux") { const reg = new RegExp(/[0-9]*[a-z]+[0-9]*\-?[0-9]*[a-z]*[0-9]*\-?[0-9]*[a-z]*[0-9]*/); if (!reg.test(name) || reg.exec(name)[0].length != name.length) { - logger.error("package name is illegal, it must be lowercase, numbers, dashes."); + logger.error("package name is illegal, it must be lowercase letters, numbers, dashes, and it must contain the lowercase letters."); logger.error("E.g com-123-xxx, 123pan, pan123,weread, we-read"); process.exit(); } } + if (process.platform === "win32" || process.platform === "darwin") { + const reg = new RegExp(/([0-9]*[a-zA-Z]+[0-9]*)+/); + if (!reg.test(name) || reg.exec(name)[0].length != name.length) { + logger.error("package name is illegal, it must be letters, numbers, and it must contain the letters"); + logger.error("E.g 123pan,123Pan Pan123,weread, WeRead, WERead"); + process.exit(); + } + } Object.assign(tauriConf.tauri.windows[0], Object.assign({ url }, tauriConfWindowOptions)); tauriConf.package.productName = name; tauriConf.tauri.bundle.identifier = identifier; From 0652753a0555684c1b3049594c872d641ab7d420 Mon Sep 17 00:00:00 2001 From: Tlntin Date: Tue, 27 Dec 2022 23:52:41 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E6=9B=B4=E6=96=B0Windows=E4=B8=8B=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=EF=BC=8C=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src-tauri/Cargo.toml | 2 ++ src-tauri/src/main.rs | 59 +++++++++++++++---------------------------- 2 files changed, 23 insertions(+), 38 deletions(-) diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index d829449..0489c7d 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -22,6 +22,8 @@ image = "0.24.5" home = "0.5" tauri-utils = "1.2.1" tauri-plugin-window-state = { git = "https://github.com/tauri-apps/tauri-plugin-window-state", branch = "dev"} + +[target.'cfg(target_os = "linux")'.dependencies] webkit2gtk = "0.18.0" # webbrowser = "0.8.2" # wry = "0.23.4" diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 0ac2093..171f041 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -9,51 +9,34 @@ use app::{get_menu, menu_event_handle}; pub fn run_app() { let system_tray = get_system_tray(); + let (pake_config, tauri_config) = get_pake_config(); + let data_dir = get_data_dir(tauri_config); #[cfg(target_os = "macos")] - { - let (pake_config, _) = get_pake_config(); + let tauri_app = { let menu = get_menu(); tauri::Builder::default() .menu(menu) .on_menu_event(menu_event_handle) - .system_tray(system_tray) - .on_system_tray_event(system_tray_handle) - .plugin(tauri_plugin_window_state::Builder::default().build()) - .invoke_handler(tauri::generate_handler![]) - .setup(|app| { - let _window = get_window(app, pake_config, std::path::PathBuf::new()); - #[cfg(feature = "devtools")] - { - app.get_window("pake").unwrap().open_devtools(); - } - Ok(()) - }) - .run(tauri::generate_context!()) - .expect("error while running tauri application"); - } + }; #[cfg(any(target_os = "linux", target_os = "windows"))] - { - let (pake_config, tauri_config) = get_pake_config(); - let data_dir = get_data_dir(tauri_config); - // let menu = get_menu(); + let tauri_app = { tauri::Builder::default() - // .menu(menu) - // .on_menu_event(menu_event_handle) - .system_tray(system_tray) - .on_system_tray_event(system_tray_handle) - .plugin(tauri_plugin_window_state::Builder::default().build()) - .invoke_handler(tauri::generate_handler![]) - .setup(|app| { - let _window = get_window(app, pake_config, data_dir); - #[cfg(feature = "devtools")] - { - app.get_window("pake").unwrap().open_devtools(); - } - Ok(()) - }) - .run(tauri::generate_context!()) - .expect("error while running tauri application"); - } + }; + tauri_app + .system_tray(system_tray) + .on_system_tray_event(system_tray_handle) + .plugin(tauri_plugin_window_state::Builder::default().build()) + .invoke_handler(tauri::generate_handler![]) + .setup(|app| { + let _window = get_window(app, pake_config, data_dir); + #[cfg(feature = "devtools")] + { + _window.open_devtools(); + } + Ok(()) + }) + .run(tauri::generate_context!()) + .expect("error while running tauri application"); } fn main() { From f05cf423aff9c5c97a2c8eae56f2548ed8d21d9c Mon Sep 17 00:00:00 2001 From: Tlntin Date: Tue, 27 Dec 2022 23:55:51 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E9=A3=8E=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src-tauri/src/main.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 171f041..2fce32d 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -19,9 +19,7 @@ pub fn run_app() { .on_menu_event(menu_event_handle) }; #[cfg(any(target_os = "linux", target_os = "windows"))] - let tauri_app = { - tauri::Builder::default() - }; + let tauri_app = tauri::Builder::default(); tauri_app .system_tray(system_tray) .on_system_tray_event(system_tray_handle)