Files
boos e0a5f57793 feat(desktop): embed BoosAPI Desktop client as a subproject
Vendor the rebranded BoosAPI Desktop client (Tauri + Vue) into metapi as
a monorepo subdirectory under desktop/. Source only — node_modules,
dist, Cargo target and the upstream .git history are excluded.

desktop/ keeps its own independent Cargo workspace (desktop/src-tauri
with crates/*); it is not part of the backend boosapi crate, so a
`cargo check` at the metapi root still compiles only the backend. Build
the desktop app from desktop/src-tauri per desktop/README.md.

Note: app icons are still placeholder assets pending the final BoosAPI
logo. The updater signing keys live outside the repo and are not
included.
2026-06-22 11:32:57 +08:00

35 lines
1.5 KiB
TypeScript

import { compressToEncodedURIComponent } from 'lz-string'
import { describe, expect, it } from 'vitest'
import { createMarkdownHash, createMarkdownHashAsync, decodeMarkdownHash, decodeMarkdownHashAsync } from '../playground-shared/testPageState'
describe('playground share payload', () => {
it('prefers Brotli for large markdown payloads', async () => {
const input = [
'# Shareable markdown',
'',
'```ts',
...Array.from({ length: 400 }, (_, index) => `console.log('line-${index}', ${index ** 2})`),
'```',
'',
...Array.from({ length: 400 }, (_, index) => `- 第 ${index + 1} 行:你好,世界 ${index.toString(36)}`),
].join('\n')
const legacyHash = `data=${compressToEncodedURIComponent(input)}`
const deflateHash = createMarkdownHash(input)
const hash = await createMarkdownHashAsync(input)
expect(hash.startsWith('data=br:')).toBe(true)
expect(hash.length).toBeLessThan(legacyHash.length)
expect(hash.length).toBeLessThan(deflateHash.length)
expect(await decodeMarkdownHashAsync(hash)).toBe(input)
})
it('continues to decode legacy raw and lz-string payloads', () => {
const input = `<a href=" ">示例链接1</a >\n<a href="https://github.com">GitHub</a >\n<a href="https://www.wikipedia.org">维基百科</a >`
const legacyRawHash = `data=raw:${encodeURIComponent(input)}`
const legacyLzHash = `data=${compressToEncodedURIComponent(input)}`
expect(decodeMarkdownHash(legacyRawHash)).toBe(input)
expect(decodeMarkdownHash(legacyLzHash)).toBe(input)
})
})