domma-cms 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +469 -0
- package/admin/css/admin.css +1123 -0
- package/admin/index.html +72 -0
- package/admin/js/api.js +210 -0
- package/admin/js/app.js +270 -0
- package/admin/js/config/sidebar-config.js +107 -0
- package/admin/js/lib/card.js +63 -0
- package/admin/js/lib/image-editor.js +869 -0
- package/admin/js/lib/markdown-toolbar.js +421 -0
- package/admin/js/templates/dashboard.html +50 -0
- package/admin/js/templates/documentation.html +237 -0
- package/admin/js/templates/layouts.html +11 -0
- package/admin/js/templates/login.html +58 -0
- package/admin/js/templates/media.html +16 -0
- package/admin/js/templates/navigation.html +50 -0
- package/admin/js/templates/page-editor.html +126 -0
- package/admin/js/templates/pages.html +18 -0
- package/admin/js/templates/plugins.html +12 -0
- package/admin/js/templates/settings.html +190 -0
- package/admin/js/templates/tutorials.html +233 -0
- package/admin/js/templates/user-editor.html +12 -0
- package/admin/js/templates/users.html +10 -0
- package/admin/js/views/dashboard.js +48 -0
- package/admin/js/views/documentation.js +12 -0
- package/admin/js/views/index.js +33 -0
- package/admin/js/views/layouts.js +49 -0
- package/admin/js/views/login.js +254 -0
- package/admin/js/views/media.js +240 -0
- package/admin/js/views/navigation.js +152 -0
- package/admin/js/views/page-editor.js +479 -0
- package/admin/js/views/pages.js +64 -0
- package/admin/js/views/plugins.js +100 -0
- package/admin/js/views/settings.js +64 -0
- package/admin/js/views/tutorials.js +12 -0
- package/admin/js/views/user-editor.js +88 -0
- package/admin/js/views/users.js +73 -0
- package/bin/cli.js +334 -0
- package/config/auth.json +20 -0
- package/config/content.json +10 -0
- package/config/navigation.json +63 -0
- package/config/plugins.json +47 -0
- package/config/presets.json +34 -0
- package/config/server.json +6 -0
- package/config/site.json +33 -0
- package/package.json +67 -0
- package/plugins/back-to-top/admin/templates/back-to-top-settings.html +55 -0
- package/plugins/back-to-top/admin/views/back-to-top-settings.js +44 -0
- package/plugins/back-to-top/config.js +10 -0
- package/plugins/back-to-top/plugin.js +24 -0
- package/plugins/back-to-top/plugin.json +36 -0
- package/plugins/back-to-top/public/inject-body.html +105 -0
- package/plugins/cookie-consent/admin/templates/cookie-consent-settings.html +113 -0
- package/plugins/cookie-consent/admin/views/cookie-consent-settings.js +73 -0
- package/plugins/cookie-consent/config.js +30 -0
- package/plugins/cookie-consent/plugin.js +24 -0
- package/plugins/cookie-consent/plugin.json +36 -0
- package/plugins/cookie-consent/public/inject-body.html +69 -0
- package/plugins/custom-css/admin/templates/custom-css.html +17 -0
- package/plugins/custom-css/admin/views/custom-css.js +35 -0
- package/plugins/custom-css/config.js +1 -0
- package/plugins/custom-css/data/custom.css +0 -0
- package/plugins/custom-css/plugin.js +63 -0
- package/plugins/custom-css/plugin.json +32 -0
- package/plugins/custom-css/public/inject-head.html +1 -0
- package/plugins/domma-effects/admin/templates/domma-effects.html +488 -0
- package/plugins/domma-effects/admin/views/domma-effects.js +56 -0
- package/plugins/domma-effects/config.js +9 -0
- package/plugins/domma-effects/plugin.js +22 -0
- package/plugins/domma-effects/plugin.json +36 -0
- package/plugins/domma-effects/public/celebrations/core/canvas.js +111 -0
- package/plugins/domma-effects/public/celebrations/core/particles.js +144 -0
- package/plugins/domma-effects/public/celebrations/core/physics.js +166 -0
- package/plugins/domma-effects/public/celebrations/index.js +535 -0
- package/plugins/domma-effects/public/celebrations/themes/christmas.js +1805 -0
- package/plugins/domma-effects/public/celebrations/themes/guy-fawkes.js +1477 -0
- package/plugins/domma-effects/public/celebrations/themes/halloween.js +1837 -0
- package/plugins/domma-effects/public/celebrations/themes/st-andrews.js +1175 -0
- package/plugins/domma-effects/public/celebrations/themes/st-davids.js +1258 -0
- package/plugins/domma-effects/public/celebrations/themes/st-georges.js +1754 -0
- package/plugins/domma-effects/public/celebrations/themes/st-patricks.js +1290 -0
- package/plugins/domma-effects/public/celebrations/themes/valentines.js +1361 -0
- package/plugins/domma-effects/public/inject-body.html +268 -0
- package/plugins/example-analytics/admin/templates/analytics.html +10 -0
- package/plugins/example-analytics/admin/views/analytics.js +51 -0
- package/plugins/example-analytics/config.js +6 -0
- package/plugins/example-analytics/plugin.js +58 -0
- package/plugins/example-analytics/plugin.json +27 -0
- package/plugins/example-analytics/public/inject-body.html +13 -0
- package/plugins/example-analytics/public/inject-head.html +1 -0
- package/plugins/example-analytics/stats.json +1 -0
- package/plugins/form-builder/admin/templates/form-editor.html +158 -0
- package/plugins/form-builder/admin/templates/form-settings.html +29 -0
- package/plugins/form-builder/admin/templates/form-submissions.html +30 -0
- package/plugins/form-builder/admin/templates/forms-list.html +17 -0
- package/plugins/form-builder/admin/views/form-editor.js +817 -0
- package/plugins/form-builder/admin/views/form-settings.js +38 -0
- package/plugins/form-builder/admin/views/form-submissions.js +295 -0
- package/plugins/form-builder/admin/views/forms-list.js +164 -0
- package/plugins/form-builder/config.js +9 -0
- package/plugins/form-builder/data/forms/contact-details.json +63 -0
- package/plugins/form-builder/data/forms/contact.json +52 -0
- package/plugins/form-builder/data/submissions/contact-details.json +1 -0
- package/plugins/form-builder/data/submissions/contact.json +14 -0
- package/plugins/form-builder/email.js +103 -0
- package/plugins/form-builder/plugin.js +454 -0
- package/plugins/form-builder/plugin.json +56 -0
- package/plugins/form-builder/public/inject-body.html +270 -0
- package/plugins/form-builder/public/inject-head.html +42 -0
- package/public/css/site.css +189 -0
- package/public/js/site.js +109 -0
- package/scripts/copy-domma.js +48 -0
- package/scripts/fresh.js +41 -0
- package/scripts/reset.js +124 -0
- package/scripts/seed.js +666 -0
- package/scripts/setup.js +263 -0
- package/server/config.js +56 -0
- package/server/middleware/auth.js +97 -0
- package/server/routes/api/auth.js +116 -0
- package/server/routes/api/layouts.js +25 -0
- package/server/routes/api/media.js +93 -0
- package/server/routes/api/navigation.js +37 -0
- package/server/routes/api/pages.js +118 -0
- package/server/routes/api/plugins.js +46 -0
- package/server/routes/api/settings.js +25 -0
- package/server/routes/api/users.js +110 -0
- package/server/routes/public.js +108 -0
- package/server/server.js +169 -0
- package/server/services/content.js +298 -0
- package/server/services/images.js +334 -0
- package/server/services/markdown.js +297 -0
- package/server/services/plugins.js +246 -0
- package/server/services/renderer.js +80 -0
- package/server/services/users.js +212 -0
- package/server/templates/page.html +78 -0
package/scripts/reset.js
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Domma CMS — Factory Reset
|
|
4
|
+
* Wipes all content, users, and resets config to defaults.
|
|
5
|
+
* Run: npm run reset
|
|
6
|
+
*/
|
|
7
|
+
import { createInterface } from 'node:readline/promises';
|
|
8
|
+
import { readFile, writeFile, readdir, rm, mkdir } from 'node:fs/promises';
|
|
9
|
+
import { existsSync } from 'node:fs';
|
|
10
|
+
import path from 'node:path';
|
|
11
|
+
import { fileURLToPath } from 'node:url';
|
|
12
|
+
|
|
13
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
14
|
+
const ROOT = path.resolve(__dirname, '..');
|
|
15
|
+
|
|
16
|
+
const USERS_DIR = path.join(ROOT, 'content', 'users');
|
|
17
|
+
const PAGES_DIR = path.join(ROOT, 'content', 'pages');
|
|
18
|
+
const MEDIA_DIR = path.join(ROOT, 'content', 'media');
|
|
19
|
+
const SITE_CFG = path.join(ROOT, 'config', 'site.json');
|
|
20
|
+
const NAV_CFG = path.join(ROOT, 'config', 'navigation.json');
|
|
21
|
+
const ENV_FILE = path.join(ROOT, '.env');
|
|
22
|
+
|
|
23
|
+
const DEFAULT_SITE = {
|
|
24
|
+
title: 'My Site',
|
|
25
|
+
tagline: 'Powered by Domma CMS',
|
|
26
|
+
theme: 'charcoal-dark',
|
|
27
|
+
seo: {
|
|
28
|
+
defaultTitle: 'My Site',
|
|
29
|
+
titleSeparator: ' | ',
|
|
30
|
+
defaultDescription: 'A site built with Domma CMS'
|
|
31
|
+
},
|
|
32
|
+
footer: {
|
|
33
|
+
copyright: `© ${new Date().getFullYear()} My Site. All rights reserved.`,
|
|
34
|
+
links: [
|
|
35
|
+
{ text: 'Privacy Policy', url: '/privacy' },
|
|
36
|
+
{ text: 'Contact', url: '/contact' }
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const DEFAULT_NAV = {
|
|
42
|
+
brand: { text: 'My Site', logo: null, url: '/' },
|
|
43
|
+
items: [
|
|
44
|
+
{ text: 'Home', url: '/', icon: 'home' },
|
|
45
|
+
{ text: 'About', url: '/about', icon: 'info' },
|
|
46
|
+
{ text: 'Contact', url: '/contact', icon: 'mail' }
|
|
47
|
+
],
|
|
48
|
+
variant: 'dark',
|
|
49
|
+
position: 'sticky'
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// ---------------------------------------------------------------------------
|
|
53
|
+
|
|
54
|
+
async function wipeDir(dir) {
|
|
55
|
+
await rm(dir, { recursive: true, force: true });
|
|
56
|
+
await mkdir(dir, { recursive: true });
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
async function resetEnv() {
|
|
60
|
+
if (!existsSync(ENV_FILE)) return;
|
|
61
|
+
const lines = (await readFile(ENV_FILE, 'utf8')).split('\n');
|
|
62
|
+
const updated = lines.map(l =>
|
|
63
|
+
l.startsWith('JWT_SECRET=')
|
|
64
|
+
? 'JWT_SECRET=change-me-to-a-64-char-random-string-before-deploying-to-production'
|
|
65
|
+
: l
|
|
66
|
+
);
|
|
67
|
+
await writeFile(ENV_FILE, updated.join('\n'), 'utf8');
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// ---------------------------------------------------------------------------
|
|
71
|
+
|
|
72
|
+
console.log('');
|
|
73
|
+
console.log(' ┌──────────────────────────────────┐');
|
|
74
|
+
console.log(' │ Domma CMS — Factory Reset │');
|
|
75
|
+
console.log(' └──────────────────────────────────┘');
|
|
76
|
+
console.log('');
|
|
77
|
+
console.log(' This will permanently delete:');
|
|
78
|
+
console.log(' • All user accounts (content/users/)');
|
|
79
|
+
console.log(' • All pages (content/pages/)');
|
|
80
|
+
console.log(' • All media uploads (content/media/)');
|
|
81
|
+
console.log(' • config/site.json (reset to defaults)');
|
|
82
|
+
console.log(' • config/navigation.json (reset to defaults)');
|
|
83
|
+
console.log(' • JWT_SECRET in .env (reset to placeholder)');
|
|
84
|
+
console.log('');
|
|
85
|
+
|
|
86
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
87
|
+
const answer = (await rl.question(' Type "yes" to confirm: ')).trim();
|
|
88
|
+
rl.close();
|
|
89
|
+
|
|
90
|
+
if (answer !== 'yes') {
|
|
91
|
+
console.log('\n Reset cancelled.\n');
|
|
92
|
+
process.exit(0);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
console.log('');
|
|
96
|
+
|
|
97
|
+
process.stdout.write(' Deleting users…');
|
|
98
|
+
await wipeDir(USERS_DIR);
|
|
99
|
+
console.log(' done.');
|
|
100
|
+
|
|
101
|
+
process.stdout.write(' Deleting pages…');
|
|
102
|
+
await wipeDir(PAGES_DIR);
|
|
103
|
+
console.log(' done.');
|
|
104
|
+
|
|
105
|
+
process.stdout.write(' Deleting media…');
|
|
106
|
+
await wipeDir(MEDIA_DIR);
|
|
107
|
+
console.log(' done.');
|
|
108
|
+
|
|
109
|
+
process.stdout.write(' Resetting config/site.json…');
|
|
110
|
+
await writeFile(SITE_CFG, JSON.stringify(DEFAULT_SITE, null, 4) + '\n', 'utf8');
|
|
111
|
+
console.log(' done.');
|
|
112
|
+
|
|
113
|
+
process.stdout.write(' Resetting config/navigation.json…');
|
|
114
|
+
await writeFile(NAV_CFG, JSON.stringify(DEFAULT_NAV, null, 4) + '\n', 'utf8');
|
|
115
|
+
console.log(' done.');
|
|
116
|
+
|
|
117
|
+
process.stdout.write(' Resetting JWT_SECRET in .env…');
|
|
118
|
+
await resetEnv();
|
|
119
|
+
console.log(' done.');
|
|
120
|
+
|
|
121
|
+
console.log('');
|
|
122
|
+
console.log(' ✓ Factory reset complete.');
|
|
123
|
+
console.log(' Run `npm run setup` to configure a new admin account.');
|
|
124
|
+
console.log('');
|