fix
This commit is contained in:
parent
0e85aa93a2
commit
bcb8b5fa18
|
|
@ -17,6 +17,9 @@ export const _ = {
|
|||
res.setHeader("Access-Control-Allow-Origin", "*");
|
||||
res.setHeader("Access-Control-Allow-Headers", "content-type");
|
||||
const gz = g.deploy.content;
|
||||
|
||||
|
||||
|
||||
const parts = req.params._.split("/");
|
||||
|
||||
const action = {
|
||||
|
|
@ -57,6 +60,7 @@ export const _ = {
|
|||
|
||||
let layout = null as null | SinglePage;
|
||||
for (const l of gz.layouts) {
|
||||
console.log(`[DEBUG] _prasi route layout: ${l.id}, content_tree: ${l.content_tree}`);
|
||||
if (!layout) layout = l;
|
||||
if (l.is_default_layout) layout = l;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -311,7 +311,32 @@ export const deploy = {
|
|||
console.error(`[ERROR] JSON content preview:`, metadataStr.substring(0, 200));
|
||||
throw new Error(`Invalid JSON in metadata.json: ${jsonError.message}`);
|
||||
}
|
||||
} else if (entry.filename.startsWith('public/')) {
|
||||
}
|
||||
else if (entry.filename === 'content/layout-content-trees.json') {
|
||||
//inject content_tree to layouts
|
||||
const layoutContentTrees = JSON.parse(new TextDecoder().decode(fileContent));
|
||||
for (const layout of g.deploy.content.layouts) {
|
||||
layout.content_tree = layoutContentTrees[layout.id];
|
||||
}
|
||||
console.log(`[DEBUG] ✓ Injected content_tree to ${g.deploy.content.layouts.length} layouts`);
|
||||
}
|
||||
else if(entry.filename === 'content/page-content-trees.json') {
|
||||
//inject content_tree to pages
|
||||
const pageContentTrees = JSON.parse(new TextDecoder().decode(fileContent));
|
||||
for (const page of g.deploy.content.pages) {
|
||||
page.content_tree = pageContentTrees[page.id];
|
||||
}
|
||||
console.log(`[DEBUG] ✓ Injected content_tree to ${g.deploy.content.pages.length} pages`);
|
||||
}
|
||||
else if(entry.filename === 'content/component-content-trees.json') {
|
||||
//inject content_tree to components
|
||||
const componentContentTrees = JSON.parse(new TextDecoder().decode(fileContent));
|
||||
for (const comp of g.deploy.content.comps) {
|
||||
comp.content_tree = componentContentTrees[comp.id];
|
||||
}
|
||||
console.log(`[DEBUG] ✓ Injected content_tree to ${g.deploy.content.comps.length} components`);
|
||||
}
|
||||
else if (entry.filename.startsWith('public/')) {
|
||||
const relativePath = entry.filename.slice(7); // Remove 'public/' prefix
|
||||
const binaryExtensions = ['.jpg', '.jpeg', '.png', '.gif', '.ico', '.svg', '.woff', '.woff2', '.ttf', '.eot', '.js', '.css', '.map'];
|
||||
const isBinary = binaryExtensions.some(ext => relativePath.toLowerCase().endsWith(ext));
|
||||
|
|
|
|||
Loading…
Reference in New Issue