chore(publish): replace source tree with static export at repo root
Publish the prerendered static export (index.html, 404.html, cinema/,
c/, about/, for-cinemas/, for-film-lovers/, assets/, images/, og/,
sitemap.xml, robots.txt) as the site root and remove the React Router
+ Nitro source tree from this branch. Source remains available in
history at 0548772.
Note: public/sw.js here reports VERSION v2.0.5 while the removed source
tree (v2.1.0) was newer, and .gitignore was not carried over.
This commit is contained in:
1 parent
05487728a7
commit
e6c4ebff48
394 files changed
+3977
-37891
No files matched your search
@@ -1,43 +0,0 @@
|
||||
import { createError, defineEventHandler, readBody } from "h3";
|
||||
|
||||
import { requireAdmin } from "@/lib/admin-auth.server";
|
||||
import { readContent, sanitizeCinemas, writeContent } from "@/lib/content.server";
|
||||
|
||||
/**
|
||||
* วาง JSON ของโรงหนัง (ออบเจกต์เดียวหรือ array) เพื่อเพิ่ม/ทับรายการเดิม
|
||||
* ใช้กับปุ่ม "วาง JSON" ในหน้า admin — ทับเฉพาะ slug ที่ซ้ำกัน
|
||||
*/
|
||||
export default defineEventHandler(async (event) => {
|
||||
requireAdmin(event);
|
||||
const body = (await readBody(event)) as { raw?: string };
|
||||
const raw = (body?.raw ?? "").trim();
|
||||
if (!raw) {
|
||||
throw createError({ statusCode: 400, statusMessage: "ยังไม่มีข้อมูลให้วาง" });
|
||||
}
|
||||
|
||||
let parsed: unknown;
|
||||
try {
|
||||
parsed = JSON.parse(raw);
|
||||
} catch (error) {
|
||||
throw createError({
|
||||
statusCode: 400,
|
||||
statusMessage: `JSON ไม่ถูกต้อง: ${error instanceof Error ? error.message : ""}`,
|
||||
});
|
||||
}
|
||||
|
||||
const incoming = sanitizeCinemas(Array.isArray(parsed) ? parsed : [parsed]);
|
||||
const current = await readContent();
|
||||
|
||||
const bySlug = new Map(current.cinemas.map((cinema) => [cinema.slug, cinema]));
|
||||
for (const cinema of incoming) bySlug.set(cinema.slug, cinema);
|
||||
|
||||
const next = {
|
||||
cinemas: Array.from(bySlug.values()),
|
||||
site: current.site,
|
||||
about: current.about,
|
||||
forCinemas: current.forCinemas,
|
||||
forFilmLovers: current.forFilmLovers,
|
||||
};
|
||||
await writeContent(next);
|
||||
return { imported: incoming.length, store: next };
|
||||
});
|
||||
Reference in new issue
Block a user