1
0
Fork 0
mirror of https://codeberg.org/icewind/shelve.git synced 2026-06-03 12:04:09 +02:00
This commit is contained in:
Robin Appelman 2021-07-30 22:46:27 +02:00
commit f6b09d03ef
3 changed files with 12 additions and 21 deletions

View file

@ -43,6 +43,15 @@ fn home() -> HtmlResponse {
HtmlResponse(Templates::get("index.html").unwrap_or(Cow::Borrowed(b"Template not found"))) HtmlResponse(Templates::get("index.html").unwrap_or(Cow::Borrowed(b"Template not found")))
} }
#[derive(Responder)]
#[response(content_type = "image/svg+xml")]
struct SvgResponse(Cow<'static, [u8]>);
#[get("/icon.svg")]
fn icon() -> SvgResponse {
SvgResponse(Templates::get("icon.svg").unwrap_or(Cow::Borrowed(b"Template not found")))
}
fn now() -> u64 { fn now() -> u64 {
let start = SystemTime::now(); let start = SystemTime::now();
start start
@ -211,7 +220,7 @@ fn rocket() -> _ {
.manage(tokens) .manage(tokens)
.manage(basedir.clone()) .manage(basedir.clone())
.manage(expire_queue) .manage(expire_queue)
.mount("/", routes![home, put_upload, post_upload, download]) .mount("/", routes![home, put_upload, post_upload, download, icon])
} }
fn expire_job(expire_basedir: PathBuf, expire_queue: ExpireQueue) -> JoinHandle<()> { fn expire_job(expire_basedir: PathBuf, expire_queue: ExpireQueue) -> JoinHandle<()> {

1
templates/icon.svg Normal file
View file

@ -0,0 +1 @@
<svg viewBox="0 0 417 417" xmlns="http://www.w3.org/2000/svg"><rect width="417" height="417" x="0" y="0" rx="60" ry="60" fill="#fff" paint-order="stroke fill markers"/><path d="M386.076 271.25h-50.944l6.19-61.567a6.622 6.622 0 0 0-6.586-7.283H323.7v-34.426h11.034a6.62 6.62 0 0 0 6.62-6.62v-22.95a6.62 6.62 0 0 0-13.24 0v16.33H323.7v-26.04c0-10.951-8.909-19.86-19.86-19.86-10.952 0-19.861 8.909-19.861 19.86V202.4h-11.034a6.62 6.62 0 0 0-6.586 7.283l6.19 61.568h-48.858l8.39-3.957a6.62 6.62 0 0 0 3.164-8.81l-55.352-117.39a6.622 6.622 0 0 0-8.81-3.164l-25.687 12.11v-1.954a6.62 6.62 0 0 0-6.62-6.62h-32.219v-5.269a6.62 6.62 0 0 0-6.62-6.62H61.1a6.62 6.62 0 0 0-6.62 6.62v135.054H31.087a6.62 6.62 0 0 0-6.62 6.62v23.838a6.62 6.62 0 0 0 6.62 6.62h354.988a6.62 6.62 0 0 0 6.62-6.62V277.87a6.62 6.62 0 0 0-6.62-6.62zM297.22 128.696c0-3.65 2.97-6.62 6.62-6.62s6.62 2.97 6.62 6.62V202.4h-13.24zm-16.954 86.946h47.15l-5.591 55.61h-35.968zm-109.524-62.912l49.705 105.414-23.153 10.917-49.705-105.413zm12.946 118.522h-38.291v-81.207zm-51.531-116.544V271.25h-25.599V154.707zm-64.437-11.89h25.598v128.434H67.72zM379.456 295.09H37.708V284.49h341.748z"/></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -1,6 +1,7 @@
<html> <html>
<head> <head>
<meta name="viewport" content="width=device-width" /> <meta name="viewport" content="width=device-width" />
<link rel="shortcut icon" href="icon.svg" />
<title>Shelve</title> <title>Shelve</title>
<style> <style>
* { * {
@ -154,15 +155,6 @@
} }
} }
.box__restart {
font-weight: 700;
}
.box__restart:focus,
.box__restart:hover {
color: #39bfd3;
}
.js .box__file { .js .box__file {
width: 0.1px; width: 0.1px;
height: 0.1px; height: 0.1px;
@ -278,7 +270,6 @@
expireInput = document.getElementById('expire'), expireInput = document.getElementById('expire'),
box = form.querySelector('.dropbox'), box = form.querySelector('.dropbox'),
errorMsg = form.querySelector('.box__error span'), errorMsg = form.querySelector('.box__error span'),
restart = form.querySelectorAll('.box__restart'),
uploads = document.getElementById('uploads'), uploads = document.getElementById('uploads'),
droppedFiles = false, droppedFiles = false,
showFiles = function (files) { showFiles = function (files) {
@ -419,16 +410,6 @@
return false; return false;
}); });
// restart the form if has a state of error/success
Array.prototype.forEach.call(restart, function (entry) {
entry.addEventListener('click', function (e) {
e.preventDefault();
form.classList.remove('is-error', 'is-success');
input.click();
});
});
// Firefox focus bug fix for file input // Firefox focus bug fix for file input
input.addEventListener('focus', function () { input.addEventListener('focus', function () {
input.classList.add('has-focus'); input.classList.add('has-focus');