@velor/remote-mouse 6.4.10 → 6.4.11

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/.env.example CHANGED
@@ -76,9 +76,6 @@ UPDATE_CHECK_COMMAND=
76
76
  # Maximum timeout for the update check command (seconds)
77
77
  UPDATE_CHECK_TIMEOUT_SEC=20
78
78
 
79
- # Update check interval (minutes)
80
- UPDATE_CHECK_INTERVAL_MIN=360
81
-
82
79
  # npm package to check (leave empty to use the local package name)
83
80
  UPDATE_CHECK_PACKAGE=
84
81
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@velor/remote-mouse",
3
- "version": "6.4.10",
3
+ "version": "6.4.11",
4
4
  "type": "module",
5
5
  "description": "Remote mouse and keyboard with mobile client",
6
6
  "homepage": "https://github.com/glennerichall/node-mouse#readme",
@@ -31,6 +31,7 @@ export const CONFIG_PATHS = [
31
31
  'samsungTv.pcInputSequence',
32
32
  'samsungTv.powerOffKey',
33
33
  'updateCheck.enabled',
34
+ 'updateCheck.intervalMin',
34
35
  'qrOverlay.enabled',
35
36
  'qrOverlay.size',
36
37
  'qrOverlay.margin',
@@ -198,6 +198,13 @@ export const CONFIG_SCHEMA = {
198
198
  label: 'Activer la verification',
199
199
  type: 'boolean',
200
200
  },
201
+ intervalMin: {
202
+ label: 'Intervalle verification (min)',
203
+ type: 'integer',
204
+ min: 1,
205
+ max: 10080,
206
+ step: 1,
207
+ },
201
208
  },
202
209
  },
203
210
  qrOverlay: {
@@ -60,7 +60,6 @@ export const DEFAULT_SYSTEM_CONFIG = {
60
60
  updateCheck: {
61
61
  checkCommand: '',
62
62
  checkTimeoutSec: 20,
63
- intervalMin: 360,
64
63
  packageName: String(packageJson.name || '').trim(),
65
64
  currentVersion: String(packageJson.version || '').trim(),
66
65
  installCommand: '',
@@ -123,6 +122,7 @@ export const DEFAULT_PERSISTED_CONFIG = {
123
122
  },
124
123
  updateCheck: {
125
124
  enabled: false,
125
+ intervalMin: 360,
126
126
  },
127
127
  qrOverlay: {
128
128
  enabled: true,
@@ -32,7 +32,6 @@ export function getEnvConfig() {
32
32
  updateCheck: {
33
33
  checkCommand: readOptionalString('UPDATE_CHECK_COMMAND'),
34
34
  checkTimeoutSec: readOptionalNumber('UPDATE_CHECK_TIMEOUT_SEC'),
35
- intervalMin: readOptionalNumber('UPDATE_CHECK_INTERVAL_MIN'),
36
35
  packageName: readOptionalString('UPDATE_CHECK_PACKAGE'),
37
36
  currentVersion: readOptionalString('UPDATE_CHECK_CURRENT_VERSION'),
38
37
  installCommand: readOptionalString('UPDATE_INSTALL_COMMAND'),
@@ -37,7 +37,7 @@ export function createTaskManager(services) {
37
37
 
38
38
  getTaskRunner().run(
39
39
  wrapTask(() => services.getUpdateManager().check()),
40
- () => getFixedDelayMs(services.getSystemConfig().updateCheck?.intervalMin || 1),
40
+ () => getFixedDelayMs(services.getConfig().updateCheck?.intervalMin || 1),
41
41
  {name: 'update-check'},
42
42
  );
43
43
 
@@ -5,16 +5,23 @@ import {createLogger} from '../../application/logger.js';
5
5
  export function chooseUpdateCheckSource({getSystemConfig}) {
6
6
  const updateConfig = getSystemConfig().updateCheck || {};
7
7
  const checkCommand = String(updateConfig.checkCommand || '').trim();
8
+ const logger = createLogger('update-check');
8
9
  const commandSource = new CommandUpdateSource({
9
10
  checkCommand,
10
11
  timeoutSec: updateConfig.checkTimeoutSec,
11
- logger: createLogger('update-check'),
12
+ logger,
12
13
  });
13
14
  const npmSource = new NpmUpdateSource({
14
15
  packageName: updateConfig.packageName,
15
16
  currentVersion: updateConfig.currentVersion,
16
17
  });
17
18
  const checkSource = checkCommand ? commandSource : npmSource;
19
+ logger.debug({
20
+ source: checkCommand ? 'command' : 'npm',
21
+ hasCheckCommand: Boolean(checkCommand),
22
+ packageName: updateConfig.packageName || '',
23
+ currentVersion: updateConfig.currentVersion || '',
24
+ }, 'Update check: source selected');
18
25
 
19
26
  return () => checkSource.check();
20
27
  }
@@ -24,7 +24,11 @@ export function createUpdateManager(services) {
24
24
  }
25
25
 
26
26
  async function check() {
27
- if (!services.getConfig().updateCheck?.enabled) {
27
+ const updateCheckEnabled = Boolean(services.getConfig().updateCheck?.enabled);
28
+ log.debug({ enabled: updateCheckEnabled, lastKey }, 'Update check: start');
29
+
30
+ if (!updateCheckEnabled) {
31
+ log.debug('Update check: skipped because disabled');
28
32
  lastResult = {
29
33
  checked: true,
30
34
  hasUpdate: false,
@@ -39,10 +43,17 @@ export function createUpdateManager(services) {
39
43
  }
40
44
 
41
45
  try {
42
- const result = await chooseUpdateCheckSource(services)();
46
+ const runCheck = chooseUpdateCheckSource(services);
47
+ log.debug('Update check: source resolved');
48
+ const result = await runCheck();
49
+ log.debug({ result }, 'Update check: source returned');
43
50
 
44
51
  if (!result?.hasUpdate || !result.key || result.key === lastKey) {
45
- log.debug('Update check: no update');
52
+ log.debug({
53
+ hasUpdate: Boolean(result?.hasUpdate),
54
+ key: result?.key || '',
55
+ duplicateKey: Boolean(result?.key && result.key === lastKey),
56
+ }, 'Update check: no update');
46
57
  lastResult = {
47
58
  checked: true,
48
59
  hasUpdate: false,
@@ -56,6 +67,7 @@ export function createUpdateManager(services) {
56
67
  }
57
68
 
58
69
  lastKey = result.key;
70
+ log.debug({ key: lastKey, ttlMs: result.ttlMs || 8000 }, 'Update check: update detected');
59
71
  lastResult = {
60
72
  checked: true,
61
73
  hasUpdate: true,
@@ -90,8 +102,10 @@ export function createUpdateManager(services) {
90
102
  async function update() {
91
103
  const install = chooseUpdateInstallSource(services);
92
104
  lastInstallCommand = String(install.command || '');
105
+ log.debug({ installCommand: lastInstallCommand }, 'Install update: source resolved');
93
106
  log.info({installCommand: lastInstallCommand}, 'Exécution commande install update');
94
107
  const result = await install();
108
+ log.debug({ result }, 'Install update: source returned');
95
109
  if (result.ok) {
96
110
  log.info('Install update terminée avec succès');
97
111
  return result;