feat: small file is unrequired to verity to download.

This commit is contained in:
2025-07-16 11:13:54 +08:00
parent 9f4eb1e2a8
commit ea8dbb90b9
3 changed files with 42 additions and 25 deletions

View File

@@ -702,20 +702,32 @@ function FileTile({ file }: { file: RFile }) {
</p>
</div>
<div className={"flex flex-row items-center"}>
<button
ref={buttonRef}
className={"btn btn-primary btn-soft btn-square"}
onClick={() => {
if (!app.cloudflareTurnstileSiteKey) {
const link = network.getFileDownloadLink(file.id, "");
window.open(link, "_blank");
} else {
showPopup(<CloudflarePopup file={file} />, buttonRef.current!);
}
}}
>
<MdOutlineDownload size={24} />
</button>
{
file.size > 10 * 1024 * 1024 ? (
<button
ref={buttonRef}
className={"btn btn-primary btn-soft btn-square"}
onClick={() => {
if (!app.cloudflareTurnstileSiteKey) {
const link = network.getFileDownloadLink(file.id, "");
window.open(link, "_blank");
} else {
showPopup(<CloudflarePopup file={file} />, buttonRef.current!);
}
}}
>
<MdOutlineDownload size={24} />
</button>
) : (
<a
href={network.getFileDownloadLink(file.id, "")}
target="_blank"
className={"btn btn-primary btn-soft btn-square"}
>
<MdOutlineDownload size={24} />
</a>
)
}
</div>
</div>
</div>