editmamei 0.17.2 → 0.17.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.
Binary file
Binary file
package/dist/cli/help.js CHANGED
@@ -41,6 +41,6 @@ Examples:
41
41
  Per-user data and session logs live in ~/.editmamei/; uninstall preserves them.
42
42
 
43
43
  Docs: https://editmamei.com/docs
44
- Issues: https://github.com/editmamei/editmamei-ce/issues
44
+ Issues: https://github.com/editmamei/editmamei-wiki/issues
45
45
  `);
46
46
  }
@@ -8,7 +8,7 @@ import { EDITION } from '../edition.js';
8
8
  import { VERSION } from '../version.js';
9
9
  import { Session } from './session.js';
10
10
  import { SessionLog, classifyError } from '../utils/session-log.js';
11
- import { loadSettings } from './settings.js';
11
+ import { loadSettings, applyTelemetryEnvOverrides } from './settings.js';
12
12
  import { TelemetryClient } from '../telemetry/client.js';
13
13
  import { join, dirname } from 'node:path';
14
14
  import { pathToFileURL } from 'node:url';
@@ -55,7 +55,11 @@ export class EditmameiServer {
55
55
  this.sessionLog = new SessionLog(this.session.getSessionId());
56
56
  this.logger.info(`Session ${this.session.getSessionId()} → ${this.sessionLog.path}`);
57
57
  const { settings, created } = loadSettings();
58
- this.telemetry = new TelemetryClient({ settings, getPsVersion: () => this.psVersion });
58
+ const effectiveSettings = applyTelemetryEnvOverrides(settings);
59
+ this.telemetry = new TelemetryClient({
60
+ settings: effectiveSettings,
61
+ getPsVersion: () => this.psVersion,
62
+ });
59
63
  if (created)
60
64
  this.logger.info(FIRST_RUN_DISCLOSURE);
61
65
  warnLogScriptOnErrorOnce(this.logger);
@@ -78,6 +78,30 @@ export function loadSettings(opts = {}) {
78
78
  return { settings: defaults(mintInstallId()), created: false };
79
79
  }
80
80
  }
81
+ function parseBoolEnv(v) {
82
+ if (v === undefined)
83
+ return undefined;
84
+ const s = v.trim().toLowerCase();
85
+ if (s === 'true' || s === '1')
86
+ return true;
87
+ if (s === 'false' || s === '0')
88
+ return false;
89
+ return undefined;
90
+ }
91
+ export function applyTelemetryEnvOverrides(settings, env = process.env) {
92
+ const usage = parseBoolEnv(env.EDITMAMEI_TELEMETRY_USAGE);
93
+ const diagnostics = parseBoolEnv(env.EDITMAMEI_TELEMETRY_DIAGNOSTICS);
94
+ if (usage === undefined && diagnostics === undefined)
95
+ return settings;
96
+ return {
97
+ ...settings,
98
+ telemetry: {
99
+ ...settings.telemetry,
100
+ usage: usage ?? settings.telemetry.usage,
101
+ diagnostics: diagnostics ?? settings.telemetry.diagnostics,
102
+ },
103
+ };
104
+ }
81
105
  export function saveSettings(settings, opts = {}) {
82
106
  const path = settingsPath(opts);
83
107
  const dir = dirname(path);
@@ -1,7 +1,7 @@
1
1
  import { createPublicKey, verify } from 'node:crypto';
2
- export const MODULE_SIGNING_PUBLIC_KEYS = [
3
- 'MCowBQYDK2VwAyEA0DfcGMets2SlBofK4iFzLddKZB6mJF/E3beKFpLRN2o=',
4
- ];
2
+ export const DEV_MODULE_SIGNING_PUBLIC_KEY = 'MCowBQYDK2VwAyEA0DfcGMets2SlBofK4iFzLddKZB6mJF/E3beKFpLRN2o=';
3
+ const PROD_MODULE_SIGNING_PUBLIC_KEY = 'MCowBQYDK2VwAyEAweoGOWvtf+aukiAD0FpuECSbCdZMeFzF2XYzbFWwfwo=';
4
+ export const MODULE_SIGNING_PUBLIC_KEYS = [PROD_MODULE_SIGNING_PUBLIC_KEY];
5
5
  export function moduleSigMessage(sku, version, sha256Hex) {
6
6
  return Buffer.from(`editmamei-module-sig-v1\n${sku}\n${version}\n${sha256Hex}`, 'utf8');
7
7
  }
Binary file
@@ -1,7 +1,7 @@
1
1
  import { Logger } from '../utils/logger.js';
2
2
  import { EDITION } from '../edition.js';
3
3
  import { VERSION } from '../version.js';
4
- import { buildDiagnosticEvent, buildSessionSummary, buildUsageEvent, dayBucket, isContentSafe, PS_VERSION_UNKNOWN, } from './events.js';
4
+ import { buildDiagnosticEvent, buildSessionStart, buildSessionSummary, buildUsageEvent, dayBucket, isContentSafe, PS_VERSION_UNKNOWN, } from './events.js';
5
5
  import { sanitizeMessage, sanitizeSnippet, sanitizeStderrTail } from './sanitize.js';
6
6
  import { httpTransport, resolveEndpoint } from './transport.js';
7
7
  import { appendOutboxSync, clearOutbox, clearSessionState, readOutbox, readSessionState, writeSessionStateSync, } from './outbox.js';
@@ -55,6 +55,10 @@ export class TelemetryClient {
55
55
  return;
56
56
  this.timer = setInterval(() => void this.flush(), this.flushIntervalMs);
57
57
  this.timer.unref?.();
58
+ if (this.settings.telemetry.usage) {
59
+ this.enqueue(buildSessionStart(this.dims, this.now()));
60
+ void this.flush();
61
+ }
58
62
  }
59
63
  recordCall(call) {
60
64
  if (!this.active || !this.settings.telemetry.usage)
@@ -45,6 +45,18 @@ export function buildSessionSummary(dims, summary, now) {
45
45
  any_failures: summary.any_failures,
46
46
  };
47
47
  }
48
+ export function buildSessionStart(dims, now) {
49
+ return {
50
+ v: TELEMETRY_SCHEMA_VERSION,
51
+ type: 'session_start',
52
+ install_id: dims.install_id,
53
+ ts_bucket: dayBucket(now),
54
+ editmamei_version: dims.editmamei_version,
55
+ edition: dims.edition,
56
+ platform: dims.platform,
57
+ ps_version: psVersionOf(dims),
58
+ };
59
+ }
48
60
  export function buildDiagnosticEvent(dims, diag, now) {
49
61
  return {
50
62
  v: TELEMETRY_SCHEMA_VERSION,
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.17.2';
1
+ export const VERSION = '0.17.4';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "editmamei",
3
- "version": "0.17.2",
3
+ "version": "0.17.4",
4
4
  "description": "Editmamei — Unlock Photoshop with natural-language photo editing (Community Edition)",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -34,7 +34,7 @@
34
34
  },
35
35
  "homepage": "https://editmamei.com",
36
36
  "bugs": {
37
- "url": "https://github.com/editmamei/editmamei-ce/issues"
37
+ "url": "https://github.com/editmamei/editmamei-wiki/issues"
38
38
  },
39
39
  "engines": {
40
40
  "node": ">=20.0.0"