Initial commit: page-manager Next.js app with Coolify deploy support
Replace Vercel-specific infra (Cron, Blob) with self-hosted equivalents for deployment to Coolify: in-container cron scheduler (scripts/cron-runner.mjs) and disk-based upload storage served via /api/uploads/[...path]. Add Dockerfile, .dockerignore, and /api/health for container health checks. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
@@ -0,0 +1,8 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 100 100">
|
||||
<rect width="100" height="100" rx="22" fill="#0077b6"/>
|
||||
<g transform="translate(18 18)">
|
||||
<path d="M8 60V16L22 2H34C49 2 56 11 56 25C56 39 47 47 33 47H22V60Z" fill="#fff"/>
|
||||
<path d="M9 16H22V3Z" fill="#0077b6"/>
|
||||
<path d="M27 25L34 32L46 19" fill="none" stroke="#0077b6" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 453 B |
Binary file not shown.
|
After Width: | Height: | Size: 464 KiB |
@@ -0,0 +1,66 @@
|
||||
<!doctype html>
|
||||
<html lang="th">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
|
||||
<meta name="theme-color" content="#e0f2fe" />
|
||||
<title>ออฟไลน์ · ระบบจัดการเพจ</title>
|
||||
<style>
|
||||
:root { color-scheme: light; }
|
||||
* { box-sizing: border-box; }
|
||||
body {
|
||||
margin: 0;
|
||||
min-height: 100vh;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
padding: 24px;
|
||||
font-family: "Anuphan", system-ui, sans-serif;
|
||||
color: #17243b;
|
||||
background: #eef8ff;
|
||||
}
|
||||
.card {
|
||||
width: 100%;
|
||||
max-width: 380px;
|
||||
background: #fff;
|
||||
border: 1px solid #cfe6f5;
|
||||
border-radius: 16px;
|
||||
padding: 28px 24px;
|
||||
text-align: center;
|
||||
box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 12px 32px -16px rgba(11, 43, 124, 0.22);
|
||||
}
|
||||
.well {
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
margin: 0 auto 12px;
|
||||
border-radius: 999px;
|
||||
background: #fffbeb;
|
||||
color: #92400e;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
}
|
||||
h1 { font-size: 20px; margin: 0 0 6px; font-weight: 600; }
|
||||
p { margin: 0 0 20px; color: #6a7889; line-height: 1.5; }
|
||||
button {
|
||||
width: 100%;
|
||||
height: 46px;
|
||||
border: 0;
|
||||
border-radius: 10px;
|
||||
background: #0077b6;
|
||||
color: #fff;
|
||||
font: inherit;
|
||||
font-weight: 500;
|
||||
box-shadow: 0 10px 20px -10px rgba(17, 100, 194, 0.55);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="card">
|
||||
<div class="well" aria-hidden="true">
|
||||
<svg width="26" height="26" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M2 8.8a15 15 0 0 1 20 0M5 12.6a10 10 0 0 1 14 0M8.5 16.2a5 5 0 0 1 7 0M12 20h.01M3 3l18 18" /></svg>
|
||||
</div>
|
||||
<h1>ไม่มีการเชื่อมต่ออินเทอร์เน็ต</h1>
|
||||
<p>โพสต์และข้อความในระบบต้องใช้อินเทอร์เน็ต เชื่อมต่อแล้วลองใหม่อีกครั้ง</p>
|
||||
<button type="button" onclick="location.reload()">ลองใหม่</button>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,47 @@
|
||||
// Service worker: installable app shell + offline fallback.
|
||||
// Never caches API responses or page HTML — they carry per-user, per-page data.
|
||||
const VERSION = "pm-v4";
|
||||
const STATIC_CACHE = `${VERSION}-static`;
|
||||
const OFFLINE_URL = "/offline.html";
|
||||
|
||||
self.addEventListener("install", (event) => {
|
||||
event.waitUntil(caches.open(STATIC_CACHE).then((c) => c.addAll([OFFLINE_URL, "/icons/192"])));
|
||||
self.skipWaiting();
|
||||
});
|
||||
|
||||
self.addEventListener("activate", (event) => {
|
||||
event.waitUntil(
|
||||
caches.keys().then((keys) => Promise.all(keys.filter((k) => !k.startsWith(VERSION)).map((k) => caches.delete(k))))
|
||||
);
|
||||
self.clients.claim();
|
||||
});
|
||||
|
||||
self.addEventListener("fetch", (event) => {
|
||||
const req = event.request;
|
||||
if (req.method !== "GET") return;
|
||||
const url = new URL(req.url);
|
||||
if (url.origin !== self.location.origin) return;
|
||||
|
||||
// Page navigations: network only, offline page when the network is gone.
|
||||
if (req.mode === "navigate") {
|
||||
event.respondWith(fetch(req).catch(() => caches.match(OFFLINE_URL)));
|
||||
return;
|
||||
}
|
||||
|
||||
// Build assets are content-hashed: cache-first is safe.
|
||||
if (url.pathname.startsWith("/_next/static/") || url.pathname.startsWith("/icons/")) {
|
||||
event.respondWith(
|
||||
caches.match(req).then(
|
||||
(hit) =>
|
||||
hit ||
|
||||
fetch(req).then((res) => {
|
||||
if (res.ok) {
|
||||
const copy = res.clone();
|
||||
caches.open(STATIC_CACHE).then((c) => c.put(req, copy));
|
||||
}
|
||||
return res;
|
||||
})
|
||||
)
|
||||
);
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user