新增权限域名限制和链接背景上传

This commit is contained in:
eoao
2025-07-26 23:11:00 +08:00
parent 0e86b93e0c
commit 12833cd901
36 changed files with 584 additions and 354 deletions

View File

@@ -14,13 +14,18 @@ export function formatBytes(bytes) {
return `${size} ${units[i]}`;
}
export function fileToBase64(file) {
export function fileToBase64(file, type = false) {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = () => {
const base64 = reader.result.split(',')[1];
resolve(base64);
if (type) {
const base64 = reader.result;
resolve(base64);
} else {
const base64 = reader.result.split(',')[1];
resolve(base64);
}
};
reader.onerror = reject;
});
@@ -50,4 +55,4 @@ export function compressImage(file, config = {}) {
},
});
});
}
}