mirror of
https://github.com/clash-verge-rev/clash-verge-rev
synced 2025-05-05 06:53:44 +08:00
feat: Use Latest Meta Core mihomo (#41)
This commit is contained in:
parent
653c7d4430
commit
0a805c16fd
@ -33,16 +33,18 @@ const CLASH_MAP = {
|
|||||||
};
|
};
|
||||||
*/
|
*/
|
||||||
/* ======= clash meta ======= */
|
/* ======= clash meta ======= */
|
||||||
const META_URL_PREFIX = `https://github.com/wonfen/Clash.Meta/releases/download/latest`;
|
const VERSION_URL =
|
||||||
// const META_VERSION = "2023.11.23";
|
"https://github.com/MetaCubeX/mihomo/releases/download/Prerelease-Alpha/version.txt";
|
||||||
|
const META_URL_PREFIX = `https://github.com/MetaCubeX/mihomo/releases/download/Prerelease-Alpha`;
|
||||||
|
let META_VERSION;
|
||||||
|
|
||||||
const META_MAP = {
|
const META_MAP = {
|
||||||
"win32-x64": "clash.meta-win-amd64",
|
"win32-x64": "mihomo-windows-amd64",
|
||||||
"win32-arm64": "clash.meta-win-arm64",
|
"win32-arm64": "mihomo-windows-arm64",
|
||||||
"darwin-x64": "clash.meta-darwin-amd64",
|
"darwin-x64": "mihomo-darwin-amd64",
|
||||||
"darwin-arm64": "clash.meta-darwin-arm64",
|
"darwin-arm64": "mihomo-darwin-arm64",
|
||||||
"linux-x64": "clash.meta-linux-amd64",
|
"linux-x64": "mihomo-linux-amd64",
|
||||||
"linux-arm64": "clash.meta-linux-arm64",
|
"linux-arm64": "mihomo-linux-arm64",
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -65,6 +67,21 @@ const ARCH_MAP = {
|
|||||||
"aarch64-unknown-linux-gnu": "arm64",
|
"aarch64-unknown-linux-gnu": "arm64",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetch the latest release version from the version.txt file
|
||||||
|
*/
|
||||||
|
async function getLatestVersion() {
|
||||||
|
try {
|
||||||
|
const response = await fetch(VERSION_URL, { method: "GET" });
|
||||||
|
let v = await response.text();
|
||||||
|
META_VERSION = v.trim(); // Trim to remove extra whitespaces
|
||||||
|
console.log(`Latest release version: ${META_VERSION}`);
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error fetching latest release version:", error.message);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const target = process.argv.slice(2)[0];
|
const target = process.argv.slice(2)[0];
|
||||||
const { platform, arch } = target
|
const { platform, arch } = target
|
||||||
? { platform: PLATFORM_MAP[target], arch: ARCH_MAP[target] }
|
? { platform: PLATFORM_MAP[target], arch: ARCH_MAP[target] }
|
||||||
@ -141,14 +158,10 @@ function clashS3() {
|
|||||||
function clashMeta() {
|
function clashMeta() {
|
||||||
const name = META_MAP[`${platform}-${arch}`];
|
const name = META_MAP[`${platform}-${arch}`];
|
||||||
const isWin = platform === "win32";
|
const isWin = platform === "win32";
|
||||||
/* const urlExt = isWin ? "zip" : "gz";
|
const urlExt = isWin ? "zip" : "gz";
|
||||||
const downloadURL = `${META_URL_PREFIX}${META_VERSION}/${name}-${META_VERSION}.${urlExt}`;
|
const downloadURL = `${META_URL_PREFIX}/${name}-${META_VERSION}.${urlExt}`;
|
||||||
const exeFile = `${name}${isWin ? ".exe" : ""}`;
|
const exeFile = `${name}${isWin ? ".exe" : ""}`;
|
||||||
const zipFile = `${name}-${META_VERSION}.${urlExt}`; */
|
const zipFile = `${name}-${META_VERSION}.${urlExt}`;
|
||||||
const urlExt = isWin ? "zip" : "tgz";
|
|
||||||
const downloadURL = `${META_URL_PREFIX}/${name}.${urlExt}`;
|
|
||||||
const exeFile = isWin ? "虚空终端-win-amd64.exe" : name;
|
|
||||||
const zipFile = `${name}.${urlExt}`;
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name: "clash-meta",
|
name: "clash-meta",
|
||||||
@ -380,7 +393,11 @@ const resolveEnableLoopback = () =>
|
|||||||
|
|
||||||
const tasks = [
|
const tasks = [
|
||||||
// { name: "clash", func: resolveClash, retry: 5 },
|
// { name: "clash", func: resolveClash, retry: 5 },
|
||||||
{ name: "clash-meta", func: () => resolveSidecar(clashMeta()), retry: 5 },
|
{
|
||||||
|
name: "clash-meta",
|
||||||
|
func: () => getLatestVersion().then(() => resolveSidecar(clashMeta())),
|
||||||
|
retry: 5,
|
||||||
|
},
|
||||||
// { name: "wintun", func: resolveWintun, retry: 5, winOnly: true },
|
// { name: "wintun", func: resolveWintun, retry: 5, winOnly: true },
|
||||||
{ name: "service", func: resolveService, retry: 5, winOnly: true },
|
{ name: "service", func: resolveService, retry: 5, winOnly: true },
|
||||||
{ name: "install", func: resolveInstall, retry: 5, winOnly: true },
|
{ name: "install", func: resolveInstall, retry: 5, winOnly: true },
|
||||||
|
Loading…
x
Reference in New Issue
Block a user