obsidian-launcher 2.3.3 → 3.0.0
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/README.md +3 -15
- package/dist/{chunk-JUVVZR3O.js → chunk-PUMOW57Y.js} +3 -115
- package/dist/chunk-PUMOW57Y.js.map +1 -0
- package/dist/{chunk-2SHNCI5R.cjs → chunk-S4VCN5YI.cjs} +37 -149
- package/dist/chunk-S4VCN5YI.cjs.map +1 -0
- package/dist/cli.cjs +21 -33
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +1 -13
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +0 -27
- package/dist/index.d.ts +0 -27
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-2SHNCI5R.cjs.map +0 -1
- package/dist/chunk-JUVVZR3O.js.map +0 -1
|
@@ -22,7 +22,7 @@ async function fileExists(path6) {
|
|
|
22
22
|
await _promises2.default.stat(path6);
|
|
23
23
|
return true;
|
|
24
24
|
} catch (e) {
|
|
25
|
-
if (_optionalChain([e, 'optionalAccess',
|
|
25
|
+
if (_optionalChain([e, 'optionalAccess', _5 => _5.code]) == "ENOENT") {
|
|
26
26
|
return false;
|
|
27
27
|
}
|
|
28
28
|
throw e;
|
|
@@ -53,14 +53,14 @@ async function atomicCreate(dest, func, opts = {}) {
|
|
|
53
53
|
throw new Error(`Returned path ${result} not under scratch`);
|
|
54
54
|
}
|
|
55
55
|
if (replace) {
|
|
56
|
-
if (await _asyncOptionalChain([(await _promises2.default.stat(dest).catch(() => null)), 'optionalAccess', async
|
|
56
|
+
if (await _asyncOptionalChain([(await _promises2.default.stat(dest).catch(() => null)), 'optionalAccess', async _6 => _6.isDirectory, 'call', async _7 => _7()])) {
|
|
57
57
|
await _promises2.default.rename(dest, `${scratch}.old`);
|
|
58
58
|
}
|
|
59
59
|
await _promises2.default.rename(result, dest);
|
|
60
60
|
} else {
|
|
61
61
|
if (!await fileExists(dest)) {
|
|
62
62
|
await _promises2.default.rename(result, dest).catch((e) => {
|
|
63
|
-
if (_optionalChain([e, 'optionalAccess',
|
|
63
|
+
if (_optionalChain([e, 'optionalAccess', _8 => _8.code]) != "ENOTEMPTY") throw e;
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
66
|
}
|
|
@@ -81,10 +81,6 @@ async function linkOrCp(src, dest) {
|
|
|
81
81
|
await _promises2.default.copyFile(src, dest);
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
function pathIsUnder(parent, child) {
|
|
85
|
-
const rel = _path2.default.relative(_path2.default.resolve(parent), _path2.default.resolve(child));
|
|
86
|
-
return rel != "" && rel.split(_path2.default.sep)[0] != ".." && !_path2.default.isAbsolute(rel);
|
|
87
|
-
}
|
|
88
84
|
async function sleep(ms) {
|
|
89
85
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
90
86
|
}
|
|
@@ -250,7 +246,7 @@ async function fetchGitHubAPIPaginated(url, params = {}) {
|
|
|
250
246
|
while (next) {
|
|
251
247
|
const response = await fetchGitHubAPI(next);
|
|
252
248
|
results.push(...await response.json());
|
|
253
|
-
next = _optionalChain([parseLinkHeader, 'call',
|
|
249
|
+
next = _optionalChain([parseLinkHeader, 'call', _9 => _9(_nullishCoalesce(response.headers.get("link"), () => ( ""))), 'access', _10 => _10.next, 'optionalAccess', _11 => _11.url]);
|
|
254
250
|
}
|
|
255
251
|
return results;
|
|
256
252
|
}
|
|
@@ -275,12 +271,12 @@ async function obsidianApiLogin(opts) {
|
|
|
275
271
|
}
|
|
276
272
|
}
|
|
277
273
|
function parseSignin(r) {
|
|
278
|
-
return { token: r.token ? "token" : void 0, error: _optionalChain([r, 'access',
|
|
274
|
+
return { token: r.token ? "token" : void 0, error: _optionalChain([r, 'access', _12 => _12.error, 'optionalAccess', _13 => _13.toString, 'call', _14 => _14()]), license: r.license };
|
|
279
275
|
}
|
|
280
276
|
let needsMfa = false;
|
|
281
277
|
let retries = 0;
|
|
282
278
|
let signin = void 0;
|
|
283
|
-
while (!_optionalChain([signin, 'optionalAccess',
|
|
279
|
+
while (!_optionalChain([signin, 'optionalAccess', _15 => _15.token]) && retries < 3) {
|
|
284
280
|
if (retries > 0 || _process.env.CI) {
|
|
285
281
|
await sleep(2 * Math.random() + retries * retries * 3);
|
|
286
282
|
}
|
|
@@ -298,15 +294,15 @@ async function obsidianApiLogin(opts) {
|
|
|
298
294
|
body: JSON.stringify({ email, password, mfa })
|
|
299
295
|
}).then((r) => r.json());
|
|
300
296
|
signin = parseSignin(response);
|
|
301
|
-
const error = _optionalChain([signin, 'access',
|
|
302
|
-
if (_optionalChain([error, 'optionalAccess',
|
|
297
|
+
const error = _optionalChain([signin, 'access', _16 => _16.error, 'optionalAccess', _17 => _17.toLowerCase, 'call', _18 => _18()]);
|
|
298
|
+
if (_optionalChain([error, 'optionalAccess', _19 => _19.includes, 'call', _20 => _20("2fa")]) && !needsMfa) {
|
|
303
299
|
needsMfa = true;
|
|
304
300
|
if (!interactive) {
|
|
305
301
|
throw Error(
|
|
306
302
|
"Can't login with 2FA in a non-interactive session. To download Obsidian beta versions disable 2FA on your account" + (_process.env.CI ? "." : ` or ${predownloadMessage}`)
|
|
307
303
|
);
|
|
308
304
|
}
|
|
309
|
-
} else if (["please wait", "try again"].some((m) => _optionalChain([error, 'optionalAccess',
|
|
305
|
+
} else if (["please wait", "try again"].some((m) => _optionalChain([error, 'optionalAccess', _21 => _21.includes, 'call', _22 => _22(m)]))) {
|
|
310
306
|
consola.warn(`Obsidian login failed: ${signin.error}`);
|
|
311
307
|
consola.warn("Retrying obsidian login...");
|
|
312
308
|
retries++;
|
|
@@ -314,9 +310,9 @@ async function obsidianApiLogin(opts) {
|
|
|
314
310
|
throw Error(`Obsidian login failed: ${_nullishCoalesce(signin.error, () => ( "unknown error"))}`);
|
|
315
311
|
}
|
|
316
312
|
}
|
|
317
|
-
if (!_optionalChain([signin, 'optionalAccess',
|
|
318
|
-
throw Error(`Obsidian login failed: ${_nullishCoalesce(_optionalChain([signin, 'optionalAccess',
|
|
319
|
-
} else if (!_optionalChain([signin, 'optionalAccess',
|
|
313
|
+
if (!_optionalChain([signin, 'optionalAccess', _23 => _23.token])) {
|
|
314
|
+
throw Error(`Obsidian login failed: ${_nullishCoalesce(_optionalChain([signin, 'optionalAccess', _24 => _24.error]), () => ( "unknown error"))}`);
|
|
315
|
+
} else if (!_optionalChain([signin, 'optionalAccess', _25 => _25.license])) {
|
|
320
316
|
throw Error("Obsidian Insiders account is required to download Obsidian beta versions");
|
|
321
317
|
}
|
|
322
318
|
if (savePath && promptedCredentials) {
|
|
@@ -444,7 +440,6 @@ var ChromeLocalStorage = class {
|
|
|
444
440
|
|
|
445
441
|
|
|
446
442
|
|
|
447
|
-
|
|
448
443
|
var _util = require('util');
|
|
449
444
|
|
|
450
445
|
|
|
@@ -455,7 +450,7 @@ var _zlib = require('zlib'); var _zlib2 = _interopRequireDefault(_zlib);
|
|
|
455
450
|
var _chromeremoteinterface = require('chrome-remote-interface'); var _chromeremoteinterface2 = _interopRequireDefault(_chromeremoteinterface);
|
|
456
451
|
var execFile = _util.promisify.call(void 0, _child_process2.default.execFile);
|
|
457
452
|
function normalizeGitHubRepo(repo) {
|
|
458
|
-
return _nullishCoalesce(_optionalChain([repo, 'access',
|
|
453
|
+
return _nullishCoalesce(_optionalChain([repo, 'access', _26 => _26.match, 'call', _27 => _27(/^(https?:\/\/)?(github.com\/)?(.*?)\/?$/), 'optionalAccess', _28 => _28[3]]), () => ( repo));
|
|
459
454
|
}
|
|
460
455
|
async function extractGz(archive, dest) {
|
|
461
456
|
await _promises3.pipeline.call(void 0, _fs2.default.createReadStream(archive), _zlib2.default.createGunzip(), _fs2.default.createWriteStream(dest));
|
|
@@ -592,7 +587,7 @@ async function getCdpSession(launcher, params) {
|
|
|
592
587
|
const portPromise = new Promise((resolve, reject) => {
|
|
593
588
|
void procExit.then(() => reject(Error("Processed ended without opening a port")));
|
|
594
589
|
proc.stderr.on("data", (data) => {
|
|
595
|
-
const port2 = _optionalChain([data, 'access',
|
|
590
|
+
const port2 = _optionalChain([data, 'access', _29 => _29.toString, 'call', _30 => _30(), 'access', _31 => _31.match, 'call', _32 => _32(/ws:\/\/[\w.]+?:(\d+)/), 'optionalAccess', _33 => _33[1]]);
|
|
596
591
|
if (port2) {
|
|
597
592
|
resolve(Number(port2));
|
|
598
593
|
}
|
|
@@ -630,84 +625,6 @@ async function cdpEvaluate(client, expression) {
|
|
|
630
625
|
async function cdpEvaluateUntil(client, expression, opts) {
|
|
631
626
|
return await until(() => cdpEvaluate(client, expression), opts);
|
|
632
627
|
}
|
|
633
|
-
async function getProcesses() {
|
|
634
|
-
if (process.platform === "win32") {
|
|
635
|
-
const { stdout } = await execFile("powershell.exe", [
|
|
636
|
-
"-NoProfile",
|
|
637
|
-
"-ExecutionPolicy",
|
|
638
|
-
"Bypass",
|
|
639
|
-
"-Command",
|
|
640
|
-
"Get-CimInstance Win32_Process | Sort-Object -Property CreationDate | Select-Object ProcessId,CommandLine | ConvertTo-Json"
|
|
641
|
-
]);
|
|
642
|
-
const data = JSON.parse(stdout);
|
|
643
|
-
const list = Array.isArray(data) ? data : [data];
|
|
644
|
-
return list.map((p) => ({ pid: p.ProcessId, command: p.CommandLine || "" }));
|
|
645
|
-
} else {
|
|
646
|
-
const { stdout } = await execFile("ps", ["-xww", "-o", "lstart=,pid=,command="]);
|
|
647
|
-
const processes = stdout.split("\n").map((l) => l.trim()).filter((line) => line).map((line) => {
|
|
648
|
-
const [_5, startTime, pid, command] = line.match(/^(\w+\s+\w+\s+\d+\s+\d\d:\d\d:\d\d\s+\d\d\d\d)\s+(\d+)\s+(.*)$/);
|
|
649
|
-
return {
|
|
650
|
-
pid: Number(pid),
|
|
651
|
-
startTime: new Date(startTime).getTime(),
|
|
652
|
-
command
|
|
653
|
-
};
|
|
654
|
-
});
|
|
655
|
-
return _lodash2.default.sortBy(processes, (i) => i.startTime).map((i) => _lodash2.default.omit(i, "startTime"));
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
async function getObsidianCli(args) {
|
|
659
|
-
const clean = (s) => {
|
|
660
|
-
return s.trim().match(/^["']?(.*?)["']?$/)[1];
|
|
661
|
-
};
|
|
662
|
-
let processes = await getProcesses();
|
|
663
|
-
processes = processes.filter((p) => p.command.includes("--tag=obsidian-launcher"));
|
|
664
|
-
let obsidianInstances = [];
|
|
665
|
-
for (const proc of processes) {
|
|
666
|
-
try {
|
|
667
|
-
const match2 = proc.command.match(/(.*?) --user-data-dir=(.*?obsidian-launcher-config-.+?)( |$)/);
|
|
668
|
-
const [_5, exe, configDir] = match2.map(clean);
|
|
669
|
-
const obsidianJson = JSON.parse(await _promises2.default.readFile(_path2.default.join(configDir, "obsidian.json"), "utf-8"));
|
|
670
|
-
for (const [vaultId, vaultInfo] of Object.entries(obsidianJson.vaults)) {
|
|
671
|
-
const vaultPath = await _promises2.default.realpath(vaultInfo.path);
|
|
672
|
-
obsidianInstances.push({ pid: proc.pid, exe, configDir, vaultId, vaultPath });
|
|
673
|
-
}
|
|
674
|
-
} catch (e) {
|
|
675
|
-
console.warn(`Failed to connect to obsidian-launcher instance ${proc.pid}: ${e}`);
|
|
676
|
-
}
|
|
677
|
-
}
|
|
678
|
-
obsidianInstances = obsidianInstances.reverse();
|
|
679
|
-
let match;
|
|
680
|
-
let newArgs = [...args];
|
|
681
|
-
if (args.length > 0 && args[0].startsWith("vault=")) {
|
|
682
|
-
const vault = args[0].slice(6);
|
|
683
|
-
match = obsidianInstances.find((i) => i.vaultId == vault || _path2.default.basename(i.vaultPath).toUpperCase() == vault.toUpperCase());
|
|
684
|
-
if (!match) {
|
|
685
|
-
const systemTmpDir = await _promises2.default.realpath(_os2.default.tmpdir());
|
|
686
|
-
match = obsidianInstances.find((i) => pathIsUnder(systemTmpDir, i.vaultPath) && _optionalChain([_path2.default, 'access', _35 => _35.basename, 'call', _36 => _36(i.vaultPath), 'access', _37 => _37.toUpperCase, 'call', _38 => _38(), 'access', _39 => _39.match, 'call', _40 => _40(/(.*)-.{6}/), 'optionalAccess', _41 => _41[1]]) == vault.toUpperCase());
|
|
687
|
-
}
|
|
688
|
-
if (!match) {
|
|
689
|
-
throw Error(`No running Obsidian instance for ${vault}`);
|
|
690
|
-
}
|
|
691
|
-
newArgs = args.slice(1);
|
|
692
|
-
}
|
|
693
|
-
if (!match) {
|
|
694
|
-
const cwd = await _promises2.default.realpath(process.cwd()).catch(() => process.cwd());
|
|
695
|
-
match = obsidianInstances.find((i) => cwd == i.vaultPath || pathIsUnder(i.vaultPath, cwd));
|
|
696
|
-
}
|
|
697
|
-
if (!match) {
|
|
698
|
-
match = obsidianInstances.at(0);
|
|
699
|
-
}
|
|
700
|
-
if (!match) {
|
|
701
|
-
throw Error(`No running Obsidian instance`);
|
|
702
|
-
}
|
|
703
|
-
newArgs = [
|
|
704
|
-
`vault=${match.vaultId}`,
|
|
705
|
-
...newArgs,
|
|
706
|
-
`--user-data-dir=${match.configDir}`,
|
|
707
|
-
...process.platform == "linux" ? ["--no-sandbox"] : []
|
|
708
|
-
];
|
|
709
|
-
return [match.exe, newArgs];
|
|
710
|
-
}
|
|
711
628
|
async function fetchObsidianDesktopReleases(sinceDate, sinceSha) {
|
|
712
629
|
const repo = "obsidianmd/obsidian-releases";
|
|
713
630
|
let commitHistory = await fetchGitHubAPIPaginated(`repos/${repo}/commits`, {
|
|
@@ -723,8 +640,8 @@ async function fetchObsidianDesktopReleases(sinceDate, sinceSha) {
|
|
|
723
640
|
commitHistory,
|
|
724
641
|
(commit) => fetch(`https://raw.githubusercontent.com/${repo}/${commit.sha}/desktop-releases.json`).then((r) => r.json())
|
|
725
642
|
);
|
|
726
|
-
const commitDate = _nullishCoalesce(_optionalChain([commitHistory, 'access',
|
|
727
|
-
const commitSha = _nullishCoalesce(_optionalChain([commitHistory, 'access',
|
|
643
|
+
const commitDate = _nullishCoalesce(_optionalChain([commitHistory, 'access', _34 => _34.at, 'call', _35 => _35(-1), 'optionalAccess', _36 => _36.commit, 'access', _37 => _37.committer, 'access', _38 => _38.date]), () => ( sinceDate));
|
|
644
|
+
const commitSha = _nullishCoalesce(_optionalChain([commitHistory, 'access', _39 => _39.at, 'call', _40 => _40(-1), 'optionalAccess', _41 => _41.sha]), () => ( sinceSha));
|
|
728
645
|
return [fileHistory, { commitDate, commitSha }];
|
|
729
646
|
}
|
|
730
647
|
async function fetchObsidianGitHubReleases() {
|
|
@@ -775,14 +692,14 @@ function parseObsidianGithubRelease(gitHubRelease) {
|
|
|
775
692
|
version,
|
|
776
693
|
gitHubRelease: gitHubRelease.html_url,
|
|
777
694
|
downloads: {
|
|
778
|
-
asar: _optionalChain([asar, 'optionalAccess',
|
|
779
|
-
appImage: _optionalChain([appImage, 'optionalAccess',
|
|
780
|
-
appImageArm: _optionalChain([appImageArm, 'optionalAccess',
|
|
781
|
-
tar: _optionalChain([tar, 'optionalAccess',
|
|
782
|
-
tarArm: _optionalChain([tarArm, 'optionalAccess',
|
|
783
|
-
dmg: _optionalChain([dmg, 'optionalAccess',
|
|
784
|
-
exe: _optionalChain([exe, 'optionalAccess',
|
|
785
|
-
apk: _optionalChain([apk, 'optionalAccess',
|
|
695
|
+
asar: _optionalChain([asar, 'optionalAccess', _42 => _42.url]),
|
|
696
|
+
appImage: _optionalChain([appImage, 'optionalAccess', _43 => _43.url]),
|
|
697
|
+
appImageArm: _optionalChain([appImageArm, 'optionalAccess', _44 => _44.url]),
|
|
698
|
+
tar: _optionalChain([tar, 'optionalAccess', _45 => _45.url]),
|
|
699
|
+
tarArm: _optionalChain([tarArm, 'optionalAccess', _46 => _46.url]),
|
|
700
|
+
dmg: _optionalChain([dmg, 'optionalAccess', _47 => _47.url]),
|
|
701
|
+
exe: _optionalChain([exe, 'optionalAccess', _48 => _48.url]),
|
|
702
|
+
apk: _optionalChain([apk, 'optionalAccess', _49 => _49.url])
|
|
786
703
|
},
|
|
787
704
|
installers: {
|
|
788
705
|
appImage: appImage ? { digest: appImage.digest } : void 0,
|
|
@@ -980,8 +897,8 @@ async function getCompatibilityInfos(versions, { _checkCompatibility = checkComp
|
|
|
980
897
|
}
|
|
981
898
|
function normalizeObsidianVersionInfo(versionInfo) {
|
|
982
899
|
versionInfo = _lodash2.default.cloneDeep(versionInfo);
|
|
983
|
-
versionInfo.electronVersion = _optionalChain([versionInfo, 'access',
|
|
984
|
-
versionInfo.chromeVersion = _optionalChain([versionInfo, 'access',
|
|
900
|
+
versionInfo.electronVersion = _optionalChain([versionInfo, 'access', _50 => _50.installers, 'optionalAccess', _51 => _51.appImage, 'optionalAccess', _52 => _52.electron]);
|
|
901
|
+
versionInfo.chromeVersion = _optionalChain([versionInfo, 'access', _53 => _53.installers, 'optionalAccess', _54 => _54.appImage, 'optionalAccess', _55 => _55.chrome]);
|
|
985
902
|
versionInfo.downloads = _nullishCoalesce(versionInfo.downloads, () => ( {}));
|
|
986
903
|
versionInfo.installers = _nullishCoalesce(versionInfo.installers, () => ( {}));
|
|
987
904
|
const canonicalForm = {
|
|
@@ -1020,11 +937,11 @@ async function updateObsidianVersionList(original, {
|
|
|
1020
937
|
_extractInstallerInfo = extractInstallerInfo,
|
|
1021
938
|
_checkCompatibility = checkCompatibility
|
|
1022
939
|
} = {}) {
|
|
1023
|
-
const oldVersions = _lodash2.default.keyBy(_nullishCoalesce(_optionalChain([original, 'optionalAccess',
|
|
940
|
+
const oldVersions = _lodash2.default.keyBy(_nullishCoalesce(_optionalChain([original, 'optionalAccess', _56 => _56.versions]), () => ( [])), (v) => v.version);
|
|
1024
941
|
let newVersions = _lodash2.default.cloneDeep(oldVersions);
|
|
1025
942
|
const [destkopReleases, commitInfo] = await _fetchObsidianDesktopReleases(
|
|
1026
|
-
_optionalChain([original, 'optionalAccess',
|
|
1027
|
-
_optionalChain([original, 'optionalAccess',
|
|
943
|
+
_optionalChain([original, 'optionalAccess', _57 => _57.metadata, 'access', _58 => _58.commitDate]),
|
|
944
|
+
_optionalChain([original, 'optionalAccess', _59 => _59.metadata, 'access', _60 => _60.commitSha])
|
|
1028
945
|
);
|
|
1029
946
|
for (const destkopRelease of destkopReleases) {
|
|
1030
947
|
const { current, beta } = parseObsidianDesktopRelease(destkopRelease);
|
|
@@ -1039,8 +956,8 @@ async function updateObsidianVersionList(original, {
|
|
|
1039
956
|
const parsed = parseObsidianGithubRelease(githubRelease);
|
|
1040
957
|
const newVersion = _lodash2.default.merge(_nullishCoalesce(newVersions[parsed.version], () => ( {})), parsed);
|
|
1041
958
|
for (const installerKey of INSTALLER_KEYS) {
|
|
1042
|
-
const oldDigest = _optionalChain([oldVersions, 'access',
|
|
1043
|
-
const newDigest = _optionalChain([newVersion, 'access',
|
|
959
|
+
const oldDigest = _optionalChain([oldVersions, 'access', _61 => _61[parsed.version], 'optionalAccess', _62 => _62.installers, 'access', _63 => _63[installerKey], 'optionalAccess', _64 => _64.digest]);
|
|
960
|
+
const newDigest = _optionalChain([newVersion, 'access', _65 => _65.installers, 'optionalAccess', _66 => _66[installerKey], 'optionalAccess', _67 => _67.digest]);
|
|
1044
961
|
if (oldDigest && oldDigest != newDigest) {
|
|
1045
962
|
newVersion.installers[installerKey] = { digest: newDigest };
|
|
1046
963
|
}
|
|
@@ -1049,7 +966,7 @@ async function updateObsidianVersionList(original, {
|
|
|
1049
966
|
}
|
|
1050
967
|
}
|
|
1051
968
|
newVersions = _lodash2.default.omitBy(newVersions, (v) => BROKEN_VERSIONS.includes(v.version));
|
|
1052
|
-
const newInstallers = Object.values(newVersions).flatMap((v) => INSTALLER_KEYS.map((k) => [v, k])).filter(([v, key]) => _optionalChain([v, 'access',
|
|
969
|
+
const newInstallers = Object.values(newVersions).flatMap((v) => INSTALLER_KEYS.map((k) => [v, k])).filter(([v, key]) => _optionalChain([v, 'access', _68 => _68.downloads, 'optionalAccess', _69 => _69[key]]) && !_optionalChain([v, 'access', _70 => _70.installers, 'optionalAccess', _71 => _71[key], 'optionalAccess', _72 => _72.chrome]));
|
|
1053
970
|
const installerInfos = await pool(maxInstances, newInstallers, async ([v, key]) => {
|
|
1054
971
|
const installerInfo = await _extractInstallerInfo(v.version, key, v.downloads[key]);
|
|
1055
972
|
return { version: v.version, installers: { [key]: installerInfo } };
|
|
@@ -1069,13 +986,13 @@ async function updateObsidianVersionList(original, {
|
|
|
1069
986
|
schemaVersion: obsidianVersionsSchemaVersion,
|
|
1070
987
|
commitDate: commitInfo.commitDate,
|
|
1071
988
|
commitSha: commitInfo.commitSha,
|
|
1072
|
-
timestamp: _nullishCoalesce(_optionalChain([original, 'optionalAccess',
|
|
989
|
+
timestamp: _nullishCoalesce(_optionalChain([original, 'optionalAccess', _73 => _73.metadata, 'access', _74 => _74.timestamp]), () => ( ""))
|
|
1073
990
|
// set down below
|
|
1074
991
|
},
|
|
1075
992
|
versions: Object.values(newVersions).map(normalizeObsidianVersionInfo).sort((a, b) => _semver2.default.compare(a.version, b.version))
|
|
1076
993
|
};
|
|
1077
994
|
const dayMs = 24 * 60 * 60 * 1e3;
|
|
1078
|
-
const timeSinceLastUpdate = (/* @__PURE__ */ new Date()).getTime() - new Date(_nullishCoalesce(_optionalChain([original, 'optionalAccess',
|
|
995
|
+
const timeSinceLastUpdate = (/* @__PURE__ */ new Date()).getTime() - new Date(_nullishCoalesce(_optionalChain([original, 'optionalAccess', _75 => _75.metadata, 'access', _76 => _76.timestamp]), () => ( 0))).getTime();
|
|
1079
996
|
if (!_lodash2.default.isEqual(original, result) || timeSinceLastUpdate > 29 * dayMs) {
|
|
1080
997
|
result.metadata.timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
1081
998
|
}
|
|
@@ -1124,7 +1041,7 @@ var ObsidianLauncher = class {
|
|
|
1124
1041
|
if (!(dest in this.metadataCache)) {
|
|
1125
1042
|
let data;
|
|
1126
1043
|
let error;
|
|
1127
|
-
const cacheMtime = await _asyncOptionalChain([(await _promises2.default.stat(dest).catch(() => void 0)), 'optionalAccess', async
|
|
1044
|
+
const cacheMtime = await _asyncOptionalChain([(await _promises2.default.stat(dest).catch(() => void 0)), 'optionalAccess', async _77 => _77.mtime]);
|
|
1128
1045
|
if (url.startsWith("file:")) {
|
|
1129
1046
|
data = JSON.parse(await _promises2.default.readFile(_url.fileURLToPath.call(void 0, url), "utf-8"));
|
|
1130
1047
|
}
|
|
@@ -1274,7 +1191,7 @@ var ObsidianLauncher = class {
|
|
|
1274
1191
|
appVersion = versions.filter((v) => !v.isBeta).at(-1).version;
|
|
1275
1192
|
} else if (appVersion == "earliest") {
|
|
1276
1193
|
const manifest = await this.getRootManifest();
|
|
1277
|
-
if (!_optionalChain([manifest, 'optionalAccess',
|
|
1194
|
+
if (!_optionalChain([manifest, 'optionalAccess', _78 => _78.minAppVersion])) {
|
|
1278
1195
|
throw Error('Unable to resolve Obsidian appVersion "earliest", no manifest.json or minAppVersion found.');
|
|
1279
1196
|
}
|
|
1280
1197
|
appVersion = manifest.minAppVersion;
|
|
@@ -1980,35 +1897,6 @@ var ObsidianLauncher = class {
|
|
|
1980
1897
|
return true;
|
|
1981
1898
|
}
|
|
1982
1899
|
}
|
|
1983
|
-
/**
|
|
1984
|
-
* Return the command needed to run the Obsidian CLI.
|
|
1985
|
-
*
|
|
1986
|
-
* As obsidian-launcher sandboxes the config dir for each Obsidian instance, the Obsidian CLI won't connect to the
|
|
1987
|
-
* launched instances by default. This method takes Obsidian CLI args, and then returns an [executable, args] tuple
|
|
1988
|
-
* that can be used to launch the Obsidian CLI against the sandboxed instances.
|
|
1989
|
-
*
|
|
1990
|
-
* Like the regular Obsidian CLI, it will connect to the instance matching the `vault=` argument if present, or
|
|
1991
|
-
* the cwd.
|
|
1992
|
-
*
|
|
1993
|
-
* Just pass the result to child_process.spawn or child_process.execFile to run the command.
|
|
1994
|
-
*
|
|
1995
|
-
* Example:
|
|
1996
|
-
* ```js
|
|
1997
|
-
* import child_process from "child_process";
|
|
1998
|
-
* import util from "util";
|
|
1999
|
-
* const execFile = util.promisify(child_process.execFile);
|
|
2000
|
-
* const [executable, args] = await launcher.getObsidianCli(["file", "file=Dashboard"]);
|
|
2001
|
-
* const {stdout, stderr} = await execFile(executable, args);
|
|
2002
|
-
* ```
|
|
2003
|
-
*
|
|
2004
|
-
* The Obsidian CLI only works on Obsidian >=1.12.0 with installer >=1.11.7.
|
|
2005
|
-
* See https://help.obsidian.md/cli
|
|
2006
|
-
*
|
|
2007
|
-
* @returns [executable, args] tuple
|
|
2008
|
-
*/
|
|
2009
|
-
async getObsidianCli(args) {
|
|
2010
|
-
return await getObsidianCli(args);
|
|
2011
|
-
}
|
|
2012
1900
|
};
|
|
2013
1901
|
|
|
2014
1902
|
|
|
@@ -2017,4 +1905,4 @@ var ObsidianLauncher = class {
|
|
|
2017
1905
|
|
|
2018
1906
|
|
|
2019
1907
|
exports.consola = consola; exports.watchFiles = watchFiles; exports.minSupportedObsidianVersion = minSupportedObsidianVersion; exports.ObsidianLauncher = ObsidianLauncher;
|
|
2020
|
-
//# sourceMappingURL=chunk-
|
|
1908
|
+
//# sourceMappingURL=chunk-S4VCN5YI.cjs.map
|