diff --git a/splashscreen.html b/splashscreen.html
new file mode 100644
index 0000000..92e4176
--- /dev/null
+++ b/splashscreen.html
@@ -0,0 +1,12 @@
+
+
+
+
+
+ StreamCapture Loading
+
+
+
+
+
+
diff --git a/src-tauri/capabilities/default.json b/src-tauri/capabilities/default.json
index 778bfb5..95e943a 100644
--- a/src-tauri/capabilities/default.json
+++ b/src-tauri/capabilities/default.json
@@ -2,7 +2,7 @@
"$schema": "../gen/schemas/desktop-schema.json",
"identifier": "default",
"description": "Capability for the main window",
- "windows": ["main"],
+ "windows": ["main", "splashscreen"],
"permissions": [
"core:default",
"opener:default",
diff --git a/src-tauri/src/commands.rs b/src-tauri/src/commands.rs
index c7f0caa..1b6b524 100644
--- a/src-tauri/src/commands.rs
+++ b/src-tauri/src/commands.rs
@@ -111,6 +111,16 @@ pub fn delete_history_item(app: AppHandle, id: String) -> Result<(), String> {
storage::delete_history_item(&app, &id).map_err(|e| e.to_string())
}
+#[tauri::command]
+pub async fn close_splash(app: AppHandle) {
+ if let Some(splash) = app.get_webview_window("splashscreen") {
+ splash.close().unwrap();
+ }
+ if let Some(main) = app.get_webview_window("main") {
+ main.show().unwrap();
+ }
+}
+
#[tauri::command]
pub fn open_in_explorer(app: AppHandle, path: String) -> Result<(), String> {
let path_to_open = if Path::new(&path).exists() {
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs
index a183d9c..6e31ad5 100644
--- a/src-tauri/src/lib.rs
+++ b/src-tauri/src/lib.rs
@@ -24,6 +24,7 @@ pub fn run() {
commands::get_history,
commands::clear_history,
commands::delete_history_item,
+ commands::close_splash,
commands::open_in_explorer
])
.run(tauri::generate_context!())
diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json
index ed036b1..8537534 100644
--- a/src-tauri/tauri.conf.json
+++ b/src-tauri/tauri.conf.json
@@ -12,9 +12,22 @@
"app": {
"windows": [
{
+ "label": "main",
"title": "流萤 - 视频下载 v1.0.0",
"width": 1300,
- "height": 900
+ "height": 900,
+ "visible": false
+ },
+ {
+ "label": "splashscreen",
+ "title": "StreamCapture Loading",
+ "url": "splashscreen.html",
+ "width": 400,
+ "height": 300,
+ "decorations": false,
+ "center": true,
+ "resizable": false,
+ "alwaysOnTop": true
}
],
"security": {
diff --git a/src/splash/App.vue b/src/splash/App.vue
new file mode 100644
index 0000000..3f07822
--- /dev/null
+++ b/src/splash/App.vue
@@ -0,0 +1,44 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/src/splash/main.ts b/src/splash/main.ts
new file mode 100644
index 0000000..246c0e8
--- /dev/null
+++ b/src/splash/main.ts
@@ -0,0 +1,5 @@
+import { createApp } from 'vue'
+import App from './App.vue'
+import '../style.css'
+
+createApp(App).mount('#app')
diff --git a/vite.config.ts b/vite.config.ts
index 812e61c..97e8803 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -1,5 +1,6 @@
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
+import { resolve } from "path";
// @ts-expect-error process is a nodejs global
const host = process.env.TAURI_DEV_HOST;
@@ -29,4 +30,12 @@ export default defineConfig(async () => ({
ignored: ["**/src-tauri/**"],
},
},
+ build: {
+ rollupOptions: {
+ input: {
+ main: resolve(__dirname, 'index.html'),
+ splashscreen: resolve(__dirname, 'splashscreen.html'),
+ },
+ },
+ },
}));