signalk-masterbus 0.2.1 → 0.4.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/README.md +28 -11
- package/bin/darwin-arm64/masterbus-signalk +0 -0
- package/bin/darwin-x64/masterbus-signalk +0 -0
- package/bin/linux-arm/masterbus-signalk +0 -0
- package/bin/linux-arm64/masterbus-signalk +0 -0
- package/bin/linux-x64/masterbus-signalk +0 -0
- package/bin/win32-x64/masterbus-signalk.exe +0 -0
- package/package.json +2 -2
- package/plugin/config.d.ts +20 -1
- package/plugin/config.d.ts.map +1 -1
- package/plugin/config.js +24 -3
- package/plugin/config.js.map +1 -1
- package/plugin/daemon.d.ts +46 -2
- package/plugin/daemon.d.ts.map +1 -1
- package/plugin/daemon.js +113 -15
- package/plugin/daemon.js.map +1 -1
- package/plugin/index.d.ts.map +1 -1
- package/plugin/index.js +7 -2
- package/plugin/index.js.map +1 -1
- package/plugin/shared.d.ts +48 -0
- package/plugin/shared.d.ts.map +1 -0
- package/plugin/shared.js +142 -0
- package/plugin/shared.js.map +1 -0
- package/plugin/types.d.ts +13 -0
- package/plugin/types.d.ts.map +1 -1
- package/plugin/types.js.map +1 -1
- package/public/assets/icon.svg +6 -0
- package/public/assets/index-uZlyoKB1.js +49 -0
- package/public/index.html +1 -1
- package/public/assets/index-D5WLRExp.js +0 -49
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The mapping and schema cache the plugin shares with the masterbus tools
|
|
3
|
+
* (`masterbus-tui`, `masterbus-dump`, a `masterbus-signalk` run by hand).
|
|
4
|
+
*
|
|
5
|
+
* With one mapping on the machine, an edit in the TUI reaches Signal K (the
|
|
6
|
+
* daemon reloads `mapping.json` when it changes) and an edit in the web
|
|
7
|
+
* editor is what the TUI shows next time. Before, the bundled daemon kept a
|
|
8
|
+
* mapping of its own, and the two drifted apart without anyone noticing.
|
|
9
|
+
*/
|
|
10
|
+
/** What the folder lookup needs to know about the machine. */
|
|
11
|
+
export interface Env {
|
|
12
|
+
platform: string;
|
|
13
|
+
home: string;
|
|
14
|
+
vars: Record<string, string | undefined>;
|
|
15
|
+
isFile: (p: string) => boolean;
|
|
16
|
+
isDir: (p: string) => boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare const ENV: Env;
|
|
19
|
+
/**
|
|
20
|
+
* The folder holding the tools' `config.ini` and `mapping.json`, by the
|
|
21
|
+
* tools' own rule: `$MASTERBUS_CONFIG_DIR`; on Linux the system folder when
|
|
22
|
+
* it has a `config.ini`; otherwise the per-user configuration folder.
|
|
23
|
+
*/
|
|
24
|
+
export declare function toolsDir(env?: Env): string;
|
|
25
|
+
/**
|
|
26
|
+
* The tools' schema cache for the folder `dir`: the `cache_dir` in its
|
|
27
|
+
* `config.ini` when that folder exists here, else the tools' default.
|
|
28
|
+
*/
|
|
29
|
+
export declare function toolsCacheDir(dir: string, env?: Env): string;
|
|
30
|
+
/**
|
|
31
|
+
* Whether Signal K runs in a container (Docker or Podman). The home folder
|
|
32
|
+
* there is usually not kept when the container is recreated, so a shared
|
|
33
|
+
* folder has to be named, one that is mounted from the host.
|
|
34
|
+
*/
|
|
35
|
+
export declare function inContainer(env?: Env): boolean;
|
|
36
|
+
export declare const BACKUP = "mapping.plugin-backup.json";
|
|
37
|
+
/**
|
|
38
|
+
* Move the mapping the plugin kept for itself (`own`) to the shared one
|
|
39
|
+
* (`shared`). Without a shared mapping it simply moves there; with the same
|
|
40
|
+
* one, the plugin's copy goes. With a different one, the shared mapping wins
|
|
41
|
+
* and the plugin's is kept beside it as `mapping.plugin-backup.json`
|
|
42
|
+
* (numbered if that name is taken), so nobody's work is lost. When the two
|
|
43
|
+
* are one file (a tools folder linked to the plugin's, #3), it stays put.
|
|
44
|
+
* Returns a sentence for the plugin status, or null when there was nothing to
|
|
45
|
+
* move.
|
|
46
|
+
*/
|
|
47
|
+
export declare function adoptMapping(own: string, shared: string): string | null;
|
|
48
|
+
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,8DAA8D;AAC9D,MAAM,WAAW,GAAG;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAA;IACxC,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,OAAO,CAAA;IAC9B,KAAK,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,OAAO,CAAA;CAC9B;AAED,eAAO,MAAM,GAAG,EAAE,GAkBjB,CAAA;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,GAAG,GAAE,GAAS,GAAG,MAAM,CAgB/C;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,GAAE,GAAS,GAAG,MAAM,CA2BjE;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,GAAG,GAAE,GAAS,GAAG,OAAO,CAEnD;AAED,eAAO,MAAM,MAAM,+BAA+B,CAAA;AAalD;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAsBvE"}
|
package/plugin/shared.js
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The mapping and schema cache the plugin shares with the masterbus tools
|
|
3
|
+
* (`masterbus-tui`, `masterbus-dump`, a `masterbus-signalk` run by hand).
|
|
4
|
+
*
|
|
5
|
+
* With one mapping on the machine, an edit in the TUI reaches Signal K (the
|
|
6
|
+
* daemon reloads `mapping.json` when it changes) and an edit in the web
|
|
7
|
+
* editor is what the TUI shows next time. Before, the bundled daemon kept a
|
|
8
|
+
* mapping of its own, and the two drifted apart without anyone noticing.
|
|
9
|
+
*/
|
|
10
|
+
import fs from 'node:fs';
|
|
11
|
+
import os from 'node:os';
|
|
12
|
+
import path from 'node:path';
|
|
13
|
+
export const ENV = {
|
|
14
|
+
platform: process.platform,
|
|
15
|
+
home: os.homedir(),
|
|
16
|
+
vars: process.env,
|
|
17
|
+
isFile: (p) => {
|
|
18
|
+
try {
|
|
19
|
+
return fs.statSync(p).isFile();
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
isDir: (p) => {
|
|
26
|
+
try {
|
|
27
|
+
return fs.statSync(p).isDirectory();
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* The folder holding the tools' `config.ini` and `mapping.json`, by the
|
|
36
|
+
* tools' own rule: `$MASTERBUS_CONFIG_DIR`; on Linux the system folder when
|
|
37
|
+
* it has a `config.ini`; otherwise the per-user configuration folder.
|
|
38
|
+
*/
|
|
39
|
+
export function toolsDir(env = ENV) {
|
|
40
|
+
const pinned = env.vars.MASTERBUS_CONFIG_DIR?.trim();
|
|
41
|
+
if (pinned)
|
|
42
|
+
return pinned;
|
|
43
|
+
switch (env.platform) {
|
|
44
|
+
case 'linux': {
|
|
45
|
+
if (env.isFile('/etc/default/masterbus/config.ini'))
|
|
46
|
+
return '/etc/default/masterbus';
|
|
47
|
+
const xdg = env.vars.XDG_CONFIG_HOME?.trim();
|
|
48
|
+
return path.join(xdg || path.join(env.home, '.config'), 'masterbus');
|
|
49
|
+
}
|
|
50
|
+
case 'darwin':
|
|
51
|
+
return path.join(env.home, 'Library', 'Application Support', 'masterbus');
|
|
52
|
+
case 'win32':
|
|
53
|
+
return path.join(env.vars.APPDATA ?? path.join(env.home, 'AppData', 'Roaming'), 'masterbus');
|
|
54
|
+
default:
|
|
55
|
+
return path.join(env.home, '.config', 'masterbus');
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The tools' schema cache for the folder `dir`: the `cache_dir` in its
|
|
60
|
+
* `config.ini` when that folder exists here, else the tools' default.
|
|
61
|
+
*/
|
|
62
|
+
export function toolsCacheDir(dir, env = ENV) {
|
|
63
|
+
let ini = '';
|
|
64
|
+
try {
|
|
65
|
+
ini = fs.readFileSync(path.join(dir, 'config.ini'), 'utf8');
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
// No config.ini: the default below.
|
|
69
|
+
}
|
|
70
|
+
const set = /^\s*cache_dir\s*=\s*(.+?)\s*$/m.exec(ini)?.[1];
|
|
71
|
+
if (set && env.isDir(set))
|
|
72
|
+
return set;
|
|
73
|
+
if (env.vars.MASTERBUS_CONFIG_DIR?.trim())
|
|
74
|
+
return path.join(dir, 'cache');
|
|
75
|
+
if (dir.startsWith('/etc/'))
|
|
76
|
+
return '/var/lib/masterbus';
|
|
77
|
+
switch (env.platform) {
|
|
78
|
+
case 'linux': {
|
|
79
|
+
const xdg = env.vars.XDG_CACHE_HOME?.trim();
|
|
80
|
+
return path.join(xdg || path.join(env.home, '.cache'), 'masterbus');
|
|
81
|
+
}
|
|
82
|
+
case 'darwin':
|
|
83
|
+
return path.join(env.home, 'Library', 'Caches', 'masterbus');
|
|
84
|
+
case 'win32':
|
|
85
|
+
return path.join(env.vars.LOCALAPPDATA ?? path.join(env.home, 'AppData', 'Local'), 'masterbus', 'cache');
|
|
86
|
+
default:
|
|
87
|
+
return path.join(dir, 'cache');
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Whether Signal K runs in a container (Docker or Podman). The home folder
|
|
92
|
+
* there is usually not kept when the container is recreated, so a shared
|
|
93
|
+
* folder has to be named, one that is mounted from the host.
|
|
94
|
+
*/
|
|
95
|
+
export function inContainer(env = ENV) {
|
|
96
|
+
return env.isFile('/.dockerenv') || env.isFile('/run/.containerenv');
|
|
97
|
+
}
|
|
98
|
+
export const BACKUP = 'mapping.plugin-backup.json';
|
|
99
|
+
/** Whether `a` and `b` are one file, through a symlink or a hard link. */
|
|
100
|
+
function sameFile(a, b) {
|
|
101
|
+
try {
|
|
102
|
+
// bigint: a Windows file id is 64 bits, more than a number holds exactly.
|
|
103
|
+
const [x, y] = [fs.statSync(a, { bigint: true }), fs.statSync(b, { bigint: true })];
|
|
104
|
+
return x.dev === y.dev && x.ino === y.ino;
|
|
105
|
+
}
|
|
106
|
+
catch {
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Move the mapping the plugin kept for itself (`own`) to the shared one
|
|
112
|
+
* (`shared`). Without a shared mapping it simply moves there; with the same
|
|
113
|
+
* one, the plugin's copy goes. With a different one, the shared mapping wins
|
|
114
|
+
* and the plugin's is kept beside it as `mapping.plugin-backup.json`
|
|
115
|
+
* (numbered if that name is taken), so nobody's work is lost. When the two
|
|
116
|
+
* are one file (a tools folder linked to the plugin's, #3), it stays put.
|
|
117
|
+
* Returns a sentence for the plugin status, or null when there was nothing to
|
|
118
|
+
* move.
|
|
119
|
+
*/
|
|
120
|
+
export function adoptMapping(own, shared) {
|
|
121
|
+
if (!fs.existsSync(own) || sameFile(own, shared))
|
|
122
|
+
return null;
|
|
123
|
+
fs.mkdirSync(path.dirname(shared), { recursive: true });
|
|
124
|
+
if (!fs.existsSync(shared)) {
|
|
125
|
+
fs.copyFileSync(own, shared);
|
|
126
|
+
fs.rmSync(own);
|
|
127
|
+
return `The plugin's mapping now lives in ${shared}, shared with the masterbus tools.`;
|
|
128
|
+
}
|
|
129
|
+
if (fs.readFileSync(own).equals(fs.readFileSync(shared))) {
|
|
130
|
+
fs.rmSync(own);
|
|
131
|
+
return `Using the mapping in ${shared}, shared with the masterbus tools.`;
|
|
132
|
+
}
|
|
133
|
+
let backup = path.join(path.dirname(shared), BACKUP);
|
|
134
|
+
for (let n = 2; fs.existsSync(backup); n++) {
|
|
135
|
+
backup = path.join(path.dirname(shared), `mapping.plugin-backup-${n}.json`);
|
|
136
|
+
}
|
|
137
|
+
fs.copyFileSync(own, backup);
|
|
138
|
+
fs.rmSync(own);
|
|
139
|
+
return (`Using the mapping in ${shared}, shared with the masterbus tools. The plugin had its own ` +
|
|
140
|
+
`mapping, which differs; it is kept as ${backup}.`);
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,IAAI,MAAM,WAAW,CAAA;AAW5B,MAAM,CAAC,MAAM,GAAG,GAAQ;IACtB,QAAQ,EAAE,OAAO,CAAC,QAAQ;IAC1B,IAAI,EAAE,EAAE,CAAC,OAAO,EAAE;IAClB,IAAI,EAAE,OAAO,CAAC,GAAG;IACjB,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE;QACZ,IAAI,CAAC;YACH,OAAO,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAA;QAChC,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAA;QACd,CAAC;IACH,CAAC;IACD,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE;QACX,IAAI,CAAC;YACH,OAAO,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAA;QACrC,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAA;QACd,CAAC;IACH,CAAC;CACF,CAAA;AAED;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAC,MAAW,GAAG;IACrC,MAAM,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,oBAAoB,EAAE,IAAI,EAAE,CAAA;IACpD,IAAI,MA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,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAA;IACpD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3C,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,yBAAyB,CAAC,OAAO,CAAC,CAAA;IAC7E,CAAC;IACD,EAAE,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;IAC5B,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IACd,OAAO,CACL,wBAAwB,MAAM,4DAA4D;QAC1F,yCAAyC,MAAM,GAAG,CACnD,CAAA;AACH,CAAC"}
|
package/plugin/types.d.ts
CHANGED
|
@@ -36,6 +36,13 @@ export interface Field {
|
|
|
36
36
|
/** The mapped Signal K path, or null. */
|
|
37
37
|
path: string | null;
|
|
38
38
|
put: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* One of the device's eventable outputs, which other devices' events
|
|
41
|
+
* switch (an APR's `Stop charge`). Absent from an older daemon.
|
|
42
|
+
*/
|
|
43
|
+
output?: boolean;
|
|
44
|
+
/** From the mapping: a PUT may also switch the output off. */
|
|
45
|
+
allowOff?: boolean;
|
|
39
46
|
/** Last value seen, in the device's own unit, or null. */
|
|
40
47
|
value: unknown;
|
|
41
48
|
}
|
|
@@ -58,6 +65,12 @@ export interface FieldMapping {
|
|
|
58
65
|
truth?: Record<string, boolean>;
|
|
59
66
|
notify?: Record<string, NotifyState>;
|
|
60
67
|
put?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* On an eventable output that is not writable: let a PUT switch it off as
|
|
70
|
+
* well as on. Without it the daemon refuses off, because the device's own
|
|
71
|
+
* events drive the output too (a battery's protection asserts `Stop charge`).
|
|
72
|
+
*/
|
|
73
|
+
allow_off?: boolean;
|
|
61
74
|
}
|
|
62
75
|
export interface DeviceMapping {
|
|
63
76
|
article?: string;
|
package/plugin/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,eAAO,MAAM,WAAW,IAAI,CAAA;AAE5B,MAAM,MAAM,IAAI,GAAG,YAAY,GAAG,eAAe,GAAG,SAAS,CAAA;AAE7D,MAAM,WAAW,MAAM;IACrB,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAA;IAC3C,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAA;CAClD;AAED,MAAM,WAAW,KAAK;IACpB,uBAAuB;IACvB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,QAAQ,EAAE,OAAO,CAAA;IACjB,IAAI,EAAE,IAAI,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,yCAAyC;IACzC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,GAAG,EAAE,OAAO,CAAA;IACZ,0DAA0D;IAC1D,KAAK,EAAE,OAAO,CAAA;CACf;AAED,MAAM,WAAW,MAAM;IACrB,mCAAmC;IACnC,EAAE,EAAE,MAAM,CA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
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAA;AAsJ5B,0EAA0E;AAC1E,MAAM,OAAO,WAAY,SAAQ,KAAK;IAC3B,MAAM,CAAQ;IACvB,mEAAmE;IAC1D,KAAK,CAAS;IAEvB,YAAY,MAAc,EAAE,OAAe,EAAE,KAAc;QACzD,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,aAAa,CAAA;QACzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;CACF"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 96 96" width="96" height="96">
|
|
2
|
+
<rect x="4" y="4" width="88" height="88" rx="16" fill="#12395b"/>
|
|
3
|
+
<rect x="20" y="30" width="46" height="36" rx="6" fill="none" stroke="#f2f5f7" stroke-width="6"/>
|
|
4
|
+
<rect x="66" y="40" width="10" height="16" rx="2" fill="#f2f5f7"/>
|
|
5
|
+
<rect x="26" y="36" width="24" height="24" rx="3" fill="#5cc8a8"/>
|
|
6
|
+
</svg>
|