aaden-cli 1.6.64 → 1.6.66
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 +32 -4
- package/index.js +12 -2
- package/modules/firebase.js +17 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -74,10 +74,13 @@ __nccwpck_require__.r(__webpack_exports__);
|
|
|
74
74
|
/* harmony export */ "deviceEcho": () => (/* binding */ deviceEcho),
|
|
75
75
|
/* harmony export */ "getCurrentBackendVersion": () => (/* binding */ getCurrentBackendVersion),
|
|
76
76
|
/* harmony export */ "getCurrentDeviceId": () => (/* binding */ getCurrentDeviceId),
|
|
77
|
-
/* harmony export */ "getNiceRestaurantInfo": () => (/* binding */ getNiceRestaurantInfo)
|
|
77
|
+
/* harmony export */ "getNiceRestaurantInfo": () => (/* binding */ getNiceRestaurantInfo),
|
|
78
|
+
/* harmony export */ "logAction": () => (/* binding */ logAction)
|
|
78
79
|
/* harmony export */ });
|
|
79
80
|
const dayjs = __nccwpck_require__(7401)
|
|
80
81
|
const {hillo} = __nccwpck_require__(6365)
|
|
82
|
+
const version = (__nccwpck_require__(4147)/* .version */ .i8)
|
|
83
|
+
const colors = __nccwpck_require__(3045)
|
|
81
84
|
const defaultData = {
|
|
82
85
|
frontendVersion: '', cliVersion: '', diskUsage: '', upTime: '', ngrokIsNew: false
|
|
83
86
|
}
|
|
@@ -110,6 +113,21 @@ async function deviceEcho(data) {
|
|
|
110
113
|
console.log('report to remote server complete')
|
|
111
114
|
}
|
|
112
115
|
|
|
116
|
+
async function logAction(content) {
|
|
117
|
+
const deviceId = await getCurrentDeviceId()
|
|
118
|
+
console.log(
|
|
119
|
+
'*******************************************************\n' +
|
|
120
|
+
'命令执行成功 !!!'.bgCyan + '操作数据已经上传到服务器❤' + '\n' +
|
|
121
|
+
'*******************************************************'
|
|
122
|
+
)
|
|
123
|
+
await hillo.jsonPost("https://cloud-v2.aaden.io/deviceLog/createEvent", {
|
|
124
|
+
deviceId,
|
|
125
|
+
content,
|
|
126
|
+
type: '系统生成',
|
|
127
|
+
operator: "aaden-cli v" + version
|
|
128
|
+
})
|
|
129
|
+
}
|
|
130
|
+
|
|
113
131
|
async function getCurrentBackendVersion() {
|
|
114
132
|
return (await hillo.get('MyVersion.php?op=version', {}, {
|
|
115
133
|
mode: 'no-cors'
|
|
@@ -18459,7 +18477,7 @@ module.exports = JSON.parse('{"name":"axios","version":"0.19.2","description":"P
|
|
|
18459
18477
|
/***/ ((module) => {
|
|
18460
18478
|
|
|
18461
18479
|
"use strict";
|
|
18462
|
-
module.exports = {"i8":"1.6.
|
|
18480
|
+
module.exports = {"i8":"1.6.66"};
|
|
18463
18481
|
|
|
18464
18482
|
/***/ })
|
|
18465
18483
|
|
|
@@ -18541,7 +18559,7 @@ const colors = __nccwpck_require__(3045)
|
|
|
18541
18559
|
const fs = __nccwpck_require__(7147)
|
|
18542
18560
|
const InnerKenTimeStampFormat = 'YYYYMMDDHHmmss'
|
|
18543
18561
|
const prompts = __nccwpck_require__(9646)
|
|
18544
|
-
const {deviceEcho} = __nccwpck_require__(7415)
|
|
18562
|
+
const {deviceEcho,logAction} = __nccwpck_require__(7415)
|
|
18545
18563
|
const GlobalDeviceId = 'notset'
|
|
18546
18564
|
|
|
18547
18565
|
const {program} = __nccwpck_require__(1904)
|
|
@@ -18675,6 +18693,7 @@ function enterDatabase() {
|
|
|
18675
18693
|
|
|
18676
18694
|
async function fixNgrok() {
|
|
18677
18695
|
await run('AadenDeploy/Utils/enableNgrok.sh')
|
|
18696
|
+
logAction("手动修复了ngrok")
|
|
18678
18697
|
}
|
|
18679
18698
|
|
|
18680
18699
|
function testPrinter() {
|
|
@@ -18702,16 +18721,19 @@ function remountTSE() {
|
|
|
18702
18721
|
function enableTSE() {
|
|
18703
18722
|
const files = ['AadenDeploy/mountTSE.sh', 'AadenDeploy/Utils/tseReady.sh']
|
|
18704
18723
|
runMultiple(files)
|
|
18724
|
+
logAction("启用了TSE")
|
|
18705
18725
|
}
|
|
18706
18726
|
|
|
18707
18727
|
function fixCronJob() {
|
|
18708
18728
|
const files = ['AadenDeploy/Utils/fixCronJob.sh']
|
|
18709
18729
|
runMultiple(files)
|
|
18730
|
+
logAction("修复了Cronjob")
|
|
18710
18731
|
}
|
|
18711
18732
|
|
|
18712
18733
|
function exportTse() {
|
|
18713
18734
|
const files = ['AadenDeploy/Utils/exportTse.sh']
|
|
18714
18735
|
runMultiple(files)
|
|
18736
|
+
logAction("导出了TSE数据")
|
|
18715
18737
|
}
|
|
18716
18738
|
|
|
18717
18739
|
|
|
@@ -18770,6 +18792,7 @@ function fullUpdate() {
|
|
|
18770
18792
|
'sudo systemctl daemon-reload'
|
|
18771
18793
|
]
|
|
18772
18794
|
cli.executeInShell(command, program.debug)
|
|
18795
|
+
logAction("进行了full-update")
|
|
18773
18796
|
}
|
|
18774
18797
|
|
|
18775
18798
|
async function updateNgrokConfig(deviceId) {
|
|
@@ -18828,7 +18851,7 @@ async function doCompress() {
|
|
|
18828
18851
|
'sudo rm -rf backups'
|
|
18829
18852
|
]
|
|
18830
18853
|
cli.executeInShell(command, program.debug)
|
|
18831
|
-
|
|
18854
|
+
logAction("清理了空间")
|
|
18832
18855
|
}
|
|
18833
18856
|
|
|
18834
18857
|
async function backup() {
|
|
@@ -18853,6 +18876,7 @@ async function backup() {
|
|
|
18853
18876
|
]
|
|
18854
18877
|
|
|
18855
18878
|
cli.executeInShell(command, program.debug)
|
|
18879
|
+
logAction("执行了手动备份")
|
|
18856
18880
|
|
|
18857
18881
|
}
|
|
18858
18882
|
|
|
@@ -18985,6 +19009,7 @@ async function update(channel = '') {
|
|
|
18985
19009
|
`./update.sh ${channel}`
|
|
18986
19010
|
])
|
|
18987
19011
|
cli.executeInShell(command, program.debug)
|
|
19012
|
+
logAction("进行了手动更新update")
|
|
18988
19013
|
} catch (e) {
|
|
18989
19014
|
console.error(e)
|
|
18990
19015
|
}
|
|
@@ -19013,6 +19038,7 @@ async function install(deviceId) {
|
|
|
19013
19038
|
} else {
|
|
19014
19039
|
console.log('Device Id is invalid.')
|
|
19015
19040
|
}
|
|
19041
|
+
logAction("出厂安装")
|
|
19016
19042
|
}
|
|
19017
19043
|
|
|
19018
19044
|
function getMyDeviceId() {
|
|
@@ -19030,6 +19056,7 @@ async function autoUpgrade() {
|
|
|
19030
19056
|
await fixNgrok()
|
|
19031
19057
|
}
|
|
19032
19058
|
upgrade()
|
|
19059
|
+
logAction("自动执行了更新aaden-cli")
|
|
19033
19060
|
}
|
|
19034
19061
|
|
|
19035
19062
|
function upgrade() {
|
|
@@ -19118,6 +19145,7 @@ async function removeAllData() {
|
|
|
19118
19145
|
'mysql -u aaden -p < AadenDeploy/purge.sql'
|
|
19119
19146
|
]
|
|
19120
19147
|
cli.executeInShell(command, program.debug)
|
|
19148
|
+
logAction("清空了数据")
|
|
19121
19149
|
}
|
|
19122
19150
|
|
|
19123
19151
|
function getUpTime() {
|
package/index.js
CHANGED
|
@@ -8,7 +8,7 @@ const colors = require('colors')
|
|
|
8
8
|
const fs = require('fs')
|
|
9
9
|
const InnerKenTimeStampFormat = 'YYYYMMDDHHmmss'
|
|
10
10
|
const prompts = require('prompts')
|
|
11
|
-
const {deviceEcho} = require('./modules/firebase')
|
|
11
|
+
const {deviceEcho,logAction} = require('./modules/firebase')
|
|
12
12
|
const GlobalDeviceId = 'notset'
|
|
13
13
|
|
|
14
14
|
const {program} = require('commander')
|
|
@@ -142,6 +142,7 @@ function enterDatabase() {
|
|
|
142
142
|
|
|
143
143
|
async function fixNgrok() {
|
|
144
144
|
await run('AadenDeploy/Utils/enableNgrok.sh')
|
|
145
|
+
logAction("手动修复了ngrok")
|
|
145
146
|
}
|
|
146
147
|
|
|
147
148
|
function testPrinter() {
|
|
@@ -169,16 +170,19 @@ function remountTSE() {
|
|
|
169
170
|
function enableTSE() {
|
|
170
171
|
const files = ['AadenDeploy/mountTSE.sh', 'AadenDeploy/Utils/tseReady.sh']
|
|
171
172
|
runMultiple(files)
|
|
173
|
+
logAction("启用了TSE")
|
|
172
174
|
}
|
|
173
175
|
|
|
174
176
|
function fixCronJob() {
|
|
175
177
|
const files = ['AadenDeploy/Utils/fixCronJob.sh']
|
|
176
178
|
runMultiple(files)
|
|
179
|
+
logAction("修复了Cronjob")
|
|
177
180
|
}
|
|
178
181
|
|
|
179
182
|
function exportTse() {
|
|
180
183
|
const files = ['AadenDeploy/Utils/exportTse.sh']
|
|
181
184
|
runMultiple(files)
|
|
185
|
+
logAction("导出了TSE数据")
|
|
182
186
|
}
|
|
183
187
|
|
|
184
188
|
|
|
@@ -237,6 +241,7 @@ function fullUpdate() {
|
|
|
237
241
|
'sudo systemctl daemon-reload'
|
|
238
242
|
]
|
|
239
243
|
cli.executeInShell(command, program.debug)
|
|
244
|
+
logAction("进行了full-update")
|
|
240
245
|
}
|
|
241
246
|
|
|
242
247
|
async function updateNgrokConfig(deviceId) {
|
|
@@ -295,7 +300,7 @@ async function doCompress() {
|
|
|
295
300
|
'sudo rm -rf backups'
|
|
296
301
|
]
|
|
297
302
|
cli.executeInShell(command, program.debug)
|
|
298
|
-
|
|
303
|
+
logAction("清理了空间")
|
|
299
304
|
}
|
|
300
305
|
|
|
301
306
|
async function backup() {
|
|
@@ -320,6 +325,7 @@ async function backup() {
|
|
|
320
325
|
]
|
|
321
326
|
|
|
322
327
|
cli.executeInShell(command, program.debug)
|
|
328
|
+
logAction("执行了手动备份")
|
|
323
329
|
|
|
324
330
|
}
|
|
325
331
|
|
|
@@ -452,6 +458,7 @@ async function update(channel = '') {
|
|
|
452
458
|
`./update.sh ${channel}`
|
|
453
459
|
])
|
|
454
460
|
cli.executeInShell(command, program.debug)
|
|
461
|
+
logAction("进行了手动更新update")
|
|
455
462
|
} catch (e) {
|
|
456
463
|
console.error(e)
|
|
457
464
|
}
|
|
@@ -480,6 +487,7 @@ async function install(deviceId) {
|
|
|
480
487
|
} else {
|
|
481
488
|
console.log('Device Id is invalid.')
|
|
482
489
|
}
|
|
490
|
+
logAction("出厂安装")
|
|
483
491
|
}
|
|
484
492
|
|
|
485
493
|
function getMyDeviceId() {
|
|
@@ -497,6 +505,7 @@ async function autoUpgrade() {
|
|
|
497
505
|
await fixNgrok()
|
|
498
506
|
}
|
|
499
507
|
upgrade()
|
|
508
|
+
logAction("自动执行了更新aaden-cli")
|
|
500
509
|
}
|
|
501
510
|
|
|
502
511
|
function upgrade() {
|
|
@@ -585,6 +594,7 @@ async function removeAllData() {
|
|
|
585
594
|
'mysql -u aaden -p < AadenDeploy/purge.sql'
|
|
586
595
|
]
|
|
587
596
|
cli.executeInShell(command, program.debug)
|
|
597
|
+
logAction("清空了数据")
|
|
588
598
|
}
|
|
589
599
|
|
|
590
600
|
function getUpTime() {
|
package/modules/firebase.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
const dayjs = require("dayjs")
|
|
2
2
|
const {hillo} = require('hillo')
|
|
3
|
+
const version = require('./../package.json').version
|
|
4
|
+
const colors = require('colors')
|
|
3
5
|
const defaultData = {
|
|
4
6
|
frontendVersion: '', cliVersion: '', diskUsage: '', upTime: '', ngrokIsNew: false
|
|
5
7
|
}
|
|
@@ -32,6 +34,21 @@ export async function deviceEcho(data) {
|
|
|
32
34
|
console.log('report to remote server complete')
|
|
33
35
|
}
|
|
34
36
|
|
|
37
|
+
export async function logAction(content) {
|
|
38
|
+
const deviceId = await getCurrentDeviceId()
|
|
39
|
+
console.log(
|
|
40
|
+
'*******************************************************\n' +
|
|
41
|
+
'命令执行成功 !!!'.bgCyan + '操作数据已经上传到服务器❤' + '\n' +
|
|
42
|
+
'*******************************************************'
|
|
43
|
+
)
|
|
44
|
+
await hillo.jsonPost("https://cloud-v2.aaden.io/deviceLog/createEvent", {
|
|
45
|
+
deviceId,
|
|
46
|
+
content,
|
|
47
|
+
type: '系统生成',
|
|
48
|
+
operator: "aaden-cli v" + version
|
|
49
|
+
})
|
|
50
|
+
}
|
|
51
|
+
|
|
35
52
|
export async function getCurrentBackendVersion() {
|
|
36
53
|
return (await hillo.get('MyVersion.php?op=version', {}, {
|
|
37
54
|
mode: 'no-cors'
|