mirror of
https://github.com/backnotprop/plannotator.git
synced 2026-09-14 14:17:26 +08:00
401793e35f
Adds user-editable display names and persistent config via ~/.plannotator/config.json. - ConfigStore singleton with precedence: server config file > cookie > default - Editable identity input in Settings with "Use git name" and regenerate buttons - POST /api/config endpoint for write-back across all 6 servers - getServerConfig() reads config fresh per request (no stale cache) - Eager constructor hydration so the store is safe to read before init() - vendor.sh as single source of truth for Pi extension vendoring - Vendor parity test to prevent missing generated modules Closes #396
30 lines
996 B
TypeScript
30 lines
996 B
TypeScript
/**
|
|
* Tater name generator — pure function, no storage dependencies.
|
|
*
|
|
* Extracted to its own module to avoid circular imports:
|
|
* settings.ts needs this for the default value, and identity.ts
|
|
* needs configStore (which imports settings.ts).
|
|
*/
|
|
|
|
import { uniqueUsernameGenerator, adjectives, nouns } from 'unique-username-generator';
|
|
|
|
/**
|
|
* Generate a new random tater identity.
|
|
* Format: {adjective}-{noun}-tater
|
|
* Examples: "swift-falcon-tater", "gentle-crystal-tater"
|
|
*/
|
|
export function generateIdentity(): string {
|
|
// Use a unique separator to split adjective from noun, avoiding issues
|
|
// with compound words that contain hyphens (e.g., "behind-the-scenes")
|
|
const generated = uniqueUsernameGenerator({
|
|
dictionaries: [adjectives, nouns],
|
|
separator: '|||',
|
|
style: 'lowerCase',
|
|
randomDigits: 0,
|
|
length: 50, // Prevent word truncation (default is too short)
|
|
});
|
|
|
|
const [adjective, noun] = generated.split('|||');
|
|
return `${adjective}-${noun}-tater`;
|
|
}
|