Skip to content

Commit

Permalink
wip!
Browse files Browse the repository at this point in the history
  • Loading branch information
matze committed Feb 10, 2025
1 parent ecb1dc2 commit 0fea1c7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/handlers/html/paste.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ pub async fn get(
}
Err(Error::NoPassword) => Ok(PasswordInput {
page: page.clone(),
id: key.id.to_string(),
id,
}
.into_response()),
Err(err) => Err(err),
Expand Down
9 changes: 3 additions & 6 deletions src/handlers/insert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,7 @@ pub mod form {

let mut url = id.to_url_path(&entry);

let burn_after_reading = entry.burn_after_reading.unwrap_or(false);
if burn_after_reading {
if entry.burn_after_reading.unwrap_or(false) {
url = format!("burn/{url}");
}

Expand All @@ -145,8 +144,7 @@ pub mod form {
.same_site(SameSite::Strict)
.build();

let jar = jar.add(cookie);
Ok((jar, Redirect::to(&url)))
Ok((jar.add(cookie), Redirect::to(&url)))
}
.await
.map_err(|err| make_error(err, state.page.clone()))
Expand Down Expand Up @@ -190,9 +188,8 @@ pub mod form {
assert!(content.contains("FooBarBaz"));

let res = client
.get(location)
.get(&format!("/raw{location}"))
.header(header::ACCEPT, "text/html; charset=utf-8")
.query(&[("fmt", "raw")])
.send()
.await?;

Expand Down
7 changes: 6 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,12 @@ async fn serve(
.route(state.page.assets.index_js.route(), get(index_js))
.route(state.page.assets.paste_js.route(), get(paste_js))
.route("/", get(html::index).post(insert::insert))
.route("/:id", get(html::paste::get).delete(delete::delete))
.route(
"/:id",
get(html::paste::get)
.post(html::paste::get)
.delete(delete::delete),
)
.route("/dl/:id", get(download::download))
.route("/qr/:id", get(html::qr))
.route("/raw/:id", get(raw::raw))
Expand Down
2 changes: 1 addition & 1 deletion templates/burn.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends "base.html" %}
{% block content %}
<div class="center">
<p class="text-center">Copy and send <a class="punctuation definition tag" href="{{ id }}">this link</a>.
<p class="text-center">Copy and send <a class="punctuation definition tag" href="/{{ id }}">this link</a>.
After opening it for the first time, it will be deleted.</p>
<p class="text-center">
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 {{ code.size() + 4 }} {{ code.size() + 4 }}" stroke="none" width="16rem">
Expand Down

0 comments on commit 0fea1c7

Please sign in to comment.