@pmate/cli 0.35.4 → 0.35.6
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/index.js
CHANGED
|
@@ -17567,8 +17567,8 @@ async function buildDesktop(args) {
|
|
|
17567
17567
|
const icon = import_node_path23.default.resolve(base, c.icon);
|
|
17568
17568
|
const output = import_node_path23.default.resolve(args.outDir);
|
|
17569
17569
|
if (!(0, import_node_fs18.existsSync)(icon) || !(0, import_node_fs18.statSync)(icon).isFile()) throw new Error(`Desktop icon not found: ${icon}`);
|
|
17570
|
-
if (args.platform
|
|
17571
|
-
if (process.platform !== "darwin") throw new Error("macOS desktop packaging requires a macOS build host");
|
|
17570
|
+
if (!["mac", "win"].includes(args.platform) || !["arm64", "x64"].includes(args.arch)) throw new Error("Supported target: mac|win --arch arm64|x64");
|
|
17571
|
+
if (args.platform === "mac" && process.platform !== "darwin") throw new Error("macOS desktop packaging requires a macOS build host");
|
|
17572
17572
|
const within = (parent, child) => {
|
|
17573
17573
|
const rel = import_node_path23.default.relative(parent, child);
|
|
17574
17574
|
return !rel || !rel.startsWith("..") && !import_node_path23.default.isAbsolute(rel);
|
|
@@ -17614,12 +17614,13 @@ async function buildDesktop(args) {
|
|
|
17614
17614
|
asar: true,
|
|
17615
17615
|
artifactName: "${productName}-${version}-${arch}.${ext}",
|
|
17616
17616
|
mac: { icon, target: args.dir ? ["dir"] : ["dmg", "zip"], category: "public.app-category.social-networking", hardenedRuntime: args.signed, extendInfo: { NSMicrophoneUsageDescription: `${c.productName} uses your microphone for voice calls and voice messages.` }, ...args.signed ? {} : { identity: "-", notarize: false } },
|
|
17617
|
+
win: { icon, target: args.dir ? ["dir"] : ["nsis", "zip"], ...args.signed ? {} : { signExecutable: false } },
|
|
17617
17618
|
forceCodeSigning: args.signed
|
|
17618
17619
|
};
|
|
17619
17620
|
const configPath = import_node_path23.default.join(staging, "builder.json");
|
|
17620
17621
|
(0, import_node_fs18.writeFileSync)(configPath, JSON.stringify(builderConfig));
|
|
17621
|
-
await runBuildCommand([process.execPath, import_node_path23.default.join(cache, "node_modules", "electron-builder", "cli.js"), "--config", configPath, "--mac", `--${args.arch}`, "--publish", "never"], appDir, { ...process.env, ...args.signed ? {} : { CSC_IDENTITY_AUTO_DISCOVERY: "false" } });
|
|
17622
|
-
const result = { ...plan, signature: args.signed ? "configured-signing-required; verify notarization before distribution" : "ad-hoc; local development", artifacts: import_node_path23.default.join(staging, "artifacts"), resources: manifest };
|
|
17622
|
+
await runBuildCommand([process.execPath, import_node_path23.default.join(cache, "node_modules", "electron-builder", "cli.js"), "--config", configPath, args.platform === "mac" ? "--mac" : "--win", `--${args.arch}`, "--publish", "never"], appDir, { ...process.env, ...args.signed ? {} : { CSC_IDENTITY_AUTO_DISCOVERY: "false" } });
|
|
17623
|
+
const result = { ...plan, signature: args.signed ? args.platform === "mac" ? "configured-signing-required; verify notarization before distribution" : "configured-signing-required; verify Authenticode before distribution" : args.platform === "mac" ? "ad-hoc; local development" : "unsigned; local development", artifacts: import_node_path23.default.join(staging, "artifacts"), resources: manifest };
|
|
17623
17624
|
(0, import_node_fs18.writeFileSync)(import_node_path23.default.join(staging, "build-report.json"), JSON.stringify(result, null, 2));
|
|
17624
17625
|
console.log(JSON.stringify({ phase: "complete", report: import_node_path23.default.join(staging, "build-report.json"), artifacts: result.artifacts, signature: result.signature }, null, 2));
|
|
17625
17626
|
}
|
|
@@ -23466,9 +23467,9 @@ function parseAppArgs(tokens) {
|
|
|
23466
23467
|
} else throw new Error(`Unknown app build option: ${key}`);
|
|
23467
23468
|
}
|
|
23468
23469
|
if (options["--target"] !== "electron" || !options["--config"]) throw new Error("Use app build <ns:app> --target electron --config <file>");
|
|
23469
|
-
const platform = options["--platform"] ?? (process.platform === "darwin" ? "mac" : process.platform);
|
|
23470
|
+
const platform = options["--platform"] ?? (process.platform === "darwin" ? "mac" : process.platform === "win32" ? "win" : process.platform);
|
|
23470
23471
|
const arch = options["--arch"] ?? process.arch;
|
|
23471
|
-
if (
|
|
23472
|
+
if (!["mac", "win"].includes(platform) || !["arm64", "x64"].includes(arch)) throw new Error("Supported target: --platform mac|win --arch arm64|x64");
|
|
23472
23473
|
return { type: "app" /* App */, action, id, target: "electron", config: options["--config"], platform, arch, outDir: options["--out-dir"] ?? "release/desktop", dryRun: switches.has("--dry-run"), signed: switches.has("--signed"), dir: switches.has("--dir"), json: switches.has("--json") };
|
|
23473
23474
|
}
|
|
23474
23475
|
let baseUrl;
|
|
@@ -9,6 +9,7 @@ const { createDesktopCalls } = require('./calls.cjs')
|
|
|
9
9
|
const config = require('./desktop-config.json')
|
|
10
10
|
const manifest = require('./resource-manifest.json')
|
|
11
11
|
app.setName(config.productName)
|
|
12
|
+
if (process.platform === 'win32') app.setAppUserModelId(config.bundleId)
|
|
12
13
|
// Stable across installer versions; separate from every other packaged PMate app.
|
|
13
14
|
app.setPath('userData', path.join(app.getPath('appData'), config.bundleId))
|
|
14
15
|
const allowedNavigation = new Set([config.origin, ...config.authOrigins])
|
|
@@ -25,10 +25,11 @@ function createDesktopNotifications({ ipcMain, Notification, origin, appId, getW
|
|
|
25
25
|
if (pending.has(input.notificationId)) return pending.get(input.notificationId)
|
|
26
26
|
const window = getWindow()
|
|
27
27
|
if (input.digestThreads !== undefined) {
|
|
28
|
-
if (!Array.isArray(input.digestThreads) || !input.digestThreads.length || input.digestThreads.length > 1000 || input.digestThreads.some(item => !item || typeof item.threadId !== 'string' || !item.threadId || item.threadId.length > 512 || typeof item.title !== 'string' || item.title.length > 512 || !Number.isSafeInteger(item.count) || item.count < 1)) throw new Error('Invalid notification digest')
|
|
28
|
+
if (!Array.isArray(input.digestThreads) || !input.digestThreads.length || input.digestThreads.length > 1000 || input.digestThreads.some(item => !item || typeof item.threadId !== 'string' || !item.threadId || item.threadId.length > 512 || (item.teamId !== undefined && (typeof item.teamId !== 'string' || !item.teamId || item.teamId.length > 512)) || typeof item.title !== 'string' || item.title.length > 512 || !Number.isSafeInteger(item.count) || item.count < 1)) throw new Error('Invalid notification digest')
|
|
29
29
|
const visible = input.digestThreads.filter(item => !(item.threadId === activeThreadId && window && window.isVisible() && window.isFocused() && !window.isMinimized()))
|
|
30
30
|
if (!visible.length) return 'suppressed'
|
|
31
31
|
input = { ...input, threadId: visible.length === 1 ? visible[0].threadId : undefined,
|
|
32
|
+
teamId: visible.length === 1 ? visible[0].teamId ?? input.teamId : input.teamId,
|
|
32
33
|
body: visible.length === input.digestThreads.length ? input.body : `${visible.length} 个会话中有 ${visible.reduce((sum, item) => sum + item.count, 0)} 条新消息` }
|
|
33
34
|
}
|
|
34
35
|
if (input.threadId && input.threadId === activeThreadId && window && window.isVisible() && window.isFocused() && !window.isMinimized()) return 'suppressed'
|