feat: add changelog modal on visit if new version is detected

This commit is contained in:
Kentai Radiquum 2024-08-12 03:18:41 +05:00
parent 04c072fba7
commit 8bcd548ae3
Signed by: Radiquum
GPG key ID: 858E8EE696525EED
11 changed files with 1137 additions and 22 deletions

17
app/api/version/route.ts Normal file
View file

@ -0,0 +1,17 @@
import { NextResponse } from "next/server";
import * as fs from "node:fs";
import * as path from "node:path";
export async function GET() {
const directoryPath = path.join(process.cwd(), "public/changelog");
const files = fs.readdirSync(directoryPath);
const current = "3.0.1";
const previous = [];
files.forEach((file) => {
if (file != `${current}.md`) {
previous.push(file.replace(".md", ""));
}
});
return NextResponse.json({ version: current, previous: previous });
}