mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-10-01 23:56:39 +08:00
feat: simple cargo
This commit is contained in:
parent
2758ea5ddd
commit
cb6576ec04
1955
src-tauri/Cargo.lock
generated
1955
src-tauri/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -2,12 +2,12 @@
|
|||||||
name = "nextchat"
|
name = "nextchat"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
description = "A cross platform app for LLM ChatBot."
|
description = "A cross platform app for LLM ChatBot."
|
||||||
authors = ["Yidadaa"]
|
authors = ["GPTsMotion Tech LLC"]
|
||||||
license = "mit"
|
license = "mit"
|
||||||
repository = ""
|
repository = ""
|
||||||
default-run = "nextchat"
|
default-run = "nextchat"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
rust-version = "1.60"
|
rust-version = "1.71"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
name = "nextchat"
|
name = "nextchat"
|
||||||
@ -19,17 +19,13 @@ crate-type = ["staticlib", "cdylib", "rlib"]
|
|||||||
tauri-build = { version = "2.0.0-rc", features = [] }
|
tauri-build = { version = "2.0.0-rc", features = [] }
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
tauri = { version = "2.0.0-rc", features = [] }
|
serde_json = "1.0"
|
||||||
tauri-plugin-shell = "2.0.0-rc"
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde = { version = "1", features = ["derive"] }
|
log = "0.4"
|
||||||
serde_json = "1"
|
tauri = { version = "2.0.0-rc.15", features = [] }
|
||||||
tauri-plugin-devtools = "2.0.0-rc"
|
tauri-plugin-log = "2.0.0-rc"
|
||||||
specta = "=2.0.0-rc.20"
|
tauri-plugin-http = "2.0.0-rc"
|
||||||
tauri-plugin-updater = "2.0.0-rc"
|
|
||||||
tauri-plugin-dialog = "2.0.0-rc"
|
|
||||||
tauri-specta = { version = "=2.0.0-rc.15", features = ["derive", "javascript", "typescript"] }
|
|
||||||
specta-typescript = "0.0.7"
|
|
||||||
log = "0.4.22"
|
|
||||||
|
|
||||||
# Optimize for smaller binary size
|
# Optimize for smaller binary size
|
||||||
[profile.release]
|
[profile.release]
|
||||||
@ -46,3 +42,4 @@ strip = true # Remove debug symbols
|
|||||||
custom-protocol = ["tauri/custom-protocol"]
|
custom-protocol = ["tauri/custom-protocol"]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,13 +4,24 @@
|
|||||||
"local": true,
|
"local": true,
|
||||||
"windows": ["main"],
|
"windows": ["main"],
|
||||||
"permissions": [
|
"permissions": [
|
||||||
"dialog:default",
|
"core:default",
|
||||||
"dialog:allow-ask",
|
"core:window:allow-start-dragging",
|
||||||
"dialog:allow-message",
|
"core:window:allow-maximize",
|
||||||
"updater:default",
|
"http:default",
|
||||||
"updater:allow-check",
|
"http:allow-fetch",
|
||||||
"updater:allow-download-and-install",
|
"http:allow-fetch-cancel",
|
||||||
"core:event:allow-listen",
|
"http:allow-fetch-read-body",
|
||||||
"core:event:default"
|
"http:allow-fetch-send",
|
||||||
|
{
|
||||||
|
"identifier": "http:allow-fetch",
|
||||||
|
"allow": [
|
||||||
|
{
|
||||||
|
"url": "https://*"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "http://*"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -1,33 +1,15 @@
|
|||||||
use tauri_specta::Event;
|
|
||||||
|
|
||||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||||
pub fn run() {
|
pub fn run() {
|
||||||
#[cfg(debug_assertions)]
|
tauri::Builder::default()
|
||||||
let devtools = tauri_plugin_devtools::init();
|
.plugin(tauri_plugin_http::init())
|
||||||
let mut builder = tauri::Builder::default();
|
.setup(|app| {
|
||||||
|
if cfg!(debug_assertions) {
|
||||||
let specta_builder = tauri_specta::Builder::<tauri::Wry>::new();
|
app.handle().plugin(
|
||||||
|
tauri_plugin_log::Builder::default()
|
||||||
#[cfg(debug_assertions)]
|
.level(log::LevelFilter::Info)
|
||||||
{
|
.build(),
|
||||||
builder = builder.plugin(devtools);
|
)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(debug_assertions, not(mobile)))]
|
|
||||||
specta_builder
|
|
||||||
.export(
|
|
||||||
specta_typescript::Typescript::default()
|
|
||||||
.formatter(specta_typescript::formatter::prettier),
|
|
||||||
"../src/bindings.ts",
|
|
||||||
)
|
|
||||||
.expect("failed to export typescript bindings");
|
|
||||||
|
|
||||||
builder
|
|
||||||
.plugin(tauri_plugin_shell::init())
|
|
||||||
.plugin(tauri_plugin_dialog::init())
|
|
||||||
.invoke_handler(specta_builder.invoke_handler())
|
|
||||||
.setup(move |app| {
|
|
||||||
specta_builder.mount_events(app);
|
|
||||||
Ok(())
|
Ok(())
|
||||||
})
|
})
|
||||||
.run(tauri::generate_context!())
|
.run(tauri::generate_context!())
|
||||||
|
71
src/bindings.ts
Normal file
71
src/bindings.ts
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
// This file was generated by [tauri-specta](https://github.com/oscartbeaumont/tauri-specta). Do not edit this file manually.
|
||||||
|
|
||||||
|
/** user-defined commands **/
|
||||||
|
|
||||||
|
export const commands = {};
|
||||||
|
|
||||||
|
/** user-defined events **/
|
||||||
|
|
||||||
|
/** user-defined constants **/
|
||||||
|
|
||||||
|
/** user-defined types **/
|
||||||
|
|
||||||
|
/** tauri-specta globals **/
|
||||||
|
|
||||||
|
import {
|
||||||
|
invoke as TAURI_INVOKE,
|
||||||
|
Channel as TAURI_CHANNEL,
|
||||||
|
} from "@tauri-apps/api/core";
|
||||||
|
import * as TAURI_API_EVENT from "@tauri-apps/api/event";
|
||||||
|
import { type WebviewWindow as __WebviewWindow__ } from "@tauri-apps/api/webviewWindow";
|
||||||
|
|
||||||
|
type __EventObj__<T> = {
|
||||||
|
listen: (
|
||||||
|
cb: TAURI_API_EVENT.EventCallback<T>,
|
||||||
|
) => ReturnType<typeof TAURI_API_EVENT.listen<T>>;
|
||||||
|
once: (
|
||||||
|
cb: TAURI_API_EVENT.EventCallback<T>,
|
||||||
|
) => ReturnType<typeof TAURI_API_EVENT.once<T>>;
|
||||||
|
emit: T extends null
|
||||||
|
? (payload?: T) => ReturnType<typeof TAURI_API_EVENT.emit>
|
||||||
|
: (payload: T) => ReturnType<typeof TAURI_API_EVENT.emit>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type Result<T, E> =
|
||||||
|
| { status: "ok"; data: T }
|
||||||
|
| { status: "error"; error: E };
|
||||||
|
|
||||||
|
function __makeEvents__<T extends Record<string, any>>(
|
||||||
|
mappings: Record<keyof T, string>,
|
||||||
|
) {
|
||||||
|
return new Proxy(
|
||||||
|
{} as unknown as {
|
||||||
|
[K in keyof T]: __EventObj__<T[K]> & {
|
||||||
|
(handle: __WebviewWindow__): __EventObj__<T[K]>;
|
||||||
|
};
|
||||||
|
},
|
||||||
|
{
|
||||||
|
get: (_, event) => {
|
||||||
|
const name = mappings[event as keyof T];
|
||||||
|
|
||||||
|
return new Proxy((() => {}) as any, {
|
||||||
|
apply: (_, __, [window]: [__WebviewWindow__]) => ({
|
||||||
|
listen: (arg: any) => window.listen(name, arg),
|
||||||
|
once: (arg: any) => window.once(name, arg),
|
||||||
|
emit: (arg: any) => window.emit(name, arg),
|
||||||
|
}),
|
||||||
|
get: (_, command: keyof __EventObj__<any>) => {
|
||||||
|
switch (command) {
|
||||||
|
case "listen":
|
||||||
|
return (arg: any) => TAURI_API_EVENT.listen(name, arg);
|
||||||
|
case "once":
|
||||||
|
return (arg: any) => TAURI_API_EVENT.once(name, arg);
|
||||||
|
case "emit":
|
||||||
|
return (arg: any) => TAURI_API_EVENT.emit(name, arg);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user