diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index de6aa5d..a013190 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,7 +8,7 @@ on: jobs: create-release: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 outputs: RELEASE_UPLOAD_ID: ${{ steps.create_release.outputs.id }} @@ -36,34 +36,32 @@ jobs: strategy: fail-fast: false matrix: - platform: [macos-latest, ubuntu-latest, windows-latest] + platform: [macos-latest, ubuntu-20.04, windows-latest] runs-on: ${{ matrix.platform }} steps: - - uses: actions/checkout@v2 - - - name: Setup node - uses: actions/setup-node@v1 + - uses: actions/checkout@v3 + - name: setup node + uses: actions/setup-node@v3 with: - node-version: 18 - - - name: Install Rust stable - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - - # Rust cache - - uses: Swatinem/rust-cache@v1 + node-version: 16 + - name: install Rust stable + uses: dtolnay/rust-toolchain@stable - name: install dependencies (ubuntu only) - if: matrix.platform == 'ubuntu-latest' + if: matrix.platform == 'ubuntu-20.04' run: | sudo apt-get update - sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf + sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf - name: Install app dependencies and build it run: yarn && yarn build:fe + - name: fix tray icon + if: matrix.platform != 'macos-latest' + run: | + yarn fix:tray + - uses: tauri-apps/tauri-action@v0.3 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -74,7 +72,7 @@ jobs: releaseId: ${{ needs.create-release.outputs.RELEASE_UPLOAD_ID }} updater: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 needs: [create-release, build-tauri] steps: diff --git a/README-ZH_CN.md b/README-ZH_CN.md index 34c652b..042cb46 100644 --- a/README-ZH_CN.md +++ b/README-ZH_CN.md @@ -22,9 +22,9 @@ **最新版:** -- `Mac`: [ChatGPT_0.7.0_x64.dmg](https://github.com/lencx/ChatGPT/releases/download/v0.7.0/ChatGPT_0.7.0_x64.dmg) -- `Linux`: [chat-gpt_0.7.0_amd64.deb](https://github.com/lencx/ChatGPT/releases/download/v0.7.0/chat-gpt_0.7.0_amd64.deb) -- `Windows`: [ChatGPT_0.7.0_x64_en-US.msi](https://github.com/lencx/ChatGPT/releases/download/v0.7.0/ChatGPT_0.7.0_x64_en-US.msi) +- `Mac`: [ChatGPT_0.7.1_x64.dmg](https://github.com/lencx/ChatGPT/releases/download/v0.7.1/ChatGPT_0.7.1_x64.dmg) +- `Linux`: [chat-gpt_0.7.1_amd64.deb](https://github.com/lencx/ChatGPT/releases/download/v0.7.1/chat-gpt_0.7.1_amd64.deb) +- `Windows`: [ChatGPT_0.7.1_x64_en-US.msi](https://github.com/lencx/ChatGPT/releases/download/v0.7.1/ChatGPT_0.7.1_x64_en-US.msi) [其他版本...](https://github.com/lencx/ChatGPT/releases) diff --git a/README.md b/README.md index 640f43e..209027b 100644 --- a/README.md +++ b/README.md @@ -24,9 +24,9 @@ **Latest:** -- `Mac`: [ChatGPT_0.7.0_x64.dmg](https://github.com/lencx/ChatGPT/releases/download/v0.7.0/ChatGPT_0.7.0_x64.dmg) -- `Linux`: [chat-gpt_0.7.0_amd64.deb](https://github.com/lencx/ChatGPT/releases/download/v0.7.0/chat-gpt_0.7.0_amd64.deb) -- `Windows`: [ChatGPT_0.7.0_x64_en-US.msi](https://github.com/lencx/ChatGPT/releases/download/v0.7.0/ChatGPT_0.7.0_x64_en-US.msi) +- `Mac`: [ChatGPT_0.7.1_x64.dmg](https://github.com/lencx/ChatGPT/releases/download/v0.7.1/ChatGPT_0.7.1_x64.dmg) +- `Linux`: [chat-gpt_0.7.1_amd64.deb](https://github.com/lencx/ChatGPT/releases/download/v0.7.1/chat-gpt_0.7.1_amd64.deb) +- `Windows`: [ChatGPT_0.7.1_x64_en-US.msi](https://github.com/lencx/ChatGPT/releases/download/v0.7.1/ChatGPT_0.7.1_x64_en-US.msi) [Other version...](https://github.com/lencx/ChatGPT/releases) diff --git a/UPDATE_LOG.md b/UPDATE_LOG.md index 1391bd3..50498fa 100644 --- a/UPDATE_LOG.md +++ b/UPDATE_LOG.md @@ -1,5 +1,12 @@ # UPDATE LOG +## v0.7.1 + +fix: +- some windows systems cannot start the application +- windows and linux add about menu (show version information) +- the tray icon is indistinguishable from the background in dark mode on window and linux + ## v0.7.0 fix: diff --git a/package.json b/package.json index dac59e6..fa52f1b 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,8 @@ "build": "yarn tauri build", "updater": "tr updater", "release": "tr release --git", + "fix:tray": "tr override --json.tauri_systemTray_iconPath=\"icons/tray-icon-light.png\" --json.tauri_systemTray_iconAsTemplate=false", + "fix:tray:mac": "tr override --json.tauri_systemTray_iconPath=\"icons/tray-icon.png\" --json.tauri_systemTray_iconAsTemplate=true", "download": "node ./scripts/download.js", "tr": "tr", "tauri": "tauri" diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 1ecccad..72044f4 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -17,7 +17,7 @@ tauri-build = {version = "1.2.1", features = [] } anyhow = "1.0.66" serde_json = "1.0" serde = { version = "1.0", features = ["derive"] } -tauri = { version = "1.2.2", features = ["api-all", "devtools", "system-tray", "updater"] } +tauri = { version = "1.2.3", features = ["api-all", "devtools", "system-tray", "updater"] } tauri-plugin-positioner = { version = "1.0.4", features = ["system-tray"] } log = "0.4.17" csv = "1.1.6" diff --git a/src-tauri/icons/tray-icon-light.png b/src-tauri/icons/tray-icon-light.png new file mode 100644 index 0000000..bbeffbb Binary files /dev/null and b/src-tauri/icons/tray-icon-light.png differ diff --git a/src-tauri/src/app/menu.rs b/src-tauri/src/app/menu.rs index 7b3454a..92d28e1 100644 --- a/src-tauri/src/app/menu.rs +++ b/src-tauri/src/app/menu.rs @@ -16,16 +16,19 @@ pub fn init() -> Menu { let name = "ChatGPT"; let app_menu = Submenu::new( name, - Menu::new() - .add_native_item(MenuItem::About(name.into(), AboutMetadata::default())) - .add_native_item(MenuItem::Services) - .add_native_item(MenuItem::Separator) - .add_native_item(MenuItem::Hide) - .add_native_item(MenuItem::HideOthers) - .add_native_item(MenuItem::ShowAll) - .add_native_item(MenuItem::Separator) - .add_native_item(MenuItem::Quit), - ); + Menu::with_items([ + #[cfg(target_os = "macos")] + MenuItem::About(name.into(), AboutMetadata::default()).into(), + #[cfg(not(target_os = "macos"))] + CustomMenuItem::new("about".to_string(), "About ChatGPT") + .into(), + MenuItem::Services.into(), + MenuItem::Hide.into(), + MenuItem::HideOthers.into(), + MenuItem::ShowAll.into(), + MenuItem::Separator.into(), + MenuItem::Quit.into(), + ])); let stay_on_top = CustomMenuItem::new("stay_on_top".to_string(), "Stay On Top").accelerator("CmdOrCtrl+T"); @@ -177,6 +180,11 @@ pub fn menu_handler(event: WindowMenuEvent) { let menu_handle = core_window.menu_handle(); match menu_id { + // App + "about" => { + let tauri_conf = utils::get_tauri_conf().unwrap(); + tauri::api::dialog::message(app.get_window("core").as_ref(), "ChatGPT", format!("Version {}", tauri_conf.package.version.unwrap())); + } // Preferences "control_center" => window::control_window(&app), "restart" => tauri::api::process::restart(&app.env()), diff --git a/src-tauri/src/utils.rs b/src-tauri/src/utils.rs index 502e3f5..4b612c0 100644 --- a/src-tauri/src/utils.rs +++ b/src-tauri/src/utils.rs @@ -8,19 +8,18 @@ use std::{ path::{Path, PathBuf}, process::Command, }; -use tauri::Manager; -// use tauri::utils::config::Config; +use tauri::{Manager, utils::config::Config}; pub fn chat_root() -> PathBuf { tauri::api::path::home_dir().unwrap().join(".chatgpt") } -// pub fn get_tauri_conf() -> Option { -// let config_file = include_str!("../tauri.conf.json"); -// let config: Config = -// serde_json::from_str(config_file).expect("failed to parse tauri.conf.json"); -// Some(config) -// } +pub fn get_tauri_conf() -> Option { + let config_file = include_str!("../tauri.conf.json"); + let config: Config = + serde_json::from_str(config_file).expect("failed to parse tauri.conf.json"); + Some(config) +} pub fn exists(path: &Path) -> bool { Path::new(path).exists() diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index d2347f7..b7ded6e 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -7,11 +7,14 @@ }, "package": { "productName": "ChatGPT", - "version": "0.7.0" + "version": "0.7.1" }, "tauri": { "allowlist": { "all": true, + "globalShortcut": { + "all": true + }, "http": { "all": true, "scope": [