mirror of
https://git.verdigado.com/NB-Public/simple-wkd.git
synced 2024-10-30 03:05:51 +01:00
Update webpage
This commit is contained in:
parent
2a22617752
commit
d5cb622b9e
9 changed files with 176 additions and 66 deletions
55
Cargo.lock
generated
55
Cargo.lock
generated
|
@ -19,6 +19,29 @@ dependencies = [
|
|||
"tokio-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "actix-files"
|
||||
version = "0.6.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d832782fac6ca7369a70c9ee9a20554623c5e51c76e190ad151780ebea1cf689"
|
||||
dependencies = [
|
||||
"actix-http",
|
||||
"actix-service",
|
||||
"actix-utils",
|
||||
"actix-web",
|
||||
"askama_escape",
|
||||
"bitflags",
|
||||
"bytes",
|
||||
"derive_more",
|
||||
"futures-core",
|
||||
"http-range",
|
||||
"log",
|
||||
"mime",
|
||||
"mime_guess",
|
||||
"percent-encoding",
|
||||
"pin-project-lite",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "actix-http"
|
||||
version = "3.3.1"
|
||||
|
@ -260,6 +283,12 @@ dependencies = [
|
|||
"term",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "askama_escape"
|
||||
version = "0.10.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "619743e34b5ba4e9703bba34deac3427c72507c7159f5fd030aea8cac0cfe341"
|
||||
|
||||
[[package]]
|
||||
name = "async-trait"
|
||||
version = "0.1.68"
|
||||
|
@ -987,6 +1016,12 @@ dependencies = [
|
|||
"pin-project-lite",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "http-range"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "21dec9db110f5f872ed9699c3ecf50cf16f423502706ba5c72462e28d3157573"
|
||||
|
||||
[[package]]
|
||||
name = "httparse"
|
||||
version = "1.8.0"
|
||||
|
@ -1356,6 +1391,16 @@ version = "0.3.17"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
|
||||
|
||||
[[package]]
|
||||
name = "mime_guess"
|
||||
version = "2.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef"
|
||||
dependencies = [
|
||||
"mime",
|
||||
"unicase",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "minimal-lexical"
|
||||
version = "0.2.1"
|
||||
|
@ -2042,6 +2087,7 @@ dependencies = [
|
|||
name = "simple-wkd"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"actix-files",
|
||||
"actix-web",
|
||||
"chrono",
|
||||
"flexi_logger",
|
||||
|
@ -2445,6 +2491,15 @@ version = "1.16.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba"
|
||||
|
||||
[[package]]
|
||||
name = "unicase"
|
||||
version = "2.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6"
|
||||
dependencies = [
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-bidi"
|
||||
version = "0.3.13"
|
||||
|
|
|
@ -6,6 +6,7 @@ edition = "2021"
|
|||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
actix-files = "0.6.2"
|
||||
actix-web = "4.3.1"
|
||||
chrono = "0.4.24"
|
||||
flexi_logger = "0.25.3"
|
||||
|
|
File diff suppressed because one or more lines are too long
1
assets/webpage/_astro/delete.cae7b1eb.css
Normal file
1
assets/webpage/_astro/delete.cae7b1eb.css
Normal file
|
@ -0,0 +1 @@
|
|||
.input:focus{border-radius:.5rem}@media (prefers-color-scheme: dark){.input{--tw-bg-opacity: 1;background-color:rgb(38 38 38 / var(--tw-bg-opacity))}}.button{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity));padding:1rem}.button:hover{border-radius:.5rem;--tw-drop-shadow: drop-shadow(0 4px 3px rgb(0 0 0 / .07)) drop-shadow(0 2px 2px rgb(0 0 0 / .06));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}@media (prefers-color-scheme: dark){.button{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity))}}.input,.button{border-bottom-left-radius:.5rem;border-top-right-radius:.5rem;border-width:1px;--tw-border-opacity: 1;border-color:rgb(0 0 0 / var(--tw-border-opacity));transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.3s}@media (prefers-color-scheme: dark){.input,.button{--tw-border-opacity: 1;border-color:rgb(212 212 212 / var(--tw-border-opacity))}}
|
|
@ -1,20 +1,23 @@
|
|||
<!DOCTYPE html><html lang="en" class="h-full"><head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
|
||||
<meta name="generator" content="Astro v2.3.0">
|
||||
<title>Submit a key</title>
|
||||
<style>*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content:""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal}body{margin:0;line-height:inherit}button,input{font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button{text-transform:none}button,[type=submit]{-webkit-appearance:button;background-color:transparent;background-image:none}input::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder{opacity:1;color:#9ca3af}button{cursor:pointer}[type=email]{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#fff;border-color:#6b7280;border-width:1px;border-radius:0;padding:.5rem .75rem;font-size:1rem;line-height:1.5rem;--tw-shadow:0 0 #0000}[type=email]:focus{outline:2px solid transparent;outline-offset:2px;--tw-ring-inset:var(--tw-empty, );--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#2563eb;--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);border-color:#2563eb}input::-moz-placeholder{color:#6b7280;opacity:1}input::placeholder{color:#6b7280;opacity:1}*,:before,:after{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgb(59 130 246 / .5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.flex{display:flex}.h-full{height:100%}.w-full{width:100%}.max-w-full{max-width:100%}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.items-center{align-items:center}.self-end{align-self:flex-end}.px-8{padding-left:2rem;padding-right:2rem}.py-4{padding-top:1rem;padding-bottom:1rem}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-xl{font-size:1.25rem;line-height:1.75rem}.font-bold{font-weight:700}.focus\:rounded-lg:focus{border-radius:.5rem}.button{--tw-bg-opacity:1;background-color:rgb(240 253 250 / var(--tw-bg-opacity));padding:1rem}.button:hover{--tw-drop-shadow:drop-shadow(0 4px 3px rgb(0 0 0 / .07)) drop-shadow(0 2px 2px rgb(0 0 0 / .06));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);border-radius:.5rem}.round,.button{--tw-border-opacity:1;border-color:rgb(0 0 0 / var(--tw-border-opacity));border-width:1px;border-top-right-radius:.5rem;border-bottom-left-radius:.5rem;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}</style><link rel="preload" href="/_astro/delete.6228aab6.css" as="style" onload="this.rel='stylesheet'"><noscript><link rel="stylesheet" href="/_astro/delete.6228aab6.css"></noscript></head>
|
||||
<body class="h-full">
|
||||
|
||||
<div class="flex flex-row items-center h-full font-mono px-8 py-4">
|
||||
<div class="flex flex-col items-center w-full">
|
||||
<form action="{{%u}}api/delete" method="get" class="flex flex-col max-w-full">
|
||||
<label for="email" class="font-bold text-xl mt-3">Request key deletion:</label>
|
||||
<input type="email" name="email" id="email-input" placeholder="e-mail" size="65" class="round focus:rounded-lg mt-3" required="">
|
||||
<button type="submit" class="button mt-4 self-end">Delete</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
|
||||
<meta name="generator" content="Astro v2.3.0">
|
||||
<title>Delete a key</title>
|
||||
<style>*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content:""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal}body{margin:0;line-height:inherit}button,input{font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button{text-transform:none}button,[type=submit]{-webkit-appearance:button;background-color:transparent;background-image:none}input::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder{opacity:1;color:#9ca3af}button{cursor:pointer}[type=email]{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#fff;border-color:#6b7280;border-width:1px;border-radius:0;padding:.5rem .75rem;font-size:1rem;line-height:1.5rem;--tw-shadow:0 0 #0000}[type=email]:focus{outline:2px solid transparent;outline-offset:2px;--tw-ring-inset:var(--tw-empty, );--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#2563eb;--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);border-color:#2563eb}input::-moz-placeholder{color:#6b7280;opacity:1}input::placeholder{color:#6b7280;opacity:1}*,:before,:after{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgb(59 130 246 / .5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.flex{display:flex}.h-full{height:100%}.w-full{width:100%}.max-w-full{max-width:100%}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.items-center{align-items:center}.self-end{align-self:flex-end}.px-8{padding-left:2rem;padding-right:2rem}.py-4{padding-top:1rem;padding-bottom:1rem}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-xl{font-size:1.25rem;line-height:1.75rem}.font-bold{font-weight:700}.focus\:rounded-lg:focus{border-radius:.5rem}@media (prefers-color-scheme: dark){.dark\:bg-neutral-800{--tw-bg-opacity:1;background-color:rgb(38 38 38 / var(--tw-bg-opacity))}.dark\:text-neutral-300{--tw-text-opacity:1;color:rgb(212 212 212 / var(--tw-text-opacity))}}.input:focus{border-radius:.5rem}@media (prefers-color-scheme: dark){.input{--tw-bg-opacity:1;background-color:rgb(38 38 38 / var(--tw-bg-opacity))}}.button{--tw-bg-opacity:1;background-color:rgb(226 232 240 / var(--tw-bg-opacity));padding:1rem}.button:hover{border-radius:.5rem;--tw-drop-shadow:drop-shadow(0 4px 3px rgb(0 0 0 / .07)) drop-shadow(0 2px 2px rgb(0 0 0 / .06));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}@media (prefers-color-scheme: dark){.button{--tw-bg-opacity:1;background-color:rgb(51 65 85 / var(--tw-bg-opacity))}}.input,.button{border-bottom-left-radius:.5rem;border-top-right-radius:.5rem;border-width:1px;--tw-border-opacity:1;border-color:rgb(0 0 0 / var(--tw-border-opacity));transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.3s}@media (prefers-color-scheme: dark){.input,.button{--tw-border-opacity:1;border-color:rgb(212 212 212 / var(--tw-border-opacity))}}</style><link rel="preload" href="/_astro/delete.4b1c40a3.css" as="style" onload="this.rel='stylesheet'"><noscript><link rel="stylesheet" href="/_astro/delete.4b1c40a3.css"></noscript>
|
||||
<link rel="preload" href="/_astro/delete.cae7b1eb.css" as="style" onload="this.rel='stylesheet'"><noscript><link rel="stylesheet" href="/_astro/delete.cae7b1eb.css"></noscript></head>
|
||||
<body class="h-full font-mono dark:bg-neutral-800 dark:text-neutral-300">
|
||||
|
||||
<div class="flex h-full flex-row items-center px-8 py-4">
|
||||
<div class="flex w-full flex-col items-center">
|
||||
|
||||
<form action="((%u))api/delete" method="get" class="flex max-w-full flex-col">
|
||||
<label for="email" class="mt-3 text-xl font-bold">Request key deletion:</label>
|
||||
<input type="email" name="email" id="email-input" placeholder="user@example.com" size="65" class="input mt-3 focus:rounded-lg" required="">
|
||||
<button type="submit" class="button mt-4 self-end">Delete</button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body></html>
|
||||
</body></html>
|
|
@ -1,20 +1,23 @@
|
|||
<!DOCTYPE html><html lang="en" class="h-full"><head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
|
||||
<meta name="generator" content="Astro v2.3.0">
|
||||
<title>Manage keys</title>
|
||||
<style>*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content:""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal}body{margin:0;line-height:inherit}h1{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}h1{margin:0}*,:before,:after{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgb(59 130 246 / .5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.flex{display:flex}.h-full{height:100%}.w-full{width:100%}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.items-center{align-items:center}.space-x-6>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(1.5rem * var(--tw-space-x-reverse));margin-left:calc(1.5rem * calc(1 - var(--tw-space-x-reverse)))}.px-8{padding-left:2rem;padding-right:2rem}.py-4{padding-top:1rem;padding-bottom:1rem}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-lg{font-size:1.125rem;line-height:1.75rem}.font-bold{font-weight:700}.button{--tw-bg-opacity:1;background-color:rgb(240 253 250 / var(--tw-bg-opacity));padding:1rem}.button:hover{--tw-drop-shadow:drop-shadow(0 4px 3px rgb(0 0 0 / .07)) drop-shadow(0 2px 2px rgb(0 0 0 / .06));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);border-radius:.5rem}.button{--tw-border-opacity:1;border-color:rgb(0 0 0 / var(--tw-border-opacity));border-width:1px;border-top-right-radius:.5rem;border-bottom-left-radius:.5rem;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}</style><link rel="preload" href="/_astro/delete.6228aab6.css" as="style" onload="this.rel='stylesheet'"><noscript><link rel="stylesheet" href="/_astro/delete.6228aab6.css"></noscript></head>
|
||||
<body class="h-full">
|
||||
|
||||
<div class="flex flex-row items-center h-full font-mono px-8 py-4">
|
||||
<div class="flex flex-col items-center w-full">
|
||||
<h1 class="font-bold text-lg">What would you like to do?</h1>
|
||||
<div class="flex flex-row space-x-6">
|
||||
<a href="/submit" class="button">Submit a key</a>
|
||||
<a href="/delete" class="button">Delete a key</a>
|
||||
</div>
|
||||
</div>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
|
||||
<meta name="generator" content="Astro v2.3.0">
|
||||
<title>Manage keys</title>
|
||||
<style>*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content:""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal}body{margin:0;line-height:inherit}h1{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}h1{margin:0}*,:before,:after{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgb(59 130 246 / .5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.flex{display:flex}.h-full{height:100%}.w-full{width:100%}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.items-center{align-items:center}.space-x-6>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(1.5rem * var(--tw-space-x-reverse));margin-left:calc(1.5rem * calc(1 - var(--tw-space-x-reverse)))}.px-8{padding-left:2rem;padding-right:2rem}.py-4{padding-top:1rem;padding-bottom:1rem}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-lg{font-size:1.125rem;line-height:1.75rem}.font-bold{font-weight:700}@media (prefers-color-scheme: dark){.dark\:bg-neutral-800{--tw-bg-opacity:1;background-color:rgb(38 38 38 / var(--tw-bg-opacity))}.dark\:text-neutral-300{--tw-text-opacity:1;color:rgb(212 212 212 / var(--tw-text-opacity))}}.button{--tw-bg-opacity:1;background-color:rgb(226 232 240 / var(--tw-bg-opacity));padding:1rem}.button:hover{border-radius:.5rem;--tw-drop-shadow:drop-shadow(0 4px 3px rgb(0 0 0 / .07)) drop-shadow(0 2px 2px rgb(0 0 0 / .06));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}@media (prefers-color-scheme: dark){.button{--tw-bg-opacity:1;background-color:rgb(51 65 85 / var(--tw-bg-opacity))}}.button{border-bottom-left-radius:.5rem;border-top-right-radius:.5rem;border-width:1px;--tw-border-opacity:1;border-color:rgb(0 0 0 / var(--tw-border-opacity));transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.3s}@media (prefers-color-scheme: dark){.button{--tw-border-opacity:1;border-color:rgb(212 212 212 / var(--tw-border-opacity))}}</style><link rel="preload" href="/_astro/delete.4b1c40a3.css" as="style" onload="this.rel='stylesheet'"><noscript><link rel="stylesheet" href="/_astro/delete.4b1c40a3.css"></noscript>
|
||||
<link rel="preload" href="/_astro/delete.cae7b1eb.css" as="style" onload="this.rel='stylesheet'"><noscript><link rel="stylesheet" href="/_astro/delete.cae7b1eb.css"></noscript></head>
|
||||
<body class="h-full font-mono dark:bg-neutral-800 dark:text-neutral-300">
|
||||
|
||||
<div class="flex h-full flex-row items-center px-8 py-4">
|
||||
<div class="flex w-full flex-col items-center">
|
||||
|
||||
<h1 class="text-lg font-bold">What would you like to do?</h1>
|
||||
<div class="flex flex-row space-x-6">
|
||||
<a href="/submit" class="button">Submit a key</a>
|
||||
<a href="/delete" class="button">Delete a key</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body></html>
|
||||
</body></html>
|
|
@ -1,20 +1,23 @@
|
|||
<!DOCTYPE html><html lang="en" class="h-full"><head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
|
||||
<meta name="generator" content="Astro v2.3.0">
|
||||
<title>Submit a key</title>
|
||||
<style>*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content:""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal}body{margin:0;line-height:inherit}button,textarea{font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button{text-transform:none}button,[type=submit]{-webkit-appearance:button;background-color:transparent;background-image:none}textarea{resize:vertical}textarea::-moz-placeholder{opacity:1;color:#9ca3af}textarea::placeholder{opacity:1;color:#9ca3af}button{cursor:pointer}textarea{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#fff;border-color:#6b7280;border-width:1px;border-radius:0;padding:.5rem .75rem;font-size:1rem;line-height:1.5rem;--tw-shadow:0 0 #0000}textarea:focus{outline:2px solid transparent;outline-offset:2px;--tw-ring-inset:var(--tw-empty, );--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#2563eb;--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);border-color:#2563eb}textarea::-moz-placeholder{color:#6b7280;opacity:1}textarea::placeholder{color:#6b7280;opacity:1}*,:before,:after{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgb(59 130 246 / .5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.mt-3{margin-top:.75rem}.mt-6{margin-top:1.5rem}.flex{display:flex}.h-full{height:100%}.w-full{width:100%}.max-w-full{max-width:100%}.resize-none{resize:none}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.items-center{align-items:center}.self-end{align-self:flex-end}.px-8{padding-left:2rem;padding-right:2rem}.py-4{padding-top:1rem;padding-bottom:1rem}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-xl{font-size:1.25rem;line-height:1.75rem}.font-bold{font-weight:700}.focus\:rounded-lg:focus{border-radius:.5rem}.button{--tw-bg-opacity:1;background-color:rgb(240 253 250 / var(--tw-bg-opacity));padding:1rem}.button:hover{--tw-drop-shadow:drop-shadow(0 4px 3px rgb(0 0 0 / .07)) drop-shadow(0 2px 2px rgb(0 0 0 / .06));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);border-radius:.5rem}.round,.button{--tw-border-opacity:1;border-color:rgb(0 0 0 / var(--tw-border-opacity));border-width:1px;border-top-right-radius:.5rem;border-bottom-left-radius:.5rem;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}</style><link rel="preload" href="/_astro/delete.6228aab6.css" as="style" onload="this.rel='stylesheet'"><noscript><link rel="stylesheet" href="/_astro/delete.6228aab6.css"></noscript></head>
|
||||
<body class="h-full">
|
||||
|
||||
<div class="flex flex-row items-center h-full font-mono px-8 py-4">
|
||||
<div class="flex flex-col items-center w-full">
|
||||
<form action="{{%u}}api/submit" method="post" class="flex flex-col max-w-full">
|
||||
<label for="key" class="font-bold text-xl">Paste your pgp keyblock here:</label>
|
||||
<textarea name="key" id="key-input" cols="65" rows="20" class="round focus:rounded-lg mt-3 resize-none" placeholder="-----BEGIN PGP PUBLIC KEY BLOCK-----" required=""></textarea>
|
||||
<button type="submit" class="button mt-6 self-end">Submit</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
|
||||
<meta name="generator" content="Astro v2.3.0">
|
||||
<title>Submit a key</title>
|
||||
<style>*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content:""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal}body{margin:0;line-height:inherit}button,textarea{font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button{text-transform:none}button,[type=submit]{-webkit-appearance:button;background-color:transparent;background-image:none}textarea{resize:vertical}textarea::-moz-placeholder{opacity:1;color:#9ca3af}textarea::placeholder{opacity:1;color:#9ca3af}button{cursor:pointer}textarea{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#fff;border-color:#6b7280;border-width:1px;border-radius:0;padding:.5rem .75rem;font-size:1rem;line-height:1.5rem;--tw-shadow:0 0 #0000}textarea:focus{outline:2px solid transparent;outline-offset:2px;--tw-ring-inset:var(--tw-empty, );--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#2563eb;--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);border-color:#2563eb}textarea::-moz-placeholder{color:#6b7280;opacity:1}textarea::placeholder{color:#6b7280;opacity:1}*,:before,:after{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgb(59 130 246 / .5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.mt-3{margin-top:.75rem}.mt-6{margin-top:1.5rem}.flex{display:flex}.h-full{height:100%}.w-full{width:100%}.max-w-full{max-width:100%}.resize-none{resize:none}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.items-center{align-items:center}.self-end{align-self:flex-end}.px-8{padding-left:2rem;padding-right:2rem}.py-4{padding-top:1rem;padding-bottom:1rem}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-xl{font-size:1.25rem;line-height:1.75rem}.font-bold{font-weight:700}@media (prefers-color-scheme: dark){.dark\:bg-neutral-800{--tw-bg-opacity:1;background-color:rgb(38 38 38 / var(--tw-bg-opacity))}.dark\:text-neutral-300{--tw-text-opacity:1;color:rgb(212 212 212 / var(--tw-text-opacity))}}.input:focus{border-radius:.5rem}@media (prefers-color-scheme: dark){.input{--tw-bg-opacity:1;background-color:rgb(38 38 38 / var(--tw-bg-opacity))}}.button{--tw-bg-opacity:1;background-color:rgb(226 232 240 / var(--tw-bg-opacity));padding:1rem}.button:hover{border-radius:.5rem;--tw-drop-shadow:drop-shadow(0 4px 3px rgb(0 0 0 / .07)) drop-shadow(0 2px 2px rgb(0 0 0 / .06));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}@media (prefers-color-scheme: dark){.button{--tw-bg-opacity:1;background-color:rgb(51 65 85 / var(--tw-bg-opacity))}}.input,.button{border-bottom-left-radius:.5rem;border-top-right-radius:.5rem;border-width:1px;--tw-border-opacity:1;border-color:rgb(0 0 0 / var(--tw-border-opacity));transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.3s}@media (prefers-color-scheme: dark){.input,.button{--tw-border-opacity:1;border-color:rgb(212 212 212 / var(--tw-border-opacity))}}</style><link rel="preload" href="/_astro/delete.4b1c40a3.css" as="style" onload="this.rel='stylesheet'"><noscript><link rel="stylesheet" href="/_astro/delete.4b1c40a3.css"></noscript>
|
||||
<link rel="preload" href="/_astro/delete.cae7b1eb.css" as="style" onload="this.rel='stylesheet'"><noscript><link rel="stylesheet" href="/_astro/delete.cae7b1eb.css"></noscript></head>
|
||||
<body class="h-full font-mono dark:bg-neutral-800 dark:text-neutral-300">
|
||||
|
||||
<div class="flex h-full flex-row items-center px-8 py-4">
|
||||
<div class="flex w-full flex-col items-center">
|
||||
|
||||
<form action="((%u))api/submit" method="post" class="flex max-w-full flex-col">
|
||||
<label for="key" class="text-xl font-bold">Paste your pgp keyblock here:</label>
|
||||
<textarea name="key" id="key-input" cols="65" rows="20" class="input mt-3 resize-none" placeholder="-----BEGIN PGP PUBLIC KEY BLOCK-----" required=""></textarea>
|
||||
<button type="submit" class="button mt-6 self-end">Submit</button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body></html>
|
||||
</body></html>
|
18
assets/webpage/success/index.html
Normal file
18
assets/webpage/success/index.html
Normal file
|
@ -0,0 +1,18 @@
|
|||
<!DOCTYPE html><html lang="en" class="h-full"><head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
|
||||
<meta name="generator" content="Astro v2.3.0">
|
||||
<title>Success!</title>
|
||||
<style>*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content:""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal}body{margin:0;line-height:inherit}h1{font-size:inherit;font-weight:inherit}h1{margin:0}*,:before,:after{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgb(59 130 246 / .5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.flex{display:flex}.h-full{height:100%}.w-full{width:100%}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.items-center{align-items:center}.px-8{padding-left:2rem;padding-right:2rem}.py-4{padding-top:1rem;padding-bottom:1rem}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-4xl{font-size:2.25rem;line-height:2.5rem}.font-bold{font-weight:700}@media (prefers-color-scheme: dark){.dark\:bg-neutral-800{--tw-bg-opacity:1;background-color:rgb(38 38 38 / var(--tw-bg-opacity))}.dark\:text-neutral-300{--tw-text-opacity:1;color:rgb(212 212 212 / var(--tw-text-opacity))}}</style><link rel="preload" href="/_astro/delete.4b1c40a3.css" as="style" onload="this.rel='stylesheet'"><noscript><link rel="stylesheet" href="/_astro/delete.4b1c40a3.css"></noscript></head>
|
||||
<body class="h-full font-mono dark:bg-neutral-800 dark:text-neutral-300">
|
||||
|
||||
<div class="flex h-full flex-row items-center px-8 py-4">
|
||||
<div class="flex w-full flex-col items-center">
|
||||
|
||||
<h1 class="text-4xl font-bold">((%m))</h1>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body></html>
|
50
src/main.rs
50
src/main.rs
|
@ -12,6 +12,7 @@ use self::confirmation::{confirm_action, send_confirmation_email};
|
|||
use self::management::{clean_stale, store_pending_addition, store_pending_deletion, Action};
|
||||
use self::utils::{gen_random_token, get_email_from_cert, parse_pem};
|
||||
|
||||
use actix_files::Files;
|
||||
use actix_web::http::header::ContentType;
|
||||
use actix_web::http::StatusCode;
|
||||
use actix_web::{
|
||||
|
@ -40,6 +41,21 @@ struct Email {
|
|||
email: String,
|
||||
}
|
||||
|
||||
fn return_success(message: &str) -> Result<HttpResponse, Error> {
|
||||
let path = webpage_path!().join("success").join("index.html");
|
||||
let template = match fs::read_to_string(&path) {
|
||||
Ok(template) => template,
|
||||
Err(_) => {
|
||||
debug!("file {} is inaccessible", path.display());
|
||||
return Err(Error::Inaccessible);
|
||||
}
|
||||
};
|
||||
let page = template.replace("((%m))", message);
|
||||
return Ok(HttpResponseBuilder::new(StatusCode::OK)
|
||||
.insert_header(ContentType::html())
|
||||
.body(page));
|
||||
}
|
||||
|
||||
#[actix_web::main]
|
||||
async fn main() -> std::io::Result<()> {
|
||||
if let Ok(value) = env::var("RUST_LOG") {
|
||||
|
@ -68,6 +84,13 @@ async fn main() -> std::io::Result<()> {
|
|||
.service(submit)
|
||||
.service(confirm)
|
||||
.service(delete)
|
||||
.service(
|
||||
Files::new(
|
||||
"/.well-known",
|
||||
Path::new(&SETTINGS.root_folder).join(".well-known"),
|
||||
)
|
||||
.use_hidden_files(),
|
||||
)
|
||||
.route("/{filename:.*}", web::get().to(index))
|
||||
})
|
||||
.bind(("127.0.0.1", SETTINGS.port))?
|
||||
|
@ -87,11 +110,11 @@ async fn index(req: HttpRequest) -> Result<HttpResponse, Error> {
|
|||
let template = match fs::read_to_string(&path) {
|
||||
Ok(template) => template,
|
||||
Err(_) => {
|
||||
debug!("file {} is inaccessible", path.display());
|
||||
debug!("File {} is inaccessible", path.display());
|
||||
return Err(Error::Inaccessible);
|
||||
}
|
||||
};
|
||||
let page = template.replace("{{%u}}", SETTINGS.external_url.as_ref());
|
||||
let page = template.replace("((%u))", SETTINGS.external_url.as_ref());
|
||||
return Ok(HttpResponseBuilder::new(StatusCode::OK)
|
||||
.insert_header(ContentType::html())
|
||||
.body(page));
|
||||
|
@ -102,7 +125,7 @@ async fn index(req: HttpRequest) -> Result<HttpResponse, Error> {
|
|||
}
|
||||
|
||||
#[post("/api/submit")]
|
||||
async fn submit(pem: web::Form<Key>) -> Result<String> {
|
||||
async fn submit(pem: web::Form<Key>) -> Result<HttpResponse, Error> {
|
||||
let cert = parse_pem(&pem.key)?;
|
||||
let email = get_email_from_cert(&cert)?;
|
||||
is_email_allowed(&email)?;
|
||||
|
@ -110,26 +133,29 @@ async fn submit(pem: web::Form<Key>) -> Result<String> {
|
|||
store_pending_addition(pem.key.clone(), &email, &token)?;
|
||||
send_confirmation_email(&email, &Action::Add, &token)?;
|
||||
info!("User {} submitted a key!", &email);
|
||||
Ok(String::from("(0x00) Key submitted successfully!"))
|
||||
return_success("You submitted your key successfully!")
|
||||
}
|
||||
|
||||
#[get("/api/confirm")]
|
||||
async fn confirm(token: web::Query<Token>) -> Result<String> {
|
||||
async fn confirm(token: web::Query<Token>) -> Result<HttpResponse, Error> {
|
||||
let (action, email) = confirm_action(&token.token)?;
|
||||
match action {
|
||||
Action::Add => info!("Key for user {} was added successfully!", email),
|
||||
Action::Delete => info!("Key for user {} was deleted successfully!", email),
|
||||
Action::Add => {
|
||||
info!("Key for user {} was added successfully!", email);
|
||||
return_success("Your key was added successfully!")
|
||||
}
|
||||
Action::Delete => {
|
||||
info!("Key for user {} was deleted successfully!", email);
|
||||
return_success("Your key was deleted successfully!")
|
||||
}
|
||||
}
|
||||
Ok(String::from("(0x00) Confirmation successful!"))
|
||||
}
|
||||
|
||||
#[get("/api/delete")]
|
||||
async fn delete(email: web::Query<Email>) -> Result<String> {
|
||||
async fn delete(email: web::Query<Email>) -> Result<HttpResponse, Error> {
|
||||
let token = gen_random_token();
|
||||
store_pending_deletion(email.email.clone(), &token)?;
|
||||
send_confirmation_email(&email.email, &Action::Delete, &token)?;
|
||||
info!("User {} requested the deletion of his key!", email.email);
|
||||
Ok(String::from(
|
||||
"(0x00) Deletion request submitted successfully!",
|
||||
))
|
||||
return_success("You requested the deletion of your key successfully!")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue