Fix image di seafile sudah tidak pakai token tapi by folder di seafile

Kasih console di page profil ppid & visi misi di Profile Desa
This commit is contained in:
2026-02-05 11:10:30 +08:00
parent 25000d0b0f
commit df154806f7
8 changed files with 274 additions and 12 deletions

33
prisma/lib/get_sharef.ts Normal file
View File

@@ -0,0 +1,33 @@
const BASE_URL = "https://cld-dkr-makuro-seafile.wibudev.com";
const ADMIN_TOKEN = process.env.SEAFILE_TOKEN!;
const REPO_ID = process.env.SEAFILE_REPO_ID!;
export async function createFileShareForFolder() {
const res = await fetch(`${BASE_URL}/api/v2.1/share-links/`, {
method: "POST",
headers: {
Authorization: `Token ${ADMIN_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
repo_id: REPO_ID,
path: "/asset-web", // FOLDER
permission: "r",
}),
});
if (!res.ok) {
const text = await res.text();
throw new Error(text);
}
const data = await res.json();
console.log("FILE SHARE LINK:", data);
// data.link -> https://domain/f/XXXX/
// data.token / data.id (tergantung versi)
}
if (import.meta.main) {
await createFileShareForFolder();
}