chore: clash meta compatible and geosite.dat

This commit is contained in:
GyDi 2022-11-10 22:58:34 +08:00
parent 0cfd718d8a
commit f7500f4cad
No known key found for this signature in database
GPG Key ID: 9C3AD40F1F99880A

View File

@ -56,7 +56,7 @@ async function resolveClashMeta() {
const latestVersion = "v1.13.2";
const map = {
"win32-x64": "Clash.Meta-windows-amd64",
"win32-x64": "Clash.Meta-windows-amd64-compatible",
"darwin-x64": "Clash.Meta-darwin-amd64",
"darwin-arm64": "Clash.Meta-darwin-arm64",
"linux-x64": "Clash.Meta-linux-amd64-compatible",
@ -271,6 +271,38 @@ async function resolveMmdb() {
await downloadFile(url, resPath);
}
/**
* get the geosite.dat for meta
*/
async function resolveGeosite() {
const url =
"https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat";
const resDir = path.join(cwd, "src-tauri", "resources");
const resPath = path.join(resDir, "geosite.dat");
if (!FORCE && (await fs.pathExists(resPath))) return;
await fs.mkdirp(resDir);
await downloadFile(url, resPath);
}
/**
* get the geoip.dat for meta
*/
async function resolveGeoIP() {
const url =
"https://github.com/Loyalsoldier/geoip/releases/latest/download/geoip.dat";
const resDir = path.join(cwd, "src-tauri", "resources");
const resPath = path.join(resDir, "geoip.dat");
if (!FORCE && (await fs.pathExists(resPath))) return;
await fs.mkdirp(resDir);
await downloadFile(url, resPath);
}
/**
* download file and save to `path`
*/
@ -302,6 +334,14 @@ async function downloadFile(url, path) {
/// main
resolveSidecar().catch(console.error);
resolveWintun().catch(console.error);
resolveMmdb().catch(console.error);
resolveWintun()
.catch(console.error)
.finally(() => {
resolveService().catch(console.error);
});
resolveMmdb()
.catch(console.error)
.finally(() => {
resolveGeosite().catch(console.error);
// resolveGeoIP().catch(console.error);
});