Skip to content

Commit

Permalink
chore: clash meta compatible and geosite.dat
Browse files Browse the repository at this point in the history
  • Loading branch information
zzzgydi committed Nov 10, 2022
1 parent 0cfd718 commit f7500f4
Showing 1 changed file with 44 additions and 4 deletions.
48 changes: 44 additions & 4 deletions scripts/check.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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`
*/
Expand Down Expand Up @@ -302,6 +334,14 @@ async function downloadFile(url, path) {

/// main
resolveSidecar().catch(console.error);
resolveWintun().catch(console.error);
resolveMmdb().catch(console.error);
resolveService().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);
});

0 comments on commit f7500f4

Please sign in to comment.