Compare commits

..

20 Commits

Author SHA1 Message Date
fe5ce580ab locales 2023-01-04 19:45:25 +01:00
0f882da5d1 bump version 2023-01-04 19:45:18 +01:00
ad6f136dd0 qr code 2023-01-04 19:40:37 +01:00
da527a0857 2.0.7 2022-12-26 22:54:47 +01:00
a95931ae77 update deps 2022-12-26 18:00:00 +01:00
d6c2236673 update deps 2022-12-26 12:59:37 +01:00
42a8ab5d0f test command 2022-11-15 13:15:34 +01:00
0934808a59 testing 2022-11-15 13:05:13 +01:00
88ea828b66 upload 2022-11-15 12:35:02 +01:00
41ed5c0e23 ci 2022-11-15 12:17:52 +01:00
0a98481991 use npx 2022-11-15 12:13:03 +01:00
5d62c48a35 don't use pnpm 2022-11-14 16:26:51 +01:00
0ab39023b0 test 2022-11-14 16:16:50 +01:00
7b202962e8 testing 2022-11-14 15:55:49 +01:00
7a045b3f34 test on docker image 2022-11-14 15:47:12 +01:00
cb80c8bfe4 changelog 2022-11-12 14:40:21 +01:00
74c3197e47 update dependencies and fix some a11y issues 2022-11-12 14:40:17 +01:00
6ae927ce71 update version and dependencies 2022-11-12 13:55:33 +01:00
9d13e607f5 #66 set minimum 2022-11-12 13:42:09 +01:00
0db3ef4a1f changelog and only test on x86 2022-11-04 23:34:36 +01:00
35 changed files with 1063 additions and 976 deletions

2
.dev.env Normal file
View File

@@ -0,0 +1,2 @@
SIZE_LIMIT=10MiB
VERBOSITY=debug

View File

@@ -7,52 +7,30 @@ on:
pull_request:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
arch: ["linux/amd64", "linux/arm64"]
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
install: true
- name: Build and push
uses: docker/build-push-action@v2
with:
platforms: ${{ matrix.arch }}
push: false
test:
runs-on: ubuntu-latest
services:
redis:
image: redis:7-alpine
ports:
- 6379:6379
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: "16"
- uses: pnpm/action-setup@v2
- uses: docker/setup-qemu-action@v1
- uses: docker/setup-buildx-action@v1
with:
version: 7
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.64
install: true
- name: Build docker image
run: npm run test:prepare
- name: Prepare
run: |
pnpm install
pnpm run test:prepare
- name: Install Playwright
run: npx playwright install --with-deps
npm install playwright
npx playwright install --with-deps
- name: Run your tests
run: pnpm run test:run
- name: Upload test results
run: npm test
- uses: actions/upload-artifact@v2
if: always()
uses: actions/upload-artifact@v2
with:
name: test-results
path: test-results

View File

@@ -1,6 +0,0 @@
{
"cSpell.words": ["ciphertext", "cryptgeon"],
"i18n-ally.localesPaths": ["packages/frontend/locales"],
"i18n-ally.enabledFrameworks": ["svelte"],
"i18n-ally.keystyle": "nested"
}

View File

@@ -5,12 +5,40 @@ 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).
## [2.1.0] - 2023-01-04
### Added
- QR Code to more easily copy and share links.
## [2.0.7] - 2022-12-26
### Changed
- Svelte Kit now stable 🎉
## [2.0.6] - 2022-11-12
### Fixed
- #66 Set minimum a view.
### Security
- Updated dependencies.
## [2.0.5] - 2022-11-04
### Fixed
- Docker build pipeline.
## [2.0.4] - 2022-10-29
### Added
- `THEME_PAGE_TITLE`
- `THEME_FAVICON`
- `THEME_PAGE_TITLE`.
- `THEME_FAVICON`.
## [2.0.3] - 2022-10-07
@@ -28,7 +56,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Toasts for events.
- E2E Tests.
- Make backend more configurable
- Make backend more configurable.
## [2.0.1] - 2022-07-18

16
cryptgeon.code-workspace Normal file
View File

@@ -0,0 +1,16 @@
{
"folders": [
{
"path": "."
},
{
"path": "packages/backend"
}
],
"settings": {
"cSpell.words": ["ciphertext", "cryptgeon"],
"i18n-ally.enabledFrameworks": ["svelte"],
"i18n-ally.keystyle": "nested",
"i18n-ally.localesPaths": ["packages/frontend/locales"]
}
}

View File

@@ -10,11 +10,10 @@ services:
- 6379:6379
app:
# build: .
image: cupcakearmy/cryptgeon
image: cupcakearmy/cryptgeon:test
build: .
env_file: .dev.env
depends_on:
- redis
environment:
SIZE_LIMIT: 10 MiB
ports:
- 1234:5000

18
docker-compose.yaml Normal file
View File

@@ -0,0 +1,18 @@
version: '3.8'
services:
redis:
image: redis:7-alpine
# Set a size limit. See link below on how to customise.
# https://redis.io/docs/manual/eviction/
# command: redis-server --maxmemory 1gb --maxmemory-policy allkeys-lru
app:
image: cupcakearmy/cryptgeon:latest
depends_on:
- redis
environment:
# Size limit for a single note.
SIZE_LIMIT: 4 MiB
ports:
- 80:5000

View File

@@ -1,17 +1,17 @@
{
"scripts": {
"dev:docker": "docker-compose up redis",
"dev:docker": "docker-compose -f docker-compose.dev.yaml up redis",
"dev:packages": "pnpm --parallel run dev",
"dev:proxy": "node proxy.mjs",
"dev": "run-p dev:*",
"test:run": "playwright test --project chrome firefox safari",
"test": "playwright test --project chrome firefox safari",
"test:local": "playwright test --project local",
"test:server": "pnpm --parallel run test:server",
"test:prepare": "pnpm --parallel run test:prepare"
"test:server": "docker compose -f docker-compose.dev.yaml up",
"test:prepare": "docker compose -f docker-compose.dev.yaml build"
},
"devDependencies": {
"@playwright/test": "^1.25.1",
"@types/node": "^16.11.57",
"@playwright/test": "^1.29.1",
"@types/node": "^16.18.10",
"http-proxy": "^1.18.1",
"npm-run-all": "^4.1.5"
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
[package]
name = "cryptgeon"
version = "2.0.4"
version = "2.1.0"
authors = ["cupcakearmy <hi@nicco.io>"]
edition = "2021"

View File

@@ -49,7 +49,7 @@ async fn create(note: web::Json<Note>) -> impl Responder {
}
match n.views {
Some(v) => {
if v > *config::MAX_VIEWS {
if v > *config::MAX_VIEWS || v < 1 {
return bad_req;
}
n.expiration = None; // views overrides expiration

View File

@@ -15,7 +15,8 @@
"encrypting": "verschlüsseln",
"decrypting": "entschlüsselt",
"uploading": "hochladen",
"downloading": "wird heruntergeladen"
"downloading": "wird heruntergeladen",
"qr_code": "qr-code"
},
"home": {
"intro": "Senden Sie ganz einfach <i>vollständig verschlüsselte</i>, sichere Notizen oder Dateien mit einem Klick. Erstellen Sie einfach eine Notiz und teilen Sie den Link.",

View File

@@ -15,7 +15,8 @@
"encrypting": "encrypting",
"decrypting": "decrypting",
"uploading": "uploading",
"downloading": "downloading"
"downloading": "downloading",
"qr_code": "qr code"
},
"home": {
"intro": "Easily send <i>fully encrypted</i>, secure notes or files with one click. Just create a note and share the link.",

View File

@@ -15,7 +15,8 @@
"encrypting": "encriptando",
"decrypting": "descifrando",
"uploading": "cargando",
"downloading": "descargando"
"downloading": "descargando",
"qr_code": "código qr"
},
"home": {
"intro": "Envía fácilmente notas o archivos <i>totalmente encriptados</i> y seguros con un solo clic. Solo tienes que crear una nota y compartir el enlace.",

View File

@@ -15,7 +15,8 @@
"encrypting": "cryptage",
"decrypting": "déchiffrer",
"uploading": "téléchargement",
"downloading": "téléchargement"
"downloading": "téléchargement",
"qr_code": "code qr"
},
"home": {
"intro": "Envoyez facilement des notes ou des fichiers <i>entièrement cryptés</i> et sécurisés en un seul clic. Il suffit de créer une note et de partager le lien.",

View File

@@ -15,7 +15,8 @@
"encrypting": "criptando",
"decrypting": "decifrando",
"uploading": "caricamento",
"downloading": "scaricando"
"downloading": "scaricando",
"qr_code": "codice qr"
},
"home": {
"intro": "Invia facilmente note o file <i>completamente criptati</i> e sicuri con un solo clic. Basta creare una nota e condividere il link.",

View File

@@ -15,7 +15,8 @@
"encrypting": "加密",
"decrypting": "解密",
"uploading": "上传",
"downloading": "下载"
"downloading": "下载",
"qr_code": "二维码"
},
"home": {
"intro": "一键轻松发送 <i>完全加密的</i> 密信或者文件。只需创建一个密信然后分享链接。",

View File

@@ -11,27 +11,28 @@
},
"type": "module",
"devDependencies": {
"@lokalise/node-api": "^7.3.1",
"@sveltejs/adapter-static": "1.0.0-next.42",
"@sveltejs/kit": "1.0.0-next.480",
"@types/dompurify": "^2.3.3",
"@lokalise/node-api": "^9.3.0",
"@sveltejs/adapter-static": "^1.0.0",
"@sveltejs/kit": "^1.0.1",
"@types/dompurify": "^2.4.0",
"@types/file-saver": "^2.0.5",
"@zerodevx/svelte-toast": "^0.7.2",
"adm-zip": "^0.5.9",
"dotenv": "^16.0.1",
"svelte": "^3.49.0",
"svelte-check": "^2.8.0",
"adm-zip": "^0.5.10",
"dotenv": "^16.0.3",
"svelte": "^3.55.0",
"svelte-check": "^2.10.3",
"svelte-intl-precompile": "^0.10.1",
"svelte-preprocess": "^4.10.7",
"tslib": "^2.4.0",
"typescript": "^4.7.4",
"vite": "^3.0.2"
"tslib": "^2.4.1",
"typescript": "^4.9.4",
"vite": "^4.0.3"
},
"dependencies": {
"@fontsource/fira-mono": "^4.5.8",
"copy-to-clipboard": "^3.3.1",
"dompurify": "^2.3.10",
"@fontsource/fira-mono": "^4.5.10",
"copy-to-clipboard": "^3.3.3",
"dompurify": "^2.4.1",
"file-saver": "^2.0.5",
"pretty-bytes": "^5.6.0"
"pretty-bytes": "^6.0.0",
"qrious": "^4.0.2"
}
}

View File

@@ -1,7 +1,7 @@
import dotenv from 'dotenv'
import { LokaliseApi } from '@lokalise/node-api'
import https from 'https'
import AdmZip from 'adm-zip'
import dotenv from 'dotenv'
import https from 'https'
dotenv.config()

View File

@@ -87,6 +87,8 @@ button {
font-size: inherit;
background: inherit;
color: inherit;
border: none;
padding-inline: initial;
}
*:disabled,

View File

@@ -18,8 +18,9 @@
bind:value={note.views}
disabled={timeExpiration}
max={$status?.max_views}
min={1}
validate={(v) =>
($status && v <= $status?.max_views) ||
($status && v <= $status?.max_views && v > 0) ||
$t('home.errors.max', { values: { n: $status?.max_views ?? 0 } })}
/>
<div class="middle-switch">

View File

@@ -0,0 +1,41 @@
<script lang="ts">
import QR from 'qrious'
import { t } from 'svelte-intl-precompile'
import { getCSSVariable } from '$lib/utils'
export let value: string
let canvas: HTMLCanvasElement
$: {
new QR({
value,
level: 'Q',
size: 800,
background: getCSSVariable('--ui-bg-0'),
foreground: getCSSVariable('--ui-text-0'),
element: canvas,
})
}
</script>
<small>{$t('common.qr_code')}</small>
<div>
<canvas bind:this={canvas} />
</div>
<style>
div {
padding: 0.5rem;
width: fit-content;
border: 2px solid var(--ui-bg-1);
background-color: var(--ui-bg-0);
margin-top: 0.125rem;
}
canvas {
width: 100%;
height: auto;
}
</style>

View File

@@ -10,9 +10,12 @@
import Button from '$lib/ui/Button.svelte'
import TextInput from '$lib/ui/TextInput.svelte'
import Canvas from './Canvas.svelte'
export let result: NoteResult
$: url = `${window.location.origin}/note/${result.id}#${result.password}`
function reset() {
window.location.reload()
}
@@ -22,11 +25,15 @@
type="text"
readonly
label={$t('common.share_link')}
value="{window.location.origin}/note/{result.id}#{result.password}"
value={url}
copy
data-testid="share-link"
/>
<br />
<div>
<Canvas value={url} />
</div>
<p>
{@html $t('home.new_note_notice')}
</p>
@@ -34,4 +41,9 @@
<Button on:click={reset}>{$t('home.new_note')}</Button>
<style>
div {
width: min(12rem, 100%);
margin-top: 1rem;
margin-bottom: 1rem;
}
</style>

View File

@@ -53,7 +53,9 @@
{:else}
{#each files as file}
<div class="note file">
<b on:click={() => downloadFile(file)}> {file.name}</b>
<button on:click={() => downloadFile(file)}>
<b>{file.name}</b>
</button>
<small> {file.type} {prettyBytes(file.size)}</small>
</div>
{/each}

View File

@@ -40,19 +40,19 @@
}
</script>
<div on:click={change}>
<button on:click={change}>
<Icon class="icon" icon="contrast" />
{$theme}
</div>
</button>
<style>
div :global(.icon) {
button :global(.icon) {
height: 1rem;
width: 1rem;
margin-right: 0.5rem;
}
div {
button {
display: flex;
flex-direction: row;
justify-content: flex-end;

View File

@@ -9,3 +9,8 @@ export function copy(value: string) {
const msg = get(t)('common.copied_to_clipboard')
notify.success(msg)
}
export function getCSSVariable(variable: string): string {
if (typeof window === 'undefined') return ''
return window.getComputedStyle(window.document.body).getPropertyValue(variable)
}

View File

@@ -7,7 +7,9 @@
<nav>
<a href="/">/home</a>
<a href="/about">/about</a>
<a href="https://github.com/cupcakearmy/cryptgeon" target="_blank" rel="noopener">/code</a>
<a href="https://github.com/cupcakearmy/cryptgeon" target="_blank" rel="noopener noreferrer">
code
</a>
</nav>
</footer>

View File

@@ -39,7 +39,7 @@
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">
<a href="https://github.com/cupcakearmy/cryptgeon" target="_blank" rel="noopener noreferrer">
source code
</a>.
</span>
@@ -47,9 +47,12 @@
<AboutParagraph title="translations">
<span
>translations are managed on <a href="https://lokalise.com/" target="_blank">Lokalise</a>,
which granted an open source license to use the paid version. If you are interested in helping
translating don't hesitate to contact me!
>translations are managed on <a
href="https://lokalise.com/"
target="_blank"
rel="noopener noreferrer">Lokalise</a
>, which granted an open source license to use the paid version. If you are interested in
helping translating don't hesitate to contact me!
</span>
</AboutParagraph>

View File

@@ -13,7 +13,7 @@ const config: PlaywrightTestConfig = {
testIgnore: ['file/too-big.spec.ts'],
webServer: {
command: 'pnpm run test:server',
command: 'docker compose -f docker-compose.dev.yaml up',
port: 1234,
reuseExistingServer: true,
},

1297
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -3,12 +3,13 @@ import httpProxy from 'http-proxy'
const proxy = httpProxy.createProxyServer()
proxy.on('error', function (err, req, res) {
console.error(err)
res.writeHead(500, { 'Content-Type': 'text/plain' })
res.end('500 Internal Server Error')
})
const server = http.createServer(function (req, res) {
const target = req.url.startsWith('/api/') ? 'http://localhost:5000' : 'http://localhost:3000'
const target = req.url.startsWith('/api/') ? 'http://127.0.0.1:5000' : 'http://localhost:3000'
proxy.web(req, res, { target })
})
server.listen(1234)

View File

@@ -1,5 +1,5 @@
export default {
PDF: 'test/assets/AES.pdf',
Image: 'test/assets/alfred-kenneally-UIu4RmMxnHU-unsplash.jpg',
Image: 'test/assets/image.jpg',
Zip: 'test/assets/Pigeons.zip',
}

View File

@@ -6,6 +6,6 @@ test('multiple', async ({ page }) => {
const files = [Files.PDF, Files.Image]
const checksums = await Promise.all(files.map(getFileChecksum))
const link = await createNote(page, { files, views: 2 })
await checkLinkForDownload(page, link, 'alfred-kenneally', checksums[1])
await checkLinkForDownload(page, link, 'image.jpg', checksums[1])
await checkLinkForDownload(page, link, 'AES.pdf', checksums[0])
})

View File

@@ -20,5 +20,5 @@ test('image content', async ({ page }) => {
const files = [Files.Image]
const checksum = await getFileChecksum(files[0])
const link = await createNote(page, { files })
await checkLinkForDownload(page, link, 'alfred-kenneally', checksum)
await checkLinkForDownload(page, link, 'image.jpg', checksum)
})