fix: windows can't start

This commit is contained in:
lencx
2022-12-28 03:33:40 +08:00
parent 631dee95a7
commit 478049e23e
8 changed files with 188 additions and 176 deletions

View File

@@ -1,89 +1,89 @@
# name: Release CI name: Release CI
# on: on:
# push: push:
# # Sequence of patterns matched against refs/tags # Sequence of patterns matched against refs/tags
# tags: tags:
# - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
# jobs: jobs:
# create-release: create-release:
# runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
# outputs: outputs:
# RELEASE_UPLOAD_ID: ${{ steps.create_release.outputs.id }} RELEASE_UPLOAD_ID: ${{ steps.create_release.outputs.id }}
# steps: steps:
# - uses: actions/checkout@v2 - uses: actions/checkout@v2
# - name: Query version number - name: Query version number
# id: get_version id: get_version
# shell: bash shell: bash
# run: | run: |
# echo "using version tag ${GITHUB_REF:10}" echo "using version tag ${GITHUB_REF:10}"
# echo "version=${GITHUB_REF:10}" >> $GITHUB_ENV echo "version=${GITHUB_REF:10}" >> $GITHUB_ENV
# - name: Create Release - name: Create Release
# id: create_release id: create_release
# uses: actions/create-release@v1 uses: actions/create-release@v1
# env: env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with: with:
# tag_name: '${{ env.version }}' tag_name: '${{ env.version }}'
# release_name: 'ChatGPT ${{ env.version }}' release_name: 'ChatGPT ${{ env.version }}'
# body: 'See the assets to download this version and install.' body: 'See the assets to download this version and install.'
# build-tauri: build-tauri:
# needs: create-release needs: create-release
# strategy: strategy:
# fail-fast: false fail-fast: false
# matrix: matrix:
# platform: [macos-latest, ubuntu-20.04, windows-latest] platform: [macos-latest, ubuntu-20.04, windows-latest]
# runs-on: ${{ matrix.platform }} runs-on: ${{ matrix.platform }}
# steps: steps:
# - uses: actions/checkout@v3 - uses: actions/checkout@v3
# - name: setup node - name: setup node
# uses: actions/setup-node@v3 uses: actions/setup-node@v3
# with: with:
# node-version: 16 node-version: 16
# - name: install Rust stable - name: install Rust stable
# uses: dtolnay/rust-toolchain@stable uses: dtolnay/rust-toolchain@stable
# - name: install dependencies (ubuntu only) - name: install dependencies (ubuntu only)
# if: matrix.platform == 'ubuntu-20.04' if: matrix.platform == 'ubuntu-20.04'
# run: | run: |
# sudo apt-get update sudo apt-get update
# sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev 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 - name: Install app dependencies and build it
# run: yarn && yarn build:fe run: yarn && yarn build:fe
# - name: fix tray icon - name: fix tray icon
# if: matrix.platform != 'macos-latest' if: matrix.platform != 'macos-latest'
# run: | run: |
# yarn fix:tray yarn fix:tray
# - uses: tauri-apps/tauri-action@v0.3 - uses: tauri-apps/tauri-action@v0.3
# env: env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# # 📝: https://tauri.app/v1/guides/distribution/updater#signing-updates # 📝: https://tauri.app/v1/guides/distribution/updater#signing-updates
# TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
# TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
# with: with:
# releaseId: ${{ needs.create-release.outputs.RELEASE_UPLOAD_ID }} releaseId: ${{ needs.create-release.outputs.RELEASE_UPLOAD_ID }}
# updater: updater:
# runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
# needs: [create-release, build-tauri] needs: [create-release, build-tauri]
# steps: steps:
# - uses: actions/checkout@v2 - uses: actions/checkout@v2
# - run: yarn - run: yarn
# - run: yarn updater --token=${{ secrets.GITHUB_TOKEN }} - run: yarn updater --token=${{ secrets.GITHUB_TOKEN }}
# - name: Deploy install.json - name: Deploy install.json
# uses: peaceiris/actions-gh-pages@v3 uses: peaceiris/actions-gh-pages@v3
# with: with:
# github_token: ${{ secrets.GITHUB_TOKEN }} github_token: ${{ secrets.GITHUB_TOKEN }}
# # 📝: Edit the deployment directory # 📝: Edit the deployment directory
# publish_dir: ./updater publish_dir: ./updater
# force_orphan: true force_orphan: true

