aaden-cli 1.6.57 → 1.6.59
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/AadenDeploy/Utils/fixCronJob.sh +2 -2
- package/AadenDeploy/upgrade.sh +4 -3
- package/dist/index.js +35 -7
- package/index.js +25 -3
- package/modules/firebase.js +9 -3
- package/package.json +1 -1
|
@@ -26,10 +26,10 @@ echo "END Aaden Deploy CONFIG"
|
|
|
26
26
|
echo "Innerken322." | sudo -S rm -rf /etc/cron.d/aaden-cli-upgrade
|
|
27
27
|
echo "Innerken322." | sudo -S touch conf
|
|
28
28
|
echo "Innerken322." | sudo -S chmod 777 conf
|
|
29
|
-
echo "
|
|
29
|
+
echo "55 4 * * * sudo npm install aaden-cli -g" >>conf
|
|
30
30
|
echo "59 4 * * * /usr/local/bin/aaden-cli auto-upgrade" >>conf
|
|
31
31
|
echo "@reboot sleep 30 && sudo npm install aaden-cli -g" >>conf
|
|
32
|
-
echo "@reboot sleep
|
|
32
|
+
echo "@reboot sleep 60 &&/usr/local/bin/aaden-cli auto-upgrade" >>conf
|
|
33
33
|
echo "Innerken322." | sudo -S crontab -u root -r
|
|
34
34
|
echo "Innerken322." | sudo -S crontab -u root conf
|
|
35
35
|
echo "Innerken322." | sudo -S rm -f conf
|
package/AadenDeploy/upgrade.sh
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
mkdir -p /etc/aaden/config
|
|
6
|
+
chmod -R 777 /etc/aaden/config
|
|
7
|
+
npm update aaden-cli -g
|
|
8
8
|
|
|
9
9
|
aaden-cli patch
|
|
10
10
|
|
|
11
|
+
|
package/dist/index.js
CHANGED
|
@@ -78,24 +78,30 @@ __nccwpck_require__.r(__webpack_exports__);
|
|
|
78
78
|
/* harmony export */ });
|
|
79
79
|
const dayjs = __nccwpck_require__(7401)
|
|
80
80
|
const {hillo} = __nccwpck_require__(6365)
|
|
81
|
+
const defaultData = {
|
|
82
|
+
frontendVersion: '', cliVersion: '', diskUsage: '', upTime: '', ngrokIsNew: false
|
|
83
|
+
}
|
|
81
84
|
|
|
82
|
-
async function deviceEcho(
|
|
85
|
+
async function deviceEcho(data) {
|
|
83
86
|
hillo.initial('http://localhost/PHP/')
|
|
84
87
|
const myDeviceId = await getCurrentDeviceId()
|
|
85
88
|
console.log('echo for device', myDeviceId)
|
|
89
|
+
const {frontendVersion, cliVersion, diskUsage, upTime, ngrokIsNew} = Object.assign({}, defaultData, data)
|
|
86
90
|
if (parseInt(myDeviceId) === -1) {
|
|
87
91
|
return
|
|
88
92
|
}
|
|
89
93
|
const {name, adress1, postCode, city, state} = await getNiceRestaurantInfo()
|
|
90
94
|
await hillo.jsonPost('https://cloud-v2.aaden.io/deviceLog/create', {
|
|
91
95
|
deviceId: myDeviceId,
|
|
92
|
-
frontendVersion:
|
|
96
|
+
frontendVersion: frontendVersion,
|
|
93
97
|
cliVersion,
|
|
94
98
|
backendVersion: await getCurrentBackendVersion(),
|
|
95
99
|
timestamp: dayjs().valueOf(),
|
|
96
100
|
accessFrom: 'aaden-cli v' + cliVersion,
|
|
97
101
|
diskUsage,
|
|
98
|
-
|
|
102
|
+
lastUptime: upTime,
|
|
103
|
+
ngrokOk: ngrokIsNew,
|
|
104
|
+
deviceName: `${name}\n${adress1}\n${postCode} ${city} ${state}`
|
|
99
105
|
})
|
|
100
106
|
console.log('report to remote server complete')
|
|
101
107
|
}
|
|
@@ -18449,7 +18455,7 @@ module.exports = JSON.parse('{"name":"axios","version":"0.19.2","description":"P
|
|
|
18449
18455
|
/***/ ((module) => {
|
|
18450
18456
|
|
|
18451
18457
|
"use strict";
|
|
18452
|
-
module.exports = {"i8":"1.6.
|
|
18458
|
+
module.exports = {"i8":"1.6.59"};
|
|
18453
18459
|
|
|
18454
18460
|
/***/ })
|
|
18455
18461
|
|
|
@@ -18663,8 +18669,8 @@ function enterDatabase() {
|
|
|
18663
18669
|
cli.executeInShell(command, program.debug)
|
|
18664
18670
|
}
|
|
18665
18671
|
|
|
18666
|
-
function fixNgrok() {
|
|
18667
|
-
run('AadenDeploy/Utils/enableNgrok.sh')
|
|
18672
|
+
async function fixNgrok() {
|
|
18673
|
+
await run('AadenDeploy/Utils/enableNgrok.sh')
|
|
18668
18674
|
}
|
|
18669
18675
|
|
|
18670
18676
|
function testPrinter() {
|
|
@@ -19016,6 +19022,9 @@ function getMyDeviceId() {
|
|
|
19016
19022
|
}
|
|
19017
19023
|
|
|
19018
19024
|
async function autoUpgrade() {
|
|
19025
|
+
if (!ngrokNewestVersion()) {
|
|
19026
|
+
await fixNgrok()
|
|
19027
|
+
}
|
|
19019
19028
|
upgrade()
|
|
19020
19029
|
}
|
|
19021
19030
|
|
|
@@ -19038,7 +19047,10 @@ function getStorageBackendFileVersion() {
|
|
|
19038
19047
|
frontVersion = '0.0.0'
|
|
19039
19048
|
}
|
|
19040
19049
|
return frontVersion
|
|
19050
|
+
}
|
|
19041
19051
|
|
|
19052
|
+
function ngrokNewestVersion() {
|
|
19053
|
+
return fs.existsSync('/etc/systemd/system/aaden-ngrok-v3.service');
|
|
19042
19054
|
}
|
|
19043
19055
|
|
|
19044
19056
|
function getBackendVersionOffline() {
|
|
@@ -19104,18 +19116,34 @@ async function removeAllData() {
|
|
|
19104
19116
|
cli.executeInShell(command, program.debug)
|
|
19105
19117
|
}
|
|
19106
19118
|
|
|
19119
|
+
function getUpTime() {
|
|
19120
|
+
try {
|
|
19121
|
+
return cli.executeInShell([''], program.debug, true).output.split(',')[0]
|
|
19122
|
+
} catch (e) {
|
|
19123
|
+
return e.message
|
|
19124
|
+
}
|
|
19125
|
+
|
|
19126
|
+
}
|
|
19107
19127
|
|
|
19108
19128
|
async function doLog() {
|
|
19109
19129
|
const res = cli.executeInShell(['snap info aaden'], program.debug, true)
|
|
19110
19130
|
const diskUsage =
|
|
19111
19131
|
cli.executeInShell(['df -h --total | command grep total | df -h --total | command grep total | head -c-3 && echo \'\''],
|
|
19112
19132
|
program.debug, true).output.split(' ')
|
|
19133
|
+
const uptime = cli.executeInShell([''], program.debug, true).output
|
|
19113
19134
|
const log = res.output
|
|
19114
19135
|
const list = log.split('\n')
|
|
19115
19136
|
const frontendVersion = list[list.length - 2].replace(/\s+/g, ' ')
|
|
19116
19137
|
.split(' ')[1]
|
|
19117
19138
|
console.log(frontendVersion)
|
|
19118
|
-
await deviceEcho(
|
|
19139
|
+
await deviceEcho({
|
|
19140
|
+
frontendVersion,
|
|
19141
|
+
cliVersion: version,
|
|
19142
|
+
diskUsage: diskUsage[diskUsage.length - 1].replace('\n', ''),
|
|
19143
|
+
upTime: getUpTime(),
|
|
19144
|
+
ngrokIsNew: ngrokNewestVersion()
|
|
19145
|
+
}
|
|
19146
|
+
)
|
|
19119
19147
|
console.log('finish')
|
|
19120
19148
|
|
|
19121
19149
|
process.exit(0)
|
package/index.js
CHANGED
|
@@ -140,8 +140,8 @@ function enterDatabase() {
|
|
|
140
140
|
cli.executeInShell(command, program.debug)
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
-
function fixNgrok() {
|
|
144
|
-
run('AadenDeploy/Utils/enableNgrok.sh')
|
|
143
|
+
async function fixNgrok() {
|
|
144
|
+
await run('AadenDeploy/Utils/enableNgrok.sh')
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
function testPrinter() {
|
|
@@ -493,6 +493,9 @@ function getMyDeviceId() {
|
|
|
493
493
|
}
|
|
494
494
|
|
|
495
495
|
async function autoUpgrade() {
|
|
496
|
+
if (!ngrokNewestVersion()) {
|
|
497
|
+
await fixNgrok()
|
|
498
|
+
}
|
|
496
499
|
upgrade()
|
|
497
500
|
}
|
|
498
501
|
|
|
@@ -515,7 +518,10 @@ function getStorageBackendFileVersion() {
|
|
|
515
518
|
frontVersion = '0.0.0'
|
|
516
519
|
}
|
|
517
520
|
return frontVersion
|
|
521
|
+
}
|
|
518
522
|
|
|
523
|
+
function ngrokNewestVersion() {
|
|
524
|
+
return fs.existsSync('/etc/systemd/system/aaden-ngrok-v3.service');
|
|
519
525
|
}
|
|
520
526
|
|
|
521
527
|
function getBackendVersionOffline() {
|
|
@@ -581,18 +587,34 @@ async function removeAllData() {
|
|
|
581
587
|
cli.executeInShell(command, program.debug)
|
|
582
588
|
}
|
|
583
589
|
|
|
590
|
+
function getUpTime() {
|
|
591
|
+
try {
|
|
592
|
+
return cli.executeInShell([''], program.debug, true).output.split(',')[0]
|
|
593
|
+
} catch (e) {
|
|
594
|
+
return e.message
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
}
|
|
584
598
|
|
|
585
599
|
async function doLog() {
|
|
586
600
|
const res = cli.executeInShell(['snap info aaden'], program.debug, true)
|
|
587
601
|
const diskUsage =
|
|
588
602
|
cli.executeInShell(['df -h --total | command grep total | df -h --total | command grep total | head -c-3 && echo \'\''],
|
|
589
603
|
program.debug, true).output.split(' ')
|
|
604
|
+
const uptime = cli.executeInShell([''], program.debug, true).output
|
|
590
605
|
const log = res.output
|
|
591
606
|
const list = log.split('\n')
|
|
592
607
|
const frontendVersion = list[list.length - 2].replace(/\s+/g, ' ')
|
|
593
608
|
.split(' ')[1]
|
|
594
609
|
console.log(frontendVersion)
|
|
595
|
-
await deviceEcho(
|
|
610
|
+
await deviceEcho({
|
|
611
|
+
frontendVersion,
|
|
612
|
+
cliVersion: version,
|
|
613
|
+
diskUsage: diskUsage[diskUsage.length - 1].replace('\n', ''),
|
|
614
|
+
upTime: getUpTime(),
|
|
615
|
+
ngrokIsNew: ngrokNewestVersion()
|
|
616
|
+
}
|
|
617
|
+
)
|
|
596
618
|
console.log('finish')
|
|
597
619
|
|
|
598
620
|
process.exit(0)
|
package/modules/firebase.js
CHANGED
|
@@ -1,23 +1,29 @@
|
|
|
1
1
|
const dayjs = require("dayjs")
|
|
2
2
|
const {hillo} = require('hillo')
|
|
3
|
+
const defaultData = {
|
|
4
|
+
frontendVersion: '', cliVersion: '', diskUsage: '', upTime: '', ngrokIsNew: false
|
|
5
|
+
}
|
|
3
6
|
|
|
4
|
-
export async function deviceEcho(
|
|
7
|
+
export async function deviceEcho(data) {
|
|
5
8
|
hillo.initial('http://localhost/PHP/')
|
|
6
9
|
const myDeviceId = await getCurrentDeviceId()
|
|
7
10
|
console.log('echo for device', myDeviceId)
|
|
11
|
+
const {frontendVersion, cliVersion, diskUsage, upTime, ngrokIsNew} = Object.assign({}, defaultData, data)
|
|
8
12
|
if (parseInt(myDeviceId) === -1) {
|
|
9
13
|
return
|
|
10
14
|
}
|
|
11
15
|
const {name, adress1, postCode, city, state} = await getNiceRestaurantInfo()
|
|
12
16
|
await hillo.jsonPost('https://cloud-v2.aaden.io/deviceLog/create', {
|
|
13
17
|
deviceId: myDeviceId,
|
|
14
|
-
frontendVersion:
|
|
18
|
+
frontendVersion: frontendVersion,
|
|
15
19
|
cliVersion,
|
|
16
20
|
backendVersion: await getCurrentBackendVersion(),
|
|
17
21
|
timestamp: dayjs().valueOf(),
|
|
18
22
|
accessFrom: 'aaden-cli v' + cliVersion,
|
|
19
23
|
diskUsage,
|
|
20
|
-
|
|
24
|
+
lastUptime: upTime,
|
|
25
|
+
ngrokOk: ngrokIsNew,
|
|
26
|
+
deviceName: `${name}\n${adress1}\n${postCode} ${city} ${state}`
|
|
21
27
|
})
|
|
22
28
|
console.log('report to remote server complete')
|
|
23
29
|
}
|