@ossy/platform 1.15.2 → 1.15.4
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/package.json +4 -4
- package/src/server.js +14 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ossy/platform",
|
|
3
|
-
"version": "1.15.
|
|
3
|
+
"version": "1.15.4",
|
|
4
4
|
"description": "Ossy application server runtime",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"author": "Ossy <yourfriends@ossy.se> (https://ossy.se)",
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@ossy/router": "^1.16.
|
|
26
|
-
"@ossy/sdk": "^1.16.
|
|
25
|
+
"@ossy/router": "^1.16.4",
|
|
26
|
+
"@ossy/sdk": "^1.16.4",
|
|
27
27
|
"cookie-parser": "^1.4.7",
|
|
28
28
|
"dotenv": ">=16.0.0 <17.0.0",
|
|
29
29
|
"express": ">=5.0.0 <6.0.0",
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"files": [
|
|
33
33
|
"src"
|
|
34
34
|
],
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "982c7c2c2dfeeb043b5ccc4d71118a026a86fc3d"
|
|
36
36
|
}
|
package/src/server.js
CHANGED
|
@@ -34,9 +34,19 @@ function loadManifest (buildDir) {
|
|
|
34
34
|
// The manifest is a flat `entries` array discriminated by `type`. Bucket
|
|
35
35
|
// them once at boot so the per-request hot path stays a simple lookup.
|
|
36
36
|
const entries = Array.isArray(manifest.entries) ? manifest.entries : []
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
// OssyRouter does `Object.entries(page.path)` on each route at lookup time,
|
|
38
|
+
// so a single malformed entry (missing `path`) crashes every request. The
|
|
39
|
+
// build is supposed to reject these — this is belt-and-suspenders for older
|
|
40
|
+
// builds and any future loosening of the build-time check.
|
|
41
|
+
const validRoutable = (e) => e.path !== undefined && e.path !== null
|
|
42
|
+
const pages = entries.filter((e) => e.type === 'page' && validRoutable(e))
|
|
43
|
+
const apis = entries.filter((e) => e.type === 'api' && validRoutable(e))
|
|
39
44
|
const tasks = entries.filter((e) => e.type === 'task')
|
|
45
|
+
for (const e of entries) {
|
|
46
|
+
if ((e.type === 'page' || e.type === 'api') && !validRoutable(e)) {
|
|
47
|
+
console.warn(`[@ossy/platform][server] Skipping ${e.type} "${e.id}" — manifest entry has no path.`)
|
|
48
|
+
}
|
|
49
|
+
}
|
|
40
50
|
return {
|
|
41
51
|
entries,
|
|
42
52
|
pages,
|
|
@@ -145,14 +155,14 @@ export async function startServer (options = {}) {
|
|
|
145
155
|
}
|
|
146
156
|
const props = {
|
|
147
157
|
...config,
|
|
148
|
-
|
|
158
|
+
...(req.userAppSettings || {}),
|
|
159
|
+
theme: req.userAppSettings?.theme || cloneSerializable(config?.theme),
|
|
149
160
|
themes: cloneSerializable(config?.themes),
|
|
150
161
|
resourceTemplates: cloneSerializable(config?.resourceTemplates),
|
|
151
162
|
url: requestUrl,
|
|
152
163
|
isAuthenticated: !!req.isAuthenticated,
|
|
153
164
|
pages: manifest.pages.map((page) => ({ id: page.id, path: page.path })),
|
|
154
165
|
pageId: pageRoute.id,
|
|
155
|
-
sidebarPrimaryCollapsed: false,
|
|
156
166
|
}
|
|
157
167
|
const html = await mod.render(props)
|
|
158
168
|
res.status(200).type('html').send(html)
|