@ionyx-apps/cli 0.2.1 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/ionyx.exe +0 -0
- package/ionyx-cli/Cargo.toml +40 -0
- package/ionyx-cli/src/commands/build.rs +53 -0
- package/ionyx-cli/src/commands/bundle.rs +349 -0
- package/ionyx-cli/src/commands/config.rs +36 -0
- package/ionyx-cli/src/commands/dev.rs +142 -0
- package/ionyx-cli/src/commands/doctor.rs +158 -0
- package/ionyx-cli/src/commands/info.rs +79 -0
- package/ionyx-cli/src/commands/init.rs +64 -0
- package/ionyx-cli/src/commands/mod.rs +9 -0
- package/ionyx-cli/src/commands/plugin.rs +34 -0
- package/ionyx-cli/src/commands/run.rs +54 -0
- package/ionyx-cli/src/config/mod.rs +155 -0
- package/ionyx-cli/src/main.rs +161 -0
- package/ionyx-cli/src/templates/basic/src-ionyx/Cargo.toml +26 -20
- package/ionyx-cli/src/templates/basic/src-ionyx/src/lib.rs +6 -0
- package/ionyx-cli/src/templates/basic/src-ionyx/src/protocol.rs +5 -4
- package/ionyx-cli/src/templates/leptos/Cargo.toml +13 -13
- package/ionyx-cli/src/templates/leptos/src-ionyx/Cargo.toml +20 -20
- package/ionyx-cli/src/templates/leptos/src-ionyx/src/protocol.rs +5 -4
- package/ionyx-cli/src/templates/react/src-ionyx/Cargo.toml +26 -20
- package/ionyx-cli/src/templates/react/src-ionyx/src/lib.rs +6 -0
- package/ionyx-cli/src/templates/react/src-ionyx/src/protocol.rs +5 -4
- package/ionyx-cli/src/templates/src-ionyx/Cargo.toml +18 -18
- package/ionyx-cli/src/templates/svelte/src-ionyx/Cargo.toml +26 -20
- package/ionyx-cli/src/templates/svelte/src-ionyx/src/lib.rs +6 -0
- package/ionyx-cli/src/templates/svelte/src-ionyx/src/protocol.rs +5 -4
- package/ionyx-cli/src/templates/vanilla/src-ionyx/Cargo.toml +26 -20
- package/ionyx-cli/src/templates/vanilla/src-ionyx/src/lib.rs +6 -0
- package/ionyx-cli/src/templates/vanilla/src-ionyx/src/protocol.rs +5 -4
- package/ionyx-cli/src/templates/vue/src-ionyx/Cargo.toml +26 -20
- package/ionyx-cli/src/templates/vue/src-ionyx/src/lib.rs +6 -0
- package/ionyx-cli/src/templates/vue/src-ionyx/src/protocol.rs +5 -4
- package/package.json +12 -4
- package/bin/cargo-ionyx-win.exe +0 -0
- package/bin/cargo-ionyx.exe +0 -0
- package/ionyx-cli/src/templates/react/src-ionyx/Cargo.lock +0 -5536
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
use clap::{Parser, Subcommand};
|
|
2
|
+
use colored::*;
|
|
3
|
+
use anyhow::Result;
|
|
4
|
+
|
|
5
|
+
mod commands;
|
|
6
|
+
mod config;
|
|
7
|
+
mod templates;
|
|
8
|
+
|
|
9
|
+
#[derive(Parser)]
|
|
10
|
+
#[command(name = "ionyx")]
|
|
11
|
+
#[command(about = "Ionyx Framework CLI Tool")]
|
|
12
|
+
#[command(version)]
|
|
13
|
+
struct Cli {
|
|
14
|
+
#[command(subcommand)]
|
|
15
|
+
command: Commands,
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
#[derive(Subcommand)]
|
|
19
|
+
enum Commands {
|
|
20
|
+
/// Initialize a new Ionyx project
|
|
21
|
+
#[command(alias = "create")]
|
|
22
|
+
Init {
|
|
23
|
+
/// Project name
|
|
24
|
+
name: Option<String>,
|
|
25
|
+
/// Project template (basic, react, svelte, vue, vanilla, leptos, angular)
|
|
26
|
+
#[arg(short, long)]
|
|
27
|
+
template: Option<String>,
|
|
28
|
+
},
|
|
29
|
+
/// Start development server
|
|
30
|
+
Dev {
|
|
31
|
+
/// Port number
|
|
32
|
+
#[arg(short, long, default_value = "5173")]
|
|
33
|
+
port: u16,
|
|
34
|
+
/// Hot reload
|
|
35
|
+
#[arg(short = 'H', long)]
|
|
36
|
+
hot: bool,
|
|
37
|
+
},
|
|
38
|
+
/// Build the project
|
|
39
|
+
Build {
|
|
40
|
+
/// Build target
|
|
41
|
+
#[arg(short, long, default_value = "web")]
|
|
42
|
+
target: String,
|
|
43
|
+
/// Minify output
|
|
44
|
+
#[arg(short, long)]
|
|
45
|
+
minify: bool,
|
|
46
|
+
},
|
|
47
|
+
/// Run the application
|
|
48
|
+
Run {
|
|
49
|
+
/// Port number
|
|
50
|
+
#[arg(short, long, default_value = "5173")]
|
|
51
|
+
port: u16,
|
|
52
|
+
},
|
|
53
|
+
/// Manage configuration
|
|
54
|
+
Config {
|
|
55
|
+
#[command(subcommand)]
|
|
56
|
+
action: ConfigAction,
|
|
57
|
+
},
|
|
58
|
+
/// Plugin management
|
|
59
|
+
Plugin {
|
|
60
|
+
#[command(subcommand)]
|
|
61
|
+
action: PluginAction,
|
|
62
|
+
},
|
|
63
|
+
/// Shows Ionyx environment information
|
|
64
|
+
Info,
|
|
65
|
+
/// Bundle the project into a native installer (EXE, MSI, DEB, DMG)
|
|
66
|
+
Bundle {
|
|
67
|
+
/// Bundle target platform (windows, macos, linux)
|
|
68
|
+
#[arg(short, long)]
|
|
69
|
+
platform: Option<String>,
|
|
70
|
+
/// Bundle format (nsis, wix, deb, appimage, dmg)
|
|
71
|
+
#[arg(short, long)]
|
|
72
|
+
format: Option<String>,
|
|
73
|
+
},
|
|
74
|
+
/// Diagnose development environment (Inspired by Flutter Doctor)
|
|
75
|
+
Doctor,
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
#[derive(Subcommand)]
|
|
79
|
+
enum ConfigAction {
|
|
80
|
+
/// Get configuration value
|
|
81
|
+
Get { key: String },
|
|
82
|
+
/// Set configuration value
|
|
83
|
+
Set { key: String, value: String },
|
|
84
|
+
/// List all configuration
|
|
85
|
+
List,
|
|
86
|
+
/// Reset configuration
|
|
87
|
+
Reset,
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
#[derive(Subcommand)]
|
|
91
|
+
enum PluginAction {
|
|
92
|
+
/// Install a plugin
|
|
93
|
+
Install { name: String },
|
|
94
|
+
/// Uninstall a plugin
|
|
95
|
+
Uninstall { name: String },
|
|
96
|
+
/// List installed plugins
|
|
97
|
+
List,
|
|
98
|
+
/// Update a plugin
|
|
99
|
+
Update { name: String },
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
#[tokio::main]
|
|
103
|
+
async fn main() -> Result<()> {
|
|
104
|
+
let cli = Cli::parse();
|
|
105
|
+
|
|
106
|
+
match cli.command {
|
|
107
|
+
Commands::Init { name, template } => {
|
|
108
|
+
use dialoguer::{Input, Select};
|
|
109
|
+
use crate::templates::get_available_templates;
|
|
110
|
+
|
|
111
|
+
let final_name = match name {
|
|
112
|
+
Some(n) => n,
|
|
113
|
+
None => Input::<String>::new()
|
|
114
|
+
.with_prompt("Project name")
|
|
115
|
+
.default("my-ionyx-app".into())
|
|
116
|
+
.interact_text()?,
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
let final_template = match template {
|
|
120
|
+
Some(t) => t,
|
|
121
|
+
None => {
|
|
122
|
+
let templates = get_available_templates();
|
|
123
|
+
let selection = Select::new()
|
|
124
|
+
.with_prompt("Choose your frontend framework")
|
|
125
|
+
.items(&templates)
|
|
126
|
+
.default(0)
|
|
127
|
+
.interact()?;
|
|
128
|
+
templates[selection].to_string()
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
commands::init::execute(final_name, &final_template).await?;
|
|
133
|
+
}
|
|
134
|
+
Commands::Dev { port, hot } => {
|
|
135
|
+
commands::dev::execute(port, hot).await?;
|
|
136
|
+
}
|
|
137
|
+
Commands::Build { target, minify } => {
|
|
138
|
+
commands::build::execute(&target, minify).await?;
|
|
139
|
+
}
|
|
140
|
+
Commands::Run { port } => {
|
|
141
|
+
commands::run::execute(port).await?;
|
|
142
|
+
}
|
|
143
|
+
Commands::Config { action } => {
|
|
144
|
+
commands::config::execute(action).await?;
|
|
145
|
+
}
|
|
146
|
+
Commands::Plugin { action } => {
|
|
147
|
+
commands::plugin::execute(action).await?;
|
|
148
|
+
}
|
|
149
|
+
Commands::Info => {
|
|
150
|
+
commands::info::execute().await?;
|
|
151
|
+
}
|
|
152
|
+
Commands::Bundle { platform, format } => {
|
|
153
|
+
commands::bundle::execute(platform, format).await?;
|
|
154
|
+
}
|
|
155
|
+
Commands::Doctor => {
|
|
156
|
+
commands::doctor::execute().await?;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
Ok(())
|
|
161
|
+
}
|
|
@@ -1,20 +1,26 @@
|
|
|
1
|
-
[package]
|
|
2
|
-
name = "my-ionyx-app"
|
|
3
|
-
version = "0.1
|
|
4
|
-
edition = "2021"
|
|
5
|
-
|
|
6
|
-
[workspace]
|
|
7
|
-
|
|
8
|
-
[
|
|
9
|
-
name = "
|
|
10
|
-
path = "
|
|
11
|
-
|
|
12
|
-
[
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
[
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
[package]
|
|
2
|
+
name = "my-ionyx-app"
|
|
3
|
+
version = "0.3.1"
|
|
4
|
+
edition = "2021"
|
|
5
|
+
|
|
6
|
+
[workspace]
|
|
7
|
+
|
|
8
|
+
[lib]
|
|
9
|
+
name = "my_ionyx_app"
|
|
10
|
+
path = "src/lib.rs"
|
|
11
|
+
|
|
12
|
+
[[bin]]
|
|
13
|
+
name = "my-ionyx-app"
|
|
14
|
+
path = "main.rs"
|
|
15
|
+
|
|
16
|
+
[dependencies]
|
|
17
|
+
ionyx = { path = "../../../../../../src-ionyx" }
|
|
18
|
+
anyhow = "1.0"
|
|
19
|
+
wry = "0.54"
|
|
20
|
+
tao = "0.34"
|
|
21
|
+
|
|
22
|
+
[profile.release]
|
|
23
|
+
opt-level = 3
|
|
24
|
+
lto = true
|
|
25
|
+
codegen-units = 1
|
|
26
|
+
panic = "abort"
|
|
@@ -35,12 +35,12 @@ impl CustomProtocolHandler {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
pub fn handle_request(&self, request: Request<Vec<u8>>) -> Response<Cow<'static, [u8]>> {
|
|
38
|
-
let path = request.uri().path();
|
|
39
|
-
|
|
40
38
|
// Debug modunda (npm run dev açıkken) bu handler'ın işi yok aslında,
|
|
41
39
|
// WebView doğrudan localhost'a gitmeli. Ama bir şekilde buraya düşerse
|
|
42
40
|
// 404 yerine temiz bir hata dönüyoruz.
|
|
43
|
-
|
|
41
|
+
#[cfg(debug_assertions)]
|
|
42
|
+
{
|
|
43
|
+
let _uri_path = request.uri().path();
|
|
44
44
|
return Response::builder()
|
|
45
45
|
.status(StatusCode::NOT_FOUND)
|
|
46
46
|
.header("Content-Type", "text/plain")
|
|
@@ -51,7 +51,8 @@ impl CustomProtocolHandler {
|
|
|
51
51
|
// Release modunda gömülü dosyaları işle
|
|
52
52
|
#[cfg(not(debug_assertions))]
|
|
53
53
|
{
|
|
54
|
-
let
|
|
54
|
+
let uri_path = request.uri().path();
|
|
55
|
+
let clean_path = uri_path.trim_start_matches('/');
|
|
55
56
|
let file_path = if clean_path.is_empty() { "index.html" } else { clean_path };
|
|
56
57
|
|
|
57
58
|
match EMBEDDED_ASSETS.get_file(file_path) {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
[package]
|
|
2
|
-
name = "my-ionyx-app"
|
|
3
|
-
version = "0.1
|
|
4
|
-
edition = "2021"
|
|
5
|
-
|
|
6
|
-
[lib]
|
|
7
|
-
crate-type = ["cdylib"]
|
|
8
|
-
|
|
9
|
-
[dependencies]
|
|
10
|
-
leptos = { version = "0.6", features = ["csr"] }
|
|
11
|
-
wasm-bindgen = "0.2"
|
|
12
|
-
console_log = "1.0"
|
|
13
|
-
log = "0.4"
|
|
1
|
+
[package]
|
|
2
|
+
name = "my-ionyx-app"
|
|
3
|
+
version = "0.3.1"
|
|
4
|
+
edition = "2021"
|
|
5
|
+
|
|
6
|
+
[lib]
|
|
7
|
+
crate-type = ["cdylib"]
|
|
8
|
+
|
|
9
|
+
[dependencies]
|
|
10
|
+
leptos = { version = "0.6", features = ["csr"] }
|
|
11
|
+
wasm-bindgen = "0.2"
|
|
12
|
+
console_log = "1.0"
|
|
13
|
+
log = "0.4"
|
|
14
14
|
console_error_panic_hook = "0.1"
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
[package]
|
|
2
|
-
name = "my-ionyx-app"
|
|
3
|
-
version = "0.1
|
|
4
|
-
edition = "2021"
|
|
5
|
-
|
|
6
|
-
[workspace]
|
|
7
|
-
|
|
8
|
-
[[bin]]
|
|
9
|
-
name = "my-ionyx-app"
|
|
10
|
-
path = "main.rs"
|
|
11
|
-
|
|
12
|
-
[dependencies]
|
|
13
|
-
ionyx = { path = "../../../../../../src-ionyx" }
|
|
14
|
-
anyhow = "1.0"
|
|
15
|
-
|
|
16
|
-
[profile.release]
|
|
17
|
-
opt-level = 3
|
|
18
|
-
lto = true
|
|
19
|
-
codegen-units = 1
|
|
20
|
-
panic = "abort"
|
|
1
|
+
[package]
|
|
2
|
+
name = "my-ionyx-app"
|
|
3
|
+
version = "0.3.1"
|
|
4
|
+
edition = "2021"
|
|
5
|
+
|
|
6
|
+
[workspace]
|
|
7
|
+
|
|
8
|
+
[[bin]]
|
|
9
|
+
name = "my-ionyx-app"
|
|
10
|
+
path = "main.rs"
|
|
11
|
+
|
|
12
|
+
[dependencies]
|
|
13
|
+
ionyx = { path = "../../../../../../src-ionyx" }
|
|
14
|
+
anyhow = "1.0"
|
|
15
|
+
|
|
16
|
+
[profile.release]
|
|
17
|
+
opt-level = 3
|
|
18
|
+
lto = true
|
|
19
|
+
codegen-units = 1
|
|
20
|
+
panic = "abort"
|
|
@@ -35,12 +35,12 @@ impl CustomProtocolHandler {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
pub fn handle_request(&self, request: Request<Vec<u8>>) -> Response<Cow<'static, [u8]>> {
|
|
38
|
-
let path = request.uri().path();
|
|
39
|
-
|
|
40
38
|
// Debug modunda (npm run dev açıkken) bu handler'ın işi yok aslında,
|
|
41
39
|
// WebView doğrudan localhost'a gitmeli. Ama bir şekilde buraya düşerse
|
|
42
40
|
// 404 yerine temiz bir hata dönüyoruz.
|
|
43
|
-
|
|
41
|
+
#[cfg(debug_assertions)]
|
|
42
|
+
{
|
|
43
|
+
let _uri_path = request.uri().path();
|
|
44
44
|
return Response::builder()
|
|
45
45
|
.status(StatusCode::NOT_FOUND)
|
|
46
46
|
.header("Content-Type", "text/plain")
|
|
@@ -51,7 +51,8 @@ impl CustomProtocolHandler {
|
|
|
51
51
|
// Release modunda gömülü dosyaları işle
|
|
52
52
|
#[cfg(not(debug_assertions))]
|
|
53
53
|
{
|
|
54
|
-
let
|
|
54
|
+
let uri_path = request.uri().path();
|
|
55
|
+
let clean_path = uri_path.trim_start_matches('/');
|
|
55
56
|
let file_path = if clean_path.is_empty() { "index.html" } else { clean_path };
|
|
56
57
|
|
|
57
58
|
match EMBEDDED_ASSETS.get_file(file_path) {
|
|
@@ -1,20 +1,26 @@
|
|
|
1
|
-
[package]
|
|
2
|
-
name = "my-ionyx-app"
|
|
3
|
-
version = "0.1
|
|
4
|
-
edition = "2021"
|
|
5
|
-
|
|
6
|
-
[workspace]
|
|
7
|
-
|
|
8
|
-
[
|
|
9
|
-
name = "
|
|
10
|
-
path = "
|
|
11
|
-
|
|
12
|
-
[
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
[
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
[package]
|
|
2
|
+
name = "my-ionyx-app"
|
|
3
|
+
version = "0.3.1"
|
|
4
|
+
edition = "2021"
|
|
5
|
+
|
|
6
|
+
[workspace]
|
|
7
|
+
|
|
8
|
+
[lib]
|
|
9
|
+
name = "my_ionyx_app"
|
|
10
|
+
path = "src/lib.rs"
|
|
11
|
+
|
|
12
|
+
[[bin]]
|
|
13
|
+
name = "my-ionyx-app"
|
|
14
|
+
path = "main.rs"
|
|
15
|
+
|
|
16
|
+
[dependencies]
|
|
17
|
+
ionyx = { path = "../../../../../../src-ionyx" }
|
|
18
|
+
anyhow = "1.0"
|
|
19
|
+
wry = "0.54"
|
|
20
|
+
tao = "0.34"
|
|
21
|
+
|
|
22
|
+
[profile.release]
|
|
23
|
+
opt-level = 3
|
|
24
|
+
lto = true
|
|
25
|
+
codegen-units = 1
|
|
26
|
+
panic = "abort"
|
|
@@ -35,12 +35,12 @@ impl CustomProtocolHandler {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
pub fn handle_request(&self, request: Request<Vec<u8>>) -> Response<Cow<'static, [u8]>> {
|
|
38
|
-
let path = request.uri().path();
|
|
39
|
-
|
|
40
38
|
// Debug modunda (npm run dev açıkken) bu handler'ın işi yok aslında,
|
|
41
39
|
// WebView doğrudan localhost'a gitmeli. Ama bir şekilde buraya düşerse
|
|
42
40
|
// 404 yerine temiz bir hata dönüyoruz.
|
|
43
|
-
|
|
41
|
+
#[cfg(debug_assertions)]
|
|
42
|
+
{
|
|
43
|
+
let _uri_path = request.uri().path();
|
|
44
44
|
return Response::builder()
|
|
45
45
|
.status(StatusCode::NOT_FOUND)
|
|
46
46
|
.header("Content-Type", "text/plain")
|
|
@@ -51,7 +51,8 @@ impl CustomProtocolHandler {
|
|
|
51
51
|
// Release modunda gömülü dosyaları işle
|
|
52
52
|
#[cfg(not(debug_assertions))]
|
|
53
53
|
{
|
|
54
|
-
let
|
|
54
|
+
let uri_path = request.uri().path();
|
|
55
|
+
let clean_path = uri_path.trim_start_matches('/');
|
|
55
56
|
let file_path = if clean_path.is_empty() { "index.html" } else { clean_path };
|
|
56
57
|
|
|
57
58
|
match EMBEDDED_ASSETS.get_file(file_path) {
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
[package]
|
|
2
|
-
name = "my-ionyx-app"
|
|
3
|
-
version = "0.1
|
|
4
|
-
edition = "2021"
|
|
5
|
-
|
|
6
|
-
[[bin]]
|
|
7
|
-
name = "my-ionyx-app"
|
|
8
|
-
path = "main.rs"
|
|
9
|
-
|
|
10
|
-
[dependencies]
|
|
11
|
-
ionyx = "1.0.0"
|
|
12
|
-
anyhow = "1.0"
|
|
13
|
-
|
|
14
|
-
[profile.release]
|
|
15
|
-
opt-level = 3
|
|
16
|
-
lto = true
|
|
17
|
-
codegen-units = 1
|
|
18
|
-
panic = "abort"
|
|
1
|
+
[package]
|
|
2
|
+
name = "my-ionyx-app"
|
|
3
|
+
version = "0.3.1"
|
|
4
|
+
edition = "2021"
|
|
5
|
+
|
|
6
|
+
[[bin]]
|
|
7
|
+
name = "my-ionyx-app"
|
|
8
|
+
path = "main.rs"
|
|
9
|
+
|
|
10
|
+
[dependencies]
|
|
11
|
+
ionyx = "1.0.0"
|
|
12
|
+
anyhow = "1.0"
|
|
13
|
+
|
|
14
|
+
[profile.release]
|
|
15
|
+
opt-level = 3
|
|
16
|
+
lto = true
|
|
17
|
+
codegen-units = 1
|
|
18
|
+
panic = "abort"
|
|
@@ -1,20 +1,26 @@
|
|
|
1
|
-
[package]
|
|
2
|
-
name = "my-ionyx-app"
|
|
3
|
-
version = "0.1
|
|
4
|
-
edition = "2021"
|
|
5
|
-
|
|
6
|
-
[workspace]
|
|
7
|
-
|
|
8
|
-
[
|
|
9
|
-
name = "
|
|
10
|
-
path = "
|
|
11
|
-
|
|
12
|
-
[
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
[
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
[package]
|
|
2
|
+
name = "my-ionyx-app"
|
|
3
|
+
version = "0.3.1"
|
|
4
|
+
edition = "2021"
|
|
5
|
+
|
|
6
|
+
[workspace]
|
|
7
|
+
|
|
8
|
+
[lib]
|
|
9
|
+
name = "my_ionyx_app"
|
|
10
|
+
path = "src/lib.rs"
|
|
11
|
+
|
|
12
|
+
[[bin]]
|
|
13
|
+
name = "my-ionyx-app"
|
|
14
|
+
path = "main.rs"
|
|
15
|
+
|
|
16
|
+
[dependencies]
|
|
17
|
+
ionyx = { path = "../../../../../../src-ionyx" }
|
|
18
|
+
anyhow = "1.0"
|
|
19
|
+
wry = "0.54"
|
|
20
|
+
tao = "0.34"
|
|
21
|
+
|
|
22
|
+
[profile.release]
|
|
23
|
+
opt-level = 3
|
|
24
|
+
lto = true
|
|
25
|
+
codegen-units = 1
|
|
26
|
+
panic = "abort"
|
|
@@ -35,12 +35,12 @@ impl CustomProtocolHandler {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
pub fn handle_request(&self, request: Request<Vec<u8>>) -> Response<Cow<'static, [u8]>> {
|
|
38
|
-
let path = request.uri().path();
|
|
39
|
-
|
|
40
38
|
// Debug modunda (npm run dev açıkken) bu handler'ın işi yok aslında,
|
|
41
39
|
// WebView doğrudan localhost'a gitmeli. Ama bir şekilde buraya düşerse
|
|
42
40
|
// 404 yerine temiz bir hata dönüyoruz.
|
|
43
|
-
|
|
41
|
+
#[cfg(debug_assertions)]
|
|
42
|
+
{
|
|
43
|
+
let _uri_path = request.uri().path();
|
|
44
44
|
return Response::builder()
|
|
45
45
|
.status(StatusCode::NOT_FOUND)
|
|
46
46
|
.header("Content-Type", "text/plain")
|
|
@@ -51,7 +51,8 @@ impl CustomProtocolHandler {
|
|
|
51
51
|
// Release modunda gömülü dosyaları işle
|
|
52
52
|
#[cfg(not(debug_assertions))]
|
|
53
53
|
{
|
|
54
|
-
let
|
|
54
|
+
let uri_path = request.uri().path();
|
|
55
|
+
let clean_path = uri_path.trim_start_matches('/');
|
|
55
56
|
let file_path = if clean_path.is_empty() { "index.html" } else { clean_path };
|
|
56
57
|
|
|
57
58
|
match EMBEDDED_ASSETS.get_file(file_path) {
|
|
@@ -1,20 +1,26 @@
|
|
|
1
|
-
[package]
|
|
2
|
-
name = "my-ionyx-app"
|
|
3
|
-
version = "0.1
|
|
4
|
-
edition = "2021"
|
|
5
|
-
|
|
6
|
-
[workspace]
|
|
7
|
-
|
|
8
|
-
[
|
|
9
|
-
name = "
|
|
10
|
-
path = "
|
|
11
|
-
|
|
12
|
-
[
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
[
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
[package]
|
|
2
|
+
name = "my-ionyx-app"
|
|
3
|
+
version = "0.3.1"
|
|
4
|
+
edition = "2021"
|
|
5
|
+
|
|
6
|
+
[workspace]
|
|
7
|
+
|
|
8
|
+
[lib]
|
|
9
|
+
name = "my_ionyx_app"
|
|
10
|
+
path = "src/lib.rs"
|
|
11
|
+
|
|
12
|
+
[[bin]]
|
|
13
|
+
name = "my-ionyx-app"
|
|
14
|
+
path = "main.rs"
|
|
15
|
+
|
|
16
|
+
[dependencies]
|
|
17
|
+
ionyx = { path = "../../../../../../src-ionyx" }
|
|
18
|
+
anyhow = "1.0"
|
|
19
|
+
wry = "0.54"
|
|
20
|
+
tao = "0.34"
|
|
21
|
+
|
|
22
|
+
[profile.release]
|
|
23
|
+
opt-level = 3
|
|
24
|
+
lto = true
|
|
25
|
+
codegen-units = 1
|
|
26
|
+
panic = "abort"
|
|
@@ -35,12 +35,12 @@ impl CustomProtocolHandler {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
pub fn handle_request(&self, request: Request<Vec<u8>>) -> Response<Cow<'static, [u8]>> {
|
|
38
|
-
let path = request.uri().path();
|
|
39
|
-
|
|
40
38
|
// Debug modunda (npm run dev açıkken) bu handler'ın işi yok aslında,
|
|
41
39
|
// WebView doğrudan localhost'a gitmeli. Ama bir şekilde buraya düşerse
|
|
42
40
|
// 404 yerine temiz bir hata dönüyoruz.
|
|
43
|
-
|
|
41
|
+
#[cfg(debug_assertions)]
|
|
42
|
+
{
|
|
43
|
+
let _uri_path = request.uri().path();
|
|
44
44
|
return Response::builder()
|
|
45
45
|
.status(StatusCode::NOT_FOUND)
|
|
46
46
|
.header("Content-Type", "text/plain")
|
|
@@ -51,7 +51,8 @@ impl CustomProtocolHandler {
|
|
|
51
51
|
// Release modunda gömülü dosyaları işle
|
|
52
52
|
#[cfg(not(debug_assertions))]
|
|
53
53
|
{
|
|
54
|
-
let
|
|
54
|
+
let uri_path = request.uri().path();
|
|
55
|
+
let clean_path = uri_path.trim_start_matches('/');
|
|
55
56
|
let file_path = if clean_path.is_empty() { "index.html" } else { clean_path };
|
|
56
57
|
|
|
57
58
|
match EMBEDDED_ASSETS.get_file(file_path) {
|
|
@@ -1,20 +1,26 @@
|
|
|
1
|
-
[package]
|
|
2
|
-
name = "my-ionyx-app"
|
|
3
|
-
version = "0.1
|
|
4
|
-
edition = "2021"
|
|
5
|
-
|
|
6
|
-
[workspace]
|
|
7
|
-
|
|
8
|
-
[
|
|
9
|
-
name = "
|
|
10
|
-
path = "
|
|
11
|
-
|
|
12
|
-
[
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
[
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
[package]
|
|
2
|
+
name = "my-ionyx-app"
|
|
3
|
+
version = "0.3.1"
|
|
4
|
+
edition = "2021"
|
|
5
|
+
|
|
6
|
+
[workspace]
|
|
7
|
+
|
|
8
|
+
[lib]
|
|
9
|
+
name = "my_ionyx_app"
|
|
10
|
+
path = "src/lib.rs"
|
|
11
|
+
|
|
12
|
+
[[bin]]
|
|
13
|
+
name = "my-ionyx-app"
|
|
14
|
+
path = "main.rs"
|
|
15
|
+
|
|
16
|
+
[dependencies]
|
|
17
|
+
ionyx = { path = "../../../../../../src-ionyx" }
|
|
18
|
+
anyhow = "1.0"
|
|
19
|
+
wry = "0.54"
|
|
20
|
+
tao = "0.34"
|
|
21
|
+
|
|
22
|
+
[profile.release]
|
|
23
|
+
opt-level = 3
|
|
24
|
+
lto = true
|
|
25
|
+
codegen-units = 1
|
|
26
|
+
panic = "abort"
|