diff --git a/xiaomusic/static/default/index.html b/xiaomusic/static/default/index.html
index 55cd202..f1a3b0e 100644
--- a/xiaomusic/static/default/index.html
+++ b/xiaomusic/static/default/index.html
@@ -26,8 +26,7 @@
@@ -191,7 +190,32 @@
-
+
+
+
+
更新
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/xiaomusic/static/default/main.css b/xiaomusic/static/default/main.css
index 150b22a..4702b74 100644
--- a/xiaomusic/static/default/main.css
+++ b/xiaomusic/static/default/main.css
@@ -313,6 +313,7 @@ textarea {
.playlist-selector,
.device-selector,
+.version-selector,
.song-selector {
width: 300px;
}
@@ -342,3 +343,11 @@ span,p {
cursor: pointer;
user-select: none;
}
+
+.changelog-button {
+ padding: 0px 0px;
+ margin: 0px;
+ font-size: 14px;
+ margin-left: auto;
+ text-decoration: none;
+}
diff --git a/xiaomusic/static/default/md.js b/xiaomusic/static/default/md.js
index 7839241..5805dcd 100644
--- a/xiaomusic/static/default/md.js
+++ b/xiaomusic/static/default/md.js
@@ -650,3 +650,49 @@ function timedShutDown(cmd) {
$(".timer-tooltip").fadeOut();
}, 3000);
}
+
+// 绑定点击事件,显示弹窗
+$('#version').on('click', function() {
+ $.get("https://xdocs.hanxi.cc/versions.json", function (data, status) {
+ console.log(data);
+ const versionSelect = document.getElementById("update-version");
+ versionSelect.innerHTML = "";
+ data.forEach((item) => {
+ const option = document.createElement("option");
+ option.value = item.version;
+ if (item.version=="main"){
+ option.textContent = "测试版";
+ } else {
+ option.textContent = item.version;
+ }
+ versionSelect.appendChild(option);
+ });
+ });
+ $('#update-component').show();
+});
+
+// 关闭更新弹窗
+function toggleUpdate() {
+ $('#update-component').hide();
+}
+
+function doUpdates() {
+ const version = $("#update-version").val();
+ let lite = $("#lite").val();
+ $.ajax({
+ type: "POST",
+ url: `/updateversion?version=${version}&lite=${lite}`,
+ contentType: "application/json; charset=utf-8",
+ success: (data) => {
+ if (data.ret == "OK") {
+ alert(`更新成功,请刷新页面`);
+ location.reload();
+ } else {
+ alert(`更新失败: ${data.ret}`);
+ }
+ },
+ error: () => {
+ alert(`更新失败`);
+ },
+ });
+}