mirror of
https://github.com/cupcakearmy/cryptgeon.git
synced 2024-12-23 00:36:28 +00:00
Compare commits
8 Commits
49a44f6a1a
...
a5da51fb2c
Author | SHA1 | Date | |
---|---|---|---|
a5da51fb2c | |||
dfa2401eea | |||
ea58d89f98 | |||
eaca1a981d | |||
199755d18e | |||
724d0709d3 | |||
bd5acca97a | |||
a0a99cd3cc |
@ -9,7 +9,7 @@ services:
|
||||
|
||||
app:
|
||||
build: .
|
||||
env_file: .dev.env
|
||||
env_file: .env.dev
|
||||
depends_on:
|
||||
- redis
|
||||
restart: unless-stopped
|
||||
|
@ -38,10 +38,6 @@ pub static ref ALLOW_FILES: bool = std::env::var("ALLOW_FILES")
|
||||
.unwrap_or("true".to_string())
|
||||
.parse()
|
||||
.unwrap();
|
||||
pub static ref THEME_NEW_NOTE_NOTICE: bool = std::env::var("THEME_NEW_NOTE_NOTICE")
|
||||
.unwrap_or("true".to_string())
|
||||
.parse()
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
// THEME
|
||||
@ -62,4 +58,8 @@ lazy_static! {
|
||||
.unwrap_or("".to_string())
|
||||
.parse()
|
||||
.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::{
|
||||
extract::Request,
|
||||
extract::{DefaultBodyLimit, Request},
|
||||
routing::{delete, get, post},
|
||||
Router, ServiceExt,
|
||||
};
|
||||
@ -7,7 +7,6 @@ use dotenv::dotenv;
|
||||
use tower::Layer;
|
||||
use tower_http::{
|
||||
compression::CompressionLayer,
|
||||
limit::RequestBodyLimitLayer,
|
||||
normalize_path::NormalizePathLayer,
|
||||
services::{ServeDir, ServeFile},
|
||||
};
|
||||
@ -47,14 +46,14 @@ async fn main() {
|
||||
let app = Router::new()
|
||||
.nest("/api", api_routes)
|
||||
.fallback_service(serve_dir)
|
||||
.layer(DefaultBodyLimit::max(*config::LIMIT))
|
||||
.layer(
|
||||
CompressionLayer::new()
|
||||
.br(true)
|
||||
.deflate(true)
|
||||
.gzip(true)
|
||||
.zstd(true),
|
||||
)
|
||||
.layer(RequestBodyLimitLayer::new(*config::LIMIT));
|
||||
);
|
||||
|
||||
let app = NormalizePathLayer::trim_trailing_slash().layer(app);
|
||||
|
||||
@ -62,9 +61,7 @@ async fn main() {
|
||||
.await
|
||||
.unwrap();
|
||||
println!("listening on {}", listener.local_addr().unwrap());
|
||||
println!("Config {}", *config::LIMIT);
|
||||
axum::serve(listener, ServiceExt::<Request>::into_make_service(app))
|
||||
// axum::serve(listener, app)
|
||||
.await
|
||||
.unwrap();
|
||||
}
|
||||
|
@ -13,12 +13,12 @@ pub struct Status {
|
||||
pub max_expiration: u32,
|
||||
pub allow_advanced: bool,
|
||||
pub allow_files: bool,
|
||||
pub theme_new_note_notice: bool,
|
||||
// Theme
|
||||
pub theme_image: String,
|
||||
pub theme_text: String,
|
||||
pub theme_page_title: String,
|
||||
pub theme_favicon: String,
|
||||
pub theme_new_note_notice: bool,
|
||||
}
|
||||
|
||||
pub async fn get_status() -> (StatusCode, Json<Status>) {
|
||||
|
@ -18,19 +18,19 @@
|
||||
export let icon: keyof typeof map
|
||||
</script>
|
||||
|
||||
<div on:click {...$$restProps}>
|
||||
<button on:click {...$$restProps}>
|
||||
{#if map[icon]}
|
||||
<svelte:component this={map[icon]} />
|
||||
{/if}
|
||||
</div>
|
||||
</button>
|
||||
|
||||
<style>
|
||||
div {
|
||||
button {
|
||||
display: inline-block;
|
||||
contain: strict;
|
||||
box-sizing: content-box;
|
||||
}
|
||||
div > :global(svg) {
|
||||
button > :global(svg) {
|
||||
display: block;
|
||||
fill: currentColor;
|
||||
}
|
||||
|
@ -116,6 +116,7 @@ export type Status = {
|
||||
theme_text: string
|
||||
theme_favicon: string
|
||||
theme_page_title: string
|
||||
theme_new_note_notice: boolean
|
||||
}
|
||||
|
||||
export async function status() {
|
||||
|
@ -9,7 +9,7 @@ const config: PlaywrightTestConfig = {
|
||||
|
||||
outputDir: './test-results',
|
||||
testDir: './test',
|
||||
timeout: 10_000,
|
||||
timeout: 30_000,
|
||||
fullyParallel: true,
|
||||
|
||||
webServer: {
|
||||
@ -22,10 +22,6 @@ const config: PlaywrightTestConfig = {
|
||||
{ name: 'chrome', use: { ...devices['Desktop Chrome'] } },
|
||||
{ name: 'firefox', use: { ...devices['Desktop Firefox'] } },
|
||||
{ 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 { 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'
|
||||
|
||||
test.describe('file @cli', () => {
|
||||
test('simple', async ({ page }) => {
|
||||
test('simple', async () => {
|
||||
const file = await tmpFile(Files.Image)
|
||||
const checksum = await getFileChecksum(file)
|
||||
const note = await CLI('send', 'file', file)
|
||||
@ -17,7 +18,7 @@ test.describe('file @cli', () => {
|
||||
test.expect(checksum).toBe(c)
|
||||
})
|
||||
|
||||
test('simple with password', async ({ page }) => {
|
||||
test('simple with password', async () => {
|
||||
const file = await tmpFile(Files.Image)
|
||||
const password = 'password'
|
||||
const checksum = await getFileChecksum(file)
|
||||
|
@ -2,7 +2,7 @@ import { test } from '@playwright/test'
|
||||
import { CLI, getLinkFromCLI } from '../../utils'
|
||||
|
||||
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 note = await CLI('send', 'text', text)
|
||||
const link = getLinkFromCLI(note.stdout)
|
||||
@ -11,7 +11,7 @@ test.describe('text @cli', () => {
|
||||
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 password = 'password'
|
||||
const note = await CLI('send', 'text', text, '--password', password)
|
||||
|
@ -1,10 +1,5 @@
|
||||
import { createHash } from 'crypto'
|
||||
import { cp as cpFN, rm as rmFN } from 'fs'
|
||||
import { readFile } from 'fs/promises'
|
||||
import { promisify } from 'util'
|
||||
|
||||
export const cp = promisify(cpFN)
|
||||
export const rm = promisify(rmFN)
|
||||
import { createHash } from 'node:crypto'
|
||||
import { cp, readFile } from 'node:fs/promises'
|
||||
|
||||
export const Files = {
|
||||
PDF: 'test/assets/AES.pdf',
|
||||
|
@ -5,6 +5,6 @@ import { Files } from '../../files'
|
||||
test.describe('@web', () => {
|
||||
test('to big zip', async ({ page }) => {
|
||||
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