Skip to content

Commit

Permalink
fix: 引擎校验 (#1916)
Browse files Browse the repository at this point in the history
  • Loading branch information
song-xiao-lin authored Aug 16, 2024
1 parent 39ad340 commit 8c9d312
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions app/main/uiOperate/yaklangAndYakit.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,21 +91,25 @@ module.exports = (win, getClient) => {

const asyncFetchCheckYaklangSource = (version) => {
return new Promise(async (resolve, reject) => {
const url = await getCheckTextUrl(version)
if (url === '') {
reject(`Unsupported platform: ${process.platform}`)
try {
const url = await getCheckTextUrl(version)
if (url === '') {
reject(`Unsupported platform: ${process.platform}`)
}
let rsp = https.get(url)
rsp.on("response", (rsp) => {
rsp.on("data", (data) => {
if (rsp.statusCode == 200) {
resolve(Buffer.from(data).toString("utf8"))
} else {
reject('校验值不存在')
}
}).on("error", (err) => reject(err))
})
rsp.on("error", reject)
} catch (error) {
reject(error)
}
let rsp = https.get(url)
rsp.on("response", (rsp) => {
rsp.on("data", (data) => {
if (rsp.statusCode == 200) {
resolve(Buffer.from(data).toString("utf8"))
} else {
reject('校验值不存在')
}
}).on("error", (err) => reject(err))
})
rsp.on("error", reject)
})
}
/** 校验Yaklang来源是否正确 */
Expand Down

0 comments on commit 8c9d312

Please sign in to comment.