emdash 0.1.1 → 0.2.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/dist/{adapters-BLMa4JGD.d.mts → adapters-N6BF7RCD.d.mts} +1 -1
- package/dist/{adapters-BLMa4JGD.d.mts.map → adapters-N6BF7RCD.d.mts.map} +1 -1
- package/dist/{apply-kC39ev1Z.mjs → apply-wmVEOSbR.mjs} +56 -9
- package/dist/apply-wmVEOSbR.mjs.map +1 -0
- package/dist/astro/index.d.mts +6 -6
- package/dist/astro/index.mjs +80 -27
- package/dist/astro/index.mjs.map +1 -1
- package/dist/astro/middleware/auth.d.mts +5 -5
- package/dist/astro/middleware/auth.d.mts.map +1 -1
- package/dist/astro/middleware/auth.mjs +127 -56
- package/dist/astro/middleware/auth.mjs.map +1 -1
- package/dist/astro/middleware/request-context.mjs +1 -1
- package/dist/astro/middleware/setup.mjs +1 -1
- package/dist/astro/middleware.d.mts.map +1 -1
- package/dist/astro/middleware.mjs +74 -39
- package/dist/astro/middleware.mjs.map +1 -1
- package/dist/astro/types.d.mts +30 -9
- package/dist/astro/types.d.mts.map +1 -1
- package/dist/{byline-CL847F26.mjs → byline-1WQPlISL.mjs} +51 -29
- package/dist/byline-1WQPlISL.mjs.map +1 -0
- package/dist/{bylines-C2a-2TGt.mjs → bylines-BYdTYmia.mjs} +10 -8
- package/dist/{bylines-C2a-2TGt.mjs.map → bylines-BYdTYmia.mjs.map} +1 -1
- package/dist/cli/index.mjs +15 -12
- package/dist/cli/index.mjs.map +1 -1
- package/dist/client/cf-access.d.mts +1 -1
- package/dist/client/index.d.mts +1 -1
- package/dist/client/index.mjs +1 -1
- package/dist/{config-CKE8p9xM.mjs → config-Cq8H0SfX.mjs} +2 -10
- package/dist/{config-CKE8p9xM.mjs.map → config-Cq8H0SfX.mjs.map} +1 -1
- package/dist/{content-D6C2WsZC.mjs → content-BmXndhdi.mjs} +16 -3
- package/dist/content-BmXndhdi.mjs.map +1 -0
- package/dist/db/index.d.mts +3 -3
- package/dist/db/index.mjs +1 -1
- package/dist/db/libsql.d.mts +1 -1
- package/dist/db/postgres.d.mts +1 -1
- package/dist/db/sqlite.d.mts +1 -1
- package/dist/{default-Cyi4aAxu.mjs → default-WYlzADZL.mjs} +1 -1
- package/dist/{default-Cyi4aAxu.mjs.map → default-WYlzADZL.mjs.map} +1 -1
- package/dist/{error-Cxz0tQeO.mjs → error-DrxtnGPg.mjs} +1 -1
- package/dist/{error-Cxz0tQeO.mjs.map → error-DrxtnGPg.mjs.map} +1 -1
- package/dist/{index-CLBc4gw-.d.mts → index-UHEVQMus.d.mts} +55 -17
- package/dist/index-UHEVQMus.d.mts.map +1 -0
- package/dist/index.d.mts +11 -11
- package/dist/index.mjs +17 -17
- package/dist/{load-yOOlckBj.mjs → load-Veizk2cT.mjs} +1 -1
- package/dist/{load-yOOlckBj.mjs.map → load-Veizk2cT.mjs.map} +1 -1
- package/dist/{loader-fz8Q_3EO.mjs → loader-CHb2v0jm.mjs} +1 -1
- package/dist/{loader-fz8Q_3EO.mjs.map → loader-CHb2v0jm.mjs.map} +1 -1
- package/dist/{manifest-schema-CL8DWO9b.mjs → manifest-schema-CuMio1A9.mjs} +1 -1
- package/dist/{manifest-schema-CL8DWO9b.mjs.map → manifest-schema-CuMio1A9.mjs.map} +1 -1
- package/dist/media/index.d.mts +1 -1
- package/dist/media/local-runtime.d.mts +7 -7
- package/dist/{mode-C2EzN1uE.mjs → mode-CYeM2rPt.mjs} +1 -1
- package/dist/{mode-C2EzN1uE.mjs.map → mode-CYeM2rPt.mjs.map} +1 -1
- package/dist/page/index.d.mts +10 -1
- package/dist/page/index.d.mts.map +1 -1
- package/dist/page/index.mjs +8 -4
- package/dist/page/index.mjs.map +1 -1
- package/dist/{placeholder-SvFCKbz_.d.mts → placeholder-bOx1xCTY.d.mts} +1 -1
- package/dist/{placeholder-SvFCKbz_.d.mts.map → placeholder-bOx1xCTY.d.mts.map} +1 -1
- package/dist/plugins/adapt-sandbox-entry.d.mts +5 -5
- package/dist/plugins/adapt-sandbox-entry.mjs +1 -1
- package/dist/{query-BVYN0PJ6.mjs → query-5Hcv_5ER.mjs} +20 -8
- package/dist/{query-BVYN0PJ6.mjs.map → query-5Hcv_5ER.mjs.map} +1 -1
- package/dist/{registry-BNYQKX_d.mjs → registry-1EvbAfsC.mjs} +6 -2
- package/dist/{registry-BNYQKX_d.mjs.map → registry-1EvbAfsC.mjs.map} +1 -1
- package/dist/{runner-BraqvGYk.mjs → runner-BoN0-FPi.mjs} +155 -130
- package/dist/runner-BoN0-FPi.mjs.map +1 -0
- package/dist/{runner-EAtf0ZIe.d.mts → runner-DTqkzOzc.d.mts} +2 -2
- package/dist/{runner-EAtf0ZIe.d.mts.map → runner-DTqkzOzc.d.mts.map} +1 -1
- package/dist/runtime.d.mts +6 -6
- package/dist/runtime.mjs +1 -1
- package/dist/{search-C1gg67nN.mjs → search-BsYMed12.mjs} +235 -105
- package/dist/search-BsYMed12.mjs.map +1 -0
- package/dist/seed/index.d.mts +2 -2
- package/dist/seed/index.mjs +8 -8
- package/dist/seo/index.d.mts +1 -1
- package/dist/storage/local.d.mts +1 -1
- package/dist/storage/local.mjs +1 -1
- package/dist/storage/s3.d.mts +1 -1
- package/dist/storage/s3.mjs +1 -1
- package/dist/{tokens-DpgrkrXK.mjs → tokens-DrB-W6Q-.mjs} +1 -1
- package/dist/{tokens-DpgrkrXK.mjs.map → tokens-DrB-W6Q-.mjs.map} +1 -1
- package/dist/{transport-yxiQsi8I.mjs → transport-Bl8cTdYt.mjs} +1 -1
- package/dist/{transport-yxiQsi8I.mjs.map → transport-Bl8cTdYt.mjs.map} +1 -1
- package/dist/{transport-BFGblqwG.d.mts → transport-COOs9GSE.d.mts} +1 -1
- package/dist/{transport-BFGblqwG.d.mts.map → transport-COOs9GSE.d.mts.map} +1 -1
- package/dist/{types-BQo5JS0J.d.mts → types-6dqxBqsH.d.mts} +80 -106
- package/dist/types-6dqxBqsH.d.mts.map +1 -0
- package/dist/{types-DRjfYOEv.d.mts → types-7-UjSEyB.d.mts} +1 -1
- package/dist/{types-DRjfYOEv.d.mts.map → types-7-UjSEyB.d.mts.map} +1 -1
- package/dist/{types-CUBbjgmP.mjs → types-Bec-r_3_.mjs} +1 -1
- package/dist/{types-CUBbjgmP.mjs.map → types-Bec-r_3_.mjs.map} +1 -1
- package/dist/{types-DaNLHo_T.d.mts → types-BljtYPSd.d.mts} +1 -1
- package/dist/{types-DaNLHo_T.d.mts.map → types-BljtYPSd.d.mts.map} +1 -1
- package/dist/{types-BRuPJGdV.d.mts → types-CIsTnQvJ.d.mts} +3 -1
- package/dist/types-CIsTnQvJ.d.mts.map +1 -0
- package/dist/types-CMMN0pNg.mjs.map +1 -1
- package/dist/{types-DPfzHnjW.d.mts → types-CcreFIIH.d.mts} +1 -1
- package/dist/{types-DPfzHnjW.d.mts.map → types-CcreFIIH.d.mts.map} +1 -1
- package/dist/{types-CiA5Gac0.mjs → types-DuNbGKjF.mjs} +1 -1
- package/dist/{types-CiA5Gac0.mjs.map → types-DuNbGKjF.mjs.map} +1 -1
- package/dist/{validate-HtxZeaBi.d.mts → validate-B7KP7VLM.d.mts} +4 -4
- package/dist/{validate-HtxZeaBi.d.mts.map → validate-B7KP7VLM.d.mts.map} +1 -1
- package/dist/{validate-_rsF-Dx_.mjs → validate-CXnRKfJK.mjs} +2 -2
- package/dist/{validate-_rsF-Dx_.mjs.map → validate-CXnRKfJK.mjs.map} +1 -1
- package/package.json +6 -6
- package/src/api/csrf.ts +13 -2
- package/src/api/handlers/content.ts +7 -0
- package/src/api/handlers/dashboard.ts +4 -8
- package/src/api/handlers/device-flow.ts +55 -37
- package/src/api/handlers/index.ts +6 -1
- package/src/api/handlers/seo.ts +48 -21
- package/src/api/public-url.ts +84 -0
- package/src/api/schemas/content.ts +2 -2
- package/src/api/schemas/menus.ts +12 -2
- package/src/astro/integration/index.ts +30 -7
- package/src/astro/integration/routes.ts +13 -2
- package/src/astro/integration/runtime.ts +7 -5
- package/src/astro/integration/vite-config.ts +52 -9
- package/src/astro/middleware/auth.ts +60 -56
- package/src/astro/middleware/csp.ts +25 -0
- package/src/astro/middleware.ts +31 -3
- package/src/astro/routes/PluginRegistry.tsx +8 -2
- package/src/astro/routes/admin.astro +7 -2
- package/src/astro/routes/api/admin/users/[id]/disable.ts +18 -12
- package/src/astro/routes/api/admin/users/[id]/index.ts +26 -5
- package/src/astro/routes/api/auth/invite/complete.ts +3 -2
- package/src/astro/routes/api/auth/oauth/[provider]/callback.ts +2 -1
- package/src/astro/routes/api/auth/oauth/[provider].ts +2 -1
- package/src/astro/routes/api/auth/passkey/options.ts +3 -2
- package/src/astro/routes/api/auth/passkey/register/options.ts +3 -2
- package/src/astro/routes/api/auth/passkey/register/verify.ts +3 -2
- package/src/astro/routes/api/auth/passkey/verify.ts +3 -2
- package/src/astro/routes/api/auth/signup/complete.ts +3 -2
- package/src/astro/routes/api/content/[collection]/index.ts +31 -3
- package/src/astro/routes/api/import/wordpress/execute.ts +9 -0
- package/src/astro/routes/api/import/wordpress-plugin/execute.ts +10 -0
- package/src/astro/routes/api/manifest.ts +1 -0
- package/src/astro/routes/api/media/providers/[providerId]/[itemId].ts +7 -2
- package/src/astro/routes/api/oauth/authorize.ts +12 -7
- package/src/astro/routes/api/oauth/device/code.ts +5 -1
- package/src/astro/routes/api/setup/admin-verify.ts +3 -2
- package/src/astro/routes/api/setup/admin.ts +3 -2
- package/src/astro/routes/api/setup/dev-bypass.ts +2 -1
- package/src/astro/routes/api/setup/index.ts +3 -2
- package/src/astro/routes/api/snapshot.ts +2 -1
- package/src/astro/routes/api/themes/preview.ts +2 -1
- package/src/astro/routes/api/well-known/auth.ts +1 -0
- package/src/astro/routes/api/well-known/oauth-authorization-server.ts +3 -2
- package/src/astro/routes/api/well-known/oauth-protected-resource.ts +3 -2
- package/src/astro/routes/robots.txt.ts +5 -1
- package/src/astro/routes/sitemap-[collection].xml.ts +104 -0
- package/src/astro/routes/sitemap.xml.ts +18 -23
- package/src/astro/types.ts +27 -1
- package/src/auth/passkey-config.ts +6 -10
- package/src/bylines/index.ts +11 -8
- package/src/cli/commands/login.ts +5 -2
- package/src/components/InlinePortableTextEditor.tsx +5 -3
- package/src/content/converters/portable-text-to-prosemirror.ts +50 -2
- package/src/database/migrations/034_published_at_index.ts +29 -0
- package/src/database/migrations/runner.ts +2 -0
- package/src/database/repositories/byline.ts +48 -42
- package/src/database/repositories/content.ts +23 -1
- package/src/database/repositories/options.ts +9 -3
- package/src/database/repositories/seo.ts +34 -17
- package/src/database/repositories/types.ts +2 -0
- package/src/emdash-runtime.ts +61 -18
- package/src/import/index.ts +1 -1
- package/src/import/sources/wxr.ts +45 -2
- package/src/index.ts +9 -1
- package/src/mcp/server.ts +85 -5
- package/src/menus/index.ts +2 -1
- package/src/page/context.ts +13 -1
- package/src/page/jsonld.ts +10 -6
- package/src/page/seo-contributions.ts +1 -1
- package/src/plugins/context.ts +145 -35
- package/src/plugins/manager.ts +12 -0
- package/src/plugins/types.ts +80 -4
- package/src/query.ts +18 -0
- package/src/schema/registry.ts +5 -0
- package/src/settings/index.ts +64 -0
- package/src/utils/chunks.ts +17 -0
- package/dist/apply-kC39ev1Z.mjs.map +0 -1
- package/dist/byline-CL847F26.mjs.map +0 -1
- package/dist/content-D6C2WsZC.mjs.map +0 -1
- package/dist/index-CLBc4gw-.d.mts.map +0 -1
- package/dist/runner-BraqvGYk.mjs.map +0 -1
- package/dist/search-C1gg67nN.mjs.map +0 -1
- package/dist/types-BQo5JS0J.d.mts.map +0 -1
- package/dist/types-BRuPJGdV.d.mts.map +0 -1
- /package/src/astro/routes/api/media/file/{[key].ts → [...key].ts} +0 -0
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import "../connection-B4zVnQIa.mjs";
|
|
2
2
|
import { a as isSqlite } from "../dialect-helpers-B9uSp2GJ.mjs";
|
|
3
|
-
import { r as runMigrations } from "../runner-
|
|
4
|
-
import { $ as
|
|
5
|
-
import { r as RevisionRepository } from "../content-
|
|
3
|
+
import { r as runMigrations } from "../runner-BoN0-FPi.mjs";
|
|
4
|
+
import { $ as sanitizeHeadersForSandbox, At as handleContentGet, Bt as handleContentUnschedule, Ct as handleContentCompare, Dt as handleContentDelete, Et as handleContentCreate, Ft as handleContentPublish, G as DEV_CONSOLE_EMAIL_PLUGIN_ID, Ht as validateRev, It as handleContentRestore, K as devConsoleEmailDeliver, Lt as handleContentSchedule, Mt as handleContentList, Nt as handleContentListTrashed, Ot as handleContentDiscardDraft, Pt as handleContentPermanentDelete, Q as extractRequestMeta, Rt as handleContentTranslations, St as hashString, Tt as handleContentCountTrashed, Vt as handleContentUpdate, W as PluginRouteRegistry, X as resolveExclusiveHooks, Y as createHookPipeline, Z as CronExecutor, _t as handleRevisionGet, et as definePlugin, ft as handleMediaCreate, gt as handleMediaUpdate, ht as handleMediaList, jt as handleContentGetIncludingTrashed, kt as handleContentDuplicate, mt as handleMediaGet, pt as handleMediaDelete, q as EmailPipeline, st as loadBundleFromR2, ut as PluginStateRepository, vt as handleRevisionList, wt as handleContentCountScheduled, yt as handleRevisionRestore, zt as handleContentUnpublish } from "../search-BsYMed12.mjs";
|
|
5
|
+
import { r as RevisionRepository } from "../content-BmXndhdi.mjs";
|
|
6
6
|
import "../base64-MBPo9ozB.mjs";
|
|
7
7
|
import "../types-CMMN0pNg.mjs";
|
|
8
8
|
import { t as MediaRepository } from "../media-DqHVh136.mjs";
|
|
9
|
-
import {
|
|
10
|
-
import { i as FTSManager, n as SchemaRegistry } from "../registry-
|
|
9
|
+
import { f as OptionsRepository } from "../apply-wmVEOSbR.mjs";
|
|
10
|
+
import { i as FTSManager, n as SchemaRegistry } from "../registry-1EvbAfsC.mjs";
|
|
11
11
|
import "../redirect-DIfIni3r.mjs";
|
|
12
|
-
import "../byline-
|
|
12
|
+
import "../byline-1WQPlISL.mjs";
|
|
13
13
|
import { n as normalizeMediaValue } from "../placeholder-aiCD8aSZ.mjs";
|
|
14
|
-
import {
|
|
14
|
+
import { i as setI18nConfig } from "../config-Cq8H0SfX.mjs";
|
|
15
15
|
import { getRequestContext, runWithContext } from "../request-context.mjs";
|
|
16
|
-
import { n as getDb } from "../loader-
|
|
17
|
-
import { r as normalizeManifestRoute } from "../manifest-schema-
|
|
18
|
-
import "../query-
|
|
19
|
-
import "../tokens-
|
|
20
|
-
import "../bylines-
|
|
21
|
-
import "../load-
|
|
16
|
+
import { n as getDb } from "../loader-CHb2v0jm.mjs";
|
|
17
|
+
import { r as normalizeManifestRoute } from "../manifest-schema-CuMio1A9.mjs";
|
|
18
|
+
import "../query-5Hcv_5ER.mjs";
|
|
19
|
+
import "../tokens-DrB-W6Q-.mjs";
|
|
20
|
+
import "../bylines-BYdTYmia.mjs";
|
|
21
|
+
import "../load-Veizk2cT.mjs";
|
|
22
22
|
import "../index.mjs";
|
|
23
|
-
import { t as getAuthMode } from "../mode-
|
|
23
|
+
import { t as getAuthMode } from "../mode-CYeM2rPt.mjs";
|
|
24
24
|
import { Kysely, sql } from "kysely";
|
|
25
25
|
import { defineMiddleware } from "astro:middleware";
|
|
26
26
|
import virtualConfig from "virtual:emdash/config";
|
|
@@ -444,9 +444,15 @@ var EmDashRuntime = class EmDashRuntime {
|
|
|
444
444
|
*/
|
|
445
445
|
async setPluginStatus(pluginId, status) {
|
|
446
446
|
this.pluginStates.set(pluginId, status);
|
|
447
|
-
if (status === "active")
|
|
448
|
-
|
|
449
|
-
|
|
447
|
+
if (status === "active") {
|
|
448
|
+
this.enabledPlugins.add(pluginId);
|
|
449
|
+
await this.rebuildHookPipeline();
|
|
450
|
+
await this._hooks.runPluginActivate(pluginId);
|
|
451
|
+
} else {
|
|
452
|
+
await this._hooks.runPluginDeactivate(pluginId);
|
|
453
|
+
this.enabledPlugins.delete(pluginId);
|
|
454
|
+
await this.rebuildHookPipeline();
|
|
455
|
+
}
|
|
450
456
|
}
|
|
451
457
|
/**
|
|
452
458
|
* Rebuild the hook pipeline from the current set of enabled plugins.
|
|
@@ -716,9 +722,9 @@ var EmDashRuntime = class EmDashRuntime {
|
|
|
716
722
|
}
|
|
717
723
|
})();
|
|
718
724
|
if (collectionCount.count === 0 && !setupDone) {
|
|
719
|
-
const { applySeed } = await import("../apply-
|
|
720
|
-
const { loadSeed } = await import("../load-
|
|
721
|
-
const { validateSeed } = await import("../validate-
|
|
725
|
+
const { applySeed } = await import("../apply-wmVEOSbR.mjs").then((n) => n.n);
|
|
726
|
+
const { loadSeed } = await import("../load-Veizk2cT.mjs").then((n) => n.r);
|
|
727
|
+
const { validateSeed } = await import("../validate-CXnRKfJK.mjs").then((n) => n.n);
|
|
722
728
|
const seed = await loadSeed();
|
|
723
729
|
if (validateSeed(seed).valid) {
|
|
724
730
|
await applySeed(db, seed, { onConflict: "skip" });
|
|
@@ -874,6 +880,7 @@ var EmDashRuntime = class EmDashRuntime {
|
|
|
874
880
|
required: field.required
|
|
875
881
|
};
|
|
876
882
|
if (field.widget) entry.widget = field.widget;
|
|
883
|
+
if (field.options) entry.options = field.options;
|
|
877
884
|
if (field.validation?.options) entry.options = field.validation.options.map((v) => ({
|
|
878
885
|
value: v,
|
|
879
886
|
label: v.charAt(0).toUpperCase() + v.slice(1)
|
|
@@ -907,8 +914,8 @@ var EmDashRuntime = class EmDashRuntime {
|
|
|
907
914
|
version: plugin.version,
|
|
908
915
|
enabled,
|
|
909
916
|
adminMode,
|
|
910
|
-
adminPages: plugin.admin?.pages,
|
|
911
|
-
dashboardWidgets: plugin.admin?.widgets,
|
|
917
|
+
adminPages: plugin.admin?.pages ?? [],
|
|
918
|
+
dashboardWidgets: plugin.admin?.widgets ?? [],
|
|
912
919
|
portableTextBlocks: plugin.admin?.portableTextBlocks,
|
|
913
920
|
fieldWidgets: plugin.admin?.fieldWidgets
|
|
914
921
|
};
|
|
@@ -923,8 +930,8 @@ var EmDashRuntime = class EmDashRuntime {
|
|
|
923
930
|
enabled,
|
|
924
931
|
sandboxed: true,
|
|
925
932
|
adminMode: hasAdminPages || hasWidgets ? "blocks" : "none",
|
|
926
|
-
adminPages: entry.adminPages,
|
|
927
|
-
dashboardWidgets: entry.adminWidgets
|
|
933
|
+
adminPages: entry.adminPages ?? [],
|
|
934
|
+
dashboardWidgets: entry.adminWidgets ?? []
|
|
928
935
|
};
|
|
929
936
|
}
|
|
930
937
|
for (const [pluginId, meta] of marketplaceManifestCache) {
|
|
@@ -939,25 +946,38 @@ var EmDashRuntime = class EmDashRuntime {
|
|
|
939
946
|
enabled,
|
|
940
947
|
sandboxed: true,
|
|
941
948
|
adminMode: hasAdminPages || hasWidgets ? "blocks" : "none",
|
|
942
|
-
adminPages: pages,
|
|
943
|
-
dashboardWidgets: widgets
|
|
949
|
+
adminPages: pages ?? [],
|
|
950
|
+
dashboardWidgets: widgets ?? []
|
|
944
951
|
};
|
|
945
952
|
}
|
|
946
|
-
|
|
953
|
+
let manifestTaxonomies = [];
|
|
954
|
+
try {
|
|
955
|
+
manifestTaxonomies = (await this.db.selectFrom("_emdash_taxonomy_defs").selectAll().orderBy("name").execute()).map((row) => ({
|
|
956
|
+
name: row.name,
|
|
957
|
+
label: row.label,
|
|
958
|
+
labelSingular: row.label_singular ?? void 0,
|
|
959
|
+
hierarchical: row.hierarchical === 1,
|
|
960
|
+
collections: row.collections ? JSON.parse(row.collections).toSorted() : []
|
|
961
|
+
}));
|
|
962
|
+
} catch (error) {
|
|
963
|
+
console.debug("EmDash: Could not load taxonomy definitions:", error);
|
|
964
|
+
}
|
|
965
|
+
const manifestHash = await hashString(JSON.stringify(manifestCollections) + JSON.stringify(manifestPlugins) + JSON.stringify(manifestTaxonomies));
|
|
947
966
|
const authMode = getAuthMode(this.config);
|
|
948
967
|
const authModeValue = authMode.type === "external" ? authMode.providerType : "passkey";
|
|
949
|
-
const
|
|
950
|
-
const
|
|
968
|
+
const i18nConfig = virtualConfig?.i18n;
|
|
969
|
+
const i18n = i18nConfig && i18nConfig.locales && i18nConfig.locales.length > 1 ? {
|
|
970
|
+
defaultLocale: i18nConfig.defaultLocale,
|
|
971
|
+
locales: i18nConfig.locales
|
|
972
|
+
} : void 0;
|
|
951
973
|
return {
|
|
952
974
|
version: "0.1.0",
|
|
953
975
|
hash: manifestHash,
|
|
954
976
|
collections: manifestCollections,
|
|
955
977
|
plugins: manifestPlugins,
|
|
978
|
+
taxonomies: manifestTaxonomies,
|
|
956
979
|
authMode: authModeValue,
|
|
957
|
-
i18n
|
|
958
|
-
defaultLocale: i18nConfig.defaultLocale,
|
|
959
|
-
locales: i18nConfig.locales
|
|
960
|
-
} : void 0,
|
|
980
|
+
i18n,
|
|
961
981
|
marketplace: !!this.config.marketplace
|
|
962
982
|
};
|
|
963
983
|
}
|
|
@@ -990,7 +1010,7 @@ var EmDashRuntime = class EmDashRuntime {
|
|
|
990
1010
|
return result;
|
|
991
1011
|
}
|
|
992
1012
|
async handleContentUpdate(collection, id, body) {
|
|
993
|
-
const { ContentRepository } = await import("../content-
|
|
1013
|
+
const { ContentRepository } = await import("../content-BmXndhdi.mjs").then((n) => n.n);
|
|
994
1014
|
const repo = new ContentRepository(this.db);
|
|
995
1015
|
const resolvedItem = await repo.findByIdOrSlug(collection, id);
|
|
996
1016
|
const resolvedId = resolvedItem?.id ?? id;
|
|
@@ -1217,7 +1237,10 @@ var EmDashRuntime = class EmDashRuntime {
|
|
|
1217
1237
|
};
|
|
1218
1238
|
const trustedPlugin = this.configuredPlugins.find((p) => p.id === pluginId);
|
|
1219
1239
|
if (trustedPlugin && this.enabledPlugins.has(trustedPlugin.id)) {
|
|
1220
|
-
const routeRegistry = new PluginRouteRegistry({
|
|
1240
|
+
const routeRegistry = new PluginRouteRegistry({
|
|
1241
|
+
db: this.db,
|
|
1242
|
+
emailPipeline: this.email ?? void 0
|
|
1243
|
+
});
|
|
1221
1244
|
routeRegistry.register(trustedPlugin);
|
|
1222
1245
|
const routeKey = path.replace(LEADING_SLASH_PATTERN, "");
|
|
1223
1246
|
let body = void 0;
|
|
@@ -1536,23 +1559,33 @@ function setBaselineSecurityHeaders(response) {
|
|
|
1536
1559
|
}
|
|
1537
1560
|
/** Public routes that require the runtime (sitemap, robots.txt, etc.) */
|
|
1538
1561
|
const PUBLIC_RUNTIME_ROUTES = new Set(["/sitemap.xml", "/robots.txt"]);
|
|
1562
|
+
const SITEMAP_COLLECTION_RE = /^\/sitemap-[a-z][a-z0-9_]*\.xml$/;
|
|
1539
1563
|
const onRequest = defineMiddleware(async (context, next) => {
|
|
1540
1564
|
const { request, locals, cookies } = context;
|
|
1541
1565
|
const url = context.url;
|
|
1542
1566
|
const isEmDashRoute = url.pathname.startsWith("/_emdash");
|
|
1543
|
-
const isPublicRuntimeRoute = PUBLIC_RUNTIME_ROUTES.has(url.pathname);
|
|
1567
|
+
const isPublicRuntimeRoute = PUBLIC_RUNTIME_ROUTES.has(url.pathname) || SITEMAP_COLLECTION_RE.test(url.pathname);
|
|
1544
1568
|
const hasEditCookie = cookies.get("emdash-edit-mode")?.value === "true";
|
|
1545
1569
|
const hasPreviewToken = url.searchParams.has("_preview");
|
|
1546
1570
|
const playgroundDb = locals.__playgroundDb;
|
|
1547
1571
|
if (!isEmDashRoute && !isPublicRuntimeRoute && !hasEditCookie && !hasPreviewToken) {
|
|
1548
|
-
if (!await context.session?.get("user") && !playgroundDb) {
|
|
1572
|
+
if (!(context.isPrerendered ? null : await context.session?.get("user")) && !playgroundDb) {
|
|
1549
1573
|
if (!setupVerified) try {
|
|
1550
|
-
const { getDb } = await import("../loader-
|
|
1574
|
+
const { getDb } = await import("../loader-CHb2v0jm.mjs").then((n) => n.r);
|
|
1551
1575
|
await (await getDb()).selectFrom("_emdash_migrations").selectAll().limit(1).execute();
|
|
1552
1576
|
setupVerified = true;
|
|
1553
1577
|
} catch {
|
|
1554
1578
|
return context.redirect("/_emdash/admin/setup");
|
|
1555
1579
|
}
|
|
1580
|
+
const config = getConfig();
|
|
1581
|
+
if (config) try {
|
|
1582
|
+
const runtime = await getRuntime(config);
|
|
1583
|
+
setupVerified = true;
|
|
1584
|
+
locals.emdash = {
|
|
1585
|
+
collectPageMetadata: runtime.collectPageMetadata.bind(runtime),
|
|
1586
|
+
collectPageFragments: runtime.collectPageFragments.bind(runtime)
|
|
1587
|
+
};
|
|
1588
|
+
} catch {}
|
|
1556
1589
|
const response = await next();
|
|
1557
1590
|
setBaselineSecurityHeaders(response);
|
|
1558
1591
|
return response;
|
|
@@ -1600,6 +1633,8 @@ const onRequest = defineMiddleware(async (context, next) => {
|
|
|
1600
1633
|
getPluginRouteMeta: runtime.getPluginRouteMeta.bind(runtime),
|
|
1601
1634
|
getMediaProvider: runtime.getMediaProvider.bind(runtime),
|
|
1602
1635
|
getMediaProviderList: runtime.getMediaProviderList.bind(runtime),
|
|
1636
|
+
collectPageMetadata: runtime.collectPageMetadata.bind(runtime),
|
|
1637
|
+
collectPageFragments: runtime.collectPageFragments.bind(runtime),
|
|
1603
1638
|
storage: runtime.storage,
|
|
1604
1639
|
db: runtime.db,
|
|
1605
1640
|
hooks: runtime.hooks,
|
|
@@ -1618,7 +1653,7 @@ const onRequest = defineMiddleware(async (context, next) => {
|
|
|
1618
1653
|
if (dbConfig && typeof isSessionEnabled === "function" && isSessionEnabled(dbConfig) && typeof getD1Binding === "function" && createSessionDialect) {
|
|
1619
1654
|
const d1Binding = getD1Binding(dbConfig);
|
|
1620
1655
|
if (d1Binding && typeof d1Binding === "object" && "withSession" in d1Binding) {
|
|
1621
|
-
const isAuthenticated = !!await context.session?.get("user");
|
|
1656
|
+
const isAuthenticated = context.isPrerendered ? false : !!await context.session?.get("user");
|
|
1622
1657
|
const isWrite = request.method !== "GET" && request.method !== "HEAD";
|
|
1623
1658
|
const configConstraint = getDefaultConstraint(dbConfig);
|
|
1624
1659
|
const cookieName = getBookmarkCookieName(dbConfig);
|