domma-cms 0.54.2 → 0.66.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/CLAUDE.md +151 -77
- package/README.md +4 -4
- package/admin/css/admin.css +1 -1
- package/admin/dist/domma/domma-tools.css +3 -3
- package/admin/dist/domma/domma-tools.min.js +3 -3
- package/admin/js/api.js +1 -1
- package/admin/js/app.js +3 -3
- package/admin/js/lib/page-picker.js +1 -0
- package/admin/js/lib/plugin-accent.js +1 -0
- package/admin/js/lib/plugin-chrome.js +1 -0
- package/admin/js/lib/shortcode-context-menu.js +2 -2
- package/admin/js/lib/sidebar-grouping.js +1 -1
- package/admin/js/lib/sidebar-grouping.test.js +1 -1
- package/admin/js/lib/sidebar-renderer.js +4 -4
- package/admin/js/lib/slideover-resizable.js +1 -0
- package/admin/js/templates/context-menu-editor.html +212 -0
- package/admin/js/templates/context-menus.html +16 -0
- package/admin/js/templates/menu-editor.html +19 -25
- package/admin/js/templates/plugin-code.html +1 -1
- package/{plugins/site-search/admin/templates/site-search.html → admin/js/templates/search.html} +50 -4
- package/admin/js/templates/settings.html +27 -97
- package/admin/js/templates/theme.html +173 -0
- package/admin/js/views/context-menu-editor.js +55 -0
- package/admin/js/views/context-menus.js +5 -0
- package/admin/js/views/form-editor.js +7 -7
- package/admin/js/views/index.js +1 -1
- package/admin/js/views/menu-editor.js +13 -13
- package/admin/js/views/plugin-marketplace.js +1 -1
- package/admin/js/views/plugins.js +25 -23
- package/admin/js/views/search.js +1 -0
- package/admin/js/views/settings.js +3 -3
- package/admin/js/views/theme.js +1 -0
- package/bin/cli.js +11 -2
- package/bin/lib/smtp-defaults.js +53 -0
- package/bin/update.js +13 -2
- package/config/menus/admin-sidebar.json +129 -23
- package/config/plugins.json +5 -5
- package/config/search.json +13 -0
- package/config/theme.json +18 -0
- package/package.json +12 -4
- package/plugins/_lib/admin/mail/compose-window.js +914 -0
- package/plugins/_lib/admin/mail/contacts.js +301 -0
- package/plugins/_lib/admin/mail/diagnostics-section.js +133 -0
- package/plugins/_lib/admin/mail/folder-tree.js +254 -0
- package/plugins/_lib/admin/mail/identity.js +480 -0
- package/plugins/_lib/admin/mail/image-senders-section.js +131 -0
- package/plugins/_lib/admin/mail/keyboard.js +136 -0
- package/plugins/_lib/admin/mail/mail.css +1 -0
- package/plugins/_lib/admin/mail/mail.html +71 -0
- package/plugins/_lib/admin/mail/panes.js +253 -0
- package/plugins/_lib/admin/mail/reader-view.js +4453 -0
- package/plugins/_lib/admin/mail/resizable.js +26 -0
- package/plugins/_lib/admin/mail/rules.js +343 -0
- package/plugins/_lib/admin/mail/scheduling.js +203 -0
- package/plugins/_lib/admin/mail/section-kit.js +277 -0
- package/plugins/_lib/admin/mail/templates.js +238 -0
- package/plugins/_lib/admin/mail/threads.js +200 -0
- package/plugins/_lib/admin/mail/vacation.js +269 -0
- package/plugins/_lib/admin/ui/help.css +1 -0
- package/plugins/_lib/admin/ui/help.js +174 -0
- package/plugins/_lib/admin/ui/resizable.js +151 -0
- package/plugins/_lib/dataStore.js +117 -0
- package/plugins/_lib/mail/accounts.js +919 -0
- package/plugins/_lib/mail/bodyTokens.js +101 -0
- package/plugins/_lib/mail/compose.js +256 -0
- package/plugins/_lib/mail/defaults.js +57 -0
- package/plugins/_lib/mail/diagnostics.js +154 -0
- package/plugins/_lib/mail/envelope.js +161 -0
- package/plugins/_lib/mail/folders.js +192 -0
- package/plugins/_lib/mail/handoff.js +274 -0
- package/plugins/_lib/mail/imapPool.js +293 -0
- package/plugins/_lib/mail/mbox.js +74 -0
- package/plugins/_lib/mail/pollSchedule.js +79 -0
- package/plugins/_lib/mail/poller.js +135 -0
- package/plugins/_lib/mail/priority.js +138 -0
- package/plugins/_lib/mail/readRoutes.js +680 -0
- package/plugins/_lib/mail/render.js +291 -0
- package/plugins/_lib/mail/ruleRunner.js +152 -0
- package/plugins/_lib/mail/scheduler.js +254 -0
- package/plugins/_lib/mail/secretbox.js +229 -0
- package/plugins/_lib/mail/send.js +396 -0
- package/plugins/_lib/mail/store.js +1002 -0
- package/plugins/_lib/mail/sync.js +292 -0
- package/plugins/_lib/mail/syncPlan.js +126 -0
- package/plugins/_lib/mail/syncSelection.js +82 -0
- package/plugins/_lib/mail/unsubscribe.js +183 -0
- package/plugins/_lib/mail/vacationRunner.js +114 -0
- package/plugins/_lib/mail/write.js +473 -0
- package/plugins/_lib/schemaSync.js +83 -0
- package/plugins/_template/admin/css/index.css +0 -0
- package/plugins/_template/admin/templates/index.html +4 -4
- package/plugins/_template/admin/views/index.js +7 -0
- package/plugins/analytics/admin/css/index.css +1 -0
- package/plugins/analytics/admin/templates/analytics.html +22 -13
- package/plugins/analytics/plugin.json +3 -0
- package/plugins/blog/admin/css/index.css +1 -0
- package/plugins/blog/admin/templates/blog.html +30 -18
- package/plugins/blog/admin/templates/categories.html +2 -2
- package/plugins/blog/admin/templates/comments.html +2 -2
- package/plugins/blog/admin/templates/post-editor.html +34 -34
- package/plugins/blog/admin/templates/settings.html +6 -3
- package/plugins/blog/admin/views/blog.js +8 -5
- package/plugins/blog/admin/views/categories.js +5 -10
- package/plugins/blog/admin/views/comments.js +5 -5
- package/plugins/blog/admin/views/post-editor.js +39 -20
- package/plugins/blog/admin/views/settings.js +52 -50
- package/plugins/blog/collections/categories/schema.json +7 -6
- package/plugins/blog/collections/comments/schema.json +11 -10
- package/plugins/blog/collections/posts/schema.json +14 -13
- package/plugins/blog/plugin.js +36 -13
- package/plugins/blog/plugin.json +13 -5
- package/plugins/blog/plugin.public.js +312 -0
- package/plugins/contacts/admin/css/index.css +1 -0
- package/plugins/contacts/admin/templates/contacts.html +128 -0
- package/plugins/contacts/admin/views/contacts.js +237 -4
- package/plugins/contacts/collections/user-contacts/schema.json +108 -0
- package/plugins/contacts/plugin.js +214 -27
- package/plugins/contacts/plugin.json +4 -1
- package/plugins/invoice/admin/css/index.css +1 -0
- package/plugins/invoice/admin/templates/editor.html +140 -49
- package/plugins/invoice/admin/templates/index.html +153 -23
- package/plugins/invoice/admin/templates/issuers.html +2 -5
- package/plugins/invoice/admin/templates/receivers.html +2 -5
- package/plugins/invoice/admin/views/contacts-source.js +266 -0
- package/plugins/invoice/admin/views/editor.js +366 -199
- package/plugins/invoice/admin/views/export.js +199 -0
- package/plugins/invoice/admin/views/help-content.js +61 -0
- package/plugins/invoice/admin/views/index.js +582 -94
- package/plugins/invoice/admin/views/issuers.js +24 -17
- package/plugins/invoice/admin/views/media.js +172 -0
- package/plugins/invoice/admin/views/party-view.js +305 -67
- package/plugins/invoice/admin/views/payments.js +127 -0
- package/plugins/invoice/admin/views/print.js +130 -0
- package/plugins/invoice/admin/views/receivers.js +49 -16
- package/plugins/invoice/admin/views/send.js +212 -0
- package/plugins/invoice/admin/views/settings.js +594 -0
- package/plugins/invoice/admin/views/view-lifecycle.js +33 -0
- package/plugins/invoice/collections/invoice-issuers/schema.json +77 -11
- package/plugins/invoice/collections/invoice-receivers/schema.json +10 -9
- package/plugins/invoice/collections/invoices/schema.json +19 -13
- package/plugins/invoice/config.js +27 -6
- package/plugins/invoice/pdf.js +164 -0
- package/plugins/invoice/plugin.js +1217 -44
- package/plugins/invoice/plugin.json +10 -9
- package/plugins/invoice/templates/_base.css +1 -0
- package/plugins/invoice/templates/classic-nologo.html +100 -0
- package/plugins/invoice/templates/classic.html +91 -0
- package/plugins/invoice/templates/invoice-print.html +24 -0
- package/plugins/invoice/templates/minimal.html +99 -0
- package/plugins/invoice/templates/modern-nologo.html +114 -0
- package/plugins/invoice/templates/modern.html +113 -0
- package/plugins/invoice/templates/templates.json +11 -0
- package/plugins/mail-reader/admin/views/mail.js +19 -0
- package/plugins/mail-reader/config.js +7 -0
- package/plugins/mail-reader/plugin.js +48 -0
- package/plugins/mail-reader/plugin.json +33 -0
- package/plugins/notes/admin/views/notes.js +1 -1
- package/plugins/notes/plugin.json +2 -2
- package/plugins/surveys/lib/audience.js +37 -0
- package/plugins/surveys/lib/campaigns.js +43 -0
- package/plugins/surveys/lib/ledger.js +110 -0
- package/plugins/surveys/lib/sending.js +106 -0
- package/plugins/surveys/lib/stats.js +62 -0
- package/plugins/surveys/lib/submit.js +95 -0
- package/plugins/surveys/lib/tokens.js +28 -0
- package/plugins/surveys/plugin.public.js +149 -0
- package/plugins/theme-switcher/admin/templates/theme-switcher.html +1 -1
- package/public/css/forms.css +1 -1
- package/public/css/menu-highlight.css +1 -1
- package/public/css/search.css +1 -0
- package/public/css/site.css +1 -1
- package/public/js/collection-context.js +2 -2
- package/public/js/context-menus.js +1 -0
- package/public/js/form-logic-engine.js +1 -1
- package/public/js/forms.js +2 -2
- package/public/js/menu-decor.mjs +1 -1
- package/public/js/search.js +1 -0
- package/public/js/site.js +1 -1
- package/scripts/build.js +37 -3
- package/scripts/copy-domma.js +48 -0
- package/scripts/seed.js +1996 -0
- package/scripts/setup.js +8 -0
- package/server/routes/api/collections.js +34 -0
- package/server/routes/api/context-menus.js +104 -0
- package/server/routes/api/forms.js +42 -3
- package/server/routes/api/notifications.js +69 -19
- package/server/routes/api/plugins.js +50 -6
- package/server/routes/api/search.js +43 -0
- package/server/routes/api/theme.js +69 -0
- package/server/routes/public.js +42 -7
- package/server/server.js +74 -0
- package/server/services/adapters/FileAdapter.js +6 -1
- package/server/services/content.js +26 -0
- package/server/services/contextMenus.js +477 -0
- package/server/services/email.js +29 -3
- package/server/services/health.js +23 -2
- package/server/services/markdown.js +70 -9
- package/server/services/menuRender.js +28 -4
- package/server/services/menus.js +25 -1
- package/server/services/permissionRegistry.js +24 -0
- package/server/services/pluginFiles.js +52 -11
- package/server/services/plugins.js +229 -6
- package/server/services/renderer.js +148 -22
- package/server/services/roles.js +1 -1
- package/server/services/search-migration.js +82 -0
- package/server/services/search.js +413 -0
- package/server/services/sidebar-migration.js +1 -0
- package/server/services/themeSettings.js +541 -0
- package/server/services/users.js +8 -0
- package/server/templates/page.html +4 -2
- package/plugins/contacts/data/contacts.json +0 -20
- package/plugins/notes/data/notes.json +0 -1
- package/plugins/site-search/admin/views/site-search.js +0 -116
- package/plugins/site-search/config.js +0 -15
- package/plugins/site-search/plugin.js +0 -188
- package/plugins/site-search/plugin.json +0 -40
- package/plugins/site-search/public/inject-body.html +0 -17
- package/plugins/site-search/public/inject-head.html +0 -1
- package/plugins/site-search/public/search.css +0 -1
- package/plugins/site-search/public/search.js +0 -1
- package/plugins/todo/data/todos.json +0 -1
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How urgent a sender said a message was.
|
|
3
|
+
*
|
|
4
|
+
* There is no one header for this. Three are in circulation, none is in the
|
|
5
|
+
* IMAP envelope, and senders disagree about them - so this reads all three,
|
|
6
|
+
* ranks them, and gives one answer.
|
|
7
|
+
*
|
|
8
|
+
* `X-Priority: 1 (Highest)` … `5 (Lowest)`, 3 being normal. The oldest and
|
|
9
|
+
* the most widely set. The parenthetical is decoration; the digit is the
|
|
10
|
+
* header.
|
|
11
|
+
* `Importance: high | normal | low`. RFC 2156, and what Outlook and
|
|
12
|
+
* Thunderbird write alongside X-Priority.
|
|
13
|
+
* `X-MSMail-Priority: High | Normal | Low`. Outlook's, written with the
|
|
14
|
+
* other two and worth reading only when neither is present.
|
|
15
|
+
*
|
|
16
|
+
* And one that is not a header at all: mailparser RENAMES `X-Priority` to
|
|
17
|
+
* `priority` with a word value, so a parsed message has no `x-priority` key.
|
|
18
|
+
* Both spellings are read, because the list (header fetch) and the reader
|
|
19
|
+
* (parsed) must not disagree about the same message.
|
|
20
|
+
*
|
|
21
|
+
* Pure, so the disagreements can be pinned down without a mail server.
|
|
22
|
+
*
|
|
23
|
+
* @module _lib/mail/priority
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/** The three answers. Anything a sender writes reduces to one of these. */
|
|
27
|
+
export const PRIORITIES = ['high', 'normal', 'low'];
|
|
28
|
+
|
|
29
|
+
/** What a composer sets, and what each level means on the wire. */
|
|
30
|
+
const OUTGOING = {
|
|
31
|
+
high: {'X-Priority': '1 (Highest)', 'Importance': 'High', 'X-MSMail-Priority': 'High'},
|
|
32
|
+
low: {'X-Priority': '5 (Lowest)', 'Importance': 'Low', 'X-MSMail-Priority': 'Low'}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Read one header value, whatever shape it arrived in.
|
|
37
|
+
*
|
|
38
|
+
* imapflow hands back a Map for a header fetch and mailparser an object, and
|
|
39
|
+
* a repeated header can be an array in either.
|
|
40
|
+
*
|
|
41
|
+
* @param {object|Map|null} headers
|
|
42
|
+
* @param {string} name
|
|
43
|
+
* @returns {string}
|
|
44
|
+
*/
|
|
45
|
+
function headerValue(headers, name) {
|
|
46
|
+
if (!headers) return '';
|
|
47
|
+
const raw = typeof headers.get === 'function'
|
|
48
|
+
? headers.get(name)
|
|
49
|
+
: (headers[name] ?? headers[name.toLowerCase()]);
|
|
50
|
+
// A repeated header is a sender's problem, not ours: take the first and
|
|
51
|
+
// move on rather than trying to reconcile two answers.
|
|
52
|
+
const value = Array.isArray(raw) ? raw[0] : raw;
|
|
53
|
+
return String(value ?? '').trim();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Turn `X-Priority` into a level.
|
|
58
|
+
*
|
|
59
|
+
* @param {string} value
|
|
60
|
+
* @returns {string|null}
|
|
61
|
+
*/
|
|
62
|
+
function fromXPriority(value) {
|
|
63
|
+
// The digit is the header; `1 (Highest)` and `1` mean the same thing, and
|
|
64
|
+
// some senders write only the word, which the digit test then ignores.
|
|
65
|
+
const digit = value.match(/\d/)?.[0];
|
|
66
|
+
if (!digit) return null;
|
|
67
|
+
const n = Number(digit);
|
|
68
|
+
if (n <= 2) return 'high';
|
|
69
|
+
if (n >= 4) return 'low';
|
|
70
|
+
return 'normal';
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Turn a word-valued priority header into a level.
|
|
75
|
+
*
|
|
76
|
+
* @param {string} value
|
|
77
|
+
* @returns {string|null}
|
|
78
|
+
*/
|
|
79
|
+
function fromWord(value) {
|
|
80
|
+
const word = value.toLowerCase();
|
|
81
|
+
if (word.startsWith('high') || word.startsWith('urgent')) return 'high';
|
|
82
|
+
if (word.startsWith('low') || word.startsWith('non-urgent')) return 'low';
|
|
83
|
+
if (word.startsWith('normal')) return 'normal';
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* What priority a message claims.
|
|
89
|
+
*
|
|
90
|
+
* `X-Priority` wins where it is present because it is the one nearly every
|
|
91
|
+
* sender sets; the others are read in the order they are worth trusting. A
|
|
92
|
+
* message that says nothing is normal - which is not the same as a message
|
|
93
|
+
* that says "normal", but nothing downstream needs to tell those apart.
|
|
94
|
+
*
|
|
95
|
+
* @param {object|Map|null} headers
|
|
96
|
+
* @returns {'high' | 'normal' | 'low'}
|
|
97
|
+
*/
|
|
98
|
+
export function readPriority(headers) {
|
|
99
|
+
// `priority` first, and it is not a typo: mailparser RENAMES `X-Priority`
|
|
100
|
+
// to `priority` in its headers Map and gives it a word value, so a message
|
|
101
|
+
// parsed rather than header-fetched has no `x-priority` key at all. The
|
|
102
|
+
// raw name is still checked, because the IMAP header fetch path does have
|
|
103
|
+
// it - both paths have to produce the same answer or a message reads as
|
|
104
|
+
// urgent in the list and ordinary once opened.
|
|
105
|
+
const own = headerValue(headers, 'priority');
|
|
106
|
+
return fromWord(own)
|
|
107
|
+
?? fromXPriority(own)
|
|
108
|
+
?? fromXPriority(headerValue(headers, 'x-priority'))
|
|
109
|
+
?? fromWord(headerValue(headers, 'importance'))
|
|
110
|
+
?? fromWord(headerValue(headers, 'x-msmail-priority'))
|
|
111
|
+
?? 'normal';
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* The headers to send for a chosen level.
|
|
116
|
+
*
|
|
117
|
+
* All three, because a recipient's client will read whichever one it knows and
|
|
118
|
+
* setting one of them is how a message looks urgent in Outlook and ordinary
|
|
119
|
+
* everywhere else. Normal sends nothing at all: the absence of the header IS
|
|
120
|
+
* normal, and saying so explicitly only adds three lines every client ignores.
|
|
121
|
+
*
|
|
122
|
+
* @param {string} priority
|
|
123
|
+
* @returns {Object.<string, string>}
|
|
124
|
+
*/
|
|
125
|
+
export function priorityHeaders(priority) {
|
|
126
|
+
return OUTGOING[priority] ?? {};
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Coerce anything into a level we are willing to send.
|
|
131
|
+
*
|
|
132
|
+
* @param {unknown} value
|
|
133
|
+
* @returns {'high' | 'normal' | 'low'}
|
|
134
|
+
*/
|
|
135
|
+
export function normalisePriority(value) {
|
|
136
|
+
const word = String(value ?? '').toLowerCase();
|
|
137
|
+
return PRIORITIES.includes(word) ? word : 'normal';
|
|
138
|
+
}
|