mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-01 01:29:31 +08:00
feat: directly open affine page on production
This commit is contained in:
Generated
+1
@@ -7,6 +7,7 @@ name = "AFFiNE"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"dotenvy",
|
||||
"futures",
|
||||
"ipc_types",
|
||||
"js-sys",
|
||||
|
||||
@@ -25,6 +25,7 @@ project-root = "0.2.2"
|
||||
schemars = "0.8.3"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
dotenvy = "0.15.6"
|
||||
tauri = {version = "1.2", features = ["api-all", "devtools"] }
|
||||
tokio = { version = "1.23.0", features = ["rt", "macros"] }
|
||||
|
||||
|
||||
@@ -5,14 +5,23 @@
|
||||
|
||||
mod commands;
|
||||
mod state;
|
||||
use dotenvy::dotenv;
|
||||
use state::AppState;
|
||||
use tokio::sync::Mutex;
|
||||
use std::env;
|
||||
use tauri::TitleBarStyle;
|
||||
use tokio::sync::Mutex;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
tauri::async_runtime::set(tokio::runtime::Handle::current());
|
||||
dotenv().ok();
|
||||
let preload = include_str!("../../public/preload/index.js");
|
||||
let is_dev = env::var("NODE_ENV").unwrap_or_default() == "development";
|
||||
let initial_path = if is_dev {
|
||||
"index.html"
|
||||
} else {
|
||||
"affine-out/index.html"
|
||||
};
|
||||
tauri::Builder::default()
|
||||
.manage(AppState(Mutex::new(
|
||||
state::AppStateRaw::new().await.unwrap(),
|
||||
@@ -20,7 +29,7 @@ async fn main() {
|
||||
// manually create window here, instead of in the tauri.conf.json, to add `initialization_script` here
|
||||
.setup(move |app| {
|
||||
let _window =
|
||||
tauri::WindowBuilder::new(app, "label", tauri::WindowUrl::App("index.html".into()))
|
||||
tauri::WindowBuilder::new(app, "label", tauri::WindowUrl::App(initial_path.into()))
|
||||
.title("AFFiNE")
|
||||
.inner_size(1000.0, 800.0)
|
||||
.title_bar_style(TitleBarStyle::Overlay)
|
||||
|
||||
Reference in New Issue
Block a user