mirror of
https://github.com/fccview/cronmaster.git
synced 2026-01-17 18:27:42 -05:00
39 lines
1001 B
TypeScript
39 lines
1001 B
TypeScript
import { NextRequest, NextResponse } from "next/server";
|
|
import { readFileSync, existsSync } from "fs";
|
|
import path from "path";
|
|
import { DATA_DIR } from "@/app/_consts/file";
|
|
|
|
export async function GET(request: NextRequest) {
|
|
try {
|
|
const officialScriptPath = path.join(
|
|
process.cwd(),
|
|
"app",
|
|
"_scripts",
|
|
"cron-log-wrapper.sh"
|
|
);
|
|
|
|
const dataScriptPath = path.join(
|
|
process.cwd(),
|
|
DATA_DIR,
|
|
"cron-log-wrapper.sh"
|
|
);
|
|
|
|
if (!existsSync(dataScriptPath)) {
|
|
return NextResponse.json({ modified: false });
|
|
}
|
|
|
|
const officialScript = readFileSync(officialScriptPath, "utf-8");
|
|
const dataScript = readFileSync(dataScriptPath, "utf-8");
|
|
|
|
const modified = officialScript !== dataScript;
|
|
|
|
return NextResponse.json({ modified });
|
|
} catch (error) {
|
|
console.error("Error checking wrapper script:", error);
|
|
return NextResponse.json(
|
|
{ error: "Failed to check wrapper script" },
|
|
{ status: 500 }
|
|
);
|
|
}
|
|
}
|