mirror of
https://github.com/cupcakearmy/cryptgeon.git
synced 2025-09-04 00:20:39 +00:00
Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
edbf8a8ecf | |||
4852804581 | |||
22b1c35b3e | |||
d1e9ffd89b | |||
9c675ba48c | |||
ef3d3d5bde | |||
7e835af3f2 | |||
f153102978 |
@@ -1 +1,2 @@
|
||||
target
|
||||
target
|
||||
node_modules
|
21
CHANGELOG.md
21
CHANGELOG.md
@@ -5,6 +5,27 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [1.0.11] - 2021-05-08
|
||||
|
||||
### Added
|
||||
|
||||
- loading text
|
||||
- description for created notes about availability
|
||||
|
||||
### Changed
|
||||
|
||||
- iterations from 100 to 100k
|
||||
|
||||
### Fixed
|
||||
|
||||
- time based view bug
|
||||
|
||||
## [1.0.10] - 2021-05-08
|
||||
|
||||
### Fixed
|
||||
|
||||
- API endpoint was not reachable
|
||||
|
||||
## [1.0.9] - 2021-05-07
|
||||
|
||||
## Changed
|
||||
|
@@ -23,4 +23,6 @@ COPY --from=CLIENT /tmp/build ./client/build
|
||||
|
||||
ENV MEMCACHE=memcached:11211
|
||||
|
||||
EXPOSE 5000
|
||||
|
||||
ENTRYPOINT [ "/app/cryptgeon" ]
|
@@ -13,7 +13,7 @@ type CallOptions = {
|
||||
method: string
|
||||
body?: any
|
||||
}
|
||||
const base = dev ? 'http://localhost:5000' : undefined
|
||||
const base = dev ? 'http://localhost:5000/api/' : '/api/'
|
||||
async function call(options: CallOptions) {
|
||||
return fetch(base + options.url, {
|
||||
method: options.method,
|
||||
@@ -27,7 +27,7 @@ async function call(options: CallOptions) {
|
||||
|
||||
export async function create(note: Note) {
|
||||
const data = await call({
|
||||
url: '/api/notes',
|
||||
url: 'notes',
|
||||
method: 'post',
|
||||
body: note,
|
||||
})
|
||||
@@ -36,7 +36,7 @@ export async function create(note: Note) {
|
||||
|
||||
export async function get(id: string) {
|
||||
const data = await call({
|
||||
url: `/api/notes/${id}`,
|
||||
url: `notes/${id}`,
|
||||
method: 'delete',
|
||||
})
|
||||
return data as NotePublic
|
||||
@@ -44,7 +44,7 @@ export async function get(id: string) {
|
||||
|
||||
export async function info(id: string) {
|
||||
const data = await call({
|
||||
url: `/api/notes/${id}`,
|
||||
url: `notes/${id}`,
|
||||
method: 'get',
|
||||
})
|
||||
return data as NoteInfo
|
||||
|
@@ -36,7 +36,7 @@ export function getKeyFromString(password: string) {
|
||||
}
|
||||
|
||||
export async function getDerivedForKey(key: CryptoKey, salt: ArrayBuffer) {
|
||||
const iterations = 1_000
|
||||
const iterations = 100_000
|
||||
return window.crypto.subtle.deriveKey(
|
||||
{
|
||||
name: 'PBKDF2',
|
||||
|
@@ -66,11 +66,21 @@
|
||||
<TextInput
|
||||
type="text"
|
||||
readonly
|
||||
label="share link"
|
||||
value="{window.location.origin}/note/{result.id}/{result.password}"
|
||||
copy
|
||||
/>
|
||||
<br />
|
||||
<Button on:click={reset}>new</Button>
|
||||
<p>
|
||||
<b>availability:</b>
|
||||
<br />
|
||||
the note is not guaranteed to be stored as everything is kept in ram, if it fills up the oldest notes
|
||||
will be removed.
|
||||
<br />
|
||||
(you probably will be fine, just be warned.)
|
||||
</p>
|
||||
<br />
|
||||
<Button on:click={reset}>new note</Button>
|
||||
{:else}
|
||||
<form on:submit|preventDefault={submit}>
|
||||
<fieldset disabled={loading}>
|
||||
@@ -85,7 +95,14 @@
|
||||
<div class="error-text">{error}</div>
|
||||
{/if}
|
||||
|
||||
<p><br />{message}</p>
|
||||
<p>
|
||||
<br />
|
||||
{#if loading}
|
||||
loading...
|
||||
{:else}
|
||||
{message}
|
||||
{/if}
|
||||
</p>
|
||||
|
||||
<div class="advanced" class:hidden={!advanced}>
|
||||
<br />
|
||||
|
@@ -7,14 +7,13 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte'
|
||||
import copy from 'copy-to-clipboard'
|
||||
|
||||
import type { NotePublic } from '$lib/api'
|
||||
import { info, get } from '$lib/api'
|
||||
import { decrypt, getKeyFromString } from '$lib/crypto'
|
||||
import Button from '$lib/ui/Button.svelte'
|
||||
import TextInput from '$lib/ui/TextInput.svelte'
|
||||
import copy from 'copy-to-clipboard'
|
||||
|
||||
import { onMount } from 'svelte'
|
||||
|
||||
export let id: string
|
||||
export let password: string
|
||||
@@ -41,12 +40,15 @@
|
||||
async function show() {
|
||||
try {
|
||||
error = false
|
||||
loading = true
|
||||
const data = note || (await get(id)) // Don't get the content twice on wrong password.
|
||||
const key = await getKeyFromString(password)
|
||||
data.contents = await decrypt(data.contents, key)
|
||||
note = data
|
||||
} catch {
|
||||
error = true
|
||||
} finally {
|
||||
loading = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -63,18 +65,23 @@
|
||||
<Button on:click={() => copy(note.contents)}>copy to clipboard</Button>
|
||||
{:else}
|
||||
<form on:submit|preventDefault={show}>
|
||||
<p>click below to show and delete the note if the counter has reached it's limit</p>
|
||||
<Button type="submit">show note</Button>
|
||||
{#if error}
|
||||
<br />
|
||||
<p class="error-text">
|
||||
wrong password. could not decipher. probably a broken link. note was destroyed.
|
||||
<fieldset>
|
||||
<p>click below to show and delete the note if the counter has reached it's limit</p>
|
||||
<Button type="submit">show note</Button>
|
||||
{#if error}
|
||||
<br />
|
||||
</p>
|
||||
{/if}
|
||||
<p class="error-text">
|
||||
wrong password. could not decipher. probably a broken link. note was destroyed.
|
||||
<br />
|
||||
</p>
|
||||
{/if}
|
||||
</fieldset>
|
||||
</form>
|
||||
{/if}
|
||||
{/if}
|
||||
{#if loading}
|
||||
<p>loading...</p>
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
.note {
|
||||
|
@@ -56,7 +56,8 @@ async fn create(note: web::Json<Note>) -> impl Responder {
|
||||
if e > 360 {
|
||||
return bad_req;
|
||||
}
|
||||
n.expiration = Some(now() + (e * 60))
|
||||
let expiration = now() + (e * 60);
|
||||
n.expiration = Some(expiration);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
@@ -89,8 +90,8 @@ async fn delete(path: web::Path<NotePath>) -> impl Responder {
|
||||
}
|
||||
match changed.expiration {
|
||||
Some(e) => {
|
||||
if e > now() {
|
||||
store::del(&p.id.clone());
|
||||
store::del(&p.id.clone());
|
||||
if e < now() {
|
||||
return HttpResponse::BadRequest().finish();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user