@velor/remote-mouse 6.4.10 → 6.5.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/.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/README.md CHANGED
@@ -305,6 +305,7 @@ Useful CLI commands:
305
305
  - `config get <path>` prints one persisted configuration value
306
306
  - `config set <path> <value>` updates one persisted configuration value
307
307
  - `sys-config` prints the system configuration
308
+ - `system-config` is an alias of `sys-config`
308
309
  - `service install` installs the local daemon/service
309
310
  - `service disable` disables the local daemon/service
310
311
  - `service uninstall` uninstalls the local daemon/service
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@velor/remote-mouse",
3
- "version": "6.4.10",
3
+ "version": "6.5.0",
4
4
  "type": "module",
5
5
  "description": "Remote mouse and keyboard with mobile client",
6
6
  "homepage": "https://github.com/glennerichall/node-mouse#readme",
@@ -29,6 +29,22 @@ function redactSecrets(value, key = '') {
29
29
  return value;
30
30
  }
31
31
 
32
+ function buildConfigSnapshots(rawConfig, rawSystemConfig) {
33
+ const config = redactSecrets(rawConfig);
34
+ const sysConfig = redactSecrets(rawSystemConfig);
35
+
36
+ return {
37
+ config: {
38
+ ...config,
39
+ updateCheck: {
40
+ ...sysConfig?.updateCheck,
41
+ ...config?.updateCheck,
42
+ },
43
+ },
44
+ sysConfig,
45
+ };
46
+ }
47
+
32
48
  function getConnectedClients(io) {
33
49
  return Array.from(io.of('/').sockets.values()).map((socket) => ({
34
50
  id: socket.id,
@@ -106,8 +122,7 @@ export function createServerInfoRouter(services) {
106
122
  const clients = getConnectedClients(services.getServer().io);
107
123
  const rawConfig = services.getConfig();
108
124
  const rawSystemConfig = services.getSystemConfig();
109
- const config = redactSecrets(rawConfig);
110
- const sysConfig = redactSecrets(rawSystemConfig);
125
+ const {config, sysConfig} = buildConfigSnapshots(rawConfig, rawSystemConfig);
111
126
  const logs = getRecentLogs(250);
112
127
  const version = readPackageVersion(packageJsonPath);
113
128
  const tasks = services.getTaskManager().getTasksSnapshot();
@@ -145,5 +160,6 @@ export function createServerInfoRouter(services) {
145
160
 
146
161
  export const __testables = {
147
162
  buildTokenEntries,
163
+ buildConfigSnapshots,
148
164
  redactSecrets,
149
165
  };
@@ -11,7 +11,7 @@ import fs from "node:fs";
11
11
 
12
12
  const __filename = fileURLToPath(import.meta.url);
13
13
  const __dirname = path.dirname(__filename);
14
- export const projectRoot = path.join(__dirname, '../..');
14
+ export const projectRoot = path.join(__dirname, '../../..');
15
15
  export const packageJsonPath = path.join(projectRoot, 'package.json');
16
16
 
17
17
  export const bootstrapConfigDir = resolveConfigDir(process.env.CONFIG_DIR || '');
@@ -27,12 +27,8 @@ loadEnvFile(envFilePath);
27
27
  export const CONFIG_DIR = resolveConfigDir(readString('CONFIG_DIR', bootstrapConfigDir));
28
28
 
29
29
  export function readPackageJson() {
30
- try {
31
- const raw = fs.readFileSync(packageJsonPath, 'utf8');
32
- return JSON.parse(raw);
33
- } catch (_error) {
34
- return {};
35
- }
30
+ const raw = fs.readFileSync(packageJsonPath, 'utf8');
31
+ return JSON.parse(raw);
36
32
  }
37
33
 
38
34
  export const packageJson = readPackageJson();
@@ -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;
@@ -51,6 +51,9 @@ export function parseCliArgs(args) {
51
51
  .command('sys-config', false, () => {}, () => {
52
52
  command = {name: 'sys-config', args: {}};
53
53
  })
54
+ .command('system-config', false, () => {}, () => {
55
+ command = {name: 'system-config', args: {}};
56
+ })
54
57
  .command('info', false, () => {}, () => {
55
58
  command = {name: 'info', args: {}};
56
59
  })
@@ -18,7 +18,12 @@ export async function runCliCmd(args) {
18
18
  if (!command?.name || command.name === 'help') {
19
19
  console.log('Usage:');
20
20
  console.log(' remote-mouse Demarre le serveur');
21
+ console.log(' remote-mouse help Affiche cette aide');
21
22
  console.log(' remote-mouse config Affiche la configuration persistée effective');
23
+ console.log(' remote-mouse config get <path> Affiche une valeur de configuration persistée');
24
+ console.log(' remote-mouse config set <path> <value> Met a jour une valeur de configuration persistée');
25
+ console.log(' remote-mouse sys-config Affiche la configuration systeme');
26
+ console.log(' remote-mouse system-config Alias de sys-config');
22
27
  console.log(' remote-mouse service install Installe le daemon/service local');
23
28
  console.log(' remote-mouse service disable Desactive le daemon/service local');
24
29
  console.log(' remote-mouse service uninstall Desinstalle le daemon/service local');
@@ -28,6 +33,7 @@ export async function runCliCmd(args) {
28
33
  console.log(' remote-mouse info --verbosity 2 Affiche les capacites serveur avec logs detailles');
29
34
  console.log(' remote-mouse system-info Alias de info');
30
35
  console.log(' remote-mouse tokens Liste les tokens en base');
36
+ console.log(' remote-mouse samsung-detect Detecte les TV Samsung sur le reseau');
31
37
  console.log(' remote-mouse open-qr Envoie une commande au service deja demarre');
32
38
  console.log(' remote-mouse qr Alias de open-qr');
33
39
  process.exit(0);
@@ -1,6 +1,23 @@
1
1
  export async function executeHelpCommand() {
2
2
  return {
3
3
  ok: true,
4
- message: 'Utilisez remote-mouse --help pour afficher les commandes disponibles.',
4
+ message: [
5
+ 'Commandes disponibles:',
6
+ 'remote-mouse help',
7
+ 'remote-mouse config',
8
+ 'remote-mouse config get <path>',
9
+ 'remote-mouse config set <path> <value>',
10
+ 'remote-mouse sys-config',
11
+ 'remote-mouse system-config',
12
+ 'remote-mouse info',
13
+ 'remote-mouse system-info',
14
+ 'remote-mouse service <install|disable|uninstall|restart>',
15
+ 'remote-mouse tasks',
16
+ 'remote-mouse task-manager',
17
+ 'remote-mouse samsung-detect',
18
+ 'remote-mouse tokens',
19
+ 'remote-mouse open-qr',
20
+ 'remote-mouse qr',
21
+ ].join('\n'),
5
22
  };
6
23
  }
@@ -15,6 +15,7 @@ const commandHandlers = {
15
15
  qr: executeOpenQrCommand,
16
16
  config: executeConfigCommand,
17
17
  'sys-config': executeSystemConfigCommand,
18
+ 'system-config': executeSystemConfigCommand,
18
19
  info: executeInfoCommand,
19
20
  'system-info': executeInfoCommand,
20
21
  service: executeServiceCommand,