|
7 | 7 | { label: "SMS管理", key: "sms" }, |
8 | 8 | { label: "服务设置", key: "settings" }, |
9 | 9 | { label: "代理服务", key: "proxy" }, |
| 10 | + { label: "关于", key: "about" }, |
10 | 11 | { label: "运行日志", key: "logs" } |
11 | 12 | ]; |
12 | 13 |
|
|
173 | 174 | remote_refresh: false, |
174 | 175 | remote_revive: false, |
175 | 176 | remote_delete: false, |
| 177 | + update_check: false, |
176 | 178 | run_stats_clear: false, |
177 | 179 | logs: false, |
178 | 180 | mail_overview: false, |
|
204 | 206 | accounts_per_file: 50 |
205 | 207 | }); |
206 | 208 |
|
| 209 | + const aboutInfo = Vue.reactive({ |
| 210 | + name: "CodeX Register", |
| 211 | + version: "0.0.0-dev", |
| 212 | + author: "-", |
| 213 | + intro: "", |
| 214 | + repo_slug: "", |
| 215 | + repo_url: "", |
| 216 | + platform: "", |
| 217 | + python: "" |
| 218 | + }); |
| 219 | + const updateInfo = Vue.reactive({ |
| 220 | + checked: false, |
| 221 | + checked_at: "", |
| 222 | + has_update: false, |
| 223 | + current_version: "", |
| 224 | + latest_tag: "", |
| 225 | + latest_name: "", |
| 226 | + published_at: "", |
| 227 | + release_url: "", |
| 228 | + release_notes: "", |
| 229 | + assets: [], |
| 230 | + error: "" |
| 231 | + }); |
| 232 | + |
207 | 233 | const remoteRows = Vue.ref([]); |
208 | 234 | const remoteSelection = Vue.ref([]); |
209 | 235 | const remoteSearch = Vue.ref(""); |
|
1605 | 1631 | remoteMeta.test_fail = Number(data.remote_test_fail || remoteMeta.test_fail || 0); |
1606 | 1632 | } |
1607 | 1633 |
|
| 1634 | + function applyAboutInfo(data) { |
| 1635 | + aboutInfo.name = String((data && data.name) || "CodeX Register"); |
| 1636 | + aboutInfo.version = String((data && data.version) || "0.0.0-dev"); |
| 1637 | + aboutInfo.author = String((data && data.author) || "-"); |
| 1638 | + aboutInfo.intro = String((data && data.intro) || ""); |
| 1639 | + aboutInfo.repo_slug = String((data && data.repo_slug) || ""); |
| 1640 | + aboutInfo.repo_url = String((data && data.repo_url) || ""); |
| 1641 | + aboutInfo.platform = String((data && data.platform) || ""); |
| 1642 | + aboutInfo.python = String((data && data.python) || ""); |
| 1643 | + } |
| 1644 | + |
| 1645 | + async function refreshAboutInfo(showSuccess = false) { |
| 1646 | + try { |
| 1647 | + const data = await apiRequest("/api/app/about"); |
| 1648 | + applyAboutInfo(data); |
| 1649 | + if (showSuccess) message.success("关于信息已刷新"); |
| 1650 | + } catch (e) { |
| 1651 | + if (showSuccess) message.error(String(e.message || e)); |
| 1652 | + } |
| 1653 | + } |
| 1654 | + |
| 1655 | + async function checkAppUpdate() { |
| 1656 | + loading.update_check = true; |
| 1657 | + try { |
| 1658 | + const data = await apiRequest("/api/app/check-update"); |
| 1659 | + updateInfo.checked = true; |
| 1660 | + updateInfo.checked_at = String(data.checked_at || ""); |
| 1661 | + updateInfo.has_update = !!data.has_update; |
| 1662 | + updateInfo.current_version = String(data.current_version || ""); |
| 1663 | + updateInfo.latest_tag = String(data.latest_tag || ""); |
| 1664 | + updateInfo.latest_name = String(data.latest_name || ""); |
| 1665 | + updateInfo.published_at = String(data.published_at || ""); |
| 1666 | + updateInfo.release_url = String(data.release_url || ""); |
| 1667 | + updateInfo.release_notes = String(data.release_notes || ""); |
| 1668 | + updateInfo.assets = Array.isArray(data.assets) ? data.assets : []; |
| 1669 | + updateInfo.error = ""; |
| 1670 | + if (updateInfo.has_update) { |
| 1671 | + message.success(`发现新版本:${updateInfo.latest_tag || updateInfo.latest_name}`); |
| 1672 | + } else { |
| 1673 | + message.info("当前已是最新版本"); |
| 1674 | + } |
| 1675 | + } catch (e) { |
| 1676 | + const err = String(e.message || e); |
| 1677 | + updateInfo.checked = true; |
| 1678 | + updateInfo.has_update = false; |
| 1679 | + updateInfo.error = err; |
| 1680 | + message.error(err); |
| 1681 | + } finally { |
| 1682 | + loading.update_check = false; |
| 1683 | + } |
| 1684 | + } |
| 1685 | + |
1608 | 1686 | async function pullLogs() { |
1609 | 1687 | if (loading.logs) return; |
1610 | 1688 | loading.logs = true; |
|
2960 | 3038 | loadMailDomainStats(), |
2961 | 3039 | refreshSmsOverview(false, true), |
2962 | 3040 | refreshSmsCountryOptions(false, true), |
| 3041 | + refreshAboutInfo(false), |
2963 | 3042 | loadStatus(), |
2964 | 3043 | pullLogs() |
2965 | 3044 | ]); |
|
3037 | 3116 | ]); |
3038 | 3117 | return; |
3039 | 3118 | } |
| 3119 | + if (tab === "about") { |
| 3120 | + await refreshAboutInfo(false); |
| 3121 | + return; |
| 3122 | + } |
3040 | 3123 | if (tab === "mail") { |
3041 | 3124 | if (normalizeMailProvider(mailProviderTab.value) === "graph") { |
3042 | 3125 | await refreshGraphAccountFiles(false); |
|
3095 | 3178 | accountManageTab, |
3096 | 3179 | showSub2ApiExportModal, |
3097 | 3180 | sub2apiExportForm, |
| 3181 | + aboutInfo, |
| 3182 | + updateInfo, |
3098 | 3183 | remoteRows, |
3099 | 3184 | remoteSelection, |
3100 | 3185 | remoteSearch, |
|
3206 | 3291 | stopRun, |
3207 | 3292 | clearLogs, |
3208 | 3293 | clearRunStats, |
| 3294 | + refreshAboutInfo, |
| 3295 | + checkAppUpdate, |
3209 | 3296 | onLogUserWheel, |
3210 | 3297 | onLogUserScroll, |
3211 | 3298 | manualPoll |
|
0 commit comments