@velocity-astro/cms-astro 0.1.0-beta.1 → 0.1.0-beta.12
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/agents/cms.md +145 -0
- package/agents/skills/cms-add-content-type/SKILL.md +81 -0
- package/agents/skills/cms-add-form/SKILL.md +85 -0
- package/agents/skills/cms-add-section/SKILL.md +97 -0
- package/agents/skills/cms-add-to-site/SKILL.md +57 -0
- package/agents/skills/cms-connect-page/SKILL.md +64 -0
- package/agents/skills/cms-deploy/SKILL.md +64 -0
- package/agents/skills/cms-import-content/SKILL.md +63 -0
- package/agents/skills/cms-set-up-crm/SKILL.md +53 -0
- package/agents/skills/cms-write-plugin/SKILL.md +81 -0
- package/dist/admin-files.d.ts +2 -2
- package/dist/admin-files.d.ts.map +1 -1
- package/dist/admin-files.js +13 -7
- package/dist/admin-files.js.map +1 -1
- package/dist/agent-files.d.ts +23 -0
- package/dist/agent-files.d.ts.map +1 -0
- package/dist/agent-files.js +84 -0
- package/dist/agent-files.js.map +1 -0
- package/dist/challenge.d.ts +35 -0
- package/dist/challenge.d.ts.map +1 -0
- package/dist/challenge.js +84 -0
- package/dist/challenge.js.map +1 -0
- package/dist/check.d.ts +38 -0
- package/dist/check.d.ts.map +1 -0
- package/dist/check.js +194 -0
- package/dist/check.js.map +1 -0
- package/dist/cli-content.d.ts +22 -0
- package/dist/cli-content.d.ts.map +1 -0
- package/dist/cli-content.js +309 -0
- package/dist/cli-content.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +130 -6
- package/dist/cli.js.map +1 -1
- package/dist/connection.d.ts +1 -0
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +31 -6
- package/dist/connection.js.map +1 -1
- package/dist/editor.d.ts +2 -0
- package/dist/editor.d.ts.map +1 -1
- package/dist/editor.js +10 -1
- package/dist/editor.js.map +1 -1
- package/dist/form-post.d.ts +9 -1
- package/dist/form-post.d.ts.map +1 -1
- package/dist/form-post.js +10 -3
- package/dist/form-post.js.map +1 -1
- package/dist/hosted.d.ts +76 -0
- package/dist/hosted.d.ts.map +1 -0
- package/dist/hosted.js +104 -0
- package/dist/hosted.js.map +1 -0
- package/dist/image-optimizer.d.ts +35 -0
- package/dist/image-optimizer.d.ts.map +1 -0
- package/dist/image-optimizer.js +76 -0
- package/dist/image-optimizer.js.map +1 -0
- package/dist/import-files.d.ts +30 -0
- package/dist/import-files.d.ts.map +1 -0
- package/dist/import-files.js +100 -0
- package/dist/import-files.js.map +1 -0
- package/dist/index.d.ts +12 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -3
- package/dist/index.js.map +1 -1
- package/dist/init.d.ts +2 -0
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +16 -1
- package/dist/init.js.map +1 -1
- package/dist/integration.d.ts +9 -0
- package/dist/integration.d.ts.map +1 -1
- package/dist/integration.js +15 -1
- package/dist/integration.js.map +1 -1
- package/dist/link.d.ts.map +1 -1
- package/dist/link.js +6 -2
- package/dist/link.js.map +1 -1
- package/dist/live-loader.d.ts +7 -3
- package/dist/live-loader.d.ts.map +1 -1
- package/dist/live-loader.js +12 -6
- package/dist/live-loader.js.map +1 -1
- package/dist/media-store.d.ts +15 -0
- package/dist/media-store.d.ts.map +1 -1
- package/dist/media-store.js +26 -2
- package/dist/media-store.js.map +1 -1
- package/dist/page-marks.d.ts +50 -0
- package/dist/page-marks.d.ts.map +1 -0
- package/dist/page-marks.js +90 -0
- package/dist/page-marks.js.map +1 -0
- package/dist/preview.d.ts +34 -2
- package/dist/preview.d.ts.map +1 -1
- package/dist/preview.js +81 -15
- package/dist/preview.js.map +1 -1
- package/dist/resend-mailer.d.ts +18 -1
- package/dist/resend-mailer.d.ts.map +1 -1
- package/dist/resend-mailer.js +24 -3
- package/dist/resend-mailer.js.map +1 -1
- package/dist/secret.d.ts +1 -1
- package/dist/secret.d.ts.map +1 -1
- package/dist/secret.js +3 -2
- package/dist/secret.js.map +1 -1
- package/dist/single.d.ts +18 -0
- package/dist/single.d.ts.map +1 -0
- package/dist/single.js +37 -0
- package/dist/single.js.map +1 -0
- package/dist/site-client.d.ts +37 -0
- package/dist/site-client.d.ts.map +1 -0
- package/dist/site-client.js +73 -0
- package/dist/site-client.js.map +1 -0
- package/dist/site-editor.d.ts +1 -1
- package/dist/site-editor.d.ts.map +1 -1
- package/dist/site-editor.js +36 -6
- package/dist/site-editor.js.map +1 -1
- package/dist/site-forms.d.ts +11 -0
- package/dist/site-forms.d.ts.map +1 -1
- package/dist/site-forms.js +37 -19
- package/dist/site-forms.js.map +1 -1
- package/dist/site-mail.d.ts +45 -0
- package/dist/site-mail.d.ts.map +1 -0
- package/dist/site-mail.js +84 -0
- package/dist/site-mail.js.map +1 -0
- package/dist/site-media.d.ts +5 -1
- package/dist/site-media.d.ts.map +1 -1
- package/dist/site-media.js +14 -5
- package/dist/site-media.js.map +1 -1
- package/dist/site-name.d.ts +9 -0
- package/dist/site-name.d.ts.map +1 -0
- package/dist/site-name.js +21 -0
- package/dist/site-name.js.map +1 -0
- package/dist/site-storage.d.ts +34 -0
- package/dist/site-storage.d.ts.map +1 -0
- package/dist/site-storage.js +118 -0
- package/dist/site-storage.js.map +1 -0
- package/package.json +12 -8
- package/routes/editor.ts +7 -6
- package/routes/form-client.js.ts +68 -0
- package/routes/media.ts +2 -2
- package/routes/preview-client.js.ts +11 -56
- package/routes/published.ts +2 -2
- package/routes/sitemap-live.xml.ts +4 -1
- package/routes/sites.ts +11 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"site-client.js","sourceRoot":"","sources":["../src/site-client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,+EAA+E;AAC/E,MAAM,OAAO,WAAY,SAAQ,KAAK;IAClB,IAAI,GAAG,aAAa,CAAC;CACxC;AAYD,MAAM,WAAW,GAAqC,EAAE,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,YAA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velocity-astro/cms-core';
|
|
3
3
|
import { EditorHost } from './editor.js';
|
|
4
4
|
/** What the integration tells the editor's routes about the site. */
|
|
5
5
|
export interface SiteEditorSettings {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"site-editor.d.ts","sourceRoot":"","sources":["../src/site-editor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,MAAM,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"site-editor.d.ts","sourceRoot":"","sources":["../src/site-editor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,MAAM,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAiB,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE5E,OAAO,EAAE,UAAU,EAAa,MAAM,aAAa,CAAC;AAMpD,qEAAqE;AACrE,MAAM,WAAW,kBAAkB;IACjC,kDAAkD;IAClD,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,mCAAmC;IACnC,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,yFAAyF;IACzF,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,uFAAuF;IACvF,QAAQ,CAAC,MAAM,CAAC,EAAE,YAAY,GAAG,SAAS,CAAC;CAC5C;AAED,iGAAiG;AACjG,qBAAa,mBAAoB,SAAQ,KAAK;CAAG;AAEjD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,kBAAkB,EAAE,MAAM,GAAG,KAAK,CAAC,GAAG,MAAM,CAezG;AAWD;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,kBAAkB,EAAE,MAAM,GAAG,KAAK,CAAC,GAAG,MAAM,GAAG,IAAI,CAa/G;AAgDD,gFAAgF;AAChF,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,kBAAkB,GAAG,OAAO,CAAC,UAAU,CAAC,CAUlG;AAED;;;;GAIG;AACH,wBAAsB,UAAU,CAC9B,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,kBAAkB,EAC5B,MAAM,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,GACzD,OAAO,CAAC,QAAQ,CAAC,CAUnB"}
|
package/dist/site-editor.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { AuthSetupError } from '@velocity-astro/cms-auth';
|
|
2
|
+
import { ConflictError } from '@velocity-astro/cms-core';
|
|
2
3
|
import { sharedConnection } from './connection.js';
|
|
3
4
|
import { EditorHost, LogMailer } from './editor.js';
|
|
4
|
-
import {
|
|
5
|
+
import { currentSite } from './hosted.js';
|
|
6
|
+
import { SiteMail } from './site-mail.js';
|
|
7
|
+
import { siteNameNow } from './site-name.js';
|
|
5
8
|
import { siteSecret } from './secret.js';
|
|
6
9
|
/** The editor cannot be served until the site's settings are completed. The message says how. */
|
|
7
10
|
export class EditorNotSetUpError extends Error {
|
|
@@ -12,6 +15,10 @@ export class EditorNotSetUpError extends Error {
|
|
|
12
15
|
* would carry a real person's sign-in to an address of the sender's choosing.
|
|
13
16
|
*/
|
|
14
17
|
export function editorOrigin(request, settings) {
|
|
18
|
+
// On a server that runs many sites, the address is the one its host keeps for the site.
|
|
19
|
+
const hosted = currentSite();
|
|
20
|
+
if (hosted)
|
|
21
|
+
return new URL(hosted.origin).origin;
|
|
15
22
|
const configured = process.env.VELOCITY_CMS_ORIGIN || (settings.dev ? new URL(request.url).origin : settings.site);
|
|
16
23
|
if (!configured) {
|
|
17
24
|
throw new EditorNotSetUpError('The editor needs to know the site\'s address. Set `site` in astro.config.mjs, or the VELOCITY_CMS_ORIGIN environment variable.');
|
|
@@ -39,6 +46,9 @@ const hostOf = (address) => {
|
|
|
39
46
|
*/
|
|
40
47
|
export function pagesOrigin(request, settings) {
|
|
41
48
|
const asked = new URL(request.url);
|
|
49
|
+
const hosted = currentSite();
|
|
50
|
+
if (hosted)
|
|
51
|
+
return new URL(hosted.origin).origin;
|
|
42
52
|
if (settings.dev)
|
|
43
53
|
return asked.origin;
|
|
44
54
|
const configured = [process.env.VELOCITY_CMS_ORIGIN, settings.site].map(hostOf);
|
|
@@ -59,17 +69,37 @@ async function createHost(origin, settings) {
|
|
|
59
69
|
throw new EditorNotSetUpError('The editor is off because VELOCITY_CMS_SECRET is not set. Set it to at least 32 random characters, for example from `openssl rand -base64 32`.');
|
|
60
70
|
}
|
|
61
71
|
try {
|
|
62
|
-
|
|
63
|
-
|
|
72
|
+
const connection = await sharedConnection({});
|
|
73
|
+
const hosted = currentSite();
|
|
74
|
+
// A host names its sites. Otherwise the name an owner saved, then the one the site's code gives.
|
|
75
|
+
const named = hosted ? undefined : () => siteNameNow(connection.cms);
|
|
76
|
+
const siteName = hosted?.name ?? (await named?.()) ?? settings.siteName;
|
|
77
|
+
// The site's own mailer first, then Resend from the server's settings, then what an owner set up in the editor, then the server's log.
|
|
78
|
+
const mail = new SiteMail({ settings: connection.cms.settings, own: settings.mailer, fallback: new LogMailer(), hosted: hosted !== undefined, ...(named && { siteName: named }) });
|
|
79
|
+
connection.cms.settings.useSite({ defaultName: hosted?.name ?? settings.siteName, fixedBy: hosted ? 'host' : null });
|
|
80
|
+
const host = new EditorHost({
|
|
81
|
+
connection,
|
|
64
82
|
secret,
|
|
65
83
|
origin,
|
|
66
|
-
siteName
|
|
84
|
+
siteName,
|
|
85
|
+
...(named && { siteNameNow: named }),
|
|
67
86
|
adminPath: settings.adminPath,
|
|
68
|
-
|
|
69
|
-
mailer: settings.mailer ?? mailerFromEnv() ?? new LogMailer(),
|
|
87
|
+
mailer: mail,
|
|
70
88
|
...(settings.images && { images: settings.images }),
|
|
71
89
|
onFault: (error) => console.error('[velocity-cms]', error),
|
|
72
90
|
});
|
|
91
|
+
connection.cms.settings.useMail({
|
|
92
|
+
fixedBy: () => mail.fixedBy(),
|
|
93
|
+
canTest: () => mail.canTest(),
|
|
94
|
+
// The test goes to the address the person signs in with, which only sign-in knows.
|
|
95
|
+
sendTest: async (actor) => {
|
|
96
|
+
const person = (await host.auth.listUsers(actor)).find((user) => user.id === actor.id);
|
|
97
|
+
if (!person)
|
|
98
|
+
throw new ConflictError('A test email goes to the person who asks for it, and only someone signed in has an address to send it to.');
|
|
99
|
+
await mail.sendTest({ email: person.email, name: person.name, siteName: hosted?.name ?? settings.siteName });
|
|
100
|
+
},
|
|
101
|
+
});
|
|
102
|
+
return host;
|
|
73
103
|
}
|
|
74
104
|
catch (error) {
|
|
75
105
|
if (error instanceof AuthSetupError)
|
package/dist/site-editor.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"site-editor.js","sourceRoot":"","sources":["../src/site-editor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAe,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"site-editor.js","sourceRoot":"","sources":["../src/site-editor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAe,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAE,aAAa,EAAqB,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE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7B,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,IAAI,GAAG,UAAU,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QACpC,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACxB,+FAA+F;QAC/F,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IACzC,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,OAAgB,EAChB,QAA4B,EAC5B,MAA0D;IAE1D,IAAI,IAAgB,CAAC;IACrB,IAAI,CAAC;QACH,IAAI,GAAG,MAAM,cAAc,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACjD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,CAAC,CAAC,KAAK,YAAY,mBAAmB,CAAC;YAAE,MAAM,KAAK,CAAC;QACzD,OAAO,CAAC,IAAI,CAAC,kBAAkB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QAChD,OAAO,QAAQ,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,eAAe,EAAE,UAAU,EAAE,EAAE,CAAC,CAAC;IAC7I,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC;AACtB,CAAC"}
|
package/dist/site-forms.d.ts
CHANGED
|
@@ -15,6 +15,17 @@ export interface SiteForm extends PublicForm {
|
|
|
15
15
|
* screen readers). A person leaves it alone; a script that fills in everything gives itself away.
|
|
16
16
|
*/
|
|
17
17
|
readonly trap: string;
|
|
18
|
+
/**
|
|
19
|
+
* The challenge a sender must pass, when an owner set one up. The form's script (`FORM_SCRIPT`)
|
|
20
|
+
* draws it where the form has a `[data-cms-form-challenge]`, or above the submit button. A
|
|
21
|
+
* site with a content security policy allows `host` for scripts and frames.
|
|
22
|
+
*/
|
|
23
|
+
readonly challenge?: {
|
|
24
|
+
readonly provider: 'turnstile';
|
|
25
|
+
readonly siteKey: string;
|
|
26
|
+
readonly script: string;
|
|
27
|
+
readonly host: string;
|
|
28
|
+
};
|
|
18
29
|
}
|
|
19
30
|
/** The address of the script that sends a form without leaving its page (`data-cms-form`). */
|
|
20
31
|
export declare const FORM_SCRIPT = "/cms-form.js";
|
package/dist/site-forms.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"site-forms.d.ts","sourceRoot":"","sources":["../src/site-forms.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAG3D,OAAO,
|
|
1
|
+
{"version":3,"file":"site-forms.d.ts","sourceRoot":"","sources":["../src/site-forms.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAG3D,OAAO,EAAqH,SAAS,EAA2C,MAAM,gBAAgB,CAAC;AACvM,OAAO,EAAU,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAOxD,OAAO,EAAgB,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAczE,wFAAwF;AACxF,wBAAgB,aAAa,CAAC,QAAQ,EAAE,kBAAkB,GAAG,OAAO,CAAC,SAAS,CAAC,CAgC9E;AAED,2FAA2F;AAC3F,MAAM,WAAW,QAAS,SAAQ,UAAU;IAC1C,wEAAwE;IACxE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,wEAAwE;IACxE,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAClD;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE;QAAE,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;QAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CACnI;AAED,8FAA8F;AAC9F,eAAO,MAAM,WAAW,iBAAiB,CAAC;AAE1C,oGAAoG;AACpG,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC;AAE1D,mDAAmD;AACnD,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC7F;AAED;;;GAGG;AACH,wBAAsB,QAAQ,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,GAAE,eAAoB,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAgC3H"}
|
package/dist/site-forms.js
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { isLiveType } from '@velocity-astro/cms-core';
|
|
2
2
|
import { sharedConnection, SITE } from './connection.js';
|
|
3
|
-
import { FORM_ABOUT_FIELD, FORM_LOCALE_FIELD, FORM_PAGE_FIELD, FORM_TOKEN_FIELD, FORM_TRAP_FIELD, FormPosts, aboutMark, formToken } from './form-post.js';
|
|
3
|
+
import { FORM_ABOUT_FIELD, FORM_CHALLENGE_KEY_FIELD, FORM_LOCALE_FIELD, FORM_PAGE_FIELD, FORM_TOKEN_FIELD, FORM_TRAP_FIELD, FormPosts, MemoryRateLimiter, aboutMark, formToken } from './form-post.js';
|
|
4
4
|
import { pageAt } from './page-head.js';
|
|
5
|
-
import {
|
|
5
|
+
import { currentSite, siteKey } from './hosted.js';
|
|
6
|
+
import { LogMailer } from './editor.js';
|
|
7
|
+
import { SiteMail } from './site-mail.js';
|
|
8
|
+
import { siteNameNow } from './site-name.js';
|
|
9
|
+
import { SiteChallenge, TURNSTILE_HOST, TURNSTILE_SCRIPT } from './challenge.js';
|
|
6
10
|
import { siteSecret } from './secret.js';
|
|
7
11
|
import { editorOrigin } from './site-editor.js';
|
|
8
|
-
|
|
9
|
-
const
|
|
12
|
+
/** One taker of form posts for each site this server runs. */
|
|
13
|
+
const takers = new Map();
|
|
10
14
|
/** The site's address for forms. A site that has not said its address yet is taken at the request's word. */
|
|
11
15
|
function originOf(request, settings) {
|
|
12
16
|
try {
|
|
@@ -18,24 +22,35 @@ function originOf(request, settings) {
|
|
|
18
22
|
}
|
|
19
23
|
/** The site's one taker of form posts for the life of the server, made on first use. */
|
|
20
24
|
export function siteFormPosts(settings) {
|
|
25
|
+
const key = siteKey();
|
|
26
|
+
let posts = takers.get(key);
|
|
21
27
|
if (!posts) {
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
const onFault = (error) => console.error('[velocity-cms]', error instanceof Error ? error.message : error);
|
|
29
|
+
const made = sharedConnection({}).then(({ cms }) => {
|
|
30
|
+
const challenge = new SiteChallenge({ account: () => cms.settings.challengeAccount(), onFault });
|
|
31
|
+
const counted = new MemoryRateLimiter();
|
|
32
|
+
return new FormPosts({
|
|
33
|
+
cms,
|
|
34
|
+
origin: (request) => originOf(request, settings),
|
|
35
|
+
siteName: currentSite()?.name ?? settings.siteName,
|
|
36
|
+
secret: siteSecret(),
|
|
37
|
+
entryAt: async (path) => {
|
|
38
|
+
const { type, entry } = await pageAt(cms, await cms.schema.list(), path);
|
|
39
|
+
return type && entry ? { typeId: type.id, entry: entry.translationGroup } : undefined;
|
|
40
|
+
},
|
|
41
|
+
// The site's own mailer when it sends notices, then Resend from the server's settings, then what an owner set up in the editor.
|
|
42
|
+
mailer: new SiteMail({ settings: cms.settings, own: settings.mailer, fallback: new LogMailer(), hosted: currentSite() !== undefined, ...(currentSite() === undefined && { siteName: () => siteNameNow(cms) }) }),
|
|
43
|
+
challenge,
|
|
44
|
+
// What an owner set under Settings, Forms and spam. Settings that cannot be read leave the limit the CMS comes with.
|
|
45
|
+
limiter: { take: async (address) => counted.take(address, await cms.settings.formPostsPerAddress().catch(() => undefined)) },
|
|
46
|
+
onFault,
|
|
47
|
+
});
|
|
48
|
+
});
|
|
35
49
|
posts = made;
|
|
50
|
+
takers.set(key, made);
|
|
36
51
|
made.catch(() => {
|
|
37
|
-
if (
|
|
38
|
-
|
|
52
|
+
if (takers.get(key) === made)
|
|
53
|
+
takers.delete(key);
|
|
39
54
|
});
|
|
40
55
|
}
|
|
41
56
|
return posts;
|
|
@@ -54,6 +69,7 @@ export async function siteForm(page, choice, options = {}) {
|
|
|
54
69
|
return null;
|
|
55
70
|
const token = await formToken(siteSecret(), form.key);
|
|
56
71
|
const locale = page.currentLocale;
|
|
72
|
+
const siteKey = await cms.settings.challengeSiteKey();
|
|
57
73
|
let about;
|
|
58
74
|
if (options.about) {
|
|
59
75
|
// An entry that is not there, or not published, leaves the form as one about nothing.
|
|
@@ -70,8 +86,10 @@ export async function siteForm(page, choice, options = {}) {
|
|
|
70
86
|
...(locale !== undefined && { [FORM_LOCALE_FIELD]: locale }),
|
|
71
87
|
...(token !== undefined && { [FORM_TOKEN_FIELD]: token }),
|
|
72
88
|
...(about !== undefined && { [FORM_ABOUT_FIELD]: about }),
|
|
89
|
+
...(siteKey !== null && { [FORM_CHALLENGE_KEY_FIELD]: siteKey }),
|
|
73
90
|
},
|
|
74
91
|
trap: FORM_TRAP_FIELD,
|
|
92
|
+
...(siteKey !== null && { challenge: { provider: 'turnstile', siteKey, script: TURNSTILE_SCRIPT, host: TURNSTILE_HOST } }),
|
|
75
93
|
};
|
|
76
94
|
}
|
|
77
95
|
catch (error) {
|
package/dist/site-forms.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"site-forms.js","sourceRoot":"","sources":["../src/site-forms.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,eAAe,EAAE,gBAAgB,EAAE,eAAe,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"site-forms.js","sourceRoot":"","sources":["../src/site-forms.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,eAAe,EAAE,gBAAgB,EAAE,eAAe,EAAE,SAAS,EAAE,iBAAiB,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACvM,OAAO,EAAE,MAAM,EAAkB,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACjF,OAAO,EAAE,UAAU,EAAE,MAAM,aAA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,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,0CAA0C,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAC1G,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { InvitationMail, Mailer, SignInMail } from '@velocity-astro/cms-auth';
|
|
2
|
+
import { type Cms, type MailFixedBy } from '@velocity-astro/cms-core';
|
|
3
|
+
import type { NoticeMailer, SubmissionNotice } from './form-post.js';
|
|
4
|
+
import { type TestMail } from './resend-mailer.js';
|
|
5
|
+
export interface SiteMailOptions {
|
|
6
|
+
/** The site's settings, where an owner may have said how email is sent. */
|
|
7
|
+
readonly settings: Cms['settings'];
|
|
8
|
+
/** The site's own mailer, from its code (`velocityCms({ mailer })`). It wins over everything. */
|
|
9
|
+
readonly own?: Mailer | undefined;
|
|
10
|
+
/** What sign-in links go to when nothing sends email: the server's log. */
|
|
11
|
+
readonly fallback: Mailer;
|
|
12
|
+
/** What an owner called the site in the editor, or `null`. It is what an email calls the site, when there is one. */
|
|
13
|
+
readonly siteName?: () => Promise<string | null>;
|
|
14
|
+
/** Whether a host runs this site among many, so what is fixed is fixed by the host. */
|
|
15
|
+
readonly hosted?: boolean;
|
|
16
|
+
/** Defaults to the server's own environment. */
|
|
17
|
+
readonly env?: Readonly<Record<string, string | undefined>>;
|
|
18
|
+
/** Defaults to the platform's own `fetch`. */
|
|
19
|
+
readonly fetch?: typeof globalThis.fetch;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* How one site's email leaves, decided each time one is sent: the site's own mailer from its
|
|
23
|
+
* code, then Resend from the server's settings, then what an owner set up in the editor, and
|
|
24
|
+
* for sign-in links with none of the three, the server's log. The editor's settings are read
|
|
25
|
+
* from the database for every email, so every running copy follows a change at once, and the
|
|
26
|
+
* key is held only for as long as the email takes.
|
|
27
|
+
*/
|
|
28
|
+
export declare class SiteMail implements Mailer, NoticeMailer {
|
|
29
|
+
#private;
|
|
30
|
+
constructor(options: SiteMailOptions);
|
|
31
|
+
/** Who decides how email is sent when the editor's settings do not. */
|
|
32
|
+
fixedBy(): MailFixedBy | null;
|
|
33
|
+
sendSignInLink(mail: SignInMail): Promise<void>;
|
|
34
|
+
sendInvitation(mail: InvitationMail): Promise<void>;
|
|
35
|
+
/** A notice goes through the site's own mailer when it sends notices, and otherwise as the settings say. */
|
|
36
|
+
sendSubmissionNotice(mail: SubmissionNotice): Promise<void>;
|
|
37
|
+
/** Whether email is sent in a way that can send a test. */
|
|
38
|
+
canTest(): Promise<boolean>;
|
|
39
|
+
/**
|
|
40
|
+
* Sends the test. What the provider said goes nowhere but into the words for the owner who
|
|
41
|
+
* asked: which of the two things they typed to look at again.
|
|
42
|
+
*/
|
|
43
|
+
sendTest(mail: TestMail): Promise<void>;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=site-mail.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"site-mail.d.ts","sourceRoot":"","sources":["../src/site-mail.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACnF,OAAO,EAAiB,KAAK,GAAG,EAAE,KAAK,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACrF,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,EAAiD,KAAK,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAElG,MAAM,WAAW,eAAe;IAC9B,2EAA2E;IAC3E,QAAQ,CAAC,QAAQ,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC;IACnC,iGAAiG;IACjG,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,2EAA2E;IAC3E,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,qHAAqH;IACrH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACjD,uFAAuF;IACvF,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,gDAAgD;IAChD,QAAQ,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;IAC5D,8CAA8C;IAC9C,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;CAC1C;AAQD;;;;;;GAMG;AACH,qBAAa,QAAS,YAAW,MAAM,EAAE,YAAY;;gBAGvC,OAAO,EAAE,eAAe;IAIpC,uEAAuE;IACvE,OAAO,IAAI,WAAW,GAAG,IAAI;IAKvB,cAAc,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAI/C,cAAc,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAIzD,4GAA4G;IACtG,oBAAoB,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAOjE,2DAA2D;IACrD,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC;IAIjC;;;OAGG;IACG,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CAyC9C"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { ConflictError } from '@velocity-astro/cms-core';
|
|
2
|
+
import { MailRefusedError, ResendMailer, mailerFromEnv } from './resend-mailer.js';
|
|
3
|
+
const takesNotices = (mailer) => typeof mailer === 'object' && mailer !== null && typeof mailer.sendSubmissionNotice === 'function';
|
|
4
|
+
const sendsTests = (mailer) => typeof mailer === 'object' && mailer !== null && typeof mailer.sendTest === 'function';
|
|
5
|
+
/**
|
|
6
|
+
* How one site's email leaves, decided each time one is sent: the site's own mailer from its
|
|
7
|
+
* code, then Resend from the server's settings, then what an owner set up in the editor, and
|
|
8
|
+
* for sign-in links with none of the three, the server's log. The editor's settings are read
|
|
9
|
+
* from the database for every email, so every running copy follows a change at once, and the
|
|
10
|
+
* key is held only for as long as the email takes.
|
|
11
|
+
*/
|
|
12
|
+
export class SiteMail {
|
|
13
|
+
#options;
|
|
14
|
+
constructor(options) {
|
|
15
|
+
this.#options = options;
|
|
16
|
+
}
|
|
17
|
+
/** Who decides how email is sent when the editor's settings do not. */
|
|
18
|
+
fixedBy() {
|
|
19
|
+
const fixed = this.#options.own ? 'code' : this.#fromServer() ? 'server' : null;
|
|
20
|
+
return fixed !== null && this.#options.hosted === true ? 'host' : fixed;
|
|
21
|
+
}
|
|
22
|
+
async sendSignInLink(mail) {
|
|
23
|
+
await ((await this.#mailer()) ?? this.#options.fallback).sendSignInLink(await this.#named(mail));
|
|
24
|
+
}
|
|
25
|
+
async sendInvitation(mail) {
|
|
26
|
+
await ((await this.#mailer()) ?? this.#options.fallback).sendInvitation(await this.#named(mail));
|
|
27
|
+
}
|
|
28
|
+
/** A notice goes through the site's own mailer when it sends notices, and otherwise as the settings say. */
|
|
29
|
+
async sendSubmissionNotice(mail) {
|
|
30
|
+
const { own } = this.#options;
|
|
31
|
+
const mailer = takesNotices(own) ? own : (this.#fromServer() ?? (await this.#fromEditor()));
|
|
32
|
+
if (!mailer)
|
|
33
|
+
throw new Error('No email provider is set up. Set one up under Settings, Email in the editor.');
|
|
34
|
+
await mailer.sendSubmissionNotice(await this.#named(mail));
|
|
35
|
+
}
|
|
36
|
+
/** Whether email is sent in a way that can send a test. */
|
|
37
|
+
async canTest() {
|
|
38
|
+
return sendsTests(await this.#mailer());
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Sends the test. What the provider said goes nowhere but into the words for the owner who
|
|
42
|
+
* asked: which of the two things they typed to look at again.
|
|
43
|
+
*/
|
|
44
|
+
async sendTest(mail) {
|
|
45
|
+
const mailer = await this.#mailer();
|
|
46
|
+
if (!sendsTests(mailer))
|
|
47
|
+
throw new ConflictError('No test email can be sent yet. Save an API key and a sender first.');
|
|
48
|
+
try {
|
|
49
|
+
await mailer.sendTest(await this.#named(mail));
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
if (!(error instanceof MailRefusedError))
|
|
53
|
+
throw new ConflictError('The email service could not be reached, so no test was sent. Try again in a moment.');
|
|
54
|
+
const { status } = error;
|
|
55
|
+
throw new ConflictError(status === 401
|
|
56
|
+
? 'Resend did not accept the API key (401). Check that it was pasted whole, and that it has not been deleted in Resend.'
|
|
57
|
+
: status === 403
|
|
58
|
+
? 'Resend refused to send from this sender (403). Verify the sender\'s domain in Resend, and check that the API key may send email.'
|
|
59
|
+
: status === 422
|
|
60
|
+
? 'Resend did not accept the sender (422). Use an address on a domain you have verified in Resend.'
|
|
61
|
+
: status === 429
|
|
62
|
+
? 'Resend is turning email away for now (429): too many were sent, or the plan\'s limit is reached. Try again later.'
|
|
63
|
+
: `Resend could not send the test (${status}). Try again in a moment.`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/** The email with the site called what an owner called it. A name that cannot be read leaves the email as it was. */
|
|
67
|
+
async #named(mail) {
|
|
68
|
+
const siteName = await this.#options.siteName?.().catch(() => null);
|
|
69
|
+
return siteName ? { ...mail, siteName } : mail;
|
|
70
|
+
}
|
|
71
|
+
async #mailer() {
|
|
72
|
+
return this.#options.own ?? this.#fromServer() ?? (await this.#fromEditor());
|
|
73
|
+
}
|
|
74
|
+
#fromServer() {
|
|
75
|
+
return mailerFromEnv(this.#options.env, this.#options.fetch);
|
|
76
|
+
}
|
|
77
|
+
async #fromEditor() {
|
|
78
|
+
const account = await this.#options.settings.mailAccount();
|
|
79
|
+
if (account === null)
|
|
80
|
+
return undefined;
|
|
81
|
+
return new ResendMailer({ apiKey: account.apiKey, from: account.from, ...(this.#options.fetch && { fetch: this.#options.fetch }) });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AC3D,IAAI,OAAO,KAAK,IAAI;YAAE,OAAO,SAAS,CAAC;QACvC,OAAO,IAAI,YAAY,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;IACtI,CAAC;CACF"}
|
package/dist/site-media.d.ts
CHANGED
|
@@ -2,8 +2,12 @@ import { type SiteImage } from '@velocity-astro/cms-core';
|
|
|
2
2
|
/**
|
|
3
3
|
* The answer to a request for an uploaded file. A file never changes once it is kept and its
|
|
4
4
|
* name is never given to another, so browsers and the CDN may keep it for good.
|
|
5
|
+
*
|
|
6
|
+
* With a width (`/media/kitchen.webp?w=640`, one of `IMAGE_WIDTHS`) the answer is a copy no
|
|
7
|
+
* wider than that. It is made when asked for and kept by the browser and the CDN like the
|
|
8
|
+
* image itself, so a width is made once.
|
|
5
9
|
*/
|
|
6
|
-
export declare function uploadedFile(key: string): Promise<Response>;
|
|
10
|
+
export declare function uploadedFile(key: string, width?: string | null): Promise<Response>;
|
|
7
11
|
/**
|
|
8
12
|
* Reads the uploaded images again. The site's middleware does this before each page is
|
|
9
13
|
* rendered, so a page never misses an image that was uploaded a moment ago, whichever server
|
package/dist/site-media.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"site-media.d.ts","sourceRoot":"","sources":["../src/site-media.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,SAAS,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"site-media.d.ts","sourceRoot":"","sources":["../src/site-media.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAIzE;;;;;;;GAOG;AACH,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,QAAQ,CAAC,CAoBxF;AAKD;;;;GAIG;AACH,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC,CAG3D;AAED;;;GAGG;AACH,eAAO,MAAM,aAAa,GAAI,MAAM,MAAM,KAAG,SAAS,GAAG,SAA6C,CAAC"}
|
package/dist/site-media.js
CHANGED
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import { NotFoundError } from '@velocity-astro/cms-core';
|
|
2
2
|
import { sharedConnection, SITE } from './connection.js';
|
|
3
|
+
import { siteKey } from './hosted.js';
|
|
3
4
|
/**
|
|
4
5
|
* The answer to a request for an uploaded file. A file never changes once it is kept and its
|
|
5
6
|
* name is never given to another, so browsers and the CDN may keep it for good.
|
|
7
|
+
*
|
|
8
|
+
* With a width (`/media/kitchen.webp?w=640`, one of `IMAGE_WIDTHS`) the answer is a copy no
|
|
9
|
+
* wider than that. It is made when asked for and kept by the browser and the CDN like the
|
|
10
|
+
* image itself, so a width is made once.
|
|
6
11
|
*/
|
|
7
|
-
export async function uploadedFile(key) {
|
|
12
|
+
export async function uploadedFile(key, width) {
|
|
8
13
|
const { cms } = await sharedConnection({});
|
|
9
14
|
try {
|
|
10
|
-
|
|
15
|
+
// `?w=640` asks for a small copy. Anything that is not a whole number is no width at all.
|
|
16
|
+
if (width != null && !/^[1-9]\d{2,3}$/.test(width))
|
|
17
|
+
throw new NotFoundError('Image', key);
|
|
18
|
+
const file = await cms.media.file(key, width == null ? undefined : Number(width));
|
|
11
19
|
return new Response(file.bytes, {
|
|
12
20
|
headers: {
|
|
13
21
|
'content-type': file.contentType,
|
|
@@ -25,7 +33,8 @@ export async function uploadedFile(key) {
|
|
|
25
33
|
throw error;
|
|
26
34
|
}
|
|
27
35
|
}
|
|
28
|
-
|
|
36
|
+
/** The uploaded images of each site this server draws pages for. */
|
|
37
|
+
const latest = new Map();
|
|
29
38
|
/**
|
|
30
39
|
* Reads the uploaded images again. The site's middleware does this before each page is
|
|
31
40
|
* rendered, so a page never misses an image that was uploaded a moment ago, whichever server
|
|
@@ -33,11 +42,11 @@ let latest = new Map();
|
|
|
33
42
|
*/
|
|
34
43
|
export async function refreshUploadedImages() {
|
|
35
44
|
const { cms } = await sharedConnection({});
|
|
36
|
-
latest
|
|
45
|
+
latest.set(siteKey(), new Map((await cms.media.uploads(SITE)).map((image) => [image.name, image])));
|
|
37
46
|
}
|
|
38
47
|
/**
|
|
39
48
|
* The uploaded image with this name, as it was when the page began to render: its address on
|
|
40
49
|
* this site and its size. `undefined` when no upload has the name.
|
|
41
50
|
*/
|
|
42
|
-
export const uploadedImage = (name) => latest.get(name);
|
|
51
|
+
export const uploadedImage = (name) => latest.get(siteKey())?.get(name);
|
|
43
52
|
//# sourceMappingURL=site-media.js.map
|
package/dist/site-media.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"site-media.js","sourceRoot":"","sources":["../src/site-media.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAkB,MAAM,0BAA0B,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"site-media.js","sourceRoot":"","sources":["../src/site-media.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAkB,MAAM,0BAA0B,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,GAAW,EAAE,KAAqB;IACnE,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,gBAAgB,CAAC,EAAE,CAAC,CAAC;IAC3C,IAAI,CAAC;QACH,0FAA0F;QAC1F,IAAI,KAAK,IAAI,IAAI,IAA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AI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACtG,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAAY,EAAyB,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Cms } from '@velocity-astro/cms-core';
|
|
2
|
+
/**
|
|
3
|
+
* What the site is called, when nothing fixes it: the name published on the page of the settings
|
|
4
|
+
* that holds it (a template's "Business details"), then what an owner saved under Settings,
|
|
5
|
+
* General. `null` when neither says, so the name from the site's code stands. One field names
|
|
6
|
+
* the site for its visitors, its editor and its emails.
|
|
7
|
+
*/
|
|
8
|
+
export declare function siteNameNow(cms: Cms): Promise<string | null>;
|
|
9
|
+
//# sourceMappingURL=site-name.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"site-name.d.ts","sourceRoot":"","sources":["../src/site-name.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,GAAG,EAAE,MAAM,0BAA0B,CAAC;AAG9E;;;;;GAKG;AACH,wBAAsB,WAAW,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAUlE"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { isLiveType, siteNameFrom } from '@velocity-astro/cms-core';
|
|
2
|
+
import { DEFAULT_LOCALE, entriesOf } from './link.js';
|
|
3
|
+
/**
|
|
4
|
+
* What the site is called, when nothing fixes it: the name published on the page of the settings
|
|
5
|
+
* that holds it (a template's "Business details"), then what an owner saved under Settings,
|
|
6
|
+
* General. `null` when neither says, so the name from the site's code stands. One field names
|
|
7
|
+
* the site for its visitors, its editor and its emails.
|
|
8
|
+
*/
|
|
9
|
+
export async function siteNameNow(cms) {
|
|
10
|
+
const type = (await cms.schema.list()).find((candidate) => isLiveType(candidate) && candidate.siteNamePath !== undefined);
|
|
11
|
+
if (type) {
|
|
12
|
+
const published = (await entriesOf(cms, type)).filter((entry) => entry.published !== undefined);
|
|
13
|
+
// The first language's name is the site's: an email is not written in a visitor's language.
|
|
14
|
+
const entry = published.find((candidate) => candidate.locale === DEFAULT_LOCALE) ?? published[0];
|
|
15
|
+
const name = entry?.published ? siteNameFrom(type, entry.published.data) : null;
|
|
16
|
+
if (name !== null)
|
|
17
|
+
return name;
|
|
18
|
+
}
|
|
19
|
+
return cms.settings.siteName();
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=site-name.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"site-name.js","sourceRoot":"","sources":["../src/site-name.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAY,MAAM,0BAA0B,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtD;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,GAAQ;IACxC,MAAM,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,SAAS,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC;IAC1H,IAAI,IAAI,EAAE,CAAC;QACT,MAAM,SAAS,GAAG,CAAC,MAAM,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC;QAChG,4FAA4F;QAC5F,MAAM,KAAK,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,KAAK,cAAc,CAAC,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC;QACjG,MAAM,IAAI,GAAG,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAChF,IAAI,IAAI,KAAK,IAAI;YAAE,OAAO,IAAI,CAAC;IACjC,CAAC;IACD,OAAO,GAAG,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type BucketAccount, type MediaStore, type NameLookup, type StorageRoom, type StoredFile } from '@velocity-astro/cms-core';
|
|
2
|
+
export interface SiteMediaStoreOptions {
|
|
3
|
+
/** The bucket an owner named in the editor's settings, read when it is needed. */
|
|
4
|
+
readonly account: () => Promise<BucketAccount | null>;
|
|
5
|
+
/** The store the server's own settings or the site's host name. It wins over the editor's. */
|
|
6
|
+
readonly fixed?: MediaStore | undefined;
|
|
7
|
+
/** Whether a host runs this site among many. Its uploads are then the host's to place, and the editor's settings are never used. */
|
|
8
|
+
readonly hosted?: boolean;
|
|
9
|
+
/** The folder on the server's disk, where there is one: where uploads go until a bucket is named, and where earlier ones are still read. */
|
|
10
|
+
readonly folder?: MediaStore | undefined;
|
|
11
|
+
/** Every address a host's name leads to, so a bucket's address that leads to a private machine is refused. */
|
|
12
|
+
readonly lookup: NameLookup;
|
|
13
|
+
/** Defaults to the platform's own `fetch`. */
|
|
14
|
+
readonly fetch?: typeof globalThis.fetch;
|
|
15
|
+
/** How long the editor's settings are believed before they are read again. Defaults to five seconds. */
|
|
16
|
+
readonly believeForMs?: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Where one site's uploads are kept, decided as each file is kept or read: the store the server
|
|
20
|
+
* or the host fixed, then the bucket an owner named in the editor, then the folder on the
|
|
21
|
+
* server's disk. The editor's settings are read again every few seconds, so every running copy
|
|
22
|
+
* follows a change. A file kept on the disk before a bucket was named is still read from there.
|
|
23
|
+
*/
|
|
24
|
+
export declare class SiteMediaStore implements MediaStore {
|
|
25
|
+
#private;
|
|
26
|
+
constructor(options: SiteMediaStoreOptions);
|
|
27
|
+
ready(): Promise<boolean>;
|
|
28
|
+
put(key: string, file: StoredFile): Promise<void>;
|
|
29
|
+
get(key: string): Promise<StoredFile | null>;
|
|
30
|
+
remove(key: string): Promise<void>;
|
|
31
|
+
/** What the settings screen asks: who decides, where an upload would go, and whether the named bucket works. */
|
|
32
|
+
room(): StorageRoom;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=site-storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"site-storage.d.ts","sourceRoot":"","sources":["../src/site-storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmC,KAAK,aAAa,EAAE,KAAK,UAAU,EAAE,KAAK,UAAU,EAA4C,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAG9M,MAAM,WAAW,qBAAqB;IACpC,kFAAkF;IAClF,QAAQ,CAAC,OAAO,EAAE,MAAM,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAAC;IACtD,8FAA8F;IAC9F,QAAQ,CAAC,KAAK,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IACxC,oIAAoI;IACpI,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,4IAA4I;IAC5I,QAAQ,CAAC,MAAM,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IACzC,8GAA8G;IAC9G,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,8CAA8C;IAC9C,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;IACzC,wGAAwG;IACxG,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC;AAKD;;;;;GAKG;AACH,qBAAa,cAAe,YAAW,UAAU;;gBAInC,OAAO,EAAE,qBAAqB;IAIpC,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