fix: changed flag name to cross-origin-policy
This commit is contained in:
1 parent
4f95a0ba6b
commit
b196affb02
5 files changed
+26
-48
No files matched your search
+3
-2
@@ -77,10 +77,11 @@ pub struct ConfigOptsServe {
|
||||
#[serde(default)]
|
||||
pub hot_reload: bool,
|
||||
|
||||
/// Build with shared_array_buffer enabled in JS [default: false]
|
||||
/// Set cross-origin-policy to same-origin [default: false]
|
||||
#[clap(name="cross-origin-policy")]
|
||||
#[clap(long)]
|
||||
#[serde(default)]
|
||||
pub shared_array_buffer: bool,
|
||||
pub cross_origin_policy: bool,
|
||||
|
||||
/// Space separated list of features to activate
|
||||
#[clap(long)]
|
||||
|
||||
@@ -20,7 +20,7 @@ impl Serve {
|
||||
|
||||
// change the relase state.
|
||||
crate_config.with_hot_reload(self.serve.hot_reload);
|
||||
crate_config.with_shared_array_buffer(self.serve.shared_array_buffer);
|
||||
crate_config.with_cross_origin_policy(self.serve.cross_origin_policy);
|
||||
crate_config.with_release(self.serve.release);
|
||||
crate_config.with_verbose(self.serve.verbose);
|
||||
|
||||
|
||||
+4
-4
@@ -146,7 +146,7 @@ pub struct CrateConfig {
|
||||
pub dioxus_config: DioxusConfig,
|
||||
pub release: bool,
|
||||
pub hot_reload: bool,
|
||||
pub shared_array_buffer: bool,
|
||||
pub cross_origin_policy: bool,
|
||||
pub verbose: bool,
|
||||
pub custom_profile: Option<String>,
|
||||
pub features: Option<Vec<String>>,
|
||||
@@ -214,7 +214,7 @@ impl CrateConfig {
|
||||
release,
|
||||
dioxus_config,
|
||||
hot_reload,
|
||||
shared_array_buffer: false,
|
||||
cross_origin_policy: false,
|
||||
custom_profile,
|
||||
features,
|
||||
verbose,
|
||||
@@ -236,8 +236,8 @@ impl CrateConfig {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_shared_array_buffer(&mut self, shared_array_buffer: bool) -> &mut Self {
|
||||
self.shared_array_buffer = shared_array_buffer;
|
||||
pub fn with_cross_origin_policy(&mut self, cross_origin_policy: bool) -> &mut Self {
|
||||
self.cross_origin_policy = cross_origin_policy;
|
||||
self
|
||||
}
|
||||
|
||||
|
||||
+2
-16
@@ -176,13 +176,6 @@ pub async fn startup_hot_reload(ip: String, port: u16, config: CrateConfig, star
|
||||
.clone()
|
||||
.unwrap_or_else(|| vec![PathBuf::from("src")]);
|
||||
|
||||
let cors = CorsLayer::new()
|
||||
// allow `GET` and `POST` when accessing the resource
|
||||
.allow_methods([Method::GET, Method::POST])
|
||||
// allow requests from any origin
|
||||
.allow_origin(Any)
|
||||
.allow_headers(Any);
|
||||
|
||||
let watcher_config = config.clone();
|
||||
let watcher_ip = ip.clone();
|
||||
let mut last_update_time = chrono::Local::now().timestamp();
|
||||
@@ -285,7 +278,7 @@ pub async fn startup_hot_reload(ip: String, port: u16, config: CrateConfig, star
|
||||
.allow_origin(Any)
|
||||
.allow_headers(Any);
|
||||
|
||||
let (coep, coop) = if config.shared_array_buffer {
|
||||
let (coep, coop) = if config.cross_origin_policy {
|
||||
(
|
||||
HeaderValue::from_static("require-corp"),
|
||||
HeaderValue::from_static("same-origin"),
|
||||
@@ -399,13 +392,6 @@ pub async fn startup_default(
|
||||
|
||||
let mut last_update_time = chrono::Local::now().timestamp();
|
||||
|
||||
let cors = CorsLayer::new()
|
||||
// allow `GET` and `POST` when accessing the resource
|
||||
.allow_methods([Method::GET, Method::POST])
|
||||
// allow requests from any origin
|
||||
.allow_origin(Any)
|
||||
.allow_headers(Any);
|
||||
|
||||
// file watcher: check file change
|
||||
let allow_watch_path = config
|
||||
.dioxus_config
|
||||
@@ -476,7 +462,7 @@ pub async fn startup_default(
|
||||
.allow_origin(Any)
|
||||
.allow_headers(Any);
|
||||
|
||||
let (coep, coop) = if config.shared_array_buffer {
|
||||
let (coep, coop) = if config.cross_origin_policy {
|
||||
(
|
||||
HeaderValue::from_static("require-corp"),
|
||||
HeaderValue::from_static("same-origin"),
|
||||
|
||||
Reference in new issue
Block a user