chore: dump demo data

Login on the demo instance is SSO-only, so visitors always arrive as a
fresh user and consume seed content through Explore. Rebuild the seed
around that funnel: four personas (steven the maintainer, alice, ben,
zoe), a public feed mixing short captures with long-form anchors, and
protected memos that visibly appear after sign-in to teach the
visibility model.

Every headline feature is now demonstrated: nested tags, memo
references, comments with mentions, reactions, locations, a database-
stored image attachment, and a rendering test memo covering math,
mermaid, code, tables, and task lists.
This commit is contained in:
boojack 2026-07-17 00:14:01 +08:00
parent d4b5a1695b
commit 469c995cc0
4 changed files with 204 additions and 52 deletions

View file

@ -48,7 +48,6 @@ Don't want to install yet? Try our [live demo](https://demo.usememos.com/) first
### Other Installation Methods ### Other Installation Methods
- **Docker Compose** - Recommended for production deployments - **Docker Compose** - Recommended for production deployments
- **Pre-built Binaries** - Available for Linux, macOS, and Windows
- **Kubernetes** - Helm charts and manifests available - **Kubernetes** - Helm charts and manifests available
- **Build from Source** - For development and customization - **Build from Source** - For development and customization

View file

@ -46,20 +46,20 @@ func TestDemoSeedUsesDeploymentAuthenticationPolicy(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
require.NotNil(t, provider) require.NotNil(t, provider)
demoUsername := "demo" adminUsername := "steven"
demoUser, err := stores.GetUser(ctx, &store.FindUser{Username: &demoUsername}) adminUser, err := stores.GetUser(ctx, &store.FindUser{Username: &adminUsername})
require.NoError(t, err) require.NoError(t, err)
require.NotNil(t, demoUser) require.NotNil(t, adminUser)
require.Equal(t, store.RoleAdmin, demoUser.Role) require.Equal(t, store.RoleAdmin, adminUser.Role)
require.Error(t, bcrypt.CompareHashAndPassword([]byte(demoUser.PasswordHash), []byte("demo"))) require.Error(t, bcrypt.CompareHashAndPassword([]byte(adminUser.PasswordHash), []byte("demo")))
demoCost, err := bcrypt.Cost([]byte(demoUser.PasswordHash)) adminCost, err := bcrypt.Cost([]byte(adminUser.PasswordHash))
require.NoError(t, err) require.NoError(t, err)
require.GreaterOrEqual(t, demoCost, 12) require.GreaterOrEqual(t, adminCost, 12)
aliceUsername := "alice" aliceUsername := "alice"
aliceUser, err := stores.GetUser(ctx, &store.FindUser{Username: &aliceUsername}) aliceUser, err := stores.GetUser(ctx, &store.FindUser{Username: &aliceUsername})
require.NoError(t, err) require.NoError(t, err)
require.NotNil(t, aliceUser) require.NotNil(t, aliceUser)
require.Error(t, bcrypt.CompareHashAndPassword([]byte(aliceUser.PasswordHash), []byte("demo"))) require.Error(t, bcrypt.CompareHashAndPassword([]byte(aliceUser.PasswordHash), []byte("demo")))
require.NotEqual(t, demoUser.PasswordHash, aliceUser.PasswordHash) require.NotEqual(t, adminUser.PasswordHash, aliceUser.PasswordHash)
} }

File diff suppressed because one or more lines are too long

View file

@ -50,13 +50,20 @@ export const MermaidBlock = ({ children, className }: MermaidBlockProps) => {
const renderDiagram = async () => { const renderDiagram = async () => {
try { try {
const { default: mermaid } = await import("mermaid"); const { default: mermaid } = await import("mermaid");
// Text is measured against the final glyphs, so webfonts must be loaded
// first. The Font Loading API is absent in some environments (jsdom).
await document.fonts?.ready;
if (cancelled) return; if (cancelled) return;
mermaid.initialize({ mermaid.initialize({
startOnLoad: false, startOnLoad: false,
theme: toMermaidTheme(currentTheme), theme: toMermaidTheme(currentTheme),
securityLevel: "strict", securityLevel: "strict",
fontFamily: "inherit", // Mermaid measures labels in a detached element at body level, but the
// rendered SVG lands inside a <pre> (monospace). "inherit" resolves to
// different fonts in those two places, sizing boxes too small for the
// final glyphs — pin the font so measurement and display agree.
fontFamily: getComputedStyle(document.body).fontFamily || "sans-serif",
suppressErrorRendering: true, suppressErrorRendering: true,
}); });