feat: add cli option to open executable files
parent
9a9e0274fd
commit
c87304602d
|
@ -2,6 +2,7 @@
|
|||
pub struct UpEndConfig {
|
||||
pub vault_name: Option<String>,
|
||||
pub desktop_enabled: bool,
|
||||
pub trust_executables: bool,
|
||||
pub secret: String,
|
||||
pub key: Option<String>,
|
||||
}
|
||||
|
|
|
@ -72,6 +72,11 @@ fn main() -> Result<()> {
|
|||
.long("no-desktop")
|
||||
.help("Disable desktop features (webbrowser, native file opening)"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("TRUST_EXECUTABLES")
|
||||
.long("trust-executables")
|
||||
.help("Trust the vault and open local executable files."),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("NO_UI")
|
||||
.long("no-ui")
|
||||
|
@ -144,6 +149,7 @@ fn main() -> Result<()> {
|
|||
);
|
||||
}
|
||||
let desktop_enabled = !matches.is_present("NO_DESKTOP");
|
||||
let trust_executables = matches.is_present("TRUST_EXECUTABLES");
|
||||
let ui_enabled = ui_path.is_ok() && !matches.is_present("NO_UI");
|
||||
let browser_enabled = desktop_enabled && !matches.is_present("NO_BROWSER");
|
||||
|
||||
|
@ -218,6 +224,7 @@ fn main() -> Result<()> {
|
|||
}),
|
||||
),
|
||||
desktop_enabled,
|
||||
trust_executables,
|
||||
secret,
|
||||
key,
|
||||
},
|
||||
|
|
|
@ -160,7 +160,7 @@ pub async fn get_raw(
|
|||
{
|
||||
info!("Opening {:?}...", file_path);
|
||||
let mut response = HttpResponse::NoContent();
|
||||
let path = if !file_path.is_executable() {
|
||||
let path = if !file_path.is_executable() || state.config.trust_executables {
|
||||
file_path
|
||||
} else {
|
||||
response
|
||||
|
|
Loading…
Reference in New Issue