cambio en URLs

This commit is contained in:
serxoz 2022-10-21 18:11:41 +02:00
parent 5fe2dc0bf6
commit eefa413574
3 changed files with 5 additions and 5 deletions

View File

@ -17,7 +17,7 @@ async fn main() {
// build our application with a route // build our application with a route
let app = Router::new() let app = Router::new()
.route("/", get(basic)) .route("/", get(basic))
.route("/u", post(upload)) .route("/", post(upload))
.route("/f/:hash", get(get_file)); .route("/f/:hash", get(get_file));
// run our app with hyper // run our app with hyper

View File

@ -8,9 +8,9 @@ SH4R.IN
======= =======
HTTP POST files here: HTTP POST files here:
curl -F'file=@yourfile.png' https://sh4r.in/u curl -F'file=@yourfile.png' https://sh4r.in
You can also POST remote URLs: You can also POST remote URLs:
curl -F'url=http://example.com/image.jpg' https://sh4r.in/u curl -F'url=http://example.com/image.jpg' https://sh4r.in
File URLs are valid for aproximately 5 days. File URLs are valid for aproximately 5 days.
@ -34,7 +34,7 @@ and the originating IP address blocked from further uploads.
UPLOAD DIRECTLY UPLOAD DIRECTLY
--------------- ---------------
</pre> </pre>
<form action=\"http://localhost:3000/u\" method=\"POST\" enctype=\"multipart/form-data\"> <form action=\"https://sh4r.in\" method=\"POST\" enctype=\"multipart/form-data\">
<input class=\"form-control\" type=\"file\" name=\"file\"> <input class=\"form-control\" type=\"file\" name=\"file\">
<input class=\"form-control\" type=\"submit\" value=\"send\"> <input class=\"form-control\" type=\"submit\" value=\"send\">
</form> </form>

View File

@ -30,7 +30,7 @@ pub async fn upload(mut multipart: Multipart) -> Response {
let mut file = File::create(dest).await.expect("error creando arquivo"); let mut file = File::create(dest).await.expect("error creando arquivo");
file.write_all(&data).await.expect("error gardando contido"); file.write_all(&data).await.expect("error gardando contido");
link = format!("http://localhost:3000/f/{}", fillo); link = format!("https://sh4r.in/f/{}", fillo);
} }
link.into_response() link.into_response()