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

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

@@ -27,7 +27,7 @@ const fileUtils = {
* @returns {File} File 对象
*/
base64ToFile(base64Data, customFilename) {
const match = base64Data.match(/^data:(image|video)\/([a-zA-Z0-9.+-]+);base64,/);
const match = base64Data.match(/^data:(image|jpeg|video)\/([a-zA-Z0-9.+-]+);base64,/);
if (!match) {
throw new Error('Invalid base64 data format');
}
@@ -35,7 +35,7 @@ const fileUtils = {
const type = match[1]; // image 或 video
const ext = match[2]; // jpg, png, mp4 等
const mimeType = `${type}/${ext}`;
const cleanBase64 = base64Data.replace(/^data:(image|video)\/[a-zA-Z0-9.+-]+;base64,/, '');
const cleanBase64 = base64Data.replace(/^data:(image|jpeg|video)\/[a-zA-Z0-9.+-]+;base64,/, '');
const byteCharacters = atob(cleanBase64);
const byteArrays = [];