aaden-cli 1.6.58 → 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/dist/index.js +27 -5
- package/index.js +17 -1
- package/modules/firebase.js +9 -3
- package/package.json +1 -1
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
|
|
|
@@ -19110,18 +19116,34 @@ async function removeAllData() {
|
|
|
19110
19116
|
cli.executeInShell(command, program.debug)
|
|
19111
19117
|
}
|
|
19112
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
|
+
}
|
|
19113
19127
|
|
|
19114
19128
|
async function doLog() {
|
|
19115
19129
|
const res = cli.executeInShell(['snap info aaden'], program.debug, true)
|
|
19116
19130
|
const diskUsage =
|
|
19117
19131
|
cli.executeInShell(['df -h --total | command grep total | df -h --total | command grep total | head -c-3 && echo \'\''],
|
|
19118
19132
|
program.debug, true).output.split(' ')
|
|
19133
|
+
const uptime = cli.executeInShell([''], program.debug, true).output
|
|
19119
19134
|
const log = res.output
|
|
19120
19135
|
const list = log.split('\n')
|
|
19121
19136
|
const frontendVersion = list[list.length - 2].replace(/\s+/g, ' ')
|
|
19122
19137
|
.split(' ')[1]
|
|
19123
19138
|
console.log(frontendVersion)
|
|
19124
|
-
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
|
+
)
|
|
19125
19147
|
console.log('finish')
|
|
19126
19148
|
|
|
19127
19149
|
process.exit(0)
|
package/index.js
CHANGED
|
@@ -587,18 +587,34 @@ async function removeAllData() {
|
|
|
587
587
|
cli.executeInShell(command, program.debug)
|
|
588
588
|
}
|
|
589
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
|
+
}
|
|
590
598
|
|
|
591
599
|
async function doLog() {
|
|
592
600
|
const res = cli.executeInShell(['snap info aaden'], program.debug, true)
|
|
593
601
|
const diskUsage =
|
|
594
602
|
cli.executeInShell(['df -h --total | command grep total | df -h --total | command grep total | head -c-3 && echo \'\''],
|
|
595
603
|
program.debug, true).output.split(' ')
|
|
604
|
+
const uptime = cli.executeInShell([''], program.debug, true).output
|
|
596
605
|
const log = res.output
|
|
597
606
|
const list = log.split('\n')
|
|
598
607
|
const frontendVersion = list[list.length - 2].replace(/\s+/g, ' ')
|
|
599
608
|
.split(' ')[1]
|
|
600
609
|
console.log(frontendVersion)
|
|
601
|
-
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
|
+
)
|
|
602
618
|
console.log('finish')
|
|
603
619
|
|
|
604
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
|
}
|