View File

@@ -1,72 +1,72 @@
name: Release CI # name: Release CI
on: # on:
push: # push:
# Sequence of patterns matched against refs/tags # # Sequence of patterns matched against refs/tags
tags: # tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 # - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
jobs: # jobs:
create-release: # create-release:
runs-on: ubuntu-20.04 # runs-on: ubuntu-20.04
outputs: # outputs:
RELEASE_UPLOAD_ID: ${{ steps.create_release.outputs.id }} # RELEASE_UPLOAD_ID: ${{ steps.create_release.outputs.id }}
steps: # steps:
- uses: actions/checkout@v2 # - uses: actions/checkout@v2
- name: Query version number # - name: Query version number
id: get_version # id: get_version
shell: bash # shell: bash
run: | # run: |
echo "using version tag ${GITHUB_REF:10}" # echo "using version tag ${GITHUB_REF:10}"
echo "version=${GITHUB_REF:10}" >> $GITHUB_ENV # echo "version=${GITHUB_REF:10}" >> $GITHUB_ENV
- name: Create Release # - name: Create Release
id: create_release # id: create_release
uses: actions/create-release@v1 # uses: actions/create-release@v1
env: # env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: # with:
tag_name: '${{ env.version }}' # tag_name: '${{ env.version }}'
release_name: 'ChatGPT ${{ env.version }}' # release_name: 'ChatGPT ${{ env.version }}'
body: 'See the assets to download this version and install.' # body: 'See the assets to download this version and install.'
build-tauri: # build-tauri:
needs: create-release # needs: create-release
strategy: # strategy:
fail-fast: false # fail-fast: false
matrix: # matrix:
platform: [windows-latest] # platform: [windows-latest]
runs-on: ${{ matrix.platform }} # runs-on: ${{ matrix.platform }}
steps: # steps:
- uses: actions/checkout@v3 # - uses: actions/checkout@v3
- name: setup node # - name: setup node
uses: actions/setup-node@v3 # uses: actions/setup-node@v3
with: # with:
node-version: 16 # node-version: 16
- name: install Rust stable # - name: install Rust stable
uses: dtolnay/rust-toolchain@stable # uses: dtolnay/rust-toolchain@stable
- name: install dependencies (ubuntu only) # - name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-20.04' # if: matrix.platform == 'ubuntu-20.04'
run: | # run: |
sudo apt-get update # sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev 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 # - name: Install app dependencies and build it
run: yarn && yarn build:fe # run: yarn && yarn build:fe
- name: fix tray icon # - name: fix tray icon
if: matrix.platform != 'macos-latest' # if: matrix.platform != 'macos-latest'
run: | # run: |
yarn fix:tray # yarn fix:tray
- uses: tauri-apps/tauri-action@v0.3 # - uses: tauri-apps/tauri-action@v0.3
env: # env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# 📝: https://tauri.app/v1/guides/distribution/updater#signing-updates # # 📝: https://tauri.app/v1/guides/distribution/updater#signing-updates
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} # TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} # TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
with: # with:
releaseId: ${{ needs.create-release.outputs.RELEASE_UPLOAD_ID }} # releaseId: ${{ needs.create-release.outputs.RELEASE_UPLOAD_ID }}

View File

