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>
+1 -1
View File
@@ -315,7 +315,7 @@ function publicItem(item, includePrivate = false) {
copy.versionManifestUrl = `/api/software/${encodeURIComponent(item.id)}/version.json`;
copy.checkUpdateUrl = `/api/software/${encodeURIComponent(item.id)}/check-update`;
if (resolveDownloadUrl(item)) {
copy.downloadUrl = `/api/software/${encodeURIComponent(item.id)}/download`;
copy.downloadUrl = `/api/software/${encodeURIComponent(item.id)}/update-download`;
}
}
return copy;
+1 -1
View File
@@ -141,6 +141,6 @@
<a href="https://beian.miit.gov.cn/" target="_blank" rel="noreferrer">粤ICP备2026053646号</a>
</footer>
<script src="assets/js/software.js?v=20260608-1"></script>
<script src="assets/js/software.js?v=20260609-1"></script>
</body>
</html>