mirror of
https://github.com/FranP-code/ChatGPT.git
synced 2025-10-13 00:13:25 +00:00
chore: tray
This commit is contained in:
20
.github/workflows/release.yml
vendored
20
.github/workflows/release.yml
vendored
@@ -90,13 +90,13 @@ jobs:
|
||||
publish_dir: ./updater
|
||||
force_orphan: true
|
||||
|
||||
# publish-winget:
|
||||
# # Action can only be run on windows
|
||||
# runs-on: windows-latest
|
||||
# needs: [create-release, build-tauri]
|
||||
# steps:
|
||||
# - uses: vedantmgoyal2009/winget-releaser@v1
|
||||
# with:
|
||||
# identifier: lencx.ChatGPT
|
||||
# token: ${{ secrets.WINGET_TOKEN }}
|
||||
# version: ${{ env.version }}
|
||||
publish-winget:
|
||||
# Action can only be run on windows
|
||||
runs-on: windows-latest
|
||||
needs: [create-release, build-tauri]
|
||||
steps:
|
||||
- uses: vedantmgoyal2009/winget-releaser@v1
|
||||
with:
|
||||
identifier: lencx.ChatGPT
|
||||
token: ${{ secrets.WINGET_TOKEN }}
|
||||
version: ${{ env.version }}
|
||||
|
||||
@@ -26,7 +26,7 @@ wry = "0.24.1"
|
||||
dark-light = "1.0.0"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
tokio = { version = "1.23.0", features = ["macros"] }
|
||||
tauri = { version = "1.2.3", features = ["api-all", "devtools", "global-shortcut", "system-tray", "updater"] }
|
||||
tauri = { version = "1.2.4", features = ["api-all", "devtools", "global-shortcut", "system-tray", "updater"] }
|
||||
tauri-plugin-positioner = { version = "1.0.4", features = ["system-tray"] }
|
||||
tauri-plugin-log = { git = "https://github.com/lencx/tauri-plugins-workspace", branch = "dev", features = ["colored"] }
|
||||
tauri-plugin-autostart = { git = "https://github.com/lencx/tauri-plugins-workspace", branch = "dev" }
|
||||
|
||||
@@ -59,7 +59,13 @@ pub fn init(app: &mut App) -> std::result::Result<(), Box<dyn std::error::Error>
|
||||
.title("ChatGPT")
|
||||
.resizable(true)
|
||||
.fullscreen(false)
|
||||
.inner_size(800.0, 600.0);
|
||||
.inner_size(800.0, 600.0)
|
||||
.theme(theme)
|
||||
.always_on_top(chat_conf.stay_on_top)
|
||||
.title_bar_style(ChatConfJson::titlebar())
|
||||
.initialization_script(&utils::user_script())
|
||||
.initialization_script(include_str!("../scripts/core.js"))
|
||||
.user_agent(&chat_conf.ua_window);
|
||||
|
||||
if cfg!(target_os = "macos") {
|
||||
main_win = main_win.hidden_title(true);
|
||||
@@ -79,15 +85,7 @@ pub fn init(app: &mut App) -> std::result::Result<(), Box<dyn std::error::Error>
|
||||
.initialization_script(include_str!("../scripts/cmd.js"))
|
||||
}
|
||||
|
||||
main_win
|
||||
.theme(theme)
|
||||
.always_on_top(chat_conf.stay_on_top)
|
||||
.title_bar_style(ChatConfJson::titlebar())
|
||||
.initialization_script(&utils::user_script())
|
||||
.initialization_script(include_str!("../scripts/core.js"))
|
||||
.user_agent(&chat_conf.ua_window)
|
||||
.build()
|
||||
.unwrap();
|
||||
main_win.build().unwrap();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -9,22 +9,24 @@ pub fn tray_window(handle: &tauri::AppHandle) {
|
||||
let app = handle.clone();
|
||||
|
||||
tauri::async_runtime::spawn(async move {
|
||||
let mut tray_win = WindowBuilder::new(
|
||||
&app,
|
||||
"tray",
|
||||
WindowUrl::App(chat_conf.tray_origin.clone().into()),
|
||||
)
|
||||
.title("ChatGPT")
|
||||
.resizable(false)
|
||||
.fullscreen(false)
|
||||
.inner_size(360.0, 540.0)
|
||||
.decorations(false)
|
||||
.always_on_top(true)
|
||||
.theme(theme)
|
||||
.initialization_script(&utils::user_script())
|
||||
.initialization_script(include_str!("../scripts/core.js"));
|
||||
let link = if chat_conf.tray_dashboard {
|
||||
"index.html"
|
||||
} else {
|
||||
&chat_conf.tray_origin
|
||||
};
|
||||
let mut tray_win = WindowBuilder::new(&app, "tray", WindowUrl::App(link.into()))
|
||||
.title("ChatGPT")
|
||||
.resizable(false)
|
||||
.fullscreen(false)
|
||||
.inner_size(360.0, 540.0)
|
||||
.decorations(false)
|
||||
.always_on_top(true)
|
||||
.theme(theme)
|
||||
.initialization_script(&utils::user_script())
|
||||
.initialization_script(include_str!("../scripts/core.js"))
|
||||
.user_agent(&chat_conf.ua_tray);
|
||||
|
||||
if chat_conf.tray_origin == "https://chat.openai.com" {
|
||||
if chat_conf.tray_origin == "https://chat.openai.com" && !chat_conf.tray_dashboard {
|
||||
tray_win = tray_win
|
||||
.initialization_script(include_str!("../vendors/floating-ui-core.js"))
|
||||
.initialization_script(include_str!("../vendors/floating-ui-dom.js"))
|
||||
@@ -32,12 +34,7 @@ pub fn tray_window(handle: &tauri::AppHandle) {
|
||||
.initialization_script(include_str!("../scripts/popup.core.js"))
|
||||
}
|
||||
|
||||
tray_win
|
||||
.user_agent(&chat_conf.ua_tray)
|
||||
.build()
|
||||
.unwrap()
|
||||
.hide()
|
||||
.unwrap();
|
||||
tray_win.build().unwrap().hide().unwrap();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
22
src/components/SwitchOrigin/index.tsx
vendored
22
src/components/SwitchOrigin/index.tsx
vendored
@@ -74,16 +74,18 @@ const SwitchOrigin: FC<SwitchOriginProps> = ({ name }) => {
|
||||
name={originName}
|
||||
>
|
||||
<Select disabled={isEnable} showSearch {...DISABLE_AUTO_COMPLETE} optionLabelProp="url">
|
||||
{[{ title: 'ChatGPT', url: 'https://chat.openai.com' }, ...list].map((i, idx) => (
|
||||
<Select.Option
|
||||
key={`${idx}_${i.url}`}
|
||||
label={i.title}
|
||||
value={i.url}
|
||||
title={`${i.title}: ${i.url}`}
|
||||
>
|
||||
<Tag color={i.title === 'ChatGPT' ? 'orange' : 'geekblue'}>{i.title}</Tag> {i.url}
|
||||
</Select.Option>
|
||||
))}
|
||||
{[{ title: 'ChatGPT', url: 'https://chat.openai.com', init: true }, ...list].map(
|
||||
(i, idx) => (
|
||||
<Select.Option
|
||||
key={`${idx}_${i.url}`}
|
||||
label={i.title}
|
||||
value={i.url}
|
||||
title={`${i.title}${i.init ? '(Built-in)' : ''}: ${i.url}`}
|
||||
>
|
||||
<Tag color={i.init ? 'orange' : 'geekblue'}>{i.title}</Tag> {i.url}
|
||||
</Select.Option>
|
||||
),
|
||||
)}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
</>
|
||||
|
||||
2
src/view/awesome/Form.tsx
vendored
2
src/view/awesome/Form.tsx
vendored
@@ -39,7 +39,7 @@ const AwesomeForm: ForwardRefRenderFunction<FormProps, AwesomeFormProps> = ({ re
|
||||
<Form.Item
|
||||
label="URL"
|
||||
name="url"
|
||||
rules={[{ required: true, message: 'Please enter the URL' }]}
|
||||
rules={[{ required: true, message: 'Please enter the URL' }, { type: 'url' }]}
|
||||
>
|
||||
<Input placeholder="Please enter the URL" {...DISABLE_AUTO_COMPLETE} />
|
||||
</Form.Item>
|
||||
|
||||
Reference in New Issue
Block a user