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
|
publish_dir: ./updater
|
||||||
force_orphan: true
|
force_orphan: true
|
||||||
|
|
||||||
# publish-winget:
|
publish-winget:
|
||||||
# # Action can only be run on windows
|
# Action can only be run on windows
|
||||||
# runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
# needs: [create-release, build-tauri]
|
needs: [create-release, build-tauri]
|
||||||
# steps:
|
steps:
|
||||||
# - uses: vedantmgoyal2009/winget-releaser@v1
|
- uses: vedantmgoyal2009/winget-releaser@v1
|
||||||
# with:
|
with:
|
||||||
# identifier: lencx.ChatGPT
|
identifier: lencx.ChatGPT
|
||||||
# token: ${{ secrets.WINGET_TOKEN }}
|
token: ${{ secrets.WINGET_TOKEN }}
|
||||||
# version: ${{ env.version }}
|
version: ${{ env.version }}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ wry = "0.24.1"
|
|||||||
dark-light = "1.0.0"
|
dark-light = "1.0.0"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
tokio = { version = "1.23.0", features = ["macros"] }
|
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-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-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" }
|
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")
|
.title("ChatGPT")
|
||||||
.resizable(true)
|
.resizable(true)
|
||||||
.fullscreen(false)
|
.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") {
|
if cfg!(target_os = "macos") {
|
||||||
main_win = main_win.hidden_title(true);
|
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"))
|
.initialization_script(include_str!("../scripts/cmd.js"))
|
||||||
}
|
}
|
||||||
|
|
||||||
main_win
|
main_win.build().unwrap();
|
||||||
.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();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,22 +9,24 @@ pub fn tray_window(handle: &tauri::AppHandle) {
|
|||||||
let app = handle.clone();
|
let app = handle.clone();
|
||||||
|
|
||||||
tauri::async_runtime::spawn(async move {
|
tauri::async_runtime::spawn(async move {
|
||||||
let mut tray_win = WindowBuilder::new(
|
let link = if chat_conf.tray_dashboard {
|
||||||
&app,
|
"index.html"
|
||||||
"tray",
|
} else {
|
||||||
WindowUrl::App(chat_conf.tray_origin.clone().into()),
|
&chat_conf.tray_origin
|
||||||
)
|
};
|
||||||
.title("ChatGPT")
|
let mut tray_win = WindowBuilder::new(&app, "tray", WindowUrl::App(link.into()))
|
||||||
.resizable(false)
|
.title("ChatGPT")
|
||||||
.fullscreen(false)
|
.resizable(false)
|
||||||
.inner_size(360.0, 540.0)
|
.fullscreen(false)
|
||||||
.decorations(false)
|
.inner_size(360.0, 540.0)
|
||||||
.always_on_top(true)
|
.decorations(false)
|
||||||
.theme(theme)
|
.always_on_top(true)
|
||||||
.initialization_script(&utils::user_script())
|
.theme(theme)
|
||||||
.initialization_script(include_str!("../scripts/core.js"));
|
.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
|
tray_win = tray_win
|
||||||
.initialization_script(include_str!("../vendors/floating-ui-core.js"))
|
.initialization_script(include_str!("../vendors/floating-ui-core.js"))
|
||||||
.initialization_script(include_str!("../vendors/floating-ui-dom.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"))
|
.initialization_script(include_str!("../scripts/popup.core.js"))
|
||||||
}
|
}
|
||||||
|
|
||||||
tray_win
|
tray_win.build().unwrap().hide().unwrap();
|
||||||
.user_agent(&chat_conf.ua_tray)
|
|
||||||
.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}
|
name={originName}
|
||||||
>
|
>
|
||||||
<Select disabled={isEnable} showSearch {...DISABLE_AUTO_COMPLETE} optionLabelProp="url">
|
<Select disabled={isEnable} showSearch {...DISABLE_AUTO_COMPLETE} optionLabelProp="url">
|
||||||
{[{ title: 'ChatGPT', url: 'https://chat.openai.com' }, ...list].map((i, idx) => (
|
{[{ title: 'ChatGPT', url: 'https://chat.openai.com', init: true }, ...list].map(
|
||||||
<Select.Option
|
(i, idx) => (
|
||||||
key={`${idx}_${i.url}`}
|
<Select.Option
|
||||||
label={i.title}
|
key={`${idx}_${i.url}`}
|
||||||
value={i.url}
|
label={i.title}
|
||||||
title={`${i.title}: ${i.url}`}
|
value={i.url}
|
||||||
>
|
title={`${i.title}${i.init ? '(Built-in)' : ''}: ${i.url}`}
|
||||||
<Tag color={i.title === 'ChatGPT' ? 'orange' : 'geekblue'}>{i.title}</Tag> {i.url}
|
>
|
||||||
</Select.Option>
|
<Tag color={i.init ? 'orange' : 'geekblue'}>{i.title}</Tag> {i.url}
|
||||||
))}
|
</Select.Option>
|
||||||
|
),
|
||||||
|
)}
|
||||||
</Select>
|
</Select>
|
||||||
</Form.Item>
|
</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
|
<Form.Item
|
||||||
label="URL"
|
label="URL"
|
||||||
name="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} />
|
<Input placeholder="Please enter the URL" {...DISABLE_AUTO_COMPLETE} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|||||||
Reference in New Issue
Block a user