add version in about page

This commit is contained in:
cupcakearmy 2021-12-22 15:20:30 +01:00
parent c8a25eb9bf
commit c8b2539414
No known key found for this signature in database
GPG Key ID: 3235314B4D31232F
6 changed files with 70 additions and 35 deletions

2
Cargo.lock generated
View File

@ -515,7 +515,7 @@ dependencies = [
[[package]]
name = "cryptgeon"
version = "1.2.0"
version = "1.3.0"
dependencies = [
"actix-files",
"actix-web",

View File

@ -1,6 +1,6 @@
[package]
name = "cryptgeon"
version = "1.2.0"
version = "1.3.0"
authors = ["cupcakearmy <hi@nicco.io>"]
edition = "2018"

View File

@ -1,8 +1,8 @@
import { call } from '$lib/api'
import { onMount } from 'svelte'
import { writable } from 'svelte/store'
export type Status = {
version: string
max_size: number
}

View File

@ -0,0 +1,19 @@
<script lang="ts">
export let title: string
</script>
<p>
<b>{title}</b>
<slot />
</p>
<style>
b {
display: block;
margin-bottom: 0.25rem;
}
p > :global(span) {
padding-left: 1.25em;
}
</style>

View File

@ -1,5 +1,8 @@
<script context="module">
import { browser, dev } from '$app/env'
import { status } from '$lib/stores/status'
import AboutParagraph from '$lib/ui/AboutParagraph.svelte'
export const hydrate = dev
export const router = browser
export const prerender = true
@ -13,45 +16,52 @@
<h1>About</h1>
<p>
<i>cryptgeon</i> is a secure, open source sharing note service inspired by
<i>cryptgeon</i> is a secure, open source sharing note / file service inspired by
<a href="https://privnote.com"><i>PrivNote</i></a>.
</p>
<p>
<b>▶ how does it work?</b>
<br />
each note has a 512bit generated <i>id</i> that is used to retrieve the note. the note is then encrypted
with aes in gcm mode on the client side and then sent to the server. data is stored in memory and
never persisted to disk. the server never sees the encryption key and cannot decrypt the contents
of the notes even if it tried to.
</p>
<AboutParagraph title="how does it work?">
<span>
each note has a 512bit generated <i>id</i> that is used to retrieve the note. the note is then
encrypted with aes in gcm mode on the client side and then sent to the server. data is stored in
memory and never persisted to disk. the server never sees the encryption key and cannot decrypt
the contents of the notes even if it tried to.
</span>
</AboutParagraph>
<b>▶ features</b>
<AboutParagraph title="features">
<ul>
<li>server cannot decrypt contents due to client side encryption</li>
<li>view and time constraints</li>
<li>in memory, no persistence</li>
</ul>
</AboutParagraph>
<p>
<b>▶ tech stack</b>
<br />
<AboutParagraph title="tech stack">
<span>
the backend is written in rust and the frontend is svelte and typescript.
<br />
you are welcomed to check & audit the
<a href="https://github.com/cupcakearmy/cryptgeon" target="_blank" rel="noopener">source code</a
>.
</p>
<a href="https://github.com/cupcakearmy/cryptgeon" target="_blank" rel="noopener">
source code
</a>.
</span>
</AboutParagraph>
<p>
<br />
<b>▶ attributions</b>
<br />
<small>
<AboutParagraph title="attribution">
<span>
icons made by <a href="https://www.freepik.com" title="Freepik">freepik</a> from
<a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a>
</small>
</p>
</span>
</AboutParagraph>
<AboutParagraph title="version">
<span>
{#if $status}
<code>v{$status.version}</code>
{/if}
</span>
</AboutParagraph>
</section>
<style>

View File

@ -107,13 +107,19 @@ async fn delete(path: web::Path<NotePath>) -> impl Responder {
#[derive(Serialize, Deserialize)]
struct Status {
version: String,
max_size: usize,
}
#[get("/status")]
async fn status() -> impl Responder {
println!("Limit: {}", *LIMIT);
return HttpResponse::Ok().json(Status { max_size: *LIMIT });
return HttpResponse::Ok().json(Status {
version: option_env!("CARGO_PKG_VERSION")
.unwrap_or("Unknown")
.to_string(),
max_size: *LIMIT,
});
}
pub fn init(cfg: &mut web::ServiceConfig) {