Ship site UI checklist, move admin to /mstcontroller, and add safe taxonomy label migration.
Deploy edu.mstaut.ir / deploy (push) Has been cancelled

Production already has migrations through 008; 009 only updates four seed labels by id. Faculty sync remains upsert-by-email/name and does not wipe curated data.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
smhk1376andCursor committed 2026-10-16 16:26:21 +03:30
1 parent 3eea1c35a6
commit 2b0db26a93
171 files changed
+1477 -807

No files matched your search

+15 -15
View File
@@ -50,31 +50,31 @@ const publicPages = [
];
const adminPages = [
{ id: "20-admin-login", url: "/admin/login", title: "ورود ادمین (/admin/login)", login: false },
{ id: "21-admin-dashboard", url: "/admin", title: "داشبورد ادمین (/admin)", login: true },
{ id: "22-admin-courses", url: "/admin/courses", title: "لیست دوره‌ها (/admin/courses)", login: true },
{ id: "20-admin-login", url: "/mstcontroller/login", title: "ورود ادمین (/mstcontroller/login)", login: false },
{ id: "21-admin-dashboard", url: "/mstcontroller", title: "داشبورد ادمین (/mstcontroller)", login: true },
{ id: "22-admin-courses", url: "/mstcontroller/courses", title: "لیست دوره‌ها (/mstcontroller/courses)", login: true },
{
id: "23-admin-course-new",
url: "/admin/courses/new",
title: "ایجاد دوره — فیلد آپلود تصویر (/admin/courses/new)",
url: "/mstcontroller/courses/new",
title: "ایجاد دوره — فیلد آپلود تصویر (/mstcontroller/courses/new)",
login: true,
},
{
id: "24-admin-articles",
url: "/admin/articles",
title: "لیست مقالات (/admin/articles)",
url: "/mstcontroller/articles",
title: "لیست مقالات (/mstcontroller/articles)",
login: true,
},
{
id: "25-admin-articles-new",
url: "/admin/articles/new",
title: "ایجاد مقاله — فیلد آپلود (/admin/articles/new)",
url: "/mstcontroller/articles/new",
title: "ایجاد مقاله — فیلد آپلود (/mstcontroller/articles/new)",
login: true,
},
{
id: "26-admin-registrations",
url: "/admin/registrations",
title: "ثبت‌نام‌ها (/admin/registrations)",
url: "/mstcontroller/registrations",
title: "ثبت‌نام‌ها (/mstcontroller/registrations)",
login: true,
},
];
@@ -134,7 +134,7 @@ async function loginAdmin(page, context) {
if (!res.ok()) {
throw new Error(`admin login API ${res.status()}: ${await res.text()}`);
}
await page.goto(new URL("/admin", BASE).toString(), {
await page.goto(new URL("/mstcontroller", BASE).toString(), {
waitUntil: "domcontentloaded",
timeout: 60000,
});
@@ -161,12 +161,12 @@ for (const item of adminPages) {
if (item.login && !loggedIn) {
try {
const after = await loginAdmin(page, context);
loggedIn = after.includes("/admin") && !after.includes("/login");
loggedIn = after.includes("/mstcontroller") && !after.includes("/login");
if (!loggedIn) {
report.push({
id: "login-blocker",
title: "ورود ادمین",
url: "/admin/login",
url: "/mstcontroller/login",
finalUrl: after,
status: "blocked",
note: "لاگین ادمین موفق نشد؛ صفحات محافظت‌شده اسکرین نشدند. احتمالاً cookie Secure روی http یا رمز اشتباه.",
@@ -178,7 +178,7 @@ for (const item of adminPages) {
report.push({
id: "login-blocker",
title: "ورود ادمین",
url: "/admin/login",
url: "/mstcontroller/login",
finalUrl: "",
status: "blocked",
note: err instanceof Error ? err.message : String(err),
+119
View File
@@ -0,0 +1,119 @@
/**
* Pull MST favicon + generate multi-size PNG icons from the faculty seal.
*/
import { copyFileSync, existsSync, mkdirSync, readdirSync } from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { createRequire } from "node:module";
const require = createRequire(import.meta.url);
const sharp = require("sharp");
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
const outDir = path.join(root, "public", "brand", "icons");
mkdirSync(outDir, { recursive: true });
function findDownloadsLogo(name) {
const downloads = path.join(process.env.USERPROFILE || "", "Downloads");
if (!existsSync(downloads)) return null;
const folder = readdirSync(downloads, { withFileTypes: true }).find(
(d) => d.isDirectory() && d.name.includes("شبکه"),
);
if (!folder) return null;
const base = path.join(downloads, folder.name);
const filesDir = readdirSync(base, { withFileTypes: true }).find(
(d) => d.isDirectory() && d.name.includes("_files"),
);
if (!filesDir) return null;
const p = path.join(base, filesDir.name, name);
return existsSync(p) ? p : null;
}
async function fetchBuffer(url) {
const res = await fetch(url, {
headers: { "User-Agent": "Mozilla/5.0 AUT-OpenEdu-Favicon/1.0" },
redirect: "follow",
});
if (!res.ok) throw new Error(`${url} → ${res.status}`);
return Buffer.from(await res.arrayBuffer());
}
const sizes = [16, 32, 48, 64, 128, 180, 192, 256, 512];
const logoFa = findDownloadsLogo("logo_fa.png");
const logoFaW = findDownloadsLogo("logo_fa_w.png");
if (!logoFa) {
console.error("logo_fa.png not found in Downloads/شبکه اساتید");
process.exit(1);
}
// Copy originals into brand/
copyFileSync(logoFa, path.join(root, "public", "brand", "logo_fa.png"));
if (logoFaW) {
copyFileSync(logoFaW, path.join(root, "public", "brand", "logo_fa_w.png"));
}
console.log("copied logo_fa.png" + (logoFaW ? " + logo_fa_w.png" : ""));
// Prefer white-on-dark seal for dark UI; dark-on-light for favicon (logo_fa)
const source = logoFa;
for (const size of sizes) {
const dest = path.join(outDir, `favicon-${size}x${size}.png`);
await sharp(source)
.resize(size, size, { fit: "contain", background: { r: 0, g: 0, b: 0, alpha: 0 } })
.png()
.toFile(dest);
console.log("wrote", path.relative(root, dest));
}
// Apple touch (180) + PWA-ish icons at public root aliases
await sharp(source)
.resize(180, 180, { fit: "contain", background: { r: 255, g: 255, b: 255, alpha: 1 } })
.png()
.toFile(path.join(root, "public", "apple-touch-icon.png"));
await sharp(source)
.resize(192, 192, { fit: "contain", background: { r: 0, g: 0, b: 0, alpha: 0 } })
.png()
.toFile(path.join(root, "public", "icon-192.png"));
await sharp(source)
.resize(512, 512, { fit: "contain", background: { r: 0, g: 0, b: 0, alpha: 0 } })
.png()
.toFile(path.join(root, "public", "icon-512.png"));
// Next.js app router file conventions
await sharp(source)
.resize(32, 32, { fit: "contain", background: { r: 0, g: 0, b: 0, alpha: 0 } })
.png()
.toFile(path.join(root, "src", "app", "icon.png"));
await sharp(source)
.resize(180, 180, { fit: "contain", background: { r: 255, g: 255, b: 255, alpha: 1 } })
.png()
.toFile(path.join(root, "src", "app", "apple-icon.png"));
// Live MST favicon.ico
try {
const ico = await fetchBuffer("https://mst.aut.ac.ir/favicon.ico");
const icoPath = path.join(root, "public", "favicon.ico");
const { writeFileSync } = await import("node:fs");
writeFileSync(icoPath, ico);
writeFileSync(path.join(root, "public", "MstAut_favicon.ico"), ico);
writeFileSync(path.join(outDir, "favicon.ico"), ico);
console.log("fetched mst.aut.ac.ir/favicon.ico (" + ico.length + " bytes)");
} catch (err) {
console.warn("live favicon fetch failed, keeping existing:", err.message);
// Fall back: copy existing if present
const existing = path.join(root, "public", "MstAut_favicon.ico");
if (existsSync(existing)) {
copyFileSync(existing, path.join(root, "public", "favicon.ico"));
copyFileSync(existing, path.join(outDir, "favicon.ico"));
console.log("copied local MstAut_favicon.ico");
}
}
// Brand icon used elsewhere
await sharp(source)
.resize(256, 256, { fit: "contain", background: { r: 0, g: 0, b: 0, alpha: 0 } })
.png()
.toFile(path.join(root, "public", "brand", "mst-faculty-icon.png"));
console.log("done → public/brand/icons/*");