@plank-cms/plank 0.31.1 → 0.31.3

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.
@@ -12,7 +12,7 @@
12
12
  href="https://fonts.googleapis.com/css2?family=Google+Sans:ital,opsz,wght@0,17..18,400..700;1,17..18,400..700&display=swap"
13
13
  rel="stylesheet"
14
14
  />
15
- <script type="module" crossorigin src="/admin/assets/index-laQsuJ53.js"></script>
15
+ <script type="module" crossorigin src="/admin/assets/index-CXEOaa5q.js"></script>
16
16
  <link rel="stylesheet" crossorigin href="/admin/assets/index-CHJ8C--M.css">
17
17
  </head>
18
18
  <body>
package/dist/index.js CHANGED
@@ -93,7 +93,7 @@ function getUpdateScriptCommand(name) {
93
93
  }
94
94
 
95
95
  // src/commands/init.ts
96
- var PACKAGE_VERSION = "0.31.1";
96
+ var PACKAGE_VERSION = "0.31.3";
97
97
  function generateSecret() {
98
98
  return randomBytes(32).toString("hex");
99
99
  }
@@ -203,7 +203,7 @@ import { dirname, join as join3, resolve as resolve2 } from "path";
203
203
  async function start() {
204
204
  config({ path: resolve2(process.cwd(), ".env") });
205
205
  process.env.PLANK_ADMIN_DIST = join3(dirname(fileURLToPath(import.meta.url)), "admin");
206
- const { start: startServer } = await import("./server-JNWXLTI3.js");
206
+ const { start: startServer } = await import("./server-C5ECJ6L6.js");
207
207
  await startServer();
208
208
  }
209
209
 
@@ -2534,22 +2534,16 @@ async function sendMail(input) {
2534
2534
 
2535
2535
  // ../core/dist/lib/mailTemplates.js
2536
2536
  import { existsSync, readdirSync, readFileSync } from "fs";
2537
- import { dirname as dirname2, join as join4 } from "path";
2537
+ import { basename, dirname as dirname2, join as join4 } from "path";
2538
2538
  import { fileURLToPath as fileURLToPath2 } from "url";
2539
2539
  import handlebars from "handlebars";
2540
2540
  var templates = /* @__PURE__ */ new Map();
2541
2541
  var partialsLoaded = false;
2542
2542
  function templatesRoot() {
2543
2543
  const moduleDir = dirname2(fileURLToPath2(import.meta.url));
2544
- const candidates = [
2545
- join4(process.cwd(), "templates"),
2546
- join4(process.cwd(), "packages/core/templates"),
2547
- join4(moduleDir, "../../templates")
2548
- ];
2549
- const root = candidates.find((candidate) => existsSync(candidate));
2550
- if (!root)
2551
- return candidates[0];
2552
- return root;
2544
+ if (basename(moduleDir) === "dist")
2545
+ return join4(moduleDir, "templates");
2546
+ return join4(moduleDir, "../../templates");
2553
2547
  }
2554
2548
  function loadPartials() {
2555
2549
  if (partialsLoaded)
@@ -2689,22 +2683,11 @@ function hashToken(token) {
2689
2683
  return createHash("sha256").update(token).digest("hex");
2690
2684
  }
2691
2685
  function adminBaseUrl(req) {
2692
- const referer = req.get("referer");
2693
- if (referer) {
2694
- try {
2695
- const url = new URL(referer);
2696
- if (url.pathname === "/admin" || url.pathname.startsWith("/admin/")) {
2697
- return `${url.origin}/admin`;
2698
- }
2699
- return url.origin;
2700
- } catch {
2701
- }
2702
- }
2703
2686
  const origin = req.get("origin");
2704
- if (origin)
2705
- return origin;
2706
- const protocol = req.protocol;
2707
- return `${protocol}://${req.get("host")}`;
2687
+ const baseOrigin = origin ?? `${req.protocol}://${req.get("host")}`;
2688
+ if (process.env.PLANK_ADMIN_DIST)
2689
+ return `${baseOrigin}/admin`;
2690
+ return baseOrigin;
2708
2691
  }
2709
2692
  async function buildAuthPayload(user) {
2710
2693
  const { rows: roleRows } = await pool_default.query("SELECT id, name, permissions FROM plank_roles WHERE id = $1", [user.role_id]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plank-cms/plank",
3
- "version": "0.31.1",
3
+ "version": "0.31.3",
4
4
  "description": "Self-hosted headless CMS. Deploy in minutes on your own infrastructure.",
5
5
  "type": "module",
6
6
  "files": [
@@ -56,10 +56,11 @@
56
56
  },
57
57
  "devDependencies": {
58
58
  "@types/fs-extra": "11.0.4",
59
+ "@types/pg": "8.20.0",
59
60
  "tsup": "8.5.1",
60
- "@plank-cms/core": "0.31.1",
61
- "@plank-cms/db": "0.31.1",
62
- "@plank-cms/schema": "0.31.1"
61
+ "@plank-cms/core": "0.31.3",
62
+ "@plank-cms/db": "0.31.3",
63
+ "@plank-cms/schema": "0.31.3"
63
64
  },
64
65
  "scripts": {
65
66
  "build": "tsup",