feat: 项目自动选中、重命名接口与长配置值展开;页面显示版本号 v1.0.<commit> build <时间>
build-and-deploy / build-and-deploy (push) Successful in 28s
build-and-deploy / build-and-deploy (push) Successful in 28s
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* 版本号加载器
|
||||
* 读取 /api/version 并将版本号填充到页面元素的 #version-text(或 .statusbar-version)
|
||||
*/
|
||||
(function () {
|
||||
function fill(text) {
|
||||
var el = document.getElementById("version-text");
|
||||
if (!el) el = document.querySelector(".statusbar-version");
|
||||
if (!el) return;
|
||||
el.textContent = text;
|
||||
}
|
||||
|
||||
try {
|
||||
fetch("/api/version")
|
||||
.then(function (r) {
|
||||
if (!r.ok) throw new Error("bad status");
|
||||
return r.json();
|
||||
})
|
||||
.then(function (data) {
|
||||
if (data && data.success && data.data) {
|
||||
fill(data.data.version || "");
|
||||
}
|
||||
})
|
||||
.catch(function () {});
|
||||
} catch (e) {}
|
||||
})();
|
||||
Reference in New Issue
Block a user