@@ -22,9 +22,9 @@
**最新版:** **最新版:**
- `Mac`: [ChatGPT_0.7.1_x64.dmg](https://github.com/lencx/ChatGPT/releases/download/v0.7.1/ChatGPT_0.7.1_x64.dmg) - `Mac`: [ChatGPT_0.7.2_x64.dmg](https://github.com/lencx/ChatGPT/releases/download/v0.7.2/ChatGPT_0.7.2_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) - `Linux`: [chat-gpt_0.7.2_amd64.deb](https://github.com/lencx/ChatGPT/releases/download/v0.7.2/chat-gpt_0.7.2_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) - `Windows`: [ChatGPT_0.7.2_x64_en-US.msi](https://github.com/lencx/ChatGPT/releases/download/v0.7.2/ChatGPT_0.7.2_x64_en-US.msi)
[其他版本...](https://github.com/lencx/ChatGPT/releases) [其他版本...](https://github.com/lencx/ChatGPT/releases)
@@ -74,7 +74,7 @@ cask "popcorn-time", args: { "no-quarantine": true }
- 系统托盘悬浮窗 - 系统托盘悬浮窗
- 应用菜单功能强大 - 应用菜单功能强大
- 支持斜杠命令及其配置(可手动配置或从文件同步 [#55](https://github.com/lencx/ChatGPT/issues/55) - 支持斜杠命令及其配置(可手动配置或从文件同步 [#55](https://github.com/lencx/ChatGPT/issues/55)
- 进入应用的全局快捷键 (mac: `command+shift+o`, windows: `ctrl+shift+o`) <!-- - 进入应用的全局快捷键 (mac: `command+shift+o`, windows: `ctrl+shift+o`) -->
### 菜单项 ### 菜单项

View File

@@ -24,9 +24,9 @@
**Latest:** **Latest:**
- `Mac`: [ChatGPT_0.7.1_x64.dmg](https://github.com/lencx/ChatGPT/releases/download/v0.7.1/ChatGPT_0.7.1_x64.dmg) - `Mac`: [ChatGPT_0.7.2_x64.dmg](https://github.com/lencx/ChatGPT/releases/download/v0.7.2/ChatGPT_0.7.2_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) - `Linux`: [chat-gpt_0.7.2_amd64.deb](https://github.com/lencx/ChatGPT/releases/download/v0.7.2/chat-gpt_0.7.2_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) - `Windows`: [ChatGPT_0.7.2_x64_en-US.msi](https://github.com/lencx/ChatGPT/releases/download/v0.7.2/ChatGPT_0.7.2_x64_en-US.msi)
[Other version...](https://github.com/lencx/ChatGPT/releases) [Other version...](https://github.com/lencx/ChatGPT/releases)
@@ -76,7 +76,7 @@ In the chatgpt text input area, type a character starting with `/` to bring up t
- System tray hover window - System tray hover window
- Powerful menu items - Powerful menu items
- Support for slash commands and their configuration (can be configured manually or synchronized from a file [#55](https://github.com/lencx/ChatGPT/issues/55)) - Support for slash commands and their configuration (can be configured manually or synchronized from a file [#55](https://github.com/lencx/ChatGPT/issues/55))
- Global shortcuts to the chatgpt app (mac: `command+shift+o`, windows: `ctrl+shift+o`) <!-- - Global shortcuts to the chatgpt app (mac: `command+shift+o`, windows: `ctrl+shift+o`) -->
### MenuItem ### MenuItem

View File

@@ -1,5 +1,9 @@
# UPDATE LOG # UPDATE LOG
## v0.7.2
fix: some windows systems cannot start the application
## v0.7.1 ## v0.7.1
fix: fix:
@@ -15,7 +19,7 @@ fix:
feat: feat:
- use the keyboard `⇧` (arrow up) and `⇩` (arrow down) keys to select the slash command - use the keyboard `⇧` (arrow up) and `⇩` (arrow down) keys to select the slash command
- global shortcuts to the chatgpt app (mac: command+shift+o, windows: ctrl+shift+o) <!-- - global shortcuts to the chatgpt app (mac: command+shift+o, windows: ctrl+shift+o) -->
## v0.6.10 ## v0.6.10

View File

@@ -3,11 +3,14 @@ use crate::{
utils, utils,
}; };
use tauri::{ use tauri::{
AboutMetadata, AppHandle, CustomMenuItem, Manager, Menu, MenuItem, Submenu, SystemTray, AppHandle, CustomMenuItem, Manager, Menu, MenuItem, Submenu, SystemTray, SystemTrayEvent,
SystemTrayEvent, SystemTrayMenu, SystemTrayMenuItem, WindowMenuEvent, SystemTrayMenu, SystemTrayMenuItem, WindowMenuEvent,
}; };
use tauri_plugin_positioner::{on_tray_event, Position, WindowExt}; use tauri_plugin_positioner::{on_tray_event, Position, WindowExt};
#[cfg(target_os = "macos")]
use tauri::AboutMetadata;
use super::window; use super::window;
// --- Menu // --- Menu
@@ -20,15 +23,15 @@ pub fn init() -> Menu {
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
MenuItem::About(name.into(), AboutMetadata::default()).into(), MenuItem::About(name.into(), AboutMetadata::default()).into(),
#[cfg(not(target_os = "macos"))] #[cfg(not(target_os = "macos"))]
CustomMenuItem::new("about".to_string(), "About ChatGPT") CustomMenuItem::new("about".to_string(), "About ChatGPT").into(),
.into(),
MenuItem::Services.into(), MenuItem::Services.into(),
MenuItem::Hide.into(), MenuItem::Hide.into(),
MenuItem::HideOthers.into(), MenuItem::HideOthers.into(),
MenuItem::ShowAll.into(), MenuItem::ShowAll.into(),
MenuItem::Separator.into(), MenuItem::Separator.into(),
MenuItem::Quit.into(), MenuItem::Quit.into(),
])); ]),
);
let stay_on_top = let stay_on_top =
CustomMenuItem::new("stay_on_top".to_string(), "Stay On Top").accelerator("CmdOrCtrl+T"); CustomMenuItem::new("stay_on_top".to_string(), "Stay On Top").accelerator("CmdOrCtrl+T");
@@ -183,7 +186,11 @@ pub fn menu_handler(event: WindowMenuEvent<tauri::Wry>) {
// App // App
"about" => { "about" => {
let tauri_conf = utils::get_tauri_conf().unwrap(); 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())); tauri::api::dialog::message(
app.get_window("core").as_ref(),
"ChatGPT",
format!("Version {}", tauri_conf.package.version.unwrap()),
);
} }
// Preferences // Preferences
"control_center" => window::control_window(&app), "control_center" => window::control_window(&app),

View File

@@ -1,6 +1,6 @@
use crate::{app::window, conf::ChatConfJson, utils}; use crate::{app::window, conf::ChatConfJson, utils};
use log::info; use log::info;
use tauri::{utils::config::WindowUrl, window::WindowBuilder, App, GlobalShortcutManager, Manager}; use tauri::{utils::config::WindowUrl, window::WindowBuilder, App, Manager};
pub fn init(app: &mut App) -> std::result::Result<(), Box<dyn std::error::Error>> { pub fn init(app: &mut App) -> std::result::Result<(), Box<dyn std::error::Error>> {
let chat_conf = ChatConfJson::get_chat_conf(); let chat_conf = ChatConfJson::get_chat_conf();
@@ -14,28 +14,29 @@ pub fn init(app: &mut App) -> std::result::Result<(), Box<dyn std::error::Error>
info!("stepup"); info!("stepup");
{ // fix: Global shortcuts can cause programs to exit under windows
info!("global_shortcut_start"); // {
let handle = app.app_handle(); // info!("global_shortcut_start");
let mut shortcut = app.global_shortcut_manager(); // let handle = app.app_handle();
let is_mini_key = shortcut.is_registered("CmdOrCtrl+Shift+O"); // let mut shortcut = app.global_shortcut_manager();
// let is_mini_key = shortcut.is_registered("CmdOrCtrl+Shift+O");
if is_mini_key.is_ok() { // if is_mini_key.is_ok() {
shortcut // shortcut
.register("CmdOrCtrl+Shift+O", move || { // .register("CmdOrCtrl+Shift+O", move || {
if let Some(w) = handle.get_window("core") { // if let Some(w) = handle.get_window("core") {
if w.is_visible().unwrap() { // if w.is_visible().unwrap() {
w.hide().unwrap(); // w.hide().unwrap();
} else { // } else {
w.show().unwrap(); // w.show().unwrap();
w.set_focus().unwrap(); // w.set_focus().unwrap();
} // }
} // }
}) // })
.unwrap(); // .unwrap();
}; // };
info!("global_shortcut_end"); // info!("global_shortcut_end");
} // }
if chat_conf.hide_dock_icon { if chat_conf.hide_dock_icon {
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]

View File

@@ -8,7 +8,7 @@ use std::{
path::{Path, PathBuf}, path::{Path, PathBuf},
process::Command, process::Command,
}; };
use tauri::{Manager, utils::config::Config}; use tauri::{utils::config::Config, Manager};
pub fn chat_root() -> PathBuf { pub fn chat_root() -> PathBuf {
tauri::api::path::home_dir().unwrap().join(".chatgpt") tauri::api::path::home_dir().unwrap().join(".chatgpt")