mirror of
https://github.com/cupcakearmy/cryptgeon.git
synced 2024-12-22 16:26:28 +00:00
Compare commits
7 Commits
c3794fa2b6
...
dfa2401eea
Author | SHA1 | Date | |
---|---|---|---|
dfa2401eea | |||
ea58d89f98 | |||
eaca1a981d | |||
199755d18e | |||
724d0709d3 | |||
bd5acca97a | |||
a0a99cd3cc |
@ -9,7 +9,7 @@ services:
|
|||||||
|
|
||||||
app:
|
app:
|
||||||
build: .
|
build: .
|
||||||
env_file: .dev.env
|
env_file: .env.dev
|
||||||
depends_on:
|
depends_on:
|
||||||
- redis
|
- redis
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
@ -38,10 +38,6 @@ pub static ref ALLOW_FILES: bool = std::env::var("ALLOW_FILES")
|
|||||||
.unwrap_or("true".to_string())
|
.unwrap_or("true".to_string())
|
||||||
.parse()
|
.parse()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
pub static ref THEME_NEW_NOTE_NOTICE: bool = std::env::var("THEME_NEW_NOTE_NOTICE")
|
|
||||||
.unwrap_or("true".to_string())
|
|
||||||
.parse()
|
|
||||||
.unwrap();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// THEME
|
// THEME
|
||||||
@ -62,4 +58,8 @@ lazy_static! {
|
|||||||
.unwrap_or("".to_string())
|
.unwrap_or("".to_string())
|
||||||
.parse()
|
.parse()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
pub static ref THEME_NEW_NOTE_NOTICE: bool = std::env::var("THEME_NEW_NOTE_NOTICE")
|
||||||
|
.unwrap_or("true".to_string())
|
||||||
|
.parse()
|
||||||
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use axum::{
|
use axum::{
|
||||||
extract::Request,
|
extract::{DefaultBodyLimit, Request},
|
||||||
routing::{delete, get, post},
|
routing::{delete, get, post},
|
||||||
Router, ServiceExt,
|
Router, ServiceExt,
|
||||||
};
|
};
|
||||||
@ -7,7 +7,6 @@ use dotenv::dotenv;
|
|||||||
use tower::Layer;
|
use tower::Layer;
|
||||||
use tower_http::{
|
use tower_http::{
|
||||||
compression::CompressionLayer,
|
compression::CompressionLayer,
|
||||||
limit::RequestBodyLimitLayer,
|
|
||||||
normalize_path::NormalizePathLayer,
|
normalize_path::NormalizePathLayer,
|
||||||
services::{ServeDir, ServeFile},
|
services::{ServeDir, ServeFile},
|
||||||
};
|
};
|
||||||
@ -47,14 +46,14 @@ async fn main() {
|
|||||||
let app = Router::new()
|
let app = Router::new()
|
||||||
.nest("/api", api_routes)
|
.nest("/api", api_routes)
|
||||||
.fallback_service(serve_dir)
|
.fallback_service(serve_dir)
|
||||||
|
.layer(DefaultBodyLimit::max(*config::LIMIT))
|
||||||
.layer(
|
.layer(
|
||||||
CompressionLayer::new()
|
CompressionLayer::new()
|
||||||
.br(true)
|
.br(true)
|
||||||
.deflate(true)
|
.deflate(true)
|
||||||
.gzip(true)
|
.gzip(true)
|
||||||
.zstd(true),
|
.zstd(true),
|
||||||
)
|
);
|
||||||
.layer(RequestBodyLimitLayer::new(*config::LIMIT));
|
|
||||||
|
|
||||||
let app = NormalizePathLayer::trim_trailing_slash().layer(app);
|
let app = NormalizePathLayer::trim_trailing_slash().layer(app);
|
||||||
|
|
||||||
@ -62,9 +61,7 @@ async fn main() {
|
|||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
println!("listening on {}", listener.local_addr().unwrap());
|
println!("listening on {}", listener.local_addr().unwrap());
|
||||||
println!("Config {}", *config::LIMIT);
|
|
||||||
axum::serve(listener, ServiceExt::<Request>::into_make_service(app))
|
axum::serve(listener, ServiceExt::<Request>::into_make_service(app))
|
||||||
// axum::serve(listener, app)
|
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
@ -13,12 +13,12 @@ pub struct Status {
|
|||||||
pub max_expiration: u32,
|
pub max_expiration: u32,
|
||||||
pub allow_advanced: bool,
|
pub allow_advanced: bool,
|
||||||
pub allow_files: bool,
|
pub allow_files: bool,
|
||||||
pub theme_new_note_notice: bool,
|
|
||||||
// Theme
|
// Theme
|
||||||
pub theme_image: String,
|
pub theme_image: String,
|
||||||
pub theme_text: String,
|
pub theme_text: String,
|
||||||
pub theme_page_title: String,
|
pub theme_page_title: String,
|
||||||
pub theme_favicon: String,
|
pub theme_favicon: String,
|
||||||
|
pub theme_new_note_notice: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn get_status() -> (StatusCode, Json<Status>) {
|
pub async fn get_status() -> (StatusCode, Json<Status>) {
|
||||||
|
@ -18,19 +18,19 @@
|
|||||||
export let icon: keyof typeof map
|
export let icon: keyof typeof map
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div on:click {...$$restProps}>
|
<button on:click {...$$restProps}>
|
||||||
{#if map[icon]}
|
{#if map[icon]}
|
||||||
<svelte:component this={map[icon]} />
|
<svelte:component this={map[icon]} />
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</button>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
div {
|
button {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
contain: strict;
|
contain: strict;
|
||||||
box-sizing: content-box;
|
box-sizing: content-box;
|
||||||
}
|
}
|
||||||
div > :global(svg) {
|
button > :global(svg) {
|
||||||
display: block;
|
display: block;
|
||||||
fill: currentColor;
|
fill: currentColor;
|
||||||
}
|
}
|
||||||
|
@ -116,6 +116,7 @@ export type Status = {
|
|||||||
theme_text: string
|
theme_text: string
|
||||||
theme_favicon: string
|
theme_favicon: string
|
||||||
theme_page_title: string
|
theme_page_title: string
|
||||||
|
theme_new_note_notice: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function status() {
|
export async function status() {
|
||||||
|
@ -9,7 +9,7 @@ const config: PlaywrightTestConfig = {
|
|||||||
|
|
||||||
outputDir: './test-results',
|
outputDir: './test-results',
|
||||||
testDir: './test',
|
testDir: './test',
|
||||||
timeout: 10_000,
|
timeout: 30_000,
|
||||||
fullyParallel: true,
|
fullyParallel: true,
|
||||||
|
|
||||||
webServer: {
|
webServer: {
|
||||||
@ -22,10 +22,6 @@ const config: PlaywrightTestConfig = {
|
|||||||
{ name: 'chrome', use: { ...devices['Desktop Chrome'] } },
|
{ name: 'chrome', use: { ...devices['Desktop Chrome'] } },
|
||||||
{ name: 'firefox', use: { ...devices['Desktop Firefox'] } },
|
{ name: 'firefox', use: { ...devices['Desktop Firefox'] } },
|
||||||
{ name: 'safari', use: { ...devices['Desktop Safari'] } },
|
{ name: 'safari', use: { ...devices['Desktop Safari'] } },
|
||||||
|
|
||||||
{ name: 'cli', use: { ...devices['Desktop Chrome'] }, grep: [/@cli/] },
|
|
||||||
{ name: 'web', use: { ...devices['Desktop Chrome'] }, grep: [/@web/] },
|
|
||||||
{ name: 'cross', use: { ...devices['Desktop Chrome'] }, grep: [/@cross/] },
|
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
import { test } from '@playwright/test'
|
import { test } from '@playwright/test'
|
||||||
import { basename } from 'node:path'
|
import { basename } from 'node:path'
|
||||||
import { Files, getFileChecksum, rm, tmpFile } from '../../files'
|
import { rm } from 'node:fs/promises'
|
||||||
|
import { Files, getFileChecksum, tmpFile } from '../../files'
|
||||||
import { CLI, getLinkFromCLI } from '../../utils'
|
import { CLI, getLinkFromCLI } from '../../utils'
|
||||||
|
|
||||||
test.describe('file @cli', () => {
|
test.describe('file @cli', () => {
|
||||||
test('simple', async ({ page }) => {
|
test('simple', async () => {
|
||||||
const file = await tmpFile(Files.Image)
|
const file = await tmpFile(Files.Image)
|
||||||
const checksum = await getFileChecksum(file)
|
const checksum = await getFileChecksum(file)
|
||||||
const note = await CLI('send', 'file', file)
|
const note = await CLI('send', 'file', file)
|
||||||
@ -17,7 +18,7 @@ test.describe('file @cli', () => {
|
|||||||
test.expect(checksum).toBe(c)
|
test.expect(checksum).toBe(c)
|
||||||
})
|
})
|
||||||
|
|
||||||
test('simple with password', async ({ page }) => {
|
test('simple with password', async () => {
|
||||||
const file = await tmpFile(Files.Image)
|
const file = await tmpFile(Files.Image)
|
||||||
const password = 'password'
|
const password = 'password'
|
||||||
const checksum = await getFileChecksum(file)
|
const checksum = await getFileChecksum(file)
|
||||||
|
@ -2,7 +2,7 @@ import { test } from '@playwright/test'
|
|||||||
import { CLI, getLinkFromCLI } from '../../utils'
|
import { CLI, getLinkFromCLI } from '../../utils'
|
||||||
|
|
||||||
test.describe('text @cli', () => {
|
test.describe('text @cli', () => {
|
||||||
test('simple', async ({ page }) => {
|
test('simple', async () => {
|
||||||
const text = `Endless prejudice endless play derive joy eternal-return selfish burying. Of decieve play pinnacle faith disgust. Spirit reason salvation burying strong of joy ascetic selfish against merciful sea truth. Ubermensch moral prejudice derive chaos mountains ubermensch justice philosophy justice ultimate joy ultimate transvaluation. Virtues convictions war ascetic eternal-return spirit. Ubermensch transvaluation noble revaluation sexuality intentions salvation endless decrepit hope noble fearful. Justice ideal ultimate snare god joy evil sexuality insofar gains oneself ideal.`
|
const text = `Endless prejudice endless play derive joy eternal-return selfish burying. Of decieve play pinnacle faith disgust. Spirit reason salvation burying strong of joy ascetic selfish against merciful sea truth. Ubermensch moral prejudice derive chaos mountains ubermensch justice philosophy justice ultimate joy ultimate transvaluation. Virtues convictions war ascetic eternal-return spirit. Ubermensch transvaluation noble revaluation sexuality intentions salvation endless decrepit hope noble fearful. Justice ideal ultimate snare god joy evil sexuality insofar gains oneself ideal.`
|
||||||
const note = await CLI('send', 'text', text)
|
const note = await CLI('send', 'text', text)
|
||||||
const link = getLinkFromCLI(note.stdout)
|
const link = getLinkFromCLI(note.stdout)
|
||||||
@ -11,7 +11,7 @@ test.describe('text @cli', () => {
|
|||||||
test.expect(retrieved.stdout.trim()).toBe(text)
|
test.expect(retrieved.stdout.trim()).toBe(text)
|
||||||
})
|
})
|
||||||
|
|
||||||
test('simple with password', async ({ page }) => {
|
test('simple with password', async () => {
|
||||||
const text = `Endless prejudice endless play derive joy eternal-return selfish burying.`
|
const text = `Endless prejudice endless play derive joy eternal-return selfish burying.`
|
||||||
const password = 'password'
|
const password = 'password'
|
||||||
const note = await CLI('send', 'text', text, '--password', password)
|
const note = await CLI('send', 'text', text, '--password', password)
|
||||||
|
@ -1,10 +1,5 @@
|
|||||||
import { createHash } from 'crypto'
|
import { createHash } from 'node:crypto'
|
||||||
import { cp as cpFN, rm as rmFN } from 'fs'
|
import { cp, readFile } from 'node:fs/promises'
|
||||||
import { readFile } from 'fs/promises'
|
|
||||||
import { promisify } from 'util'
|
|
||||||
|
|
||||||
export const cp = promisify(cpFN)
|
|
||||||
export const rm = promisify(rmFN)
|
|
||||||
|
|
||||||
export const Files = {
|
export const Files = {
|
||||||
PDF: 'test/assets/AES.pdf',
|
PDF: 'test/assets/AES.pdf',
|
||||||
|
@ -5,6 +5,6 @@ import { Files } from '../../files'
|
|||||||
test.describe('@web', () => {
|
test.describe('@web', () => {
|
||||||
test('to big zip', async ({ page }) => {
|
test('to big zip', async ({ page }) => {
|
||||||
const files = [Files.Zip]
|
const files = [Files.Zip]
|
||||||
const link = await createNote(page, { files, error: 'note is to big' })
|
await createNote(page, { files, error: 'note is to big' })
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user