Allow public software downloads

This commit is contained in:
lwt
2026-06-09 15:01:28 +08:00
parent c178a7c540
commit cadaa0a1c5
3 changed files with 4 additions and 13 deletions
+2 -11
View File
@@ -112,7 +112,7 @@ function getInitial(name = "") {
function getDownloadHref(item) {
if (!item.downloadUrl) return "";
return `/api/software/${encodeURIComponent(item.id)}/download`;
return item.downloadUrl;
}
function getLoginHref(next = "/software.html") {
@@ -132,16 +132,7 @@ function downloadButton(item) {
if (!href) {
return `<span class="download-button is-disabled">待上传</span>`;
}
if (!state.player) {
return `<a class="download-button login-required" href="login.html?next=${encodeURIComponent(href)}">
<svg aria-hidden="true" viewBox="0 0 24 24">
<path d="M12 3 5 6v5c0 4.6 2.8 8.5 7 10 4.2-1.5 7-5.4 7-10V6l-7-3Z"></path>
<path d="m9.5 12 1.7 1.7 3.6-4"></path>
</svg>
登录下载
</a>`;
}
return `<a class="download-button" href="${href}">
return `<a class="download-button" href="${escapeHtml(href)}">
<svg aria-hidden="true" viewBox="0 0 24 24">
<path d="M12 3v12"></path>
<path d="m7 10 5 5 5-5"></path>