@noforeignland/signalk-to-noforeignland 1.0.1-beta.5 → 1.1.0-beta.2
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/CHANGELOG.md +4 -1
- package/PROJECT_STRUCTURE.md +0 -0
- package/README.md +10 -3
- package/cleanup-old-plugin.js +58 -14
- package/doc/beta_install_cerbo.md +116 -0
- package/doc/beta_install_rpi.md +64 -0
- package/index.js +217 -866
- package/lib/ConfigManager.js +216 -0
- package/lib/DataPathEmitter.js +93 -0
- package/lib/DirectoryUtils.js +38 -0
- package/lib/HealthMonitor.js +91 -0
- package/lib/PluginCleanup.js +161 -0
- package/lib/TrackLogger.js +306 -0
- package/lib/TrackMigration.js +110 -0
- package/lib/TrackSender.js +257 -0
- package/package.json +3 -2
- package/doc/beta_install.md +0 -60
- package/doc/dev +0 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
1.1.0
|
|
2
|
+
* CHANGE: Refactored Project structure, see PROJECT_STRUCTURE.md
|
|
3
|
+
|
|
1
4
|
1.0.1
|
|
2
|
-
* CHANGE: Cleanup previous installs and migrate plugin config.
|
|
5
|
+
* CHANGE: Cleanup previous installs and migrate plugin config, removes depricated old plugins.
|
|
3
6
|
|
|
4
7
|
1.0.0
|
|
5
8
|
* CHANGE: Package now released unter npmjs org noforeignland in version 1.0.0 due to deployment changes in npmjs and the need of trustworthy sources. All npmjs keys will be revoked Nov 19th, 2025.
|
|
File without changes
|
package/README.md
CHANGED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
Effortlessly log your boat's movement to **noforeignland.com**
|
|
3
3
|
|
|
4
4
|
## Important for 0.1.x users
|
|
5
|
-
|
|
6
|
-
Users of the old (depricated) 0.1.x versions need to install this new package once manually using the Signal K Appstore. The Plugin Configuration will be kept from the 0.1.x install.
|
|
5
|
+
Upgrade to >1.0.1 by installing this plugin from the Appstore ageain. Your old config will be migrated.
|
|
7
6
|
|
|
8
7
|
## Features
|
|
9
8
|
* Automatically log your position to noforeignland.com
|
|
@@ -43,4 +42,12 @@ noforeignland.status - string - Status & Error
|
|
|
43
42
|
noforeignland.status_boolean - number - 0 = normal operation, 1 = error
|
|
44
43
|
noforeignland.source - string - string - data source of navigation.position
|
|
45
44
|
notifications.noforeignland.status_boolean - json object - auto created
|
|
46
|
-
```
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
https://github.com/noforeignland/nfl-signalk/issues
|
|
48
|
+
|
|
49
|
+
# Virctron Cerbo GX Users
|
|
50
|
+
|
|
51
|
+
## Limited storage
|
|
52
|
+
Signal K can quickly exhaust the small onboard storage of the device, especially when a lot of logging is enabled. Vicron Energy addressed this here:
|
|
53
|
+
https://www.victronenergy.com/live/venus-os:large#disk_space_issues_data_partition_full
|
package/cleanup-old-plugin.js
CHANGED
|
@@ -1,11 +1,33 @@
|
|
|
1
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Cleanup script for old plugin versions
|
|
5
|
+
* This runs as a standalone script during npm postinstall
|
|
6
|
+
* NOT a class - just a simple executable script
|
|
7
|
+
*/
|
|
8
|
+
|
|
2
9
|
const fs = require('fs');
|
|
3
10
|
const path = require('path');
|
|
4
11
|
|
|
5
|
-
//
|
|
12
|
+
// Detect SignalK directory (standard ~/.signalk or Victron Cerbo /data/conf/signalk)
|
|
13
|
+
function getSignalKDir() {
|
|
14
|
+
const victronPath = '/data/conf/signalk';
|
|
15
|
+
const homePath = path.join(process.env.HOME || '', '.signalk');
|
|
16
|
+
|
|
17
|
+
// Check Victron path first
|
|
18
|
+
if (fs.existsSync(victronPath)) {
|
|
19
|
+
return victronPath;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return homePath;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const signalkDir = getSignalKDir();
|
|
26
|
+
console.log(`Using SignalK directory: ${signalkDir}`);
|
|
27
|
+
|
|
28
|
+
// 1. Migration (only for signalk-to-noforeignland config)
|
|
6
29
|
try {
|
|
7
|
-
const
|
|
8
|
-
const configPath = path.join(configDir, 'plugin-config-data');
|
|
30
|
+
const configPath = path.join(signalkDir, 'plugin-config-data');
|
|
9
31
|
const oldConfig = path.join(configPath, 'signalk-to-noforeignland.json');
|
|
10
32
|
const newConfig = path.join(configPath, '@noforeignland-signalk-to-noforeignland.json');
|
|
11
33
|
|
|
@@ -18,19 +40,41 @@ try {
|
|
|
18
40
|
console.warn('Could not migrate config:', e.message);
|
|
19
41
|
}
|
|
20
42
|
|
|
21
|
-
// 2. Uninstall (
|
|
43
|
+
// 2. Uninstall old plugins (with delay so npm can finish)
|
|
22
44
|
setTimeout(() => {
|
|
23
45
|
try {
|
|
24
|
-
const
|
|
25
|
-
|
|
46
|
+
const oldPlugins = [
|
|
47
|
+
{ dir: path.join(signalkDir, 'node_modules', 'signalk-to-noforeignland'), name: 'signalk-to-noforeignland' },
|
|
48
|
+
{ dir: path.join(signalkDir, 'node_modules', 'signalk-to-nfl'), name: 'signalk-to-nfl' }
|
|
49
|
+
];
|
|
50
|
+
|
|
51
|
+
let removedAny = false;
|
|
52
|
+
const failedPlugins = [];
|
|
53
|
+
|
|
54
|
+
for (const plugin of oldPlugins) {
|
|
55
|
+
if (fs.existsSync(plugin.dir)) {
|
|
56
|
+
try {
|
|
57
|
+
console.log(`Removing old plugin "${plugin.name}"...`);
|
|
58
|
+
// Direct deletion is safer than npm uninstall during installation
|
|
59
|
+
fs.rmSync(plugin.dir, { recursive: true, force: true });
|
|
60
|
+
console.log(`✓ Old plugin "${plugin.name}" removed`);
|
|
61
|
+
removedAny = true;
|
|
62
|
+
} catch (e) {
|
|
63
|
+
console.warn(`Could not remove "${plugin.name}":`, e.message);
|
|
64
|
+
failedPlugins.push(plugin.name);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (failedPlugins.length > 0) {
|
|
70
|
+
const uninstallCmd = failedPlugins.join(' ');
|
|
71
|
+
console.warn(`Please run manually: npm uninstall ${uninstallCmd}`);
|
|
72
|
+
}
|
|
26
73
|
|
|
27
|
-
if (
|
|
28
|
-
console.log('
|
|
29
|
-
// Direktes Löschen ist sicherer als npm uninstall während Installation
|
|
30
|
-
fs.rmSync(oldPluginDir, { recursive: true, force: true });
|
|
31
|
-
console.log('✓ Old plugin removed');
|
|
74
|
+
if (!removedAny && failedPlugins.length === 0) {
|
|
75
|
+
console.log('No old plugins found - already clean!');
|
|
32
76
|
}
|
|
33
77
|
} catch (e) {
|
|
34
|
-
console.warn('
|
|
78
|
+
console.warn('Error during cleanup:', e.message);
|
|
35
79
|
}
|
|
36
|
-
}, 2000); // 2
|
|
80
|
+
}, 2000); // Wait 2 seconds for npm to finish
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
How-to install the latest beta or dev tree (unstable) on your device?
|
|
2
|
+
|
|
3
|
+
This guide assumes you have a default install with default folders.
|
|
4
|
+
This is written for a Victron Cerbo GX jump to the section you need want to go to.
|
|
5
|
+
It is recommended to enable the Debug Log for this plugin in Server -> Plugin Config before updating.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
# Pre-requirements
|
|
9
|
+
On the Cerbo GUI enable SSH access and set a afmin password
|
|
10
|
+
Windows User: Download putty (for ssh) and Winscp (for secure fie copy)
|
|
11
|
+
|
|
12
|
+
## On GUI v1:
|
|
13
|
+
1. Click "Menu" (bottom right)
|
|
14
|
+
2. Settings > General
|
|
15
|
+
3. Set root password
|
|
16
|
+
4. Enable "SSH on LAN"
|
|
17
|
+
|
|
18
|
+
## On GUI v2:
|
|
19
|
+
1. Settings -> General
|
|
20
|
+
2. Set root password
|
|
21
|
+
3. Enable "SSH on LAN"
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
# Backup old data
|
|
25
|
+
|
|
26
|
+
## BEST + SLOW: Full signalk copy to local computer
|
|
27
|
+
1. Connect your Cerbo with WinSCP
|
|
28
|
+
2. Copy the folder "/data/conf/signalk" to your local PC
|
|
29
|
+
|
|
30
|
+
## Alternative Cerbo has a SD Card connected:
|
|
31
|
+
1. ssh to the Cerbo
|
|
32
|
+
```
|
|
33
|
+
df -h
|
|
34
|
+
# showns for me that /dev/mmcblk0p1 has 29GB free and is mounted to /run/media/mmcblk0p1
|
|
35
|
+
# This is a SD card that is manually inserted.
|
|
36
|
+
|
|
37
|
+
mount
|
|
38
|
+
# confirms this for me with output:
|
|
39
|
+
# /dev/mmcblk0p1 on /run/media/mmcblk0p1 type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
|
|
40
|
+
|
|
41
|
+
cp -r /data/conf/signalk /run/media/mmcblk0p1/signalk-backup
|
|
42
|
+
# copies the files for you, it will take some time, as the CPU and IO are not the fastest
|
|
43
|
+
|
|
44
|
+
ls –la /run/media/mmcblk0p1/signalk-backup
|
|
45
|
+
# Verify that folder and files exist.
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
# npmjs beta on Cerbo
|
|
50
|
+
|
|
51
|
+
## Install latest beta
|
|
52
|
+
1. SSH to the Cerbo:
|
|
53
|
+
```
|
|
54
|
+
cd /data/conf/signalk
|
|
55
|
+
|
|
56
|
+
npm i @noforeignland/signalk-to-noforeignland@beta
|
|
57
|
+
|
|
58
|
+
# reset owner properly, else package belongs to root
|
|
59
|
+
chown -R signalk:signalk /data/conf/signalk/*
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
2. Restart Server & Check logs
|
|
64
|
+
```
|
|
65
|
+
svc -t /service/signalk-server
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
## Install specific beta version f.e. 1.0.1-beta.5
|
|
70
|
+
1. SSH to the Cerbo:
|
|
71
|
+
```
|
|
72
|
+
cd /data/conf/signalk
|
|
73
|
+
|
|
74
|
+
# Here use the beta version you want to install
|
|
75
|
+
npm i @noforeignland/signalk-to-noforeignland@1.0.1-beta.5
|
|
76
|
+
|
|
77
|
+
# reset owner properly, else package belongs to root
|
|
78
|
+
chown -R signalk:signalk /data/conf/signalk/*
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
2. Restart Server & Check logs
|
|
82
|
+
```
|
|
83
|
+
svc -t /service/signalk-server
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
----------------------------------------
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
# dev tree (unstable) install - NOT RECOMMENDED
|
|
91
|
+
|
|
92
|
+
1. Backup as above
|
|
93
|
+
|
|
94
|
+
2. Get new files from repo (main for latest)
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
cd ~
|
|
98
|
+
mkdir dev
|
|
99
|
+
cd dev
|
|
100
|
+
wget https://github.com/noforeignland/nfl-signalk/archive/refs/heads/main.zip
|
|
101
|
+
unzip main.zip
|
|
102
|
+
cd nfl-signalk-main/
|
|
103
|
+
npm pack
|
|
104
|
+
|
|
105
|
+
cd /data/conf/signalk
|
|
106
|
+
npm install ~/dev/nfl-signalk-main/<your_npm_pack.tgz>
|
|
107
|
+
|
|
108
|
+
# reset owner properly, else package belongs to root
|
|
109
|
+
chown -R signalk:signalk /data/conf/signalk/*
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
3. Restart Server & Check logs
|
|
114
|
+
```
|
|
115
|
+
svc -t /service/signalk-server
|
|
116
|
+
```
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
How-to install the latest beta or dev tree (unstable) on your device?
|
|
2
|
+
|
|
3
|
+
This guide assumes you have a default install with default folders.
|
|
4
|
+
This is written for a RPI, jump to the section you need want to go to.
|
|
5
|
+
It is recommended to enable the Debug Log for this plugin in Server -> Plugin Config before updating.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
# Backup old data
|
|
9
|
+
```
|
|
10
|
+
cp -a ~/.signalk ~/signalk-backup
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
# npmjs beta on RPI
|
|
14
|
+
|
|
15
|
+
## Install latest beta
|
|
16
|
+
```
|
|
17
|
+
cd ~.signalk
|
|
18
|
+
|
|
19
|
+
npm i @noforeignland/signalk-to-noforeignland@beta
|
|
20
|
+
|
|
21
|
+
sudo systemctl restart signalk.service && sudo journalctl -u signalk.service -f
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Install a specific beta
|
|
25
|
+
```
|
|
26
|
+
cd ~.signalk
|
|
27
|
+
|
|
28
|
+
# Here use the beta version you want to install
|
|
29
|
+
npm i @noforeignland/signalk-to-noforeignland@1.0.1-beta.5
|
|
30
|
+
|
|
31
|
+
sudo systemctl restart signalk.service && sudo journalctl -u signalk.service -f
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
--------------------------
|
|
35
|
+
|
|
36
|
+
# dev tree (unstable) - NOT RECOMMENDED
|
|
37
|
+
1. Backup old data
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
cd ~
|
|
41
|
+
cp -a .signalk/ signalk-backup
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
2. Get new files from repo (main for latest)
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
cd ~
|
|
48
|
+
mkdir dev
|
|
49
|
+
cd dev
|
|
50
|
+
wget https://github.com/noforeignland/nfl-signalk/archive/refs/heads/main.zip
|
|
51
|
+
unzip main.zip
|
|
52
|
+
cd nfl-signalk-main/
|
|
53
|
+
npm pack
|
|
54
|
+
|
|
55
|
+
cd ~/.signalk
|
|
56
|
+
npm install ~/dev/nfl-signalk-main/<your_npm_pack.tgz>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
3. Restart Server & Check logs
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
sudo systemctl restart signalk.service && sudo journalctl -u signalk.service -f
|
|
63
|
+
```
|
|
64
|
+
|