|
|
|
@ -15,7 +15,10 @@ struct Video { |
|
|
|
|
#[post("/new", data = "<video>")] |
|
|
|
|
fn new(video: Form<Video>) -> Redirect { |
|
|
|
|
if video.link.starts_with("https://"){ |
|
|
|
|
Command::new("/bin/env").args(&["bash", "-c", &format!("mpv {link}", link=&video.link).to_string()]).output().expect("Failed to execute command"); |
|
|
|
|
Command::new("/bin/env") |
|
|
|
|
.args(&["DISPLAY:=0", "bash", "-c", &format!("mpv {link}", link=&video.link).to_string()]) |
|
|
|
|
.output() |
|
|
|
|
.expect("Failed to execute command"); |
|
|
|
|
} |
|
|
|
|
Redirect::to("/") |
|
|
|
|
} |
|
|
|
|