MCPcopy Create free account
hub / github.com/Semporia/Scripts / version

Function version

jd_api_test.js:76–110  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

74}
75
76function version() {
77 return new Promise(resolve => {
78 console.log('\n开始版本检测......')
79 $.get({url: `http://api.sharecode.ga/api/version`, timeout: 3000}, (err, resp, data) => {
80 try {
81 if (data) {
82 console.log(`本地:${$.version}\n远程:${data}`)
83 if (data === $.version) {
84 console.log('已是最新版本')
85 } else {
86 $.msg("JDHelloWorld", "请更新!", `本地:${$.version}\n远程:${data}`)
87 if ($.isNode()) {
88 const notify = require('./sendNotify')
89 notify.sendNotify("JDHelloWorld", `本地:${$.version}\n远程:${data}\n\n请及时更新!`)
90 }
91 }
92 } else {
93 $.msg("JDHelloWorld", "版本检测失败", `请手动访问 http://api.sharecode.ga/api/version 测试网络`, {"open-url": "http://api.sharecode.ga/api/version"})
94 if ($.isNode()) {
95 const notify = require('./sendNotify')
96 notify.sendNotify("JDHelloWorld", `版本检测失败\n请手动访问\nhttp://api.sharecode.ga/api/version\n测试网络`)
97 }
98 }
99 } catch (e) {
100 $.msg("JDHelloWorld", "版本检测失败", `请手动访问 http://api.sharecode.ga/api/version 测试网络`, {"open-url": "http://api.sharecode.ga/api/version"})
101 if ($.isNode()) {
102 const notify = require('./sendNotify')
103 notify.sendNotify("JDHelloWorld", `版本检测失败\n请手动访问\nhttp://api.sharecode.ga/api/version 测试网络`)
104 }
105 } finally {
106 resolve()
107 }
108 })
109 })
110}
111
112// prettier-ignore
113function Env(t, e) {

Callers

nothing calls this directly

Calls 4

logMethod · 0.45
getMethod · 0.45
msgMethod · 0.45
isNodeMethod · 0.45

Tested by

no test coverage detected