upd: dahsboard admin

Deskripsi:
- tampil image
- tampil ttd pada setting desa

No Issues
This commit is contained in:
2025-11-20 17:22:01 +08:00
parent d0ff675950
commit e5a9ee86dd
4 changed files with 96 additions and 19 deletions

View File

@@ -128,11 +128,15 @@ export async function listFiles(config: Config): Promise<{ name: string }[]> {
}
}
export async function catFile(config: Config, fileName: string): Promise<string> {
const downloadUrlResponse = await fetchWithAuth(config, `${config.URL}/${config.REPO}/file/?p=/${fileName}`);
export async function catFile(config: Config, folder: string, fileName: string): Promise<ArrayBuffer> {
const downloadUrlResponse = await fetchWithAuth(config, `${config.URL}/${config.REPO}/file/?p=/${folder}/${fileName}`);
const downloadUrl = (await downloadUrlResponse.text()).replace(/"/g, '');
const content = await (await fetchWithAuth(config, downloadUrl)).text();
return content
// Download file sebagai binary, BUKAN text
const fileResponse = await fetchWithAuth(config, downloadUrl);
const buffer = await fileResponse.arrayBuffer();
return buffer;
}
export async function uploadFile(config: Config, file: File): Promise<string> {