restructuring
|
@ -23,11 +23,11 @@ jobs:
|
|||
- name: Prepare
|
||||
run: |
|
||||
pnpm install
|
||||
pnpm run ci:prepare
|
||||
pnpm run test:prepare
|
||||
- name: Install Playwright
|
||||
run: npx playwright install --with-deps
|
||||
- name: Run your tests
|
||||
run: pnpm run test
|
||||
run: pnpm run test:run
|
||||
- name: Upload test results
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v2
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
FROM node:16-alpine as client
|
||||
WORKDIR /tmp
|
||||
RUN npm install -g pnpm@7
|
||||
COPY ./frontend ./
|
||||
COPY ./packages/frontend ./
|
||||
RUN pnpm install
|
||||
RUN pnpm exec svelte-kit sync
|
||||
RUN pnpm run build
|
||||
|
@ -12,9 +12,9 @@ RUN pnpm run build
|
|||
FROM rust:1.61-alpine as backend
|
||||
WORKDIR /tmp
|
||||
RUN apk add libc-dev openssl-dev alpine-sdk
|
||||
COPY ./backend/Cargo.* ./
|
||||
COPY ./packages/backend/Cargo.* ./
|
||||
RUN cargo fetch
|
||||
COPY ./backend ./
|
||||
COPY ./packages/backend ./
|
||||
RUN cargo build --release
|
||||
|
||||
|
||||
|
|
|
@ -146,9 +146,9 @@ You can see the app under [localhost:1234](http://localhost:1234).
|
|||
Tests are end to end tests written with Playwright.
|
||||
|
||||
```sh
|
||||
pnpm run ci:prepare
|
||||
pnpm run test:prepare
|
||||
docker compose up redis -d
|
||||
pnpm run ci:server
|
||||
pnpm run test:server
|
||||
|
||||
# In another terminal.
|
||||
# Use the test or test:local script. The local version only runs in one browser for quicker development.
|
||||
|
|
|
@ -47,15 +47,15 @@ _加密鸽_ 是一个受 [_PrivNote_](https://privnote.com)项目启发的安全
|
|||
|
||||
## 环境变量
|
||||
|
||||
| 变量名称 | 默认值 | 描述 |
|
||||
| 变量名称 | 默认值 | 描述 |
|
||||
| ----------------- | ---------------- | --------------------------------------------------------------------------------- |
|
||||
| `REDIS` | `redis://redis/` | Redis 连接 URL。 |
|
||||
| `SIZE_LIMIT` | `1 KiB` | 最大请求体(body)限制。有关支持的数值请查看 [字节单位](https://docs.rs/byte-unit/) |
|
||||
| `MAX_VIEWS` | `100` | 密信最多查看次数限制 |
|
||||
| ` MAX_EXPIRATION` | `360` | 密信最长过期时间限制(分钟) |
|
||||
| `ALLOW_ADVANCED` | `true` | 是否允许自定义设置,该项如果设为`false`,则不会显示自定义设置模块 |
|
||||
| `THEME_IMAGE` | `""` | 自定义Logo图片,你在这里填写的的图片链接必须是可以公开访问的。 |
|
||||
| `THEME_TEXT` | `""` | 自定义在Logo下方的文本。 |
|
||||
| `REDIS` | `redis://redis/` | Redis 连接 URL。 |
|
||||
| `SIZE_LIMIT` | `1 KiB` | 最大请求体(body)限制。有关支持的数值请查看 [字节单位](https://docs.rs/byte-unit/) |
|
||||
| `MAX_VIEWS` | `100` | 密信最多查看次数限制 |
|
||||
| ` MAX_EXPIRATION` | `360` | 密信最长过期时间限制(分钟) |
|
||||
| `ALLOW_ADVANCED` | `true` | 是否允许自定义设置,该项如果设为`false`,则不会显示自定义设置模块 |
|
||||
| `THEME_IMAGE` | `""` | 自定义 Logo 图片,你在这里填写的的图片链接必须是可以公开访问的。 |
|
||||
| `THEME_TEXT` | `""` | 自定义在 Logo 下方的文本。 |
|
||||
|
||||
## 部署
|
||||
|
||||
|
@ -148,7 +148,7 @@ cargo install cargo-watch
|
|||
|
||||
确保你的 Docker 正在运行
|
||||
|
||||
> 如果你用的是 `macOS` 的话你可能需要关闭AirPlay接收功能因为该功能需要占用5000端口...)
|
||||
> 如果你用的是 `macOS` 的话你可能需要关闭 AirPlay 接收功能因为该功能需要占用 5000 端口...)
|
||||
> https://developer.apple.com/forums/thread/682332
|
||||
|
||||
```bash
|
||||
|
@ -165,12 +165,12 @@ pnpm run dev
|
|||
|
||||
## 测试
|
||||
|
||||
这些测试是用Playwright实现的一些端到端测试用例。
|
||||
这些测试是用 Playwright 实现的一些端到端测试用例。
|
||||
|
||||
```sh
|
||||
pnpm run ci:prepare
|
||||
pnpm run test:prepare
|
||||
docker compose up redis -d
|
||||
pnpm run ci:server
|
||||
pnpm run test:server
|
||||
|
||||
# 在另一个终端中:
|
||||
# 使用test或者test:local script。为了更快的开发,本地版本只会在一个浏览器中运行。
|
||||
|
|
|
@ -10,10 +10,11 @@ services:
|
|||
- 6379:6379
|
||||
|
||||
app:
|
||||
build: .
|
||||
# build: .
|
||||
image: cupcakearmy/cryptgeon
|
||||
depends_on:
|
||||
- redis
|
||||
environment:
|
||||
SIZE_LIMIT: 128 MiB
|
||||
SIZE_LIMIT: 10 MiB
|
||||
ports:
|
||||
- 1234:5000
|
||||
|
|
15
package.json
|
@ -1,20 +1,17 @@
|
|||
{
|
||||
"scripts": {
|
||||
"dev:docker": "docker-compose up redis",
|
||||
"dev:backend": "cd backend && cargo watch -x 'run --bin cryptgeon'",
|
||||
"dev:front": "pnpm --prefix frontend run dev",
|
||||
"dev:packages": "pnpm -r run dev",
|
||||
"dev:proxy": "node proxy.mjs",
|
||||
"dev": "run-p dev:*",
|
||||
"test": "playwright test --project chrome firefox safari",
|
||||
"test:run": "playwright test --project chrome firefox safari",
|
||||
"test:local": "playwright test --project local",
|
||||
"ci:server": "cd backend && SIZE_LIMIT=10MiB LISTEN_ADDR=0.0.0.0:1234 cargo run",
|
||||
"ci:prepare": "run-p ci:prepare:*",
|
||||
"ci:prepare:backend": "cd backend && cargo build",
|
||||
"ci:prepare:front": "pnpm --prefix frontend install && pnpm --prefix frontend run build"
|
||||
"test:server": "pnpm -r run test:server",
|
||||
"test:prepare": "pnpm -r run test:prepare"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@playwright/test": "^1.23.4",
|
||||
"@types/node": "16",
|
||||
"@playwright/test": "^1.25.1",
|
||||
"@types/node": "^16.11.57",
|
||||
"http-proxy": "^1.18.1",
|
||||
"npm-run-all": "^4.1.5"
|
||||
}
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"name": "backend",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "cargo watch -x 'run --bin cryptgeon'",
|
||||
"build": "cargo build --release",
|
||||
"test:server": "SIZE_LIMIT=10MiB LISTEN_ADDR=0.0.0.0:1234 cargo run",
|
||||
"test:prepare": "cargo build"
|
||||
}
|
||||
}
|
|
@ -7,5 +7,6 @@ pub fn init(cfg: &mut web::ServiceConfig) {
|
|||
let plain = web::PayloadConfig::default()
|
||||
.limit(*config::LIMIT)
|
||||
.mimetype(mime::STAR_STAR);
|
||||
// cfg.app_data(plain);
|
||||
cfg.app_data(json).app_data(plain);
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
├─ MIT: 12
|
||||
├─ MIT: 13
|
||||
├─ ISC: 2
|
||||
├─ BSD-3-Clause: 1
|
||||
├─ (MPL-2.0 OR Apache-2.0): 1
|
||||
├─ BSD-2-Clause: 1
|
||||
├─ ISC: 1
|
||||
├─ 0BSD: 1
|
||||
└─ Apache-2.0: 1
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
"preview": "vite preview --port 3000",
|
||||
"check": "svelte-check --tsconfig tsconfig.json",
|
||||
"licenses": "license-checker --summary > licenses.csv",
|
||||
"locale:download": "node scripts/locale.js"
|
||||
"locale:download": "node scripts/locale.js",
|
||||
"test:prepare": "pnpm run build"
|
||||
},
|
||||
"type": "module",
|
||||
"devDependencies": {
|
Before Width: | Height: | Size: 287 B After Width: | Height: | Size: 287 B |
Before Width: | Height: | Size: 325 B After Width: | Height: | Size: 325 B |
Before Width: | Height: | Size: 736 B After Width: | Height: | Size: 736 B |
Before Width: | Height: | Size: 483 B After Width: | Height: | Size: 483 B |
Before Width: | Height: | Size: 732 B After Width: | Height: | Size: 732 B |
Before Width: | Height: | Size: 784 B After Width: | Height: | Size: 784 B |
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.1 KiB |
|
@ -3,6 +3,7 @@ import precompileIntl from 'svelte-intl-precompile/sveltekit-plugin'
|
|||
|
||||
/** @type {import('vite').UserConfig} */
|
||||
const config = {
|
||||
clearScreen: false,
|
||||
server: {
|
||||
port: 3000,
|
||||
},
|
|
@ -11,7 +11,7 @@ const config: PlaywrightTestConfig = {
|
|||
testDir: './test',
|
||||
|
||||
webServer: {
|
||||
command: 'pnpm run ci:server',
|
||||
command: 'pnpm run test:server',
|
||||
port: 1234,
|
||||
reuseExistingServer: true,
|
||||
},
|
||||
|
|
1642
pnpm-lock.yaml
|
@ -0,0 +1,2 @@
|
|||
packages:
|
||||
- "packages/**"
|
|
@ -0,0 +1,8 @@
|
|||
import { test } from '@playwright/test'
|
||||
import { createNote } from '../utils'
|
||||
import Files from './files'
|
||||
|
||||
test('to big zip', async ({ page }) => {
|
||||
const files = [Files.Zip]
|
||||
const link = await createNote(page, { files, error: 'note is to big' })
|
||||
})
|