hinacode 0.2.0-alpha.3 → 0.2.0-alpha.4
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 +2 -1
- package/bin/hinacode.mjs +1 -1
- package/out/server/chunks/index-DvmBS5P5.js +116570 -0
- package/out/server/daemon.js +114914 -0
- package/package.json +6 -105
- package/out/main/chunks/icon-B49l-pLu.png +0 -0
- package/out/main/chunks/icon-dev-DGWXI65o.png +0 -0
- package/out/main/chunks/shellPath-zO68cje6.js +0 -51581
- package/out/main/daemon.js +0 -286
- package/out/main/index.js +0 -1183
package/out/main/index.js
DELETED
|
@@ -1,1183 +0,0 @@
|
|
|
1
|
-
import { existsSync, renameSync } from "node:fs";
|
|
2
|
-
import { join, delimiter } from "node:path";
|
|
3
|
-
import { pathToFileURL } from "node:url";
|
|
4
|
-
import { nativeImage, Menu, shell, clipboard, dialog, Notification, BrowserWindow, ipcMain, app, nativeTheme, protocol, safeStorage, powerMonitor, net, session } from "electron";
|
|
5
|
-
import { Z as TaggedError, j as String$1, _ as promise, t as tryPromise, g as gen, $ as ClientSettings, a0 as Environments, a1 as projectFileRequest, a2 as attachmentRequest, a3 as githubAssetId, a4 as externalUrl, k as andThen, p as flatMap, a5 as catch_, h as sync, a6 as catchDefect, a7 as succeed, a8 as callback, a9 as timeoutOrElse, aa as seconds, ab as EVENT_CHANNEL, ac as RPC_CHANNEL, ad as isTrustedSender, ae as route, af as map, v as void_, ag as logWarning, u as unsupported, E as Events, ah as runFork, r as repeat, a as spaced, f as forkScoped, U as Updates, s as suspend, e as effect, ai as ignore, z as hydratePath, aj as ATTACHMENT_PROTOCOL, ak as GITHUB_ASSET_PROTOCOL, al as PROJECT_FILE_PROTOCOL, am as decodeUnknownOption, an as RpcMethods, N as succeed$1, ao as Keyring, A as make$1, B as makeAppLayer, ap as isInside, aq as GitHub, ar as Files, as as BROWSER_PARTITION, at as LIQUID_GLASS_ARGUMENT, au as lockDownWebview, av as getOrUndefined, aw as isAllowedNavigation } from "./chunks/shellPath-zO68cje6.js";
|
|
6
|
-
import { execFile, spawn } from "node:child_process";
|
|
7
|
-
import { access } from "node:fs/promises";
|
|
8
|
-
import { homedir } from "node:os";
|
|
9
|
-
import { createRequire } from "node:module";
|
|
10
|
-
import { randomUUID } from "node:crypto";
|
|
11
|
-
import updater from "electron-updater";
|
|
12
|
-
import { join as join$1 } from "path";
|
|
13
|
-
import "node:stream";
|
|
14
|
-
import "node:readline";
|
|
15
|
-
import "@anthropic-ai/claude-agent-sdk";
|
|
16
|
-
import "node:util";
|
|
17
|
-
import "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
18
|
-
import "@modelcontextprotocol/sdk/types.js";
|
|
19
|
-
import "@muse-code/sdk";
|
|
20
|
-
import "node:sqlite";
|
|
21
|
-
import "node-pty";
|
|
22
|
-
import "playwright";
|
|
23
|
-
import "ws";
|
|
24
|
-
import "@noble/hashes/hmac.js";
|
|
25
|
-
import "@noble/hashes/sha2.js";
|
|
26
|
-
import "@noble/hashes/utils.js";
|
|
27
|
-
import "node:http";
|
|
28
|
-
import "node:stream/promises";
|
|
29
|
-
import "node:zlib";
|
|
30
|
-
import "node:net";
|
|
31
|
-
import "node:tls";
|
|
32
|
-
const URLPattern = {};
|
|
33
|
-
const baseLocale = "en";
|
|
34
|
-
const locales = (
|
|
35
|
-
/** @type {const} */
|
|
36
|
-
["en", "zh-TW", "ja"]
|
|
37
|
-
);
|
|
38
|
-
const strategy = [
|
|
39
|
-
"globalVariable",
|
|
40
|
-
"baseLocale"
|
|
41
|
-
];
|
|
42
|
-
const routeStrategies = [];
|
|
43
|
-
const isServer = typeof window === "undefined";
|
|
44
|
-
globalThis.__paraglide = /** @type {any} */
|
|
45
|
-
globalThis.__paraglide ?? {};
|
|
46
|
-
globalThis.__paraglide.ssr = /** @type {any} */
|
|
47
|
-
globalThis.__paraglide.ssr ?? {};
|
|
48
|
-
let _locale;
|
|
49
|
-
let localeInitiallySet = false;
|
|
50
|
-
let getLocale = () => {
|
|
51
|
-
let strategyToUse = strategy;
|
|
52
|
-
if (!isServer && typeof window !== "undefined" && window.location?.href) {
|
|
53
|
-
strategyToUse = getStrategyForUrl(window.location.href);
|
|
54
|
-
}
|
|
55
|
-
const resolved = resolveLocaleWithStrategies(strategyToUse);
|
|
56
|
-
if (resolved) {
|
|
57
|
-
if (!localeInitiallySet) {
|
|
58
|
-
_locale = resolved;
|
|
59
|
-
localeInitiallySet = true;
|
|
60
|
-
setLocale(resolved, { reload: false });
|
|
61
|
-
}
|
|
62
|
-
return resolved;
|
|
63
|
-
}
|
|
64
|
-
throw new Error("No locale found. Read the docs https://paraglidejs.com/errors#no-locale-found");
|
|
65
|
-
};
|
|
66
|
-
function resolveLocaleWithStrategies(strategyToUse, urlForUrlStrategy) {
|
|
67
|
-
let locale;
|
|
68
|
-
for (const strat of strategyToUse) {
|
|
69
|
-
if (strat === "baseLocale") {
|
|
70
|
-
locale = baseLocale;
|
|
71
|
-
} else if (strat === "globalVariable" && _locale !== void 0) {
|
|
72
|
-
locale = _locale;
|
|
73
|
-
} else if (isCustomStrategy(strat) && customClientStrategies.has(strat)) {
|
|
74
|
-
const handler = customClientStrategies.get(strat);
|
|
75
|
-
if (handler) {
|
|
76
|
-
const result = handler.getLocale();
|
|
77
|
-
if (result instanceof Promise) {
|
|
78
|
-
continue;
|
|
79
|
-
}
|
|
80
|
-
if (result !== void 0) {
|
|
81
|
-
return assertIsLocale(result);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
const matchedLocale = toLocale(locale);
|
|
86
|
-
if (matchedLocale) {
|
|
87
|
-
return matchedLocale;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
return void 0;
|
|
91
|
-
}
|
|
92
|
-
const navigateOrReload = (newLocation) => {
|
|
93
|
-
{
|
|
94
|
-
window.location.reload();
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
let setLocale = (newLocale, options) => {
|
|
98
|
-
const optionsWithDefaults = {
|
|
99
|
-
reload: true,
|
|
100
|
-
...options
|
|
101
|
-
};
|
|
102
|
-
let currentLocale;
|
|
103
|
-
try {
|
|
104
|
-
currentLocale = getLocale();
|
|
105
|
-
} catch {
|
|
106
|
-
}
|
|
107
|
-
const customSetLocalePromises = [];
|
|
108
|
-
let strategyToUse = strategy;
|
|
109
|
-
if (!isServer && typeof window !== "undefined" && window.location?.href) {
|
|
110
|
-
strategyToUse = getStrategyForUrl(window.location.href);
|
|
111
|
-
}
|
|
112
|
-
for (const strat of strategyToUse) {
|
|
113
|
-
if (strat === "globalVariable") {
|
|
114
|
-
_locale = newLocale;
|
|
115
|
-
} else if (strat === "baseLocale") {
|
|
116
|
-
continue;
|
|
117
|
-
} else if (isCustomStrategy(strat) && customClientStrategies.has(strat)) {
|
|
118
|
-
const handler = customClientStrategies.get(strat);
|
|
119
|
-
if (handler) {
|
|
120
|
-
let result = handler.setLocale(newLocale);
|
|
121
|
-
if (result instanceof Promise) {
|
|
122
|
-
result = result.catch((error) => {
|
|
123
|
-
throw new Error(`Custom strategy "${strat}" setLocale failed.`, {
|
|
124
|
-
cause: error
|
|
125
|
-
});
|
|
126
|
-
});
|
|
127
|
-
customSetLocalePromises.push(result);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
const runReload = () => {
|
|
133
|
-
if (!isServer && optionsWithDefaults.reload && window.location && newLocale !== currentLocale) {
|
|
134
|
-
navigateOrReload();
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
if (customSetLocalePromises.length) {
|
|
138
|
-
return Promise.all(customSetLocalePromises).then(() => {
|
|
139
|
-
runReload();
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
runReload();
|
|
143
|
-
return;
|
|
144
|
-
};
|
|
145
|
-
let getUrlOrigin = () => {
|
|
146
|
-
if (typeof window !== "undefined") {
|
|
147
|
-
return window.location.origin;
|
|
148
|
-
}
|
|
149
|
-
return "http://fallback.com";
|
|
150
|
-
};
|
|
151
|
-
function toLocale(value) {
|
|
152
|
-
if (typeof value !== "string") {
|
|
153
|
-
return void 0;
|
|
154
|
-
}
|
|
155
|
-
const lowerValue = value.toLowerCase();
|
|
156
|
-
for (const locale of locales) {
|
|
157
|
-
if (locale.toLowerCase() === lowerValue) {
|
|
158
|
-
return locale;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
return void 0;
|
|
162
|
-
}
|
|
163
|
-
function assertIsLocale(input) {
|
|
164
|
-
const locale = toLocale(input);
|
|
165
|
-
if (locale)
|
|
166
|
-
return locale;
|
|
167
|
-
throw new Error(`Invalid locale: ${input}. Expected one of: ${locales.join(", ")}`);
|
|
168
|
-
}
|
|
169
|
-
function normalizeTrailingSlash(url) {
|
|
170
|
-
{
|
|
171
|
-
return url;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
function getUrlPattern(pattern, url) {
|
|
175
|
-
return new URLPattern(pattern, url.href);
|
|
176
|
-
}
|
|
177
|
-
function getRoutingConfigVersion() {
|
|
178
|
-
return 0;
|
|
179
|
-
}
|
|
180
|
-
function getRouteStrategyCandidates(_url) {
|
|
181
|
-
return routeStrategies;
|
|
182
|
-
}
|
|
183
|
-
function execUrlPattern(pattern, url) {
|
|
184
|
-
{
|
|
185
|
-
return pattern.exec(url.href);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
function deLocalizeUrl(url) {
|
|
189
|
-
{
|
|
190
|
-
return deLocalizeUrlDefaultPattern(url);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
function deLocalizeUrlDefaultPattern(url) {
|
|
194
|
-
const urlObj = normalizeTrailingSlash(typeof url === "string" ? new URL(url, getUrlOrigin()) : new URL(url));
|
|
195
|
-
const pathSegments = urlObj.pathname.replace(/^\/+/, "").split("/");
|
|
196
|
-
if (pathSegments.length > 0 && toLocale(pathSegments[0])) {
|
|
197
|
-
urlObj.pathname = "/" + pathSegments.slice(1).join("/");
|
|
198
|
-
}
|
|
199
|
-
return normalizeTrailingSlash(urlObj);
|
|
200
|
-
}
|
|
201
|
-
let cachedRouteConfigVersion = -1;
|
|
202
|
-
let cachedRouteStrategyUrl;
|
|
203
|
-
let cachedRouteStrategy;
|
|
204
|
-
function findMatchingRouteStrategy(url) {
|
|
205
|
-
if (routeStrategies.length === 0) {
|
|
206
|
-
return void 0;
|
|
207
|
-
}
|
|
208
|
-
const urlString = typeof url === "string" ? url : url.href;
|
|
209
|
-
const configVersion = getRoutingConfigVersion();
|
|
210
|
-
if (cachedRouteStrategyUrl === urlString && cachedRouteConfigVersion === configVersion) {
|
|
211
|
-
return cachedRouteStrategy;
|
|
212
|
-
}
|
|
213
|
-
const publicUrl = normalizeTrailingSlash(new URL(urlString, "http://example.com"));
|
|
214
|
-
const canonicalUrl = deLocalizeUrl(publicUrl);
|
|
215
|
-
const candidateUrls = canonicalUrl.href === publicUrl.href ? [publicUrl] : [publicUrl, canonicalUrl];
|
|
216
|
-
let match;
|
|
217
|
-
for (const candidateUrl of candidateUrls) {
|
|
218
|
-
for (const routeStrategy of getRouteStrategyCandidates()) {
|
|
219
|
-
const pattern = getUrlPattern(routeStrategy.match, candidateUrl);
|
|
220
|
-
if (execUrlPattern(pattern, candidateUrl)) {
|
|
221
|
-
match = routeStrategy;
|
|
222
|
-
break;
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
if (match)
|
|
226
|
-
break;
|
|
227
|
-
}
|
|
228
|
-
cachedRouteConfigVersion = configVersion;
|
|
229
|
-
cachedRouteStrategyUrl = urlString;
|
|
230
|
-
cachedRouteStrategy = match;
|
|
231
|
-
return match;
|
|
232
|
-
}
|
|
233
|
-
function getStrategyForUrl(url) {
|
|
234
|
-
const routeStrategy = findMatchingRouteStrategy(url);
|
|
235
|
-
if (routeStrategy && routeStrategy.exclude !== true && Array.isArray(routeStrategy.strategy)) {
|
|
236
|
-
return routeStrategy.strategy;
|
|
237
|
-
}
|
|
238
|
-
return strategy;
|
|
239
|
-
}
|
|
240
|
-
const customClientStrategies = /* @__PURE__ */ new Map();
|
|
241
|
-
function isCustomStrategy(strategy2) {
|
|
242
|
-
return typeof strategy2 === "string" && /^custom-[A-Za-z0-9_-]+$/.test(strategy2);
|
|
243
|
-
}
|
|
244
|
-
const en_context_menu_copy = (
|
|
245
|
-
/** @type {(inputs: Context_Menu_CopyInputs) => LocalizedString} */
|
|
246
|
-
() => {
|
|
247
|
-
return (
|
|
248
|
-
/** @type {LocalizedString} */
|
|
249
|
-
`Copy`
|
|
250
|
-
);
|
|
251
|
-
}
|
|
252
|
-
);
|
|
253
|
-
const zh_tw2_context_menu_copy = (
|
|
254
|
-
/** @type {(inputs: Context_Menu_CopyInputs) => LocalizedString} */
|
|
255
|
-
() => {
|
|
256
|
-
return (
|
|
257
|
-
/** @type {LocalizedString} */
|
|
258
|
-
`複製`
|
|
259
|
-
);
|
|
260
|
-
}
|
|
261
|
-
);
|
|
262
|
-
const ja_context_menu_copy = (
|
|
263
|
-
/** @type {(inputs: Context_Menu_CopyInputs) => LocalizedString} */
|
|
264
|
-
() => {
|
|
265
|
-
return (
|
|
266
|
-
/** @type {LocalizedString} */
|
|
267
|
-
`コピー`
|
|
268
|
-
);
|
|
269
|
-
}
|
|
270
|
-
);
|
|
271
|
-
const context_menu_copy = (
|
|
272
|
-
/** @type {((inputs?: Context_Menu_CopyInputs, options?: { locale?: "en" | "zh-TW" | "ja" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Context_Menu_CopyInputs, { locale?: "en" | "zh-TW" | "ja" }, {}>} */
|
|
273
|
-
((inputs = {}, options = {}) => {
|
|
274
|
-
const locale = options.locale ?? getLocale();
|
|
275
|
-
if (locale === "zh-TW") return zh_tw2_context_menu_copy();
|
|
276
|
-
if (locale === "ja") return ja_context_menu_copy();
|
|
277
|
-
return en_context_menu_copy();
|
|
278
|
-
})
|
|
279
|
-
);
|
|
280
|
-
const en_context_menu_cut = (
|
|
281
|
-
/** @type {(inputs: Context_Menu_CutInputs) => LocalizedString} */
|
|
282
|
-
() => {
|
|
283
|
-
return (
|
|
284
|
-
/** @type {LocalizedString} */
|
|
285
|
-
`Cut`
|
|
286
|
-
);
|
|
287
|
-
}
|
|
288
|
-
);
|
|
289
|
-
const zh_tw2_context_menu_cut = (
|
|
290
|
-
/** @type {(inputs: Context_Menu_CutInputs) => LocalizedString} */
|
|
291
|
-
() => {
|
|
292
|
-
return (
|
|
293
|
-
/** @type {LocalizedString} */
|
|
294
|
-
`剪下`
|
|
295
|
-
);
|
|
296
|
-
}
|
|
297
|
-
);
|
|
298
|
-
const ja_context_menu_cut = (
|
|
299
|
-
/** @type {(inputs: Context_Menu_CutInputs) => LocalizedString} */
|
|
300
|
-
() => {
|
|
301
|
-
return (
|
|
302
|
-
/** @type {LocalizedString} */
|
|
303
|
-
`切り取り`
|
|
304
|
-
);
|
|
305
|
-
}
|
|
306
|
-
);
|
|
307
|
-
const context_menu_cut = (
|
|
308
|
-
/** @type {((inputs?: Context_Menu_CutInputs, options?: { locale?: "en" | "zh-TW" | "ja" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Context_Menu_CutInputs, { locale?: "en" | "zh-TW" | "ja" }, {}>} */
|
|
309
|
-
((inputs = {}, options = {}) => {
|
|
310
|
-
const locale = options.locale ?? getLocale();
|
|
311
|
-
if (locale === "zh-TW") return zh_tw2_context_menu_cut();
|
|
312
|
-
if (locale === "ja") return ja_context_menu_cut();
|
|
313
|
-
return en_context_menu_cut();
|
|
314
|
-
})
|
|
315
|
-
);
|
|
316
|
-
const en_context_menu_paste = (
|
|
317
|
-
/** @type {(inputs: Context_Menu_PasteInputs) => LocalizedString} */
|
|
318
|
-
() => {
|
|
319
|
-
return (
|
|
320
|
-
/** @type {LocalizedString} */
|
|
321
|
-
`Paste`
|
|
322
|
-
);
|
|
323
|
-
}
|
|
324
|
-
);
|
|
325
|
-
const zh_tw2_context_menu_paste = (
|
|
326
|
-
/** @type {(inputs: Context_Menu_PasteInputs) => LocalizedString} */
|
|
327
|
-
() => {
|
|
328
|
-
return (
|
|
329
|
-
/** @type {LocalizedString} */
|
|
330
|
-
`貼上`
|
|
331
|
-
);
|
|
332
|
-
}
|
|
333
|
-
);
|
|
334
|
-
const ja_context_menu_paste = (
|
|
335
|
-
/** @type {(inputs: Context_Menu_PasteInputs) => LocalizedString} */
|
|
336
|
-
() => {
|
|
337
|
-
return (
|
|
338
|
-
/** @type {LocalizedString} */
|
|
339
|
-
`貼り付け`
|
|
340
|
-
);
|
|
341
|
-
}
|
|
342
|
-
);
|
|
343
|
-
const context_menu_paste = (
|
|
344
|
-
/** @type {((inputs?: Context_Menu_PasteInputs, options?: { locale?: "en" | "zh-TW" | "ja" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Context_Menu_PasteInputs, { locale?: "en" | "zh-TW" | "ja" }, {}>} */
|
|
345
|
-
((inputs = {}, options = {}) => {
|
|
346
|
-
const locale = options.locale ?? getLocale();
|
|
347
|
-
if (locale === "zh-TW") return zh_tw2_context_menu_paste();
|
|
348
|
-
if (locale === "ja") return ja_context_menu_paste();
|
|
349
|
-
return en_context_menu_paste();
|
|
350
|
-
})
|
|
351
|
-
);
|
|
352
|
-
const en_context_menu_select_all = (
|
|
353
|
-
/** @type {(inputs: Context_Menu_Select_AllInputs) => LocalizedString} */
|
|
354
|
-
() => {
|
|
355
|
-
return (
|
|
356
|
-
/** @type {LocalizedString} */
|
|
357
|
-
`Select all`
|
|
358
|
-
);
|
|
359
|
-
}
|
|
360
|
-
);
|
|
361
|
-
const zh_tw2_context_menu_select_all = (
|
|
362
|
-
/** @type {(inputs: Context_Menu_Select_AllInputs) => LocalizedString} */
|
|
363
|
-
() => {
|
|
364
|
-
return (
|
|
365
|
-
/** @type {LocalizedString} */
|
|
366
|
-
`全選`
|
|
367
|
-
);
|
|
368
|
-
}
|
|
369
|
-
);
|
|
370
|
-
const ja_context_menu_select_all = (
|
|
371
|
-
/** @type {(inputs: Context_Menu_Select_AllInputs) => LocalizedString} */
|
|
372
|
-
() => {
|
|
373
|
-
return (
|
|
374
|
-
/** @type {LocalizedString} */
|
|
375
|
-
`すべて選択`
|
|
376
|
-
);
|
|
377
|
-
}
|
|
378
|
-
);
|
|
379
|
-
const context_menu_select_all = (
|
|
380
|
-
/** @type {((inputs?: Context_Menu_Select_AllInputs, options?: { locale?: "en" | "zh-TW" | "ja" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Context_Menu_Select_AllInputs, { locale?: "en" | "zh-TW" | "ja" }, {}>} */
|
|
381
|
-
((inputs = {}, options = {}) => {
|
|
382
|
-
const locale = options.locale ?? getLocale();
|
|
383
|
-
if (locale === "zh-TW") return zh_tw2_context_menu_select_all();
|
|
384
|
-
if (locale === "ja") return ja_context_menu_select_all();
|
|
385
|
-
return en_context_menu_select_all();
|
|
386
|
-
})
|
|
387
|
-
);
|
|
388
|
-
const en_explorer_copy_path = (
|
|
389
|
-
/** @type {(inputs: Explorer_Copy_PathInputs) => LocalizedString} */
|
|
390
|
-
() => {
|
|
391
|
-
return (
|
|
392
|
-
/** @type {LocalizedString} */
|
|
393
|
-
`Copy path`
|
|
394
|
-
);
|
|
395
|
-
}
|
|
396
|
-
);
|
|
397
|
-
const zh_tw2_explorer_copy_path = (
|
|
398
|
-
/** @type {(inputs: Explorer_Copy_PathInputs) => LocalizedString} */
|
|
399
|
-
() => {
|
|
400
|
-
return (
|
|
401
|
-
/** @type {LocalizedString} */
|
|
402
|
-
`複製路徑`
|
|
403
|
-
);
|
|
404
|
-
}
|
|
405
|
-
);
|
|
406
|
-
const ja_explorer_copy_path = (
|
|
407
|
-
/** @type {(inputs: Explorer_Copy_PathInputs) => LocalizedString} */
|
|
408
|
-
() => {
|
|
409
|
-
return (
|
|
410
|
-
/** @type {LocalizedString} */
|
|
411
|
-
`パスをコピー`
|
|
412
|
-
);
|
|
413
|
-
}
|
|
414
|
-
);
|
|
415
|
-
const explorer_copy_path = (
|
|
416
|
-
/** @type {((inputs?: Explorer_Copy_PathInputs, options?: { locale?: "en" | "zh-TW" | "ja" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Explorer_Copy_PathInputs, { locale?: "en" | "zh-TW" | "ja" }, {}>} */
|
|
417
|
-
((inputs = {}, options = {}) => {
|
|
418
|
-
const locale = options.locale ?? getLocale();
|
|
419
|
-
if (locale === "zh-TW") return zh_tw2_explorer_copy_path();
|
|
420
|
-
if (locale === "ja") return ja_explorer_copy_path();
|
|
421
|
-
return en_explorer_copy_path();
|
|
422
|
-
})
|
|
423
|
-
);
|
|
424
|
-
const en_markdown_copy_image = (
|
|
425
|
-
/** @type {(inputs: Markdown_Copy_ImageInputs) => LocalizedString} */
|
|
426
|
-
() => {
|
|
427
|
-
return (
|
|
428
|
-
/** @type {LocalizedString} */
|
|
429
|
-
`Copy image`
|
|
430
|
-
);
|
|
431
|
-
}
|
|
432
|
-
);
|
|
433
|
-
const zh_tw2_markdown_copy_image = (
|
|
434
|
-
/** @type {(inputs: Markdown_Copy_ImageInputs) => LocalizedString} */
|
|
435
|
-
() => {
|
|
436
|
-
return (
|
|
437
|
-
/** @type {LocalizedString} */
|
|
438
|
-
`複製圖片`
|
|
439
|
-
);
|
|
440
|
-
}
|
|
441
|
-
);
|
|
442
|
-
const ja_markdown_copy_image = (
|
|
443
|
-
/** @type {(inputs: Markdown_Copy_ImageInputs) => LocalizedString} */
|
|
444
|
-
() => {
|
|
445
|
-
return (
|
|
446
|
-
/** @type {LocalizedString} */
|
|
447
|
-
`画像をコピー`
|
|
448
|
-
);
|
|
449
|
-
}
|
|
450
|
-
);
|
|
451
|
-
const markdown_copy_image = (
|
|
452
|
-
/** @type {((inputs?: Markdown_Copy_ImageInputs, options?: { locale?: "en" | "zh-TW" | "ja" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Markdown_Copy_ImageInputs, { locale?: "en" | "zh-TW" | "ja" }, {}>} */
|
|
453
|
-
((inputs = {}, options = {}) => {
|
|
454
|
-
const locale = options.locale ?? getLocale();
|
|
455
|
-
if (locale === "zh-TW") return zh_tw2_markdown_copy_image();
|
|
456
|
-
if (locale === "ja") return ja_markdown_copy_image();
|
|
457
|
-
return en_markdown_copy_image();
|
|
458
|
-
})
|
|
459
|
-
);
|
|
460
|
-
const en_markdown_copy_image_address = (
|
|
461
|
-
/** @type {(inputs: Markdown_Copy_Image_AddressInputs) => LocalizedString} */
|
|
462
|
-
() => {
|
|
463
|
-
return (
|
|
464
|
-
/** @type {LocalizedString} */
|
|
465
|
-
`Copy image address`
|
|
466
|
-
);
|
|
467
|
-
}
|
|
468
|
-
);
|
|
469
|
-
const zh_tw2_markdown_copy_image_address = (
|
|
470
|
-
/** @type {(inputs: Markdown_Copy_Image_AddressInputs) => LocalizedString} */
|
|
471
|
-
() => {
|
|
472
|
-
return (
|
|
473
|
-
/** @type {LocalizedString} */
|
|
474
|
-
`複製圖片網址`
|
|
475
|
-
);
|
|
476
|
-
}
|
|
477
|
-
);
|
|
478
|
-
const ja_markdown_copy_image_address = (
|
|
479
|
-
/** @type {(inputs: Markdown_Copy_Image_AddressInputs) => LocalizedString} */
|
|
480
|
-
() => {
|
|
481
|
-
return (
|
|
482
|
-
/** @type {LocalizedString} */
|
|
483
|
-
`画像のアドレスをコピー`
|
|
484
|
-
);
|
|
485
|
-
}
|
|
486
|
-
);
|
|
487
|
-
const markdown_copy_image_address = (
|
|
488
|
-
/** @type {((inputs?: Markdown_Copy_Image_AddressInputs, options?: { locale?: "en" | "zh-TW" | "ja" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Markdown_Copy_Image_AddressInputs, { locale?: "en" | "zh-TW" | "ja" }, {}>} */
|
|
489
|
-
((inputs = {}, options = {}) => {
|
|
490
|
-
const locale = options.locale ?? getLocale();
|
|
491
|
-
if (locale === "zh-TW") return zh_tw2_markdown_copy_image_address();
|
|
492
|
-
if (locale === "ja") return ja_markdown_copy_image_address();
|
|
493
|
-
return en_markdown_copy_image_address();
|
|
494
|
-
})
|
|
495
|
-
);
|
|
496
|
-
const en_markdown_copy_link = (
|
|
497
|
-
/** @type {(inputs: Markdown_Copy_LinkInputs) => LocalizedString} */
|
|
498
|
-
() => {
|
|
499
|
-
return (
|
|
500
|
-
/** @type {LocalizedString} */
|
|
501
|
-
`Copy link`
|
|
502
|
-
);
|
|
503
|
-
}
|
|
504
|
-
);
|
|
505
|
-
const zh_tw2_markdown_copy_link = (
|
|
506
|
-
/** @type {(inputs: Markdown_Copy_LinkInputs) => LocalizedString} */
|
|
507
|
-
() => {
|
|
508
|
-
return (
|
|
509
|
-
/** @type {LocalizedString} */
|
|
510
|
-
`複製連結`
|
|
511
|
-
);
|
|
512
|
-
}
|
|
513
|
-
);
|
|
514
|
-
const ja_markdown_copy_link = (
|
|
515
|
-
/** @type {(inputs: Markdown_Copy_LinkInputs) => LocalizedString} */
|
|
516
|
-
() => {
|
|
517
|
-
return (
|
|
518
|
-
/** @type {LocalizedString} */
|
|
519
|
-
`リンクをコピー`
|
|
520
|
-
);
|
|
521
|
-
}
|
|
522
|
-
);
|
|
523
|
-
const markdown_copy_link = (
|
|
524
|
-
/** @type {((inputs?: Markdown_Copy_LinkInputs, options?: { locale?: "en" | "zh-TW" | "ja" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Markdown_Copy_LinkInputs, { locale?: "en" | "zh-TW" | "ja" }, {}>} */
|
|
525
|
-
((inputs = {}, options = {}) => {
|
|
526
|
-
const locale = options.locale ?? getLocale();
|
|
527
|
-
if (locale === "zh-TW") return zh_tw2_markdown_copy_link();
|
|
528
|
-
if (locale === "ja") return ja_markdown_copy_link();
|
|
529
|
-
return en_markdown_copy_link();
|
|
530
|
-
})
|
|
531
|
-
);
|
|
532
|
-
const en_markdown_open_link = (
|
|
533
|
-
/** @type {(inputs: Markdown_Open_LinkInputs) => LocalizedString} */
|
|
534
|
-
() => {
|
|
535
|
-
return (
|
|
536
|
-
/** @type {LocalizedString} */
|
|
537
|
-
`Open link`
|
|
538
|
-
);
|
|
539
|
-
}
|
|
540
|
-
);
|
|
541
|
-
const zh_tw2_markdown_open_link = (
|
|
542
|
-
/** @type {(inputs: Markdown_Open_LinkInputs) => LocalizedString} */
|
|
543
|
-
() => {
|
|
544
|
-
return (
|
|
545
|
-
/** @type {LocalizedString} */
|
|
546
|
-
`開啟連結`
|
|
547
|
-
);
|
|
548
|
-
}
|
|
549
|
-
);
|
|
550
|
-
const ja_markdown_open_link = (
|
|
551
|
-
/** @type {(inputs: Markdown_Open_LinkInputs) => LocalizedString} */
|
|
552
|
-
() => {
|
|
553
|
-
return (
|
|
554
|
-
/** @type {LocalizedString} */
|
|
555
|
-
`リンクを開く`
|
|
556
|
-
);
|
|
557
|
-
}
|
|
558
|
-
);
|
|
559
|
-
const markdown_open_link = (
|
|
560
|
-
/** @type {((inputs?: Markdown_Open_LinkInputs, options?: { locale?: "en" | "zh-TW" | "ja" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Markdown_Open_LinkInputs, { locale?: "en" | "zh-TW" | "ja" }, {}>} */
|
|
561
|
-
((inputs = {}, options = {}) => {
|
|
562
|
-
const locale = options.locale ?? getLocale();
|
|
563
|
-
if (locale === "zh-TW") return zh_tw2_markdown_open_link();
|
|
564
|
-
if (locale === "ja") return ja_markdown_open_link();
|
|
565
|
-
return en_markdown_open_link();
|
|
566
|
-
})
|
|
567
|
-
);
|
|
568
|
-
const en_open_with = (
|
|
569
|
-
/** @type {(inputs: Open_WithInputs) => LocalizedString} */
|
|
570
|
-
() => {
|
|
571
|
-
return (
|
|
572
|
-
/** @type {LocalizedString} */
|
|
573
|
-
`Open with`
|
|
574
|
-
);
|
|
575
|
-
}
|
|
576
|
-
);
|
|
577
|
-
const zh_tw2_open_with = (
|
|
578
|
-
/** @type {(inputs: Open_WithInputs) => LocalizedString} */
|
|
579
|
-
() => {
|
|
580
|
-
return (
|
|
581
|
-
/** @type {LocalizedString} */
|
|
582
|
-
`開啟方式`
|
|
583
|
-
);
|
|
584
|
-
}
|
|
585
|
-
);
|
|
586
|
-
const ja_open_with = (
|
|
587
|
-
/** @type {(inputs: Open_WithInputs) => LocalizedString} */
|
|
588
|
-
() => {
|
|
589
|
-
return (
|
|
590
|
-
/** @type {LocalizedString} */
|
|
591
|
-
`このアプリで開く`
|
|
592
|
-
);
|
|
593
|
-
}
|
|
594
|
-
);
|
|
595
|
-
const open_with = (
|
|
596
|
-
/** @type {((inputs?: Open_WithInputs, options?: { locale?: "en" | "zh-TW" | "ja" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Open_WithInputs, { locale?: "en" | "zh-TW" | "ja" }, {}>} */
|
|
597
|
-
((inputs = {}, options = {}) => {
|
|
598
|
-
const locale = options.locale ?? getLocale();
|
|
599
|
-
if (locale === "zh-TW") return zh_tw2_open_with();
|
|
600
|
-
if (locale === "ja") return ja_open_with();
|
|
601
|
-
return en_open_with();
|
|
602
|
-
})
|
|
603
|
-
);
|
|
604
|
-
const en_open_with_failed = (
|
|
605
|
-
/** @type {(inputs: Open_With_FailedInputs) => LocalizedString} */
|
|
606
|
-
(i) => {
|
|
607
|
-
return (
|
|
608
|
-
/** @type {LocalizedString} */
|
|
609
|
-
`Could not open in ${i?.app}: ${i?.message}`
|
|
610
|
-
);
|
|
611
|
-
}
|
|
612
|
-
);
|
|
613
|
-
const zh_tw2_open_with_failed = (
|
|
614
|
-
/** @type {(inputs: Open_With_FailedInputs) => LocalizedString} */
|
|
615
|
-
(i) => {
|
|
616
|
-
return (
|
|
617
|
-
/** @type {LocalizedString} */
|
|
618
|
-
`無法在 ${i?.app} 中開啟:${i?.message}`
|
|
619
|
-
);
|
|
620
|
-
}
|
|
621
|
-
);
|
|
622
|
-
const ja_open_with_failed = (
|
|
623
|
-
/** @type {(inputs: Open_With_FailedInputs) => LocalizedString} */
|
|
624
|
-
(i) => {
|
|
625
|
-
return (
|
|
626
|
-
/** @type {LocalizedString} */
|
|
627
|
-
`${i?.app} で開けませんでした:${i?.message}`
|
|
628
|
-
);
|
|
629
|
-
}
|
|
630
|
-
);
|
|
631
|
-
const open_with_failed = (
|
|
632
|
-
/** @type {((inputs: Open_With_FailedInputs, options?: { locale?: "en" | "zh-TW" | "ja" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Open_With_FailedInputs, { locale?: "en" | "zh-TW" | "ja" }, {}>} */
|
|
633
|
-
((inputs, options = {}) => {
|
|
634
|
-
const locale = options.locale ?? getLocale();
|
|
635
|
-
if (locale === "zh-TW") return zh_tw2_open_with_failed(inputs);
|
|
636
|
-
if (locale === "ja") return ja_open_with_failed(inputs);
|
|
637
|
-
return en_open_with_failed(inputs);
|
|
638
|
-
})
|
|
639
|
-
);
|
|
640
|
-
const en_panel_reveal = (
|
|
641
|
-
/** @type {(inputs: Panel_RevealInputs) => LocalizedString} */
|
|
642
|
-
() => {
|
|
643
|
-
return (
|
|
644
|
-
/** @type {LocalizedString} */
|
|
645
|
-
`Show in folder`
|
|
646
|
-
);
|
|
647
|
-
}
|
|
648
|
-
);
|
|
649
|
-
const zh_tw2_panel_reveal = (
|
|
650
|
-
/** @type {(inputs: Panel_RevealInputs) => LocalizedString} */
|
|
651
|
-
() => {
|
|
652
|
-
return (
|
|
653
|
-
/** @type {LocalizedString} */
|
|
654
|
-
`在資料夾中顯示`
|
|
655
|
-
);
|
|
656
|
-
}
|
|
657
|
-
);
|
|
658
|
-
const ja_panel_reveal = (
|
|
659
|
-
/** @type {(inputs: Panel_RevealInputs) => LocalizedString} */
|
|
660
|
-
() => {
|
|
661
|
-
return (
|
|
662
|
-
/** @type {LocalizedString} */
|
|
663
|
-
`フォルダを表示`
|
|
664
|
-
);
|
|
665
|
-
}
|
|
666
|
-
);
|
|
667
|
-
const panel_reveal = (
|
|
668
|
-
/** @type {((inputs?: Panel_RevealInputs, options?: { locale?: "en" | "zh-TW" | "ja" }) => LocalizedString) & import('../runtime.js').MessageMetadata<Panel_RevealInputs, { locale?: "en" | "zh-TW" | "ja" }, {}>} */
|
|
669
|
-
((inputs = {}, options = {}) => {
|
|
670
|
-
const locale = options.locale ?? getLocale();
|
|
671
|
-
if (locale === "zh-TW") return zh_tw2_panel_reveal();
|
|
672
|
-
if (locale === "ja") return ja_panel_reveal();
|
|
673
|
-
return en_panel_reveal();
|
|
674
|
-
})
|
|
675
|
-
);
|
|
676
|
-
const launchers = {
|
|
677
|
-
vscode: { name: "VS Code", bundle: "Visual Studio Code.app", cli: "code", opensFiles: true },
|
|
678
|
-
cursor: { name: "Cursor", bundle: "Cursor.app", cli: "cursor", opensFiles: true },
|
|
679
|
-
windsurf: { name: "Windsurf", bundle: "Windsurf.app", cli: "windsurf", opensFiles: true },
|
|
680
|
-
zed: { name: "Zed", bundle: "Zed.app", cli: "zed", opensFiles: true },
|
|
681
|
-
sublime: { name: "Sublime Text", bundle: "Sublime Text.app", cli: "subl", opensFiles: true },
|
|
682
|
-
xcode: { name: "Xcode", bundle: "Xcode.app", cli: null, opensFiles: true },
|
|
683
|
-
terminal: { name: "Terminal", bundle: "Utilities/Terminal.app", cli: null, opensFiles: false },
|
|
684
|
-
iterm: { name: "iTerm", bundle: "iTerm.app", cli: null, opensFiles: false },
|
|
685
|
-
ghostty: { name: "Ghostty", bundle: "Ghostty.app", cli: null, opensFiles: false },
|
|
686
|
-
warp: { name: "Warp", bundle: "Warp.app", cli: null, opensFiles: false }
|
|
687
|
-
};
|
|
688
|
-
class OpenerError extends TaggedError()("OpenerError", { message: String$1 }) {
|
|
689
|
-
}
|
|
690
|
-
const exists = (path) => access(path).then(
|
|
691
|
-
() => true,
|
|
692
|
-
() => false
|
|
693
|
-
);
|
|
694
|
-
const firstExisting = async (paths) => {
|
|
695
|
-
for (const path of paths) if (await exists(path)) return path;
|
|
696
|
-
return null;
|
|
697
|
-
};
|
|
698
|
-
const applicationDirs = ["/Applications", join(homedir(), "Applications"), "/System/Applications"];
|
|
699
|
-
const executableNames = (cli) => process.platform === "win32" ? [`${cli}.cmd`, `${cli}.exe`, cli] : [cli];
|
|
700
|
-
const locate = (launcher) => {
|
|
701
|
-
if (process.platform === "darwin") {
|
|
702
|
-
const { bundle } = launcher;
|
|
703
|
-
return bundle === null ? Promise.resolve(null) : firstExisting(applicationDirs.map((dir) => join(dir, bundle)));
|
|
704
|
-
}
|
|
705
|
-
const { cli } = launcher;
|
|
706
|
-
if (cli === null) return Promise.resolve(null);
|
|
707
|
-
const dirs = (process.env.PATH ?? "").split(delimiter).filter(Boolean);
|
|
708
|
-
return firstExisting(dirs.flatMap((dir) => executableNames(cli).map((name) => join(dir, name))));
|
|
709
|
-
};
|
|
710
|
-
const iconOf = async (location) => {
|
|
711
|
-
if (process.platform !== "darwin") return null;
|
|
712
|
-
const icon2 = await nativeImage.createThumbnailFromPath(location, { width: 64, height: 64 }).catch(() => null);
|
|
713
|
-
return icon2 === null || icon2.isEmpty() ? null : icon2.toDataURL();
|
|
714
|
-
};
|
|
715
|
-
const listOpeners = promise(async () => {
|
|
716
|
-
const entries = Object.entries(launchers);
|
|
717
|
-
const found = await Promise.all(
|
|
718
|
-
entries.map(async ([id, launcher]) => {
|
|
719
|
-
const location = await locate(launcher);
|
|
720
|
-
if (location === null) return null;
|
|
721
|
-
return { id, name: launcher.name, opensFiles: launcher.opensFiles, icon: await iconOf(location) };
|
|
722
|
-
})
|
|
723
|
-
);
|
|
724
|
-
return found.filter((opener) => opener !== null);
|
|
725
|
-
});
|
|
726
|
-
const launch = (location, path) => new Promise((resolve, reject) => {
|
|
727
|
-
if (process.platform === "darwin") {
|
|
728
|
-
execFile("open", ["-a", location, path], (error) => error ? reject(error) : resolve());
|
|
729
|
-
return;
|
|
730
|
-
}
|
|
731
|
-
const env = { ...process.env, HINACODE_INSTANCE: void 0 };
|
|
732
|
-
const child = process.platform === "win32" ? spawn(`"${location}"`, [`"${path}"`], { detached: true, stdio: "ignore", shell: true, env }) : spawn(location, [path], { detached: true, stdio: "ignore", env });
|
|
733
|
-
child.once("error", reject);
|
|
734
|
-
child.once("spawn", () => {
|
|
735
|
-
child.unref();
|
|
736
|
-
resolve();
|
|
737
|
-
});
|
|
738
|
-
});
|
|
739
|
-
const openWith = (path, id) => tryPromise({
|
|
740
|
-
try: async () => {
|
|
741
|
-
const launcher = launchers[id];
|
|
742
|
-
const location = await locate(launcher);
|
|
743
|
-
if (location === null) throw new Error(`${launcher.name} is not installed`);
|
|
744
|
-
await launch(location, path);
|
|
745
|
-
},
|
|
746
|
-
catch: (cause) => new OpenerError({ message: cause instanceof Error ? cause.message : String(cause) })
|
|
747
|
-
});
|
|
748
|
-
const imageOrigin = (src, cloudOfRoot) => {
|
|
749
|
-
const project = projectFileRequest(src);
|
|
750
|
-
if (project !== null)
|
|
751
|
-
return { kind: "file", path: join(project.root, project.path), local: cloudOfRoot(project.root) === void 0 };
|
|
752
|
-
const attachment = attachmentRequest(src);
|
|
753
|
-
if (attachment !== null) return { kind: "file", path: attachment.path, local: attachment.environment === null };
|
|
754
|
-
const asset = githubAssetId(src);
|
|
755
|
-
return { kind: "web", address: asset === null ? src : `https://github.com/user-attachments/assets/${asset}` };
|
|
756
|
-
};
|
|
757
|
-
const openerIcon = (opener) => opener.icon === null ? void 0 : nativeImage.createFromDataURL(opener.icon).resize({ width: 16, height: 16 });
|
|
758
|
-
const linkItems = ({ params, locale, appUrl: appUrl2 }) => {
|
|
759
|
-
const { linkURL } = params;
|
|
760
|
-
if (linkURL === "" || linkURL.startsWith(new URL(".", appUrl2).href)) return [];
|
|
761
|
-
const web = externalUrl(linkURL);
|
|
762
|
-
return [
|
|
763
|
-
...web === null ? [] : [{ label: markdown_open_link({}, { locale }), click: () => void shell.openExternal(web) }],
|
|
764
|
-
{ label: markdown_copy_link({}, { locale }), click: () => void clipboard.writeText(linkURL) }
|
|
765
|
-
];
|
|
766
|
-
};
|
|
767
|
-
const imageItems = ({ window: window2, params, locale, image, openers, open }) => {
|
|
768
|
-
if (image === null) return [];
|
|
769
|
-
const copy = [
|
|
770
|
-
{ label: markdown_copy_image({}, { locale }), click: () => window2.webContents.copyImageAt(params.x, params.y) },
|
|
771
|
-
image.kind === "file" ? { label: explorer_copy_path({}, { locale }), click: () => void clipboard.writeText(image.path) } : { label: markdown_copy_image_address({}, { locale }), click: () => void clipboard.writeText(image.address) }
|
|
772
|
-
];
|
|
773
|
-
if (image.kind === "web" || !image.local) return copy;
|
|
774
|
-
const { path } = image;
|
|
775
|
-
const apps = openers.map((opener) => ({
|
|
776
|
-
label: opener.name,
|
|
777
|
-
icon: openerIcon(opener),
|
|
778
|
-
click: () => open(path, opener)
|
|
779
|
-
}));
|
|
780
|
-
return [
|
|
781
|
-
...copy,
|
|
782
|
-
{ type: "separator" },
|
|
783
|
-
{
|
|
784
|
-
label: open_with({}, { locale }),
|
|
785
|
-
submenu: [
|
|
786
|
-
...apps,
|
|
787
|
-
...apps.length > 0 ? [{ type: "separator" }] : [],
|
|
788
|
-
{ label: panel_reveal({}, { locale }), click: () => shell.showItemInFolder(path) }
|
|
789
|
-
]
|
|
790
|
-
}
|
|
791
|
-
];
|
|
792
|
-
};
|
|
793
|
-
const textItems = ({ window: window2, params, locale }) => {
|
|
794
|
-
const page = window2.webContents;
|
|
795
|
-
const copy = { label: context_menu_copy({}, { locale }), click: () => page.copy() };
|
|
796
|
-
const { isEditable, editFlags, selectionText } = params;
|
|
797
|
-
if (isEditable)
|
|
798
|
-
return [
|
|
799
|
-
{ label: context_menu_cut({}, { locale }), enabled: editFlags.canCut, click: () => page.cut() },
|
|
800
|
-
{ ...copy, enabled: editFlags.canCopy },
|
|
801
|
-
{ label: context_menu_paste({}, { locale }), enabled: editFlags.canPaste, click: () => page.paste() },
|
|
802
|
-
{ type: "separator" },
|
|
803
|
-
{
|
|
804
|
-
label: context_menu_select_all({}, { locale }),
|
|
805
|
-
enabled: editFlags.canSelectAll,
|
|
806
|
-
click: () => page.selectAll()
|
|
807
|
-
}
|
|
808
|
-
];
|
|
809
|
-
return selectionText.trim() === "" ? [] : [copy];
|
|
810
|
-
};
|
|
811
|
-
const contextMenuTemplate = (context) => [linkItems(context), imageItems(context), textItems(context)].filter((section) => section.length > 0).flatMap((section, index) => index === 0 ? section : [{ type: "separator" }, ...section]);
|
|
812
|
-
const handleContextMenu = (window2, runtime, appUrl2) => window2.webContents.on("context-menu", (_event, params) => {
|
|
813
|
-
const show = gen(function* () {
|
|
814
|
-
const { locale } = yield* (yield* ClientSettings).get;
|
|
815
|
-
const environments = yield* Environments;
|
|
816
|
-
const image = params.mediaType === "image" && params.srcURL !== "" && !params.srcURL.startsWith("data:") ? imageOrigin(params.srcURL, (root) => environments.owner("root", root)) : null;
|
|
817
|
-
const openers = image?.kind === "file" && image.local ? yield* listOpeners : [];
|
|
818
|
-
const template = contextMenuTemplate({
|
|
819
|
-
window: window2,
|
|
820
|
-
params,
|
|
821
|
-
locale,
|
|
822
|
-
appUrl: appUrl2,
|
|
823
|
-
image,
|
|
824
|
-
openers: openers.filter((opener) => opener.opensFiles),
|
|
825
|
-
open: (path, opener) => void runtime.runPromise(
|
|
826
|
-
openWith(path, opener.id).pipe(
|
|
827
|
-
andThen(flatMap(ClientSettings, (settings) => settings.set({ openWith: opener.id }))),
|
|
828
|
-
catch_(
|
|
829
|
-
(error) => promise(
|
|
830
|
-
() => dialog.showMessageBox(window2, {
|
|
831
|
-
type: "error",
|
|
832
|
-
message: open_with_failed({ app: opener.name, message: error.message }, { locale })
|
|
833
|
-
})
|
|
834
|
-
)
|
|
835
|
-
)
|
|
836
|
-
)
|
|
837
|
-
)
|
|
838
|
-
});
|
|
839
|
-
if (template.length > 0) Menu.buildFromTemplate(template).popup({ window: window2 });
|
|
840
|
-
});
|
|
841
|
-
void runtime.runPromise(show).catch((cause) => console.error("context menu failed", cause));
|
|
842
|
-
});
|
|
843
|
-
const require$2 = createRequire(import.meta.url);
|
|
844
|
-
const notificationPermission = sync(() => {
|
|
845
|
-
if (process.platform !== "darwin") return "unknown";
|
|
846
|
-
const { getAuthStatus } = require$2("node-mac-permissions");
|
|
847
|
-
const status = getAuthStatus("notifications");
|
|
848
|
-
switch (status) {
|
|
849
|
-
case "authorized":
|
|
850
|
-
case "provisional":
|
|
851
|
-
return "granted";
|
|
852
|
-
case "denied":
|
|
853
|
-
case "restricted":
|
|
854
|
-
return "denied";
|
|
855
|
-
case "not determined":
|
|
856
|
-
return "notDetermined";
|
|
857
|
-
default:
|
|
858
|
-
return "unknown";
|
|
859
|
-
}
|
|
860
|
-
}).pipe(catchDefect(() => succeed("unknown")));
|
|
861
|
-
const askNotificationPermission = (title, body) => callback((resume) => {
|
|
862
|
-
const notification = new Notification({ title, body, silent: true });
|
|
863
|
-
notification.once("show", () => resume(succeed("shown")));
|
|
864
|
-
notification.once("failed", () => resume(succeed("refused")));
|
|
865
|
-
notification.show();
|
|
866
|
-
}).pipe(timeoutOrElse({ duration: seconds(10), orElse: () => succeed("noAnswer") }));
|
|
867
|
-
const bringToFront = (window2) => {
|
|
868
|
-
if (window2.isMinimized()) window2.restore();
|
|
869
|
-
window2.show();
|
|
870
|
-
app.focus({ steal: true });
|
|
871
|
-
window2.focus();
|
|
872
|
-
};
|
|
873
|
-
const showOpenDialog = (window2, options) => promise(() => window2 ? dialog.showOpenDialog(window2, options) : dialog.showOpenDialog(options));
|
|
874
|
-
const desktopCalls = (window2) => ({
|
|
875
|
-
show: sync(() => window2?.show()),
|
|
876
|
-
focus: sync(() => {
|
|
877
|
-
if (window2) bringToFront(window2);
|
|
878
|
-
}),
|
|
879
|
-
setBadgeCount: (count) => sync(() => app.setBadgeCount(count)),
|
|
880
|
-
setColorScheme: (scheme) => sync(() => {
|
|
881
|
-
nativeTheme.themeSource = scheme;
|
|
882
|
-
}),
|
|
883
|
-
reveal: (path) => sync(() => shell.showItemInFolder(path)),
|
|
884
|
-
openExternal: (url) => {
|
|
885
|
-
const allowed = externalUrl(url);
|
|
886
|
-
return allowed === null ? void_ : tryPromise(() => shell.openExternal(allowed)).pipe(
|
|
887
|
-
catch_((error) => logWarning("could not open the browser", error))
|
|
888
|
-
);
|
|
889
|
-
},
|
|
890
|
-
openers: listOpeners,
|
|
891
|
-
openWith,
|
|
892
|
-
pickFolder: map(
|
|
893
|
-
showOpenDialog(window2, { properties: ["openDirectory", "createDirectory"] }),
|
|
894
|
-
(result) => result.canceled ? null : result.filePaths[0] ?? null
|
|
895
|
-
),
|
|
896
|
-
pickFiles: map(
|
|
897
|
-
showOpenDialog(window2, { properties: ["openFile", "multiSelections"] }),
|
|
898
|
-
(result) => result.canceled ? [] : result.filePaths
|
|
899
|
-
),
|
|
900
|
-
notificationPermission,
|
|
901
|
-
askNotificationPermission,
|
|
902
|
-
screenOwner: window2?.webContents ?? null
|
|
903
|
-
});
|
|
904
|
-
const untrustedSender = {
|
|
905
|
-
error: { tag: "UntrustedSender", message: "RPC is only available to the HinaCode window" }
|
|
906
|
-
};
|
|
907
|
-
const registerIpc = (runtime, appUrl2) => {
|
|
908
|
-
ipcMain.handle(
|
|
909
|
-
RPC_CHANNEL,
|
|
910
|
-
(event, raw) => isTrustedSender(event.senderFrame, appUrl2) ? runtime.runPromise(route(raw, desktopCalls(BrowserWindow.fromWebContents(event.sender)))) : Promise.resolve(untrustedSender)
|
|
911
|
-
);
|
|
912
|
-
};
|
|
913
|
-
const sendToWindows = (encoded) => {
|
|
914
|
-
for (const window2 of BrowserWindow.getAllWindows()) window2.webContents.send(EVENT_CHANNEL, encoded);
|
|
915
|
-
};
|
|
916
|
-
const binary = join(import.meta.dirname, "../../tools/resource-monitor/bin/resource-monitor");
|
|
917
|
-
const startResourceMonitor = (userData) => {
|
|
918
|
-
if (!existsSync(binary)) return;
|
|
919
|
-
const instance = randomUUID();
|
|
920
|
-
process.env["HINACODE_INSTANCE"] = instance;
|
|
921
|
-
const log = join(userData, "resource-monitor", `${(/* @__PURE__ */ new Date()).toISOString().replaceAll(":", "-")}.ndjson`);
|
|
922
|
-
spawn(binary, ["watch", "-root", String(process.pid), "-instance", instance, "-out", log], {
|
|
923
|
-
detached: true,
|
|
924
|
-
stdio: ["ignore", "ignore", "inherit"]
|
|
925
|
-
}).on("error", (error) => console.error(`Resource monitor did not start: ${error.message}`)).unref();
|
|
926
|
-
console.log(`Resource monitor log: ${log}`);
|
|
927
|
-
};
|
|
928
|
-
const require$1 = createRequire(import.meta.url);
|
|
929
|
-
const liquidGlass = (() => {
|
|
930
|
-
if (process.platform !== "darwin") return void 0;
|
|
931
|
-
try {
|
|
932
|
-
return require$1("electron-liquid-glass");
|
|
933
|
-
} catch {
|
|
934
|
-
return void 0;
|
|
935
|
-
}
|
|
936
|
-
})();
|
|
937
|
-
const CHECK_INTERVAL = "4 hours";
|
|
938
|
-
const make = gen(function* () {
|
|
939
|
-
const current = app.getVersion();
|
|
940
|
-
if (!app.isPackaged) return unsupported(current);
|
|
941
|
-
const { autoUpdater } = updater;
|
|
942
|
-
const events = yield* Events;
|
|
943
|
-
let state = { type: "idle" };
|
|
944
|
-
const set = (next) => {
|
|
945
|
-
state = next;
|
|
946
|
-
runFork(events.publish({ type: "update.changed" }));
|
|
947
|
-
};
|
|
948
|
-
autoUpdater.autoDownload = true;
|
|
949
|
-
autoUpdater.on("checking-for-update", () => set({ type: "checking" }));
|
|
950
|
-
autoUpdater.on("update-not-available", () => set({ type: "upToDate" }));
|
|
951
|
-
autoUpdater.on("update-available", ({ version }) => set({ type: "downloading", version }));
|
|
952
|
-
autoUpdater.on("update-downloaded", ({ version }) => set({ type: "ready", version }));
|
|
953
|
-
autoUpdater.on("error", (error) => {
|
|
954
|
-
set({ type: "failed", message: error.message });
|
|
955
|
-
runFork(logWarning("update failed", error));
|
|
956
|
-
});
|
|
957
|
-
const check = suspend(
|
|
958
|
-
() => state.type === "checking" || state.type === "downloading" || state.type === "ready" ? void_ : tryPromise(() => autoUpdater.checkForUpdates()).pipe(ignore)
|
|
959
|
-
);
|
|
960
|
-
yield* repeat(check, spaced(CHECK_INTERVAL)).pipe(forkScoped);
|
|
961
|
-
return Updates.of({
|
|
962
|
-
status: sync(() => ({ current, state })),
|
|
963
|
-
check,
|
|
964
|
-
install: sync(() => autoUpdater.quitAndInstall())
|
|
965
|
-
});
|
|
966
|
-
});
|
|
967
|
-
const layer = effect(Updates, make);
|
|
968
|
-
const devIcon = join$1(import.meta.dirname, "./chunks/icon-dev-DGWXI65o.png");
|
|
969
|
-
const releaseIcon = join$1(import.meta.dirname, "./chunks/icon-B49l-pLu.png");
|
|
970
|
-
app.setName("kkcode");
|
|
971
|
-
if (process.platform === "win32") app.setAppUserModelId("app.hinacode");
|
|
972
|
-
const userDataOverride = process.env["HINACODE_USER_DATA"];
|
|
973
|
-
if (userDataOverride) app.setPath("userData", userDataOverride);
|
|
974
|
-
if (!app.isPackaged) app.commandLine.appendSwitch("use-mock-keychain");
|
|
975
|
-
if (!app.isPackaged && !userDataOverride) app.setPath("userData", join(app.getPath("appData"), "kkcode-dev"));
|
|
976
|
-
if (!app.requestSingleInstanceLock()) {
|
|
977
|
-
console.error(`HinaCode is already running on ${app.getPath("userData")}. Set HINACODE_USER_DATA to run another.`);
|
|
978
|
-
app.exit(0);
|
|
979
|
-
}
|
|
980
|
-
if (!app.isPackaged) startResourceMonitor(app.getPath("userData"));
|
|
981
|
-
const icon = app.isPackaged ? releaseIcon : devIcon;
|
|
982
|
-
const pathHydrated = hydratePath(process.env);
|
|
983
|
-
protocol.registerSchemesAsPrivileged([
|
|
984
|
-
{ scheme: ATTACHMENT_PROTOCOL, privileges: { standard: true, secure: true } },
|
|
985
|
-
// `stream` lets <video> and <audio> seek with Range requests.
|
|
986
|
-
{ scheme: GITHUB_ASSET_PROTOCOL, privileges: { standard: true, secure: true, stream: true } },
|
|
987
|
-
{ scheme: PROJECT_FILE_PROTOCOL, privileges: { standard: true, secure: true, stream: true } }
|
|
988
|
-
]);
|
|
989
|
-
const decodeCloudFile = decodeUnknownOption(RpcMethods["fs.preview"].response);
|
|
990
|
-
const fetchFromCloud = async (runtime, environment, call) => {
|
|
991
|
-
const envelope = await runtime.runPromise(
|
|
992
|
-
flatMap(Environments, (environments) => environments.forward(environment, call))
|
|
993
|
-
);
|
|
994
|
-
const file = "error" in envelope ? void 0 : getOrUndefined(decodeCloudFile(envelope.result));
|
|
995
|
-
return file === void 0 ? new Response(null, { status: 404 }) : fetch(file.dataUrl);
|
|
996
|
-
};
|
|
997
|
-
const sandboxed = (response) => {
|
|
998
|
-
const headers = new Headers(response.headers);
|
|
999
|
-
headers.set("content-security-policy", "sandbox allow-scripts");
|
|
1000
|
-
return new Response(response.body, { status: response.status, headers });
|
|
1001
|
-
};
|
|
1002
|
-
const serveAttachments = (runtime, attachmentsRoot) => protocol.handle(ATTACHMENT_PROTOCOL, async (request) => {
|
|
1003
|
-
const target = attachmentRequest(request.url);
|
|
1004
|
-
if (target === null) return new Response(null, { status: 404 });
|
|
1005
|
-
const { path, environment } = target;
|
|
1006
|
-
if (environment !== null)
|
|
1007
|
-
return fetchFromCloud(runtime, environment, { method: "attachments.read", payload: { path } });
|
|
1008
|
-
if (!isInside(attachmentsRoot, path)) return new Response(null, { status: 403 });
|
|
1009
|
-
return net.fetch(pathToFileURL(path).toString());
|
|
1010
|
-
});
|
|
1011
|
-
const rangeOf = (request) => {
|
|
1012
|
-
const range = request.headers.get("range");
|
|
1013
|
-
return range === null ? {} : { headers: { range } };
|
|
1014
|
-
};
|
|
1015
|
-
const serveGitHubAssets = (runtime) => protocol.handle(GITHUB_ASSET_PROTOCOL, async (request) => {
|
|
1016
|
-
const id = githubAssetId(request.url);
|
|
1017
|
-
if (id === null) return new Response(null, { status: 404 });
|
|
1018
|
-
const token = await runtime.runPromise(flatMap(GitHub, (github) => github.token)).catch(() => null);
|
|
1019
|
-
if (token === null) return new Response(null, { status: 401 });
|
|
1020
|
-
const redirect = await fetch(`https://github.com/user-attachments/assets/${id}`, {
|
|
1021
|
-
headers: { authorization: `Bearer ${token}` },
|
|
1022
|
-
redirect: "manual"
|
|
1023
|
-
});
|
|
1024
|
-
const signed = externalUrl(redirect.headers.get("location") ?? "");
|
|
1025
|
-
if (signed === null) return new Response(null, { status: redirect.status === 404 ? 404 : 502 });
|
|
1026
|
-
return net.fetch(signed, rangeOf(request));
|
|
1027
|
-
});
|
|
1028
|
-
const serveProjectFiles = (runtime) => protocol.handle(PROJECT_FILE_PROTOCOL, async (request) => {
|
|
1029
|
-
const target = projectFileRequest(request.url);
|
|
1030
|
-
if (target === null) return new Response(null, { status: 404 });
|
|
1031
|
-
const cloud = await runtime.runPromise(
|
|
1032
|
-
map(Environments, (environments) => environments.owner("root", target.root))
|
|
1033
|
-
);
|
|
1034
|
-
if (cloud !== void 0)
|
|
1035
|
-
return sandboxed(await fetchFromCloud(runtime, cloud, { method: "fs.preview", payload: target }));
|
|
1036
|
-
const file = await runtime.runPromise(flatMap(Files, (files) => files.resolve(target.root, target.path))).catch(() => null);
|
|
1037
|
-
if (file === null) return new Response(null, { status: 403 });
|
|
1038
|
-
return sandboxed(await net.fetch(pathToFileURL(file).toString(), rangeOf(request)));
|
|
1039
|
-
});
|
|
1040
|
-
const safeStorageKeyring = succeed$1(
|
|
1041
|
-
Keyring,
|
|
1042
|
-
Keyring.of({
|
|
1043
|
-
seal: (value) => safeStorage.isEncryptionAvailable() ? safeStorage.encryptString(value) : void 0,
|
|
1044
|
-
open: (sealed) => safeStorage.decryptString(sealed)
|
|
1045
|
-
})
|
|
1046
|
-
);
|
|
1047
|
-
const QUIT_TIMEOUT_MS = 5e3;
|
|
1048
|
-
const devRendererUrl = app.isPackaged ? void 0 : process.env["ELECTRON_RENDERER_URL"];
|
|
1049
|
-
const appUrl = devRendererUrl ?? pathToFileURL(join(import.meta.dirname, "../renderer/index.html")).href;
|
|
1050
|
-
const httpOnly = (event) => {
|
|
1051
|
-
if (!externalUrl(event.url)) event.preventDefault();
|
|
1052
|
-
};
|
|
1053
|
-
const keepOnTheWeb = (page) => {
|
|
1054
|
-
page.setWindowOpenHandler(({ url }) => {
|
|
1055
|
-
const web = externalUrl(url);
|
|
1056
|
-
if (web) void page.loadURL(web);
|
|
1057
|
-
return { action: "deny" };
|
|
1058
|
-
});
|
|
1059
|
-
page.on("will-navigate", httpOnly);
|
|
1060
|
-
page.on("will-redirect", httpOnly);
|
|
1061
|
-
};
|
|
1062
|
-
const limitBrowserPermissions = () => {
|
|
1063
|
-
const browser = session.fromPartition(BROWSER_PARTITION);
|
|
1064
|
-
browser.setPermissionRequestHandler(
|
|
1065
|
-
(_page, permission, respond) => respond(permission === "clipboard-sanitized-write")
|
|
1066
|
-
);
|
|
1067
|
-
browser.setPermissionCheckHandler((_page, permission) => permission === "clipboard-sanitized-write");
|
|
1068
|
-
};
|
|
1069
|
-
const createWindow = (runtime) => {
|
|
1070
|
-
const window2 = new BrowserWindow({
|
|
1071
|
-
width: 1280,
|
|
1072
|
-
height: 820,
|
|
1073
|
-
minWidth: 720,
|
|
1074
|
-
minHeight: 480,
|
|
1075
|
-
show: false,
|
|
1076
|
-
// The glass draws behind the web contents, so the window itself must be clear.
|
|
1077
|
-
...liquidGlass ? { transparent: true, backgroundColor: "#00000000" } : { backgroundColor: "#0a0a0a" },
|
|
1078
|
-
title: "HinaCode",
|
|
1079
|
-
icon,
|
|
1080
|
-
// The renderer draws its own title bar around the traffic lights (see TitleBar.tsx).
|
|
1081
|
-
...process.platform === "darwin" && { titleBarStyle: "hidden", trafficLightPosition: { x: 14, y: 13 } },
|
|
1082
|
-
webPreferences: {
|
|
1083
|
-
preload: join(import.meta.dirname, "../preload/index.cjs"),
|
|
1084
|
-
sandbox: true,
|
|
1085
|
-
contextIsolation: true,
|
|
1086
|
-
webviewTag: true,
|
|
1087
|
-
additionalArguments: liquidGlass ? [LIQUID_GLASS_ARGUMENT] : []
|
|
1088
|
-
}
|
|
1089
|
-
});
|
|
1090
|
-
liquidGlass?.addView(window2.getNativeWindowHandle());
|
|
1091
|
-
window2.webContents.setWindowOpenHandler(({ url }) => {
|
|
1092
|
-
const external = externalUrl(url);
|
|
1093
|
-
if (external) void shell.openExternal(external);
|
|
1094
|
-
return { action: "deny" };
|
|
1095
|
-
});
|
|
1096
|
-
const stayInApp = (event) => {
|
|
1097
|
-
if (!isAllowedNavigation(event.url, event.isMainFrame, appUrl)) event.preventDefault();
|
|
1098
|
-
};
|
|
1099
|
-
window2.webContents.on("will-frame-navigate", stayInApp);
|
|
1100
|
-
window2.webContents.on("will-redirect", stayInApp);
|
|
1101
|
-
window2.webContents.on("will-attach-webview", (event, preferences, params) => {
|
|
1102
|
-
if (!lockDownWebview(preferences, params)) event.preventDefault();
|
|
1103
|
-
});
|
|
1104
|
-
window2.webContents.on("did-attach-webview", (_event, page) => keepOnTheWeb(page));
|
|
1105
|
-
handleContextMenu(window2, runtime, appUrl);
|
|
1106
|
-
void window2.loadURL(appUrl);
|
|
1107
|
-
};
|
|
1108
|
-
const setMacMenu = () => Menu.setApplicationMenu(
|
|
1109
|
-
Menu.buildFromTemplate([
|
|
1110
|
-
{
|
|
1111
|
-
label: "HinaCode",
|
|
1112
|
-
submenu: [
|
|
1113
|
-
{ role: "about", label: "About HinaCode" },
|
|
1114
|
-
{ type: "separator" },
|
|
1115
|
-
{ role: "services" },
|
|
1116
|
-
{ type: "separator" },
|
|
1117
|
-
{ role: "hide", label: "Hide HinaCode" },
|
|
1118
|
-
{ role: "hideOthers" },
|
|
1119
|
-
{ role: "unhide" },
|
|
1120
|
-
{ type: "separator" },
|
|
1121
|
-
{ role: "quit", label: "Quit HinaCode" }
|
|
1122
|
-
]
|
|
1123
|
-
},
|
|
1124
|
-
{ role: "fileMenu" },
|
|
1125
|
-
{ role: "editMenu" },
|
|
1126
|
-
{ role: "viewMenu" },
|
|
1127
|
-
{ role: "windowMenu" }
|
|
1128
|
-
])
|
|
1129
|
-
);
|
|
1130
|
-
app.whenReady().then(async () => {
|
|
1131
|
-
await pathHydrated;
|
|
1132
|
-
const userData = app.getPath("userData");
|
|
1133
|
-
const sbxConfigPath = join(app.getPath("appData"), "sbx", "config.json");
|
|
1134
|
-
const dbPath = join(userData, "hinacode.sqlite");
|
|
1135
|
-
if (!existsSync(dbPath)) {
|
|
1136
|
-
for (const suffix of ["", "-wal", "-shm"]) {
|
|
1137
|
-
const previous = join(userData, `kkcode.sqlite${suffix}`);
|
|
1138
|
-
if (existsSync(previous)) renameSync(previous, `${dbPath}${suffix}`);
|
|
1139
|
-
}
|
|
1140
|
-
}
|
|
1141
|
-
const runtime = make$1(
|
|
1142
|
-
makeAppLayer({
|
|
1143
|
-
userData,
|
|
1144
|
-
sbxConfigPath,
|
|
1145
|
-
keyring: safeStorageKeyring,
|
|
1146
|
-
updates: layer,
|
|
1147
|
-
toWindows: sendToWindows
|
|
1148
|
-
})
|
|
1149
|
-
);
|
|
1150
|
-
await runtime.runPromise(void_);
|
|
1151
|
-
let disposed = false;
|
|
1152
|
-
app.on("before-quit", (event) => {
|
|
1153
|
-
if (disposed) return;
|
|
1154
|
-
event.preventDefault();
|
|
1155
|
-
disposed = true;
|
|
1156
|
-
const disposal = runtime.dispose().catch((cause) => console.error("runtime dispose failed", cause));
|
|
1157
|
-
const timeout = new Promise((resolve) => setTimeout(resolve, QUIT_TIMEOUT_MS));
|
|
1158
|
-
void Promise.race([disposal, timeout]).then(() => app.quit());
|
|
1159
|
-
});
|
|
1160
|
-
registerIpc(runtime, appUrl);
|
|
1161
|
-
powerMonitor.on(
|
|
1162
|
-
"resume",
|
|
1163
|
-
() => runtime.runFork(flatMap(Environments, (environments) => environments.reconnectAll))
|
|
1164
|
-
);
|
|
1165
|
-
app.dock?.setIcon(icon);
|
|
1166
|
-
if (process.platform === "darwin") setMacMenu();
|
|
1167
|
-
serveAttachments(runtime, join(userData, "attachments"));
|
|
1168
|
-
serveGitHubAssets(runtime);
|
|
1169
|
-
serveProjectFiles(runtime);
|
|
1170
|
-
limitBrowserPermissions();
|
|
1171
|
-
app.on("activate", () => {
|
|
1172
|
-
if (BrowserWindow.getAllWindows().length === 0) createWindow(runtime);
|
|
1173
|
-
});
|
|
1174
|
-
app.on("second-instance", () => {
|
|
1175
|
-
const [window2] = BrowserWindow.getAllWindows();
|
|
1176
|
-
if (window2) bringToFront(window2);
|
|
1177
|
-
else createWindow(runtime);
|
|
1178
|
-
});
|
|
1179
|
-
createWindow(runtime);
|
|
1180
|
-
});
|
|
1181
|
-
app.on("window-all-closed", () => {
|
|
1182
|
-
if (process.platform !== "darwin") app.quit();
|
|
1183
|
-
});
|