feat: Added the base64-encoded url for magic vars

This commit is contained in:
Samler 2025-06-30 21:33:27 +08:00
parent 8e2c2bcff1
commit 2ac5263363
No known key found for this signature in database
GPG Key ID: BFDA5A582449E3B0
5 changed files with 9 additions and 0 deletions

View File

@ -192,6 +192,7 @@
"maxSizeDes": "The maximum file size supported by this application. 0 means no limit. If the file exceeds this size, it will still be opened, but users will be warned.",
"srcEncodedVar": "URL-encoded file Blob temporary access URL",
"srcVar": "File blob temporary access URL",
"srcBase64Var": "Base64-encoded File blob temporary access URL",
"nameEncodedVar": "URL-encoded file name",
"versionEntityVar": "The Blob ID of the opened file version, empty means the latest version.",
"fileIdVar": "File ID",

View File

@ -192,6 +192,7 @@
"maxSizeDes": "このアプリがサポートする最大ファイルサイズです。「0」と入力すると制限なしになります。サイズ超過の場合もファイルを開こうとしますが、警告が表示されます。",
"srcEncodedVar": "URLエンコード済みのファイルBlob一時アクセスアドレス",
"srcVar": "ファイルBlob一時アクセスアドレス",
"srcBase64Var": "Base64エンコード済みのファイルBlob一時アクセスアドレス",
"nameEncodedVar": "URLエンコード済みのファイル名",
"versionEntityVar": "開いているファイルバージョンのBlob ID空欄の場合は最新バージョンが開かれています。",
"fileIdVar": "ファイルID",

View File

@ -192,6 +192,7 @@
"maxSizeDes": "此应用支持的最大文件大小,填写 0 表示不限制,超出大小时仍会尝试打开文件,但会警告用户。",
"srcEncodedVar": "经过 URL 编码后的文件 Blob 临时访问地址",
"srcVar": "文件 Blob 临时访问地址",
"srcBase64Var": "经过 Base64 编码后的文件 Blob 临时访问地址",
"nameEncodedVar": "经过 URL 编码后的文件名",
"versionEntityVar": "打开的文件版本 Blob ID为空时表示打开的是最新版本。",
"fileIdVar": "文件 ID",

View File

@ -59,6 +59,11 @@ const magicVars: MagicVar[] = [
value: "settings.srcVar",
example: "https://cloudreve.org/api/v4/file/content/zOie/0/text.txt?sign=xxx",
},
{
name: "{$src_raw_base64}",
value: "settings.srcBase64Var",
example: "aHR0cHM6Ly9jbG91ZHJldmUub3JnL2FwaS92NC9maWxlL2NvbnRlbnQvek9pZS8wL3RleHQudHh0P3NpZ249eHh4",
},
{
name: "{$name}",
value: "settings.nameEncodedVar",

View File

@ -273,6 +273,7 @@ export function openCustomViewer(file: FileResponse, viewer: Viewer, preferredVe
const vars: { [key: string]: string } = {
src: encodeURIComponent(entityUrl.urls[0].url),
src_raw: entityUrl.urls[0].url,
src_raw_base64: btoa(entityUrl.urls[0].url),
name: encodeURIComponent(file.name),
version: preferredVersion ? preferredVersion : "",
id: file.id,