Skip to content

Commit

Permalink
add version in about page
Browse files Browse the repository at this point in the history
  • Loading branch information
cupcakearmy committed Dec 22, 2021
1 parent c8a25eb commit c8b2539
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 35 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cryptgeon"
version = "1.2.0"
version = "1.3.0"
authors = ["cupcakearmy <[email protected]>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion client/src/lib/stores/status.ts
Original file line number Diff line number Diff line change
@@ -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
}

Expand Down
19 changes: 19 additions & 0 deletions client/src/lib/ui/AboutParagraph.svelte
Original file line number Diff line number Diff line change
@@ -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>
72 changes: 41 additions & 31 deletions client/src/routes/about.svelte
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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>
<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 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 />
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>
<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>.
</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>
Expand Down
8 changes: 7 additions & 1 deletion src/note/routes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit c8b2539

Please sign in to comment.