mirror of
https://github.com/Xinrea/bili-shadowreplay.git
synced 2025-11-25 12:29:24 +08:00
feat: avoid tauri in headless
This commit is contained in:
@@ -47,7 +47,6 @@ futures = "0.3"
|
|||||||
tokio-util = { version = "0.7", features = ["io"] }
|
tokio-util = { version = "0.7", features = ["io"] }
|
||||||
clap = { version = "4.5.37", features = ["derive"] }
|
clap = { version = "4.5.37", features = ["derive"] }
|
||||||
url = "2.5.4"
|
url = "2.5.4"
|
||||||
tauri-plugin-sql = { version = "2", features = ["sqlite"] }
|
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
# this feature is used for production builds or when `devPath` points to the filesystem
|
# this feature is used for production builds or when `devPath` points to the filesystem
|
||||||
@@ -63,6 +62,7 @@ gui = [
|
|||||||
"tauri-plugin-shell",
|
"tauri-plugin-shell",
|
||||||
"tauri-plugin-fs",
|
"tauri-plugin-fs",
|
||||||
"tauri-plugin-http",
|
"tauri-plugin-http",
|
||||||
|
"tauri-plugin-sql",
|
||||||
"tauri-utils",
|
"tauri-utils",
|
||||||
"tauri-plugin-os",
|
"tauri-plugin-os",
|
||||||
"tauri-plugin-notification",
|
"tauri-plugin-notification",
|
||||||
@@ -94,6 +94,11 @@ optional = true
|
|||||||
version = "2"
|
version = "2"
|
||||||
optional = true
|
optional = true
|
||||||
|
|
||||||
|
[dependencies.tauri-plugin-sql]
|
||||||
|
version = "2"
|
||||||
|
optional = true
|
||||||
|
features = ["sqlite"]
|
||||||
|
|
||||||
[dependencies.tauri-utils]
|
[dependencies.tauri-utils]
|
||||||
version = "2"
|
version = "2"
|
||||||
optional = true
|
optional = true
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ mod ffmpeg;
|
|||||||
mod handlers;
|
mod handlers;
|
||||||
#[cfg(feature = "headless")]
|
#[cfg(feature = "headless")]
|
||||||
mod http_server;
|
mod http_server;
|
||||||
|
#[cfg(feature = "headless")]
|
||||||
|
mod migration;
|
||||||
mod progress_manager;
|
mod progress_manager;
|
||||||
mod progress_reporter;
|
mod progress_reporter;
|
||||||
mod recorder;
|
mod recorder;
|
||||||
@@ -28,19 +30,20 @@ use state::State;
|
|||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use tauri_plugin_sql::{Migration, MigrationKind};
|
|
||||||
use tokio::sync::RwLock;
|
use tokio::sync::RwLock;
|
||||||
|
|
||||||
#[cfg(not(feature = "headless"))]
|
#[cfg(not(feature = "headless"))]
|
||||||
use {
|
use {
|
||||||
recorder::PlatformType,
|
recorder::PlatformType,
|
||||||
tauri::{Manager, WindowEvent},
|
tauri::{Manager, WindowEvent},
|
||||||
|
tauri_plugin_sql::{Migration, MigrationKind},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(feature = "headless")]
|
#[cfg(feature = "headless")]
|
||||||
use {
|
use {
|
||||||
clap::{arg, command, Parser},
|
clap::{arg, command, Parser},
|
||||||
futures_core::future::BoxFuture,
|
futures_core::future::BoxFuture,
|
||||||
|
migration::{Migration, MigrationKind},
|
||||||
sqlx::error::BoxDynError,
|
sqlx::error::BoxDynError,
|
||||||
sqlx::migrate::Migration as SqlxMigration,
|
sqlx::migrate::Migration as SqlxMigration,
|
||||||
sqlx::migrate::MigrationSource,
|
sqlx::migrate::MigrationSource,
|
||||||
|
|||||||
24
src-tauri/src/migration.rs
Normal file
24
src-tauri/src/migration.rs
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
use sqlx::migrate::MigrationType;
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub enum MigrationKind {
|
||||||
|
Up,
|
||||||
|
Down,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub struct Migration {
|
||||||
|
pub version: i64,
|
||||||
|
pub description: &'static str,
|
||||||
|
pub sql: &'static str,
|
||||||
|
pub kind: MigrationKind,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<MigrationKind> for MigrationType {
|
||||||
|
fn from(kind: MigrationKind) -> Self {
|
||||||
|
match kind {
|
||||||
|
MigrationKind::Up => Self::ReversibleUp,
|
||||||
|
MigrationKind::Down => Self::ReversibleDown,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user