mirror of
https://github.com/Xinrea/bili-shadowreplay.git
synced 2025-11-25 04:22: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"] }
|
||||
clap = { version = "4.5.37", features = ["derive"] }
|
||||
url = "2.5.4"
|
||||
tauri-plugin-sql = { version = "2", features = ["sqlite"] }
|
||||
|
||||
[features]
|
||||
# this feature is used for production builds or when `devPath` points to the filesystem
|
||||
@@ -63,6 +62,7 @@ gui = [
|
||||
"tauri-plugin-shell",
|
||||
"tauri-plugin-fs",
|
||||
"tauri-plugin-http",
|
||||
"tauri-plugin-sql",
|
||||
"tauri-utils",
|
||||
"tauri-plugin-os",
|
||||
"tauri-plugin-notification",
|
||||
@@ -94,6 +94,11 @@ optional = true
|
||||
version = "2"
|
||||
optional = true
|
||||
|
||||
[dependencies.tauri-plugin-sql]
|
||||
version = "2"
|
||||
optional = true
|
||||
features = ["sqlite"]
|
||||
|
||||
[dependencies.tauri-utils]
|
||||
version = "2"
|
||||
optional = true
|
||||
|
||||
@@ -9,6 +9,8 @@ mod ffmpeg;
|
||||
mod handlers;
|
||||
#[cfg(feature = "headless")]
|
||||
mod http_server;
|
||||
#[cfg(feature = "headless")]
|
||||
mod migration;
|
||||
mod progress_manager;
|
||||
mod progress_reporter;
|
||||
mod recorder;
|
||||
@@ -28,19 +30,20 @@ use state::State;
|
||||
use std::fs::File;
|
||||
use std::path::Path;
|
||||
use std::sync::Arc;
|
||||
use tauri_plugin_sql::{Migration, MigrationKind};
|
||||
use tokio::sync::RwLock;
|
||||
|
||||
#[cfg(not(feature = "headless"))]
|
||||
use {
|
||||
recorder::PlatformType,
|
||||
tauri::{Manager, WindowEvent},
|
||||
tauri_plugin_sql::{Migration, MigrationKind},
|
||||
};
|
||||
|
||||
#[cfg(feature = "headless")]
|
||||
use {
|
||||
clap::{arg, command, Parser},
|
||||
futures_core::future::BoxFuture,
|
||||
migration::{Migration, MigrationKind},
|
||||
sqlx::error::BoxDynError,
|
||||
sqlx::migrate::Migration as SqlxMigration,
|
||||
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