obsidian-launcher 2.1.2 → 2.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-HMKNUWAY.js → chunk-AUVMYPHG.js} +57 -57
- package/dist/{chunk-HMKNUWAY.js.map → chunk-AUVMYPHG.js.map} +1 -1
- package/dist/{chunk-Z5EOC6TG.cjs → chunk-T56PL6MR.cjs} +57 -57
- package/dist/{chunk-Z5EOC6TG.cjs.map → chunk-T56PL6MR.cjs.map} +1 -1
- package/dist/cli.cjs +4 -4
- package/dist/cli.js +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -433,6 +433,62 @@ async function extractObsidianDmg(dmg, dest) {
|
|
|
433
433
|
}
|
|
434
434
|
});
|
|
435
435
|
}
|
|
436
|
+
async function extractInstallerInfo(installerKey, url) {
|
|
437
|
+
const installerName = url.split("/").at(-1);
|
|
438
|
+
console.log(`Extrating installer info for ${installerName}...`);
|
|
439
|
+
const tmpDir = await makeTmpDir("obsidian-launcher-");
|
|
440
|
+
try {
|
|
441
|
+
const installerPath = path4.join(tmpDir, url.split("/").at(-1));
|
|
442
|
+
await downloadResponse(await fetch(url), installerPath);
|
|
443
|
+
const exractedPath = path4.join(tmpDir, "Obsidian");
|
|
444
|
+
let platforms = [];
|
|
445
|
+
if (installerKey == "appImage" || installerKey == "appImageArm") {
|
|
446
|
+
await extractObsidianAppImage(installerPath, exractedPath);
|
|
447
|
+
platforms = ["linux-" + (installerKey == "appImage" ? "x64" : "arm64")];
|
|
448
|
+
} else if (installerKey == "tar" || installerKey == "tarArm") {
|
|
449
|
+
await extractObsidianTar(installerPath, exractedPath);
|
|
450
|
+
platforms = ["linux-" + (installerKey == "tar" ? "x64" : "arm64")];
|
|
451
|
+
} else if (installerKey == "exe") {
|
|
452
|
+
await extractObsidianExe(installerPath, "x64", exractedPath);
|
|
453
|
+
const { stdout } = await sevenZ(["l", "-ba", path4.relative(tmpDir, installerPath)], { cwd: tmpDir });
|
|
454
|
+
const lines = stdout.trim().split("\n").map((l) => l.trim());
|
|
455
|
+
const files = lines.map((l) => l.split(/\s+/).at(-1).replace(/\\/g, "/"));
|
|
456
|
+
if (files.includes("$PLUGINSDIR/app-arm64.7z")) platforms.push("win32-arm64");
|
|
457
|
+
if (files.includes("$PLUGINSDIR/app-32.7z")) platforms.push("win32-ia32");
|
|
458
|
+
if (files.includes("$PLUGINSDIR/app-64.7z")) platforms.push("win32-x64");
|
|
459
|
+
} else if (installerKey == "dmg") {
|
|
460
|
+
await extractObsidianDmg(installerPath, exractedPath);
|
|
461
|
+
platforms = ["darwin-arm64", "darwin-x64"];
|
|
462
|
+
} else {
|
|
463
|
+
throw new Error(`Unknown installer key ${installerKey}`);
|
|
464
|
+
}
|
|
465
|
+
const matches = [];
|
|
466
|
+
const installerFiles = await fsAsync3.readdir(exractedPath, { recursive: true, withFileTypes: true });
|
|
467
|
+
for (const file of installerFiles) {
|
|
468
|
+
if (file.isFile() && !file.name.endsWith(".asar")) {
|
|
469
|
+
const stream = fs3.createReadStream(path4.join(file.parentPath, file.name), { encoding: "utf-8" });
|
|
470
|
+
let prev = "";
|
|
471
|
+
for await (let chunk of stream) {
|
|
472
|
+
const regex = /Chrome\/\d+\.\d+\.\d+\.\d+|Electron\/\d+\.\d+\.\d+/g;
|
|
473
|
+
chunk = prev + chunk;
|
|
474
|
+
matches.push(...[...(prev + chunk).matchAll(regex)].map((m) => m[0]));
|
|
475
|
+
prev = chunk.slice(-64);
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
const versionSortKey = (v) => v.split(".").map((s) => s.padStart(9, "0")).join(".");
|
|
480
|
+
const versions = _3(matches).map((m) => m.split("/")).groupBy(0).mapValues((ms) => ms.map((m) => m[1])).mapValues((ms) => _3.sortBy(ms, versionSortKey).at(-1)).value();
|
|
481
|
+
const electron = versions["Electron"];
|
|
482
|
+
const chrome = versions["Chrome"];
|
|
483
|
+
if (!electron || !chrome) {
|
|
484
|
+
throw new Error(`Failed to extract Electron and Chrome versions from binary ${installerPath}`);
|
|
485
|
+
}
|
|
486
|
+
console.log(`Extracted installer info for ${installerName}`);
|
|
487
|
+
return { electron, chrome, platforms };
|
|
488
|
+
} finally {
|
|
489
|
+
await fsAsync3.rm(tmpDir, { recursive: true, force: true });
|
|
490
|
+
}
|
|
491
|
+
}
|
|
436
492
|
async function fetchObsidianDesktopReleases(sinceDate, sinceSha) {
|
|
437
493
|
const repo = "obsidianmd/obsidian-releases";
|
|
438
494
|
let commitHistory = await fetchGitHubAPIPaginated(`repos/${repo}/commits`, {
|
|
@@ -582,62 +638,6 @@ function updateObsidianVersionList(args) {
|
|
|
582
638
|
}
|
|
583
639
|
return Object.values(newVersions).map(normalizeObsidianVersionInfo).sort((a, b) => semver.compare(a.version, b.version));
|
|
584
640
|
}
|
|
585
|
-
async function extractInstallerInfo(installerKey, url) {
|
|
586
|
-
const installerName = url.split("/").at(-1);
|
|
587
|
-
console.log(`Extrating installer info for ${installerName}...`);
|
|
588
|
-
const tmpDir = await makeTmpDir("obsidian-launcher-");
|
|
589
|
-
try {
|
|
590
|
-
const installerPath = path4.join(tmpDir, url.split("/").at(-1));
|
|
591
|
-
await downloadResponse(await fetch(url), installerPath);
|
|
592
|
-
const exractedPath = path4.join(tmpDir, "Obsidian");
|
|
593
|
-
let platforms = [];
|
|
594
|
-
if (installerKey == "appImage" || installerKey == "appImageArm") {
|
|
595
|
-
await extractObsidianAppImage(installerPath, exractedPath);
|
|
596
|
-
platforms = ["linux-" + (installerKey == "appImage" ? "x64" : "arm64")];
|
|
597
|
-
} else if (installerKey == "tar" || installerKey == "tarArm") {
|
|
598
|
-
await extractObsidianTar(installerPath, exractedPath);
|
|
599
|
-
platforms = ["linux-" + (installerKey == "tar" ? "x64" : "arm64")];
|
|
600
|
-
} else if (installerKey == "exe") {
|
|
601
|
-
await extractObsidianExe(installerPath, "x64", exractedPath);
|
|
602
|
-
const { stdout } = await sevenZ(["l", "-ba", path4.relative(tmpDir, installerPath)], { cwd: tmpDir });
|
|
603
|
-
const lines = stdout.trim().split("\n").map((l) => l.trim());
|
|
604
|
-
const files = lines.map((l) => l.split(/\s+/).at(-1).replace(/\\/g, "/"));
|
|
605
|
-
if (files.includes("$PLUGINSDIR/app-arm64.7z")) platforms.push("win32-arm64");
|
|
606
|
-
if (files.includes("$PLUGINSDIR/app-32.7z")) platforms.push("win32-ia32");
|
|
607
|
-
if (files.includes("$PLUGINSDIR/app-64.7z")) platforms.push("win32-x64");
|
|
608
|
-
} else if (installerKey == "dmg") {
|
|
609
|
-
await extractObsidianDmg(installerPath, exractedPath);
|
|
610
|
-
platforms = ["darwin-arm64", "darwin-x64"];
|
|
611
|
-
} else {
|
|
612
|
-
throw new Error(`Unknown installer key ${installerKey}`);
|
|
613
|
-
}
|
|
614
|
-
const matches = [];
|
|
615
|
-
const installerFiles = await fsAsync3.readdir(exractedPath, { recursive: true, withFileTypes: true });
|
|
616
|
-
for (const file of installerFiles) {
|
|
617
|
-
if (file.isFile() && !file.name.endsWith(".asar")) {
|
|
618
|
-
const stream = fs3.createReadStream(path4.join(file.parentPath, file.name), { encoding: "utf-8" });
|
|
619
|
-
let prev = "";
|
|
620
|
-
for await (let chunk of stream) {
|
|
621
|
-
const regex = /Chrome\/\d+\.\d+\.\d+\.\d+|Electron\/\d+\.\d+\.\d+/g;
|
|
622
|
-
chunk = prev + chunk;
|
|
623
|
-
matches.push(...[...(prev + chunk).matchAll(regex)].map((m) => m[0]));
|
|
624
|
-
prev = chunk.slice(-64);
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
const versionSortKey = (v) => v.split(".").map((s) => s.padStart(9, "0")).join(".");
|
|
629
|
-
const versions = _3(matches).map((m) => m.split("/")).groupBy(0).mapValues((ms) => ms.map((m) => m[1])).mapValues((ms) => _3.sortBy(ms, versionSortKey).at(-1)).value();
|
|
630
|
-
const electron = versions["Electron"];
|
|
631
|
-
const chrome = versions["Chrome"];
|
|
632
|
-
if (!electron || !chrome) {
|
|
633
|
-
throw new Error(`Failed to extract Electron and Chrome versions from binary ${installerPath}`);
|
|
634
|
-
}
|
|
635
|
-
console.log(`Extracted installer info for ${installerName}`);
|
|
636
|
-
return { electron, chrome, platforms };
|
|
637
|
-
} finally {
|
|
638
|
-
await fsAsync3.rm(tmpDir, { recursive: true, force: true });
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
641
|
function normalizeObsidianVersionInfo(versionInfo) {
|
|
642
642
|
versionInfo = _3.cloneDeep(versionInfo);
|
|
643
643
|
versionInfo.electronVersion = versionInfo.installers?.appImage?.electron;
|
|
@@ -1583,4 +1583,4 @@ export {
|
|
|
1583
1583
|
watchFiles,
|
|
1584
1584
|
ObsidianLauncher
|
|
1585
1585
|
};
|
|
1586
|
-
//# sourceMappingURL=chunk-
|
|
1586
|
+
//# sourceMappingURL=chunk-AUVMYPHG.js.map
|