mirror of
https://github.com/xenos1337/httptoolkit-patcher.git
synced 2026-07-15 16:20:02 +02:00
refactor(version): read LOCAL_VERSION from package.json dynamically
This commit is contained in:
@@ -8,10 +8,6 @@ import readline from "readline";
|
||||
import https from "https";
|
||||
import { fileURLToPath } from "url";
|
||||
|
||||
// Version info
|
||||
const LOCAL_VERSION = "2.0.8";
|
||||
const GITHUB_REPO = "xenos1337/httptoolkit-patcher";
|
||||
|
||||
const isWin = process.platform === "win32";
|
||||
const isMac = process.platform === "darwin";
|
||||
const isLinux = process.platform === "linux";
|
||||
@@ -27,6 +23,18 @@ const __filename = (() => {
|
||||
return fileURLToPath(import.meta.url);
|
||||
})();
|
||||
|
||||
// Version info - read from package.json
|
||||
const GITHUB_REPO = "xenos1337/httptoolkit-patcher";
|
||||
const LOCAL_VERSION = (() => {
|
||||
try {
|
||||
const packageJsonPath = path.join(path.dirname(__filename), "package.json");
|
||||
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
|
||||
return packageJson.version || "0.0.0";
|
||||
} catch {
|
||||
return "0.0.0";
|
||||
}
|
||||
})();
|
||||
|
||||
// Check if running with elevated privileges
|
||||
function isElevated() {
|
||||
if (isWin) {
|
||||
|
||||
Reference in New Issue
Block a user