mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
feat:download update
This commit is contained in:
parent
1d130d4580
commit
63c2b95cbb
@ -1,7 +1,9 @@
|
|||||||
import { version } from "../../version";
|
import { version } from "../../version";
|
||||||
import https from "node:https";
|
import https from "node:https";
|
||||||
//import http from "node:http";
|
//import http from "node:http";
|
||||||
|
import * as path from "node:path";
|
||||||
import * as fs from "node:fs";
|
import * as fs from "node:fs";
|
||||||
|
import { TEMP_DIR } from ".";
|
||||||
export async function checkVersion() {
|
export async function checkVersion() {
|
||||||
const latestVersionText = await getRemoteVersion();
|
const latestVersionText = await getRemoteVersion();
|
||||||
const latestVersion = latestVersionText.split(".");
|
const latestVersion = latestVersionText.split(".");
|
||||||
@ -19,11 +21,11 @@ export async function updateLLOneBot() {
|
|||||||
if (latestVersion && latestVersion != "") {
|
if (latestVersion && latestVersion != "") {
|
||||||
const downloadUrl = "https://github.com/LLOneBot/LLOneBot/releases/download/v" + latestVersion + "/LLOneBot.zip";
|
const downloadUrl = "https://github.com/LLOneBot/LLOneBot/releases/download/v" + latestVersion + "/LLOneBot.zip";
|
||||||
const realUrl = mirrorGithubList[0] + downloadUrl;
|
const realUrl = mirrorGithubList[0] + downloadUrl;
|
||||||
/**const fileStream = fs.createWriteStream("F:\\TOOLS\\test.zip");
|
const filePath = path.join(TEMP_DIR, "./update-" + latestVersion + ".zip");
|
||||||
|
const fileStream = fs.createWriteStream(filePath);
|
||||||
https.get(realUrl, (res) => {
|
https.get(realUrl, (res) => {
|
||||||
res.pipe(fileStream);
|
res.pipe(fileStream);
|
||||||
})
|
})
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user