Compare commits
No commits in common. "ce8737b0f571b44b3aaa250ef7cf26e4b328c9d1" and "e73afde9bc5e7f8e50f0efcd95316ebb309bad89" have entirely different histories.
ce8737b0f5
...
e73afde9bc
|
@ -13,22 +13,18 @@ use super::{state::SharedState, rejection::HttpReject};
|
||||||
|
|
||||||
#[derive(Template)]
|
#[derive(Template)]
|
||||||
#[template( path = "index.html" )]
|
#[template( path = "index.html" )]
|
||||||
pub struct Index {
|
pub struct Index {}
|
||||||
env: Env
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Template)]
|
#[derive(Template)]
|
||||||
#[template( path = "bad_action_req.html" )]
|
#[template( path = "bad_action_req.html" )]
|
||||||
pub struct BadActionReq {
|
pub struct BadActionReq {}
|
||||||
env: Env
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Template)]
|
#[derive(Template)]
|
||||||
#[template( path = "uploaded.html" )]
|
#[template( path = "uploaded.html" )]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
pub struct Uploaded {
|
pub struct Uploaded {
|
||||||
file: String,
|
file: String,
|
||||||
env: Env
|
instance_url: String
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -40,7 +36,7 @@ pub async fn uploaded(query: HashMap<String, String>, state: SharedState) -> Res
|
||||||
|
|
||||||
let rendered = Uploaded {
|
let rendered = Uploaded {
|
||||||
file: query.get("file").unwrap().clone(),
|
file: query.get("file").unwrap().clone(),
|
||||||
env: state.env.clone()
|
instance_url: state.env.instanceurl.clone()
|
||||||
};
|
};
|
||||||
Ok(warp::reply::html(rendered.render().map_err(|err| warp::reject::custom(HttpReject::AskamaError(err)))?))
|
Ok(warp::reply::html(rendered.render().map_err(|err| warp::reject::custom(HttpReject::AskamaError(err)))?))
|
||||||
}
|
}
|
||||||
|
@ -54,20 +50,16 @@ pub fn uploaded_f(state: SharedState) -> impl Filter<Extract = impl Reply, Error
|
||||||
.and_then(uploaded)
|
.and_then(uploaded)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn index(state: SharedState) -> Result<Html<String>, Rejection> {
|
pub async fn index() -> Result<Html<String>, Rejection> {
|
||||||
let rendered = Index {
|
let rendered = Index {};
|
||||||
env: state.env.clone()
|
|
||||||
};
|
|
||||||
Ok(warp::reply::html(rendered.render().map_err(|err| warp::reject::custom(HttpReject::AskamaError(err)))?))
|
Ok(warp::reply::html(rendered.render().map_err(|err| warp::reject::custom(HttpReject::AskamaError(err)))?))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn index_f(state: SharedState) -> impl Filter<Extract = impl Reply, Error = warp::Rejection> + Clone {
|
pub fn index_f() -> impl Filter<Extract = impl Reply, Error = warp::Rejection> + Clone {
|
||||||
warp::path::end()
|
warp::path::end().and_then(index)
|
||||||
.map(move || state.clone())
|
|
||||||
.and_then(index)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_routes(state: SharedState) -> impl Filter<Extract = impl Reply, Error = Rejection> + Clone {
|
pub fn get_routes(state: SharedState) -> impl Filter<Extract = impl Reply, Error = Rejection> + Clone {
|
||||||
index_f(state.clone())
|
index_f()
|
||||||
.or(uploaded_f(state.clone()))
|
.or(uploaded_f(state))
|
||||||
}
|
}
|
|
@ -14,7 +14,6 @@
|
||||||
<link rel="stylesheet" href="/js-only.css" />
|
<link rel="stylesheet" href="/js-only.css" />
|
||||||
<script src="/delay.js"></script>
|
<script src="/delay.js"></script>
|
||||||
<title>blek! File</title>
|
<title>blek! File</title>
|
||||||
{% include "seotags.html" %}
|
|
||||||
{% block head %}{% endblock %}
|
{% block head %}{% endblock %}
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|
|
@ -11,9 +11,8 @@
|
||||||
|
|
||||||
<meta property="og:title" content="🛸 blek! File">
|
<meta property="og:title" content="🛸 blek! File">
|
||||||
<meta property="og:description" content="A minute file hosting service">
|
<meta property="og:description" content="A minute file hosting service">
|
||||||
|
<meta property="og:url" content="https://file.blek.codes">
|
||||||
<meta property="og:url" content='{{ env.instanceurl }}'>
|
<meta property="og:site_name" content="file.blek.codes">
|
||||||
<meta property="og:site_name" content="blek! File">
|
|
||||||
<meta property="og:type" content="website">
|
<meta property="og:type" content="website">
|
||||||
<meta property="og:image" content="">
|
<meta property="og:image" content="">
|
||||||
|
|
||||||
|
|
|
@ -10,11 +10,11 @@
|
||||||
<div class="card-text">
|
<div class="card-text">
|
||||||
<p>
|
<p>
|
||||||
The file is accessible via this link:
|
The file is accessible via this link:
|
||||||
<a href='{{ env.instanceurl }}/file/{{ file }}'>{{ env.instanceurl }}/file/{{ file }}</a>
|
<a href='{{ instance_url }}/file/{{ file }}'>{{ instance_url }}/file/{{ file }}</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p class="js-only">
|
<p class="js-only">
|
||||||
<button class="btn btn-fill" style="cursor:pointer" id="copylink" data-clipboard-text="{{ env.instanceurl }}/file/{{ file }}">
|
<button class="btn btn-fill" style="cursor:pointer" id="copylink" data-clipboard-text="{{ instance_url }}/file/{{ file }}">
|
||||||
Copy link
|
Copy link
|
||||||
</button>
|
</button>
|
||||||
</p>
|
</p>
|
||||||
|
|
Loading…
Reference in New Issue