backend/src/messages.js (view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
import { readFileSync } from 'fs';
export const MSG = {
NOT_FOUND: 'Document not found.',
EXPIRED: 'This link has expired.',
INVALID_MODE: 'Invalid mode. Use markdown or org.',
INVALID_CONTENT: 'Invalid content.',
CONTENT_TOO_LARGE: 'Document is larger than 1 MB.',
INVALID_EXPIRES_IN: 'Invalid validity. Use 1h, 24h, 7d, 30d, or never.',
INVALID_CLIENT: 'clientId is required.',
INVALID_REQUEST: 'clientId and lockToken are required.',
DOCUMENT_LOCKED: 'This document is being edited by someone else.',
LOCK_INVALID: 'Edit lock not found or expired.',
LOCK_REQUIRED: 'You need an active edit lock to save.',
RATE_LIMIT: 'Too many requests. Try again in a minute.',
INVALID_JSON: 'Invalid JSON in request body.',
INTERNAL_ERROR: 'Internal server error.',
ORIGIN_NOT_ALLOWED:
'Document creation is only allowed from the Snow Editor website.',
VERSION_NOT_FOUND: 'Version not found.',
};
const pkg = JSON.parse(
readFileSync(new URL('../package.json', import.meta.url), 'utf8'),
);
export const APP_VERSION = pkg.version;
export const MAX_VERSIONS_PER_DOCUMENT = 50;
export const DEFAULT_DOCUMENT_TITLE = 'Untitled document';
|