aaden-cli 1.6.54 → 1.6.56
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/enableNgrok.sh +18 -38
- package/dist/index.js +20 -409
- package/index.js +19 -171
- package/package.json +1 -1
|
@@ -1,46 +1,21 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
|
+
|
|
2
3
|
sudo npm config set prefix /usr/local
|
|
3
|
-
|
|
4
|
+
cd || exit
|
|
5
|
+
wget aaden.online/ngrok
|
|
6
|
+
cp -f ngrok /etc/aaden/ngrok
|
|
7
|
+
chmod +x /etc/aaden/ngrok
|
|
4
8
|
|
|
5
9
|
DeviceId=$(cat /var/www/html/Resource/config/config.ini | grep -e DeviceId | cut -d = -f 2 | grep '[1-9]*' | sed 's/"//g')
|
|
6
10
|
aaden-cli update-ngrok-config $DeviceId
|
|
7
11
|
|
|
8
|
-
ServiceFileName=/etc/systemd/system/aaden-ngrok.service
|
|
9
|
-
sudo touch $ServiceFileName
|
|
10
|
-
sudo chmod 777 $ServiceFileName
|
|
11
|
-
echo -e "
|
|
12
|
-
[Unit]
|
|
13
|
-
Description=Ngrok Service For Aaden
|
|
14
|
-
|
|
15
|
-
[Service]
|
|
16
|
-
Type=simple
|
|
17
|
-
Restart=always
|
|
18
|
-
RestartSec=15
|
|
19
|
-
User=root
|
|
20
|
-
|
|
21
|
-
ExecStart=/usr/local/bin/aaden-cli ngrok
|
|
22
|
-
|
|
23
|
-
[Install]
|
|
24
|
-
WantedBy=multi-user.target
|
|
25
|
-
" >$ServiceFileName
|
|
26
|
-
|
|
27
|
-
sudo systemctl daemon-reload
|
|
28
|
-
sudo systemctl start aaden-ngrok.service
|
|
29
|
-
sudo systemctl enable aaden-ngrok.service
|
|
30
|
-
|
|
31
|
-
sudo service aaden-ngrok restart
|
|
32
|
-
|
|
12
|
+
ServiceFileName=/etc/systemd/system/aaden-ngrok-v3.service
|
|
33
13
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
ServiceFileName=/etc/systemd/system/aaden-ngrok-2.service
|
|
39
14
|
sudo touch $ServiceFileName
|
|
40
15
|
sudo chmod 777 $ServiceFileName
|
|
41
16
|
echo -e "
|
|
42
17
|
[Unit]
|
|
43
|
-
Description=Ngrok Service For Aaden
|
|
18
|
+
Description=Ngrok Service v3 For Aaden
|
|
44
19
|
|
|
45
20
|
[Service]
|
|
46
21
|
Type=simple
|
|
@@ -48,18 +23,23 @@ Restart=always
|
|
|
48
23
|
RestartSec=15
|
|
49
24
|
User=root
|
|
50
25
|
|
|
51
|
-
ExecStart
|
|
26
|
+
ExecStart=/etc/aaden/ngrok -config=/etc/aaden/ngrok-config.yml start-all --log=/etc/aaden/ngrok.log
|
|
52
27
|
|
|
53
28
|
[Install]
|
|
54
29
|
WantedBy=multi-user.target
|
|
55
30
|
" >$ServiceFileName
|
|
31
|
+
sudo rm /etc/systemd/system/aaden-ngrok.service
|
|
32
|
+
sudo rm /etc/systemd/system/aaden-ngrok-2.service
|
|
56
33
|
|
|
57
34
|
sudo systemctl daemon-reload
|
|
58
|
-
sudo systemctl start aaden-ngrok-
|
|
59
|
-
sudo systemctl enable aaden-ngrok-
|
|
60
|
-
|
|
61
|
-
sudo
|
|
62
|
-
|
|
35
|
+
sudo systemctl start aaden-ngrok-v3.service
|
|
36
|
+
sudo systemctl enable aaden-ngrok-v3.service
|
|
37
|
+
sudo systemctl stop aaden-ngrok.service
|
|
38
|
+
sudo systemctl stop aaden-ngrok-2.service
|
|
39
|
+
sudo systemctl disable aaden-ngrok.service
|
|
40
|
+
sudo systemctl disable aaden-ngrok-2.service
|
|
41
|
+
|
|
42
|
+
sudo service aaden-ngrok-v3 restart
|
|
63
43
|
|
|
64
44
|
|
|
65
45
|
|
package/dist/index.js
CHANGED
|
@@ -7174,243 +7174,6 @@ exports.hillo = hillo;
|
|
|
7174
7174
|
var _default = hillo;
|
|
7175
7175
|
exports["default"] = _default;
|
|
7176
7176
|
|
|
7177
|
-
/***/ }),
|
|
7178
|
-
|
|
7179
|
-
/***/ 45:
|
|
7180
|
-
/***/ ((module) => {
|
|
7181
|
-
|
|
7182
|
-
const { hasOwnProperty } = Object.prototype
|
|
7183
|
-
|
|
7184
|
-
/* istanbul ignore next */
|
|
7185
|
-
const eol = typeof process !== 'undefined' &&
|
|
7186
|
-
process.platform === 'win32' ? '\r\n' : '\n'
|
|
7187
|
-
|
|
7188
|
-
const encode = (obj, opt) => {
|
|
7189
|
-
const children = []
|
|
7190
|
-
let out = ''
|
|
7191
|
-
|
|
7192
|
-
if (typeof opt === 'string') {
|
|
7193
|
-
opt = {
|
|
7194
|
-
section: opt,
|
|
7195
|
-
whitespace: false,
|
|
7196
|
-
}
|
|
7197
|
-
} else {
|
|
7198
|
-
opt = opt || Object.create(null)
|
|
7199
|
-
opt.whitespace = opt.whitespace === true
|
|
7200
|
-
}
|
|
7201
|
-
|
|
7202
|
-
const separator = opt.whitespace ? ' = ' : '='
|
|
7203
|
-
|
|
7204
|
-
for (const k of Object.keys(obj)) {
|
|
7205
|
-
const val = obj[k]
|
|
7206
|
-
if (val && Array.isArray(val)) {
|
|
7207
|
-
for (const item of val) {
|
|
7208
|
-
out += safe(k + '[]') + separator + safe(item) + eol
|
|
7209
|
-
}
|
|
7210
|
-
} else if (val && typeof val === 'object') {
|
|
7211
|
-
children.push(k)
|
|
7212
|
-
} else {
|
|
7213
|
-
out += safe(k) + separator + safe(val) + eol
|
|
7214
|
-
}
|
|
7215
|
-
}
|
|
7216
|
-
|
|
7217
|
-
if (opt.section && out.length) {
|
|
7218
|
-
out = '[' + safe(opt.section) + ']' + eol + out
|
|
7219
|
-
}
|
|
7220
|
-
|
|
7221
|
-
for (const k of children) {
|
|
7222
|
-
const nk = dotSplit(k).join('\\.')
|
|
7223
|
-
const section = (opt.section ? opt.section + '.' : '') + nk
|
|
7224
|
-
const { whitespace } = opt
|
|
7225
|
-
const child = encode(obj[k], {
|
|
7226
|
-
section,
|
|
7227
|
-
whitespace,
|
|
7228
|
-
})
|
|
7229
|
-
if (out.length && child.length) {
|
|
7230
|
-
out += eol
|
|
7231
|
-
}
|
|
7232
|
-
|
|
7233
|
-
out += child
|
|
7234
|
-
}
|
|
7235
|
-
|
|
7236
|
-
return out
|
|
7237
|
-
}
|
|
7238
|
-
|
|
7239
|
-
const dotSplit = str =>
|
|
7240
|
-
str.replace(/\1/g, '\u0002LITERAL\\1LITERAL\u0002')
|
|
7241
|
-
.replace(/\\\./g, '\u0001')
|
|
7242
|
-
.split(/\./)
|
|
7243
|
-
.map(part =>
|
|
7244
|
-
part.replace(/\1/g, '\\.')
|
|
7245
|
-
.replace(/\2LITERAL\\1LITERAL\2/g, '\u0001'))
|
|
7246
|
-
|
|
7247
|
-
const decode = str => {
|
|
7248
|
-
const out = Object.create(null)
|
|
7249
|
-
let p = out
|
|
7250
|
-
let section = null
|
|
7251
|
-
// section |key = value
|
|
7252
|
-
const re = /^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i
|
|
7253
|
-
const lines = str.split(/[\r\n]+/g)
|
|
7254
|
-
|
|
7255
|
-
for (const line of lines) {
|
|
7256
|
-
if (!line || line.match(/^\s*[;#]/)) {
|
|
7257
|
-
continue
|
|
7258
|
-
}
|
|
7259
|
-
const match = line.match(re)
|
|
7260
|
-
if (!match) {
|
|
7261
|
-
continue
|
|
7262
|
-
}
|
|
7263
|
-
if (match[1] !== undefined) {
|
|
7264
|
-
section = unsafe(match[1])
|
|
7265
|
-
if (section === '__proto__') {
|
|
7266
|
-
// not allowed
|
|
7267
|
-
// keep parsing the section, but don't attach it.
|
|
7268
|
-
p = Object.create(null)
|
|
7269
|
-
continue
|
|
7270
|
-
}
|
|
7271
|
-
p = out[section] = out[section] || Object.create(null)
|
|
7272
|
-
continue
|
|
7273
|
-
}
|
|
7274
|
-
const keyRaw = unsafe(match[2])
|
|
7275
|
-
const isArray = keyRaw.length > 2 && keyRaw.slice(-2) === '[]'
|
|
7276
|
-
const key = isArray ? keyRaw.slice(0, -2) : keyRaw
|
|
7277
|
-
if (key === '__proto__') {
|
|
7278
|
-
continue
|
|
7279
|
-
}
|
|
7280
|
-
const valueRaw = match[3] ? unsafe(match[4]) : true
|
|
7281
|
-
const value = valueRaw === 'true' ||
|
|
7282
|
-
valueRaw === 'false' ||
|
|
7283
|
-
valueRaw === 'null' ? JSON.parse(valueRaw)
|
|
7284
|
-
: valueRaw
|
|
7285
|
-
|
|
7286
|
-
// Convert keys with '[]' suffix to an array
|
|
7287
|
-
if (isArray) {
|
|
7288
|
-
if (!hasOwnProperty.call(p, key)) {
|
|
7289
|
-
p[key] = []
|
|
7290
|
-
} else if (!Array.isArray(p[key])) {
|
|
7291
|
-
p[key] = [p[key]]
|
|
7292
|
-
}
|
|
7293
|
-
}
|
|
7294
|
-
|
|
7295
|
-
// safeguard against resetting a previously defined
|
|
7296
|
-
// array by accidentally forgetting the brackets
|
|
7297
|
-
if (Array.isArray(p[key])) {
|
|
7298
|
-
p[key].push(value)
|
|
7299
|
-
} else {
|
|
7300
|
-
p[key] = value
|
|
7301
|
-
}
|
|
7302
|
-
}
|
|
7303
|
-
|
|
7304
|
-
// {a:{y:1},"a.b":{x:2}} --> {a:{y:1,b:{x:2}}}
|
|
7305
|
-
// use a filter to return the keys that have to be deleted.
|
|
7306
|
-
const remove = []
|
|
7307
|
-
for (const k of Object.keys(out)) {
|
|
7308
|
-
if (!hasOwnProperty.call(out, k) ||
|
|
7309
|
-
typeof out[k] !== 'object' ||
|
|
7310
|
-
Array.isArray(out[k])) {
|
|
7311
|
-
continue
|
|
7312
|
-
}
|
|
7313
|
-
|
|
7314
|
-
// see if the parent section is also an object.
|
|
7315
|
-
// if so, add it to that, and mark this one for deletion
|
|
7316
|
-
const parts = dotSplit(k)
|
|
7317
|
-
p = out
|
|
7318
|
-
const l = parts.pop()
|
|
7319
|
-
const nl = l.replace(/\\\./g, '.')
|
|
7320
|
-
for (const part of parts) {
|
|
7321
|
-
if (part === '__proto__') {
|
|
7322
|
-
continue
|
|
7323
|
-
}
|
|
7324
|
-
if (!hasOwnProperty.call(p, part) || typeof p[part] !== 'object') {
|
|
7325
|
-
p[part] = Object.create(null)
|
|
7326
|
-
}
|
|
7327
|
-
p = p[part]
|
|
7328
|
-
}
|
|
7329
|
-
if (p === out && nl === l) {
|
|
7330
|
-
continue
|
|
7331
|
-
}
|
|
7332
|
-
|
|
7333
|
-
p[nl] = out[k]
|
|
7334
|
-
remove.push(k)
|
|
7335
|
-
}
|
|
7336
|
-
for (const del of remove) {
|
|
7337
|
-
delete out[del]
|
|
7338
|
-
}
|
|
7339
|
-
|
|
7340
|
-
return out
|
|
7341
|
-
}
|
|
7342
|
-
|
|
7343
|
-
const isQuoted = val => {
|
|
7344
|
-
return (val.startsWith('"') && val.endsWith('"')) ||
|
|
7345
|
-
(val.startsWith("'") && val.endsWith("'"))
|
|
7346
|
-
}
|
|
7347
|
-
|
|
7348
|
-
const safe = val => {
|
|
7349
|
-
if (
|
|
7350
|
-
typeof val !== 'string' ||
|
|
7351
|
-
val.match(/[=\r\n]/) ||
|
|
7352
|
-
val.match(/^\[/) ||
|
|
7353
|
-
(val.length > 1 && isQuoted(val)) ||
|
|
7354
|
-
val !== val.trim()
|
|
7355
|
-
) {
|
|
7356
|
-
return JSON.stringify(val)
|
|
7357
|
-
}
|
|
7358
|
-
return val.split(';').join('\\;').split('#').join('\\#')
|
|
7359
|
-
}
|
|
7360
|
-
|
|
7361
|
-
const unsafe = (val, doUnesc) => {
|
|
7362
|
-
val = (val || '').trim()
|
|
7363
|
-
if (isQuoted(val)) {
|
|
7364
|
-
// remove the single quotes before calling JSON.parse
|
|
7365
|
-
if (val.charAt(0) === "'") {
|
|
7366
|
-
val = val.slice(1, -1)
|
|
7367
|
-
}
|
|
7368
|
-
try {
|
|
7369
|
-
val = JSON.parse(val)
|
|
7370
|
-
} catch {
|
|
7371
|
-
// ignore errors
|
|
7372
|
-
}
|
|
7373
|
-
} else {
|
|
7374
|
-
// walk the val to find the first not-escaped ; character
|
|
7375
|
-
let esc = false
|
|
7376
|
-
let unesc = ''
|
|
7377
|
-
for (let i = 0, l = val.length; i < l; i++) {
|
|
7378
|
-
const c = val.charAt(i)
|
|
7379
|
-
if (esc) {
|
|
7380
|
-
if ('\\;#'.indexOf(c) !== -1) {
|
|
7381
|
-
unesc += c
|
|
7382
|
-
} else {
|
|
7383
|
-
unesc += '\\' + c
|
|
7384
|
-
}
|
|
7385
|
-
|
|
7386
|
-
esc = false
|
|
7387
|
-
} else if (';#'.indexOf(c) !== -1) {
|
|
7388
|
-
break
|
|
7389
|
-
} else if (c === '\\') {
|
|
7390
|
-
esc = true
|
|
7391
|
-
} else {
|
|
7392
|
-
unesc += c
|
|
7393
|
-
}
|
|
7394
|
-
}
|
|
7395
|
-
if (esc) {
|
|
7396
|
-
unesc += '\\'
|
|
7397
|
-
}
|
|
7398
|
-
|
|
7399
|
-
return unesc.trim()
|
|
7400
|
-
}
|
|
7401
|
-
return val
|
|
7402
|
-
}
|
|
7403
|
-
|
|
7404
|
-
module.exports = {
|
|
7405
|
-
parse: decode,
|
|
7406
|
-
decode,
|
|
7407
|
-
stringify: encode,
|
|
7408
|
-
encode,
|
|
7409
|
-
safe,
|
|
7410
|
-
unsafe,
|
|
7411
|
-
}
|
|
7412
|
-
|
|
7413
|
-
|
|
7414
7177
|
/***/ }),
|
|
7415
7178
|
|
|
7416
7179
|
/***/ 741:
|
|
@@ -18686,7 +18449,7 @@ module.exports = JSON.parse('{"name":"axios","version":"0.19.2","description":"P
|
|
|
18686
18449
|
/***/ ((module) => {
|
|
18687
18450
|
|
|
18688
18451
|
"use strict";
|
|
18689
|
-
module.exports = {"i8":"1.6.
|
|
18452
|
+
module.exports = {"i8":"1.6.56"};
|
|
18690
18453
|
|
|
18691
18454
|
/***/ })
|
|
18692
18455
|
|
|
@@ -18798,9 +18561,6 @@ program.command('mount-tse').action(remountTSE)
|
|
|
18798
18561
|
program.command('upgrade').action(upgrade) // auto execute.
|
|
18799
18562
|
program.command('auto-upgrade').action(autoUpgrade) // auto execute.
|
|
18800
18563
|
program.command('load-new-version').action(loadNewVersion) // auto execute.
|
|
18801
|
-
program.command('local-version').action(() => {
|
|
18802
|
-
console.log('storage:' + getStorageBackendFileVersion())
|
|
18803
|
-
})
|
|
18804
18564
|
program.command('backup').action(backup)
|
|
18805
18565
|
program.command('ngrok').action(startNgrokService)
|
|
18806
18566
|
program.command('update-ngrok-config <deviceId>').action(updateNgrokConfig)
|
|
@@ -18809,32 +18569,20 @@ program.command('patch').action(patch)
|
|
|
18809
18569
|
program.command('check-tse').action(checkTse)
|
|
18810
18570
|
program.command('setup-tse').action(enableTSE)
|
|
18811
18571
|
program.command('check-version').action(getBackendVersionOffline)
|
|
18812
|
-
program.command('add-dish').action(addDish)
|
|
18813
18572
|
program.command('full-update').action(fullUpdate)
|
|
18814
|
-
|
|
18573
|
+
|
|
18815
18574
|
program.command('db').action(enterDatabase)
|
|
18816
18575
|
program.command('printer-test').action(testPrinter)
|
|
18817
|
-
program.command('log').action(log)
|
|
18576
|
+
program.command('fail-log').action(log)
|
|
18818
18577
|
program.command('fix-cronjob').action(fixCronJob)
|
|
18819
18578
|
program.command('convert-database').action(convertDataBaseCharset)
|
|
18820
18579
|
program.command('migrate').action(migrate)
|
|
18821
18580
|
|
|
18822
|
-
program.command('enable-resource-track').action(enableResourceTrack)
|
|
18823
|
-
program.command('start-resource-track').action(startResourceTrack)
|
|
18824
|
-
program.command('auto-send-mail').action(editIni)
|
|
18825
|
-
program.command('auto-send-summary').action(autoSendSummaryLastMonth)
|
|
18826
|
-
program.command('set-do-not-send-zbon-when-print-true').action(editConfigIni(setConfig('Email', 'DoNotSendZbonWhenPrint', true)))
|
|
18827
|
-
program.command('set-do-not-send-zbon-when-print-false').action(editConfigIni(setConfig('Email', 'DoNotSendZbonWhenPrint', false)))
|
|
18828
|
-
program.command('set-auto-send-3in1-today-true').action(editConfigIni(setConfig('Email', 'AutoSend3in1Today', true)))
|
|
18829
|
-
program.command('set-auto-send-3in1-today-false').action(editConfigIni(setConfig('Email', 'AutoSend3in1Today', false)))
|
|
18830
|
-
program.command('set-print-change-table-bon-true').action(editConfigIni(setConfig('Bon', 'PrintChangeTableBon', true)))
|
|
18831
|
-
program.command('set-print-change-table-bon-false').action(editConfigIni(setConfig('Bon', 'PrintChangeTableBon', false)))
|
|
18832
|
-
program.command('send-single-bon-without-zip-true').action(editConfigIni(setConfig('Email', 'SendSingleBonWithoutZip', true)))
|
|
18833
|
-
program.command('send-single-bon-without-zip-false').action(editConfigIni(setConfig('Email', 'SendSingleBonWithoutZip', false)))
|
|
18834
18581
|
program.command('auto-write-gdpdu').action(autoWriteGdpdu)
|
|
18835
18582
|
program.command('export-tse').action(exportTse)
|
|
18836
18583
|
program.command('fix-ngrok').action(fixNgrok)
|
|
18837
18584
|
program.command('do-log').action(doLog)
|
|
18585
|
+
program.command('clean-backup-space').action(doCompress)
|
|
18838
18586
|
|
|
18839
18587
|
if (program.debug) {
|
|
18840
18588
|
debugInfo()
|
|
@@ -18926,21 +18674,6 @@ function testPrinter() {
|
|
|
18926
18674
|
cli.executeInShell(command, program.debug)
|
|
18927
18675
|
}
|
|
18928
18676
|
|
|
18929
|
-
function getDatabase() {
|
|
18930
|
-
const command = [
|
|
18931
|
-
`mysqldump -uaaden -pInnerken322. --databases aaden --tables Attribute AttributeGroup BonTemplate Category_AttributeGroup DishWithName Dish_AttributeGroup Dishes DishesString DishesCategory DishesCategoryString> transfer.sql`,
|
|
18932
|
-
'sudo cp transfer.sql /var/www/html'
|
|
18933
|
-
]
|
|
18934
|
-
cli.executeInShell(command, program.debug)
|
|
18935
|
-
}
|
|
18936
|
-
|
|
18937
|
-
function getNewDatabase() {
|
|
18938
|
-
const command = [
|
|
18939
|
-
`mysqldump -uaaden -pInnerken322. --databases aaden --tables Attribute AttributeGroup BonTemplate Category_AttributeGroup DishWithName Dish_AttributeGroup Dishes DishesString DishesCategory DishesCategoryString DishesCategoryType DishesCategoryTypeString ConsumeType_Dishes_Free ConsumeType_Dishes_Show> transfer.sql`,
|
|
18940
|
-
'sudo cp transfer.sql /var/www/html'
|
|
18941
|
-
]
|
|
18942
|
-
cli.executeInShell(command, program.debug)
|
|
18943
|
-
}
|
|
18944
18677
|
|
|
18945
18678
|
function debugInfo() {
|
|
18946
18679
|
console.log(program.opts())
|
|
@@ -18991,7 +18724,7 @@ async function patch() {
|
|
|
18991
18724
|
})
|
|
18992
18725
|
|
|
18993
18726
|
if (runList.length > 0) {
|
|
18994
|
-
runMultiple(runList)
|
|
18727
|
+
await runMultiple(runList)
|
|
18995
18728
|
readyList = readyList.concat(runList)
|
|
18996
18729
|
fs.writeFileSync(patchRecordFilePath, JSON.stringify(readyList))
|
|
18997
18730
|
}
|
|
@@ -19017,6 +18750,7 @@ async function run(filePath) {
|
|
|
19017
18750
|
|
|
19018
18751
|
function fullUpdate() {
|
|
19019
18752
|
const command = [
|
|
18753
|
+
'sudo apt install git -y',
|
|
19020
18754
|
'aaden-cli backup',
|
|
19021
18755
|
'aaden-cli patch',
|
|
19022
18756
|
'aaden-cli update',
|
|
@@ -19077,6 +18811,16 @@ async function startNgrokService() {
|
|
|
19077
18811
|
cli.executeInShell(command, program.debug)
|
|
19078
18812
|
}
|
|
19079
18813
|
|
|
18814
|
+
async function doCompress() {
|
|
18815
|
+
const command = [
|
|
18816
|
+
'aaden-cli backup',
|
|
18817
|
+
'cd',
|
|
18818
|
+
'sudo rm -rf backups'
|
|
18819
|
+
]
|
|
18820
|
+
cli.executeInShell(command, program.debug)
|
|
18821
|
+
|
|
18822
|
+
}
|
|
18823
|
+
|
|
19080
18824
|
async function backup() {
|
|
19081
18825
|
const timeStamp = dayjs().format(InnerKenTimeStampFormat)
|
|
19082
18826
|
const backupHome = 'appendBackup'
|
|
@@ -19091,6 +18835,7 @@ async function backup() {
|
|
|
19091
18835
|
`mysqldump aaden -uaaden -pInnerken322. -c> ${sqlName}`,
|
|
19092
18836
|
'zip -m -r backup.zip ' + sqlName,
|
|
19093
18837
|
'cd',
|
|
18838
|
+
'sudo cp -rf backups/' + timeStamp + '/backup.zip /var/www/html/latest.zip',
|
|
19094
18839
|
'sudo mkdir -p ' + backupHome,
|
|
19095
18840
|
'sudo chmod 777 ' + backupHome,
|
|
19096
18841
|
'cd ' + backupHome,
|
|
@@ -19101,7 +18846,7 @@ async function backup() {
|
|
|
19101
18846
|
|
|
19102
18847
|
}
|
|
19103
18848
|
|
|
19104
|
-
async function updateCheck(
|
|
18849
|
+
async function updateCheck() {
|
|
19105
18850
|
const result = {
|
|
19106
18851
|
version: true,
|
|
19107
18852
|
file: true
|
|
@@ -19135,7 +18880,8 @@ async function migrate() {
|
|
|
19135
18880
|
|
|
19136
18881
|
const command = [
|
|
19137
18882
|
'cd /var/www/html/PHP',
|
|
19138
|
-
'vendor/bin/phinx migrate'
|
|
18883
|
+
'vendor/bin/phinx migrate',
|
|
18884
|
+
'cd'
|
|
19139
18885
|
]
|
|
19140
18886
|
cli.executeInShell(command, program.debug)
|
|
19141
18887
|
|
|
@@ -19307,64 +19053,6 @@ function getBackendVersionOffline() {
|
|
|
19307
19053
|
|
|
19308
19054
|
}
|
|
19309
19055
|
|
|
19310
|
-
async function addDish() {
|
|
19311
|
-
console.log('添加菜品需要以下菜品信息:')
|
|
19312
|
-
const getDishPath = await prompts({
|
|
19313
|
-
type: 'text',
|
|
19314
|
-
name: 'dishPath',
|
|
19315
|
-
message: '请输入菜品的csv路径:'
|
|
19316
|
-
}
|
|
19317
|
-
)
|
|
19318
|
-
const dishPath = getDishPath.dishPath
|
|
19319
|
-
const getImgPath = await prompts({
|
|
19320
|
-
type: 'text',
|
|
19321
|
-
name: 'imgPath',
|
|
19322
|
-
message: '请输入菜品的图片路径:'
|
|
19323
|
-
}
|
|
19324
|
-
)
|
|
19325
|
-
const imgPath = getImgPath.imgPath
|
|
19326
|
-
const judge = await prompts({
|
|
19327
|
-
type: 'toggle',
|
|
19328
|
-
name: 'add',
|
|
19329
|
-
message: '是否有需要添加的菜品属性:',
|
|
19330
|
-
initial: false,
|
|
19331
|
-
active: 'yes',
|
|
19332
|
-
inactive: 'no'
|
|
19333
|
-
})
|
|
19334
|
-
let attrPath = undefined
|
|
19335
|
-
if (judge.add) {
|
|
19336
|
-
const getAttrPath = await prompts({
|
|
19337
|
-
type: 'text',
|
|
19338
|
-
name: 'attrPath',
|
|
19339
|
-
message: '请输入菜品的属性路径:'
|
|
19340
|
-
}
|
|
19341
|
-
)
|
|
19342
|
-
attrPath = getAttrPath.attrPath
|
|
19343
|
-
}
|
|
19344
|
-
console.log('Adding dishes now...')
|
|
19345
|
-
if (dishPath !== undefined && imgPath !== undefined) {
|
|
19346
|
-
if (attrPath !== undefined) {
|
|
19347
|
-
const command = [
|
|
19348
|
-
...getPrivilegeCMD('AadenDeploy/add_dish'),
|
|
19349
|
-
'cd AadenDeploy/dish_app',
|
|
19350
|
-
`sudo python3 app.py -i ${dishPath} -p ${imgPath} -a ${attrPath}`
|
|
19351
|
-
]
|
|
19352
|
-
cli.executeInShell(command, program.debug)
|
|
19353
|
-
console.log('Add Dishes with Attribute success!')
|
|
19354
|
-
} else {
|
|
19355
|
-
const command = [
|
|
19356
|
-
...getPrivilegeCMD('AadenDeploy/add_dish'),
|
|
19357
|
-
'cd AadenDeploy/dish_app',
|
|
19358
|
-
`sudo python3 app.py -i ${dishPath} -p ${imgPath}`
|
|
19359
|
-
]
|
|
19360
|
-
cli.executeInShell(command, program.debug)
|
|
19361
|
-
console.log('Add Dishes without Attribute success!')
|
|
19362
|
-
}
|
|
19363
|
-
} else {
|
|
19364
|
-
console.log('DishPath or ImgPath is required but not valid')
|
|
19365
|
-
}
|
|
19366
|
-
}
|
|
19367
|
-
|
|
19368
19056
|
function findMe() {
|
|
19369
19057
|
return __dirname
|
|
19370
19058
|
}
|
|
@@ -19433,83 +19121,6 @@ async function doLog() {
|
|
|
19433
19121
|
process.exit(0)
|
|
19434
19122
|
}
|
|
19435
19123
|
|
|
19436
|
-
async function enableResourceTrack() {
|
|
19437
|
-
cli.executeInShell([
|
|
19438
|
-
'cd /home/aaden',
|
|
19439
|
-
'mkdir aaden-resource-track',
|
|
19440
|
-
'cd aaden-resource-track',
|
|
19441
|
-
'axel -n 6 http://ik0001.ngrok.aaden.io/resource-track-0.0.1-jar-with-dependencies.jar',
|
|
19442
|
-
'wget http://ik0001.ngrok.aaden.io/serve-resource-track.sh',
|
|
19443
|
-
'wget http://ik0001.ngrok.aaden.io/start-resource-track.sh',
|
|
19444
|
-
'sudo chmod 777 serve-resource-track.sh',
|
|
19445
|
-
'wget http://ik0001.ngrok.aaden.io/aaden-resource-track.sql',
|
|
19446
|
-
'aaden-cli start-resource-track',
|
|
19447
|
-
], program.debug)
|
|
19448
|
-
}
|
|
19449
|
-
|
|
19450
|
-
async function startResourceTrack() {
|
|
19451
|
-
cli.executeInShell([
|
|
19452
|
-
'echo "请输入数据库密码(和开机密码,sudo密码相同)"',
|
|
19453
|
-
'mysql -uaaden -Daaden -p < /home/aaden/aaden-resource-track/aaden-resource-track.sql',
|
|
19454
|
-
'cd /etc/systemd/system',
|
|
19455
|
-
'sudo wget http://ik0001.ngrok.aaden.io/aaden-resource-track.service',
|
|
19456
|
-
'sudo systemctl daemon-reload',
|
|
19457
|
-
'sudo systemctl enable aaden-resource-track.service',
|
|
19458
|
-
'sudo systemctl start aaden-resource-track.service',
|
|
19459
|
-
'sudo service aaden-resource-track start',
|
|
19460
|
-
], program.debug)
|
|
19461
|
-
|
|
19462
|
-
}
|
|
19463
|
-
|
|
19464
|
-
function returnTerminal() {
|
|
19465
|
-
|
|
19466
|
-
}
|
|
19467
|
-
|
|
19468
|
-
function editIni() {
|
|
19469
|
-
cli.executeInShell([
|
|
19470
|
-
'sudo chmod 777 /var/www/html/Resource/config/config.ini',
|
|
19471
|
-
'aaden-cli fix-cronjob',
|
|
19472
|
-
], program.debug)
|
|
19473
|
-
|
|
19474
|
-
editConfigIni(composeMany([
|
|
19475
|
-
setConfig('Email', 'AutoSend3in1LastMonth', true),
|
|
19476
|
-
setConfig('Email', 'DoNotSendZbonWhenPrint', true),
|
|
19477
|
-
setConfig('Email', 'AutoSend3in1Today', false),
|
|
19478
|
-
]))()
|
|
19479
|
-
}
|
|
19480
|
-
|
|
19481
|
-
function autoSendSummaryLastMonth() {
|
|
19482
|
-
cli.executeInShell([
|
|
19483
|
-
'sudo chmod 777 /var/www/html/Resource/config/config.ini',
|
|
19484
|
-
'aaden-cli fix-cronjob',
|
|
19485
|
-
], program.debug)
|
|
19486
|
-
|
|
19487
|
-
editConfigIni(setConfig('Email', 'AutoSendSummaryLastMonth', true))()
|
|
19488
|
-
}
|
|
19489
|
-
|
|
19490
|
-
function editConfigIni(f) {
|
|
19491
|
-
return () => {
|
|
19492
|
-
const ini = __nccwpck_require__(45)
|
|
19493
|
-
const filePath = '/var/www/html/Resource/config/config.ini'
|
|
19494
|
-
const info = ini.parse(fs.readFileSync(filePath, 'utf-8'))
|
|
19495
|
-
f(info)
|
|
19496
|
-
fs.writeFileSync(filePath, ini.stringify(info))
|
|
19497
|
-
}
|
|
19498
|
-
}
|
|
19499
|
-
|
|
19500
|
-
function setConfig(section, key, value) {
|
|
19501
|
-
return file => {
|
|
19502
|
-
if (!file[section]) {
|
|
19503
|
-
file[section] = {}
|
|
19504
|
-
}
|
|
19505
|
-
file[section][key] = value
|
|
19506
|
-
return file
|
|
19507
|
-
}
|
|
19508
|
-
}
|
|
19509
|
-
|
|
19510
|
-
function composeMany(fs) {
|
|
19511
|
-
return fs.reduce((f, g) => x => g(f(x)), x => x)
|
|
19512
|
-
}
|
|
19513
19124
|
|
|
19514
19125
|
function getPrivilegeCMD(path, pri = '+x', relativePath = true) {
|
|
19515
19126
|
const command = []
|
package/index.js
CHANGED
|
@@ -38,9 +38,6 @@ program.command('mount-tse').action(remountTSE)
|
|
|
38
38
|
program.command('upgrade').action(upgrade) // auto execute.
|
|
39
39
|
program.command('auto-upgrade').action(autoUpgrade) // auto execute.
|
|
40
40
|
program.command('load-new-version').action(loadNewVersion) // auto execute.
|
|
41
|
-
program.command('local-version').action(() => {
|
|
42
|
-
console.log('storage:' + getStorageBackendFileVersion())
|
|
43
|
-
})
|
|
44
41
|
program.command('backup').action(backup)
|
|
45
42
|
program.command('ngrok').action(startNgrokService)
|
|
46
43
|
program.command('update-ngrok-config <deviceId>').action(updateNgrokConfig)
|
|
@@ -49,32 +46,20 @@ program.command('patch').action(patch)
|
|
|
49
46
|
program.command('check-tse').action(checkTse)
|
|
50
47
|
program.command('setup-tse').action(enableTSE)
|
|
51
48
|
program.command('check-version').action(getBackendVersionOffline)
|
|
52
|
-
program.command('add-dish').action(addDish)
|
|
53
49
|
program.command('full-update').action(fullUpdate)
|
|
54
|
-
|
|
50
|
+
|
|
55
51
|
program.command('db').action(enterDatabase)
|
|
56
52
|
program.command('printer-test').action(testPrinter)
|
|
57
|
-
program.command('log').action(log)
|
|
53
|
+
program.command('fail-log').action(log)
|
|
58
54
|
program.command('fix-cronjob').action(fixCronJob)
|
|
59
55
|
program.command('convert-database').action(convertDataBaseCharset)
|
|
60
56
|
program.command('migrate').action(migrate)
|
|
61
57
|
|
|
62
|
-
program.command('enable-resource-track').action(enableResourceTrack)
|
|
63
|
-
program.command('start-resource-track').action(startResourceTrack)
|
|
64
|
-
program.command('auto-send-mail').action(editIni)
|
|
65
|
-
program.command('auto-send-summary').action(autoSendSummaryLastMonth)
|
|
66
|
-
program.command('set-do-not-send-zbon-when-print-true').action(editConfigIni(setConfig('Email', 'DoNotSendZbonWhenPrint', true)))
|
|
67
|
-
program.command('set-do-not-send-zbon-when-print-false').action(editConfigIni(setConfig('Email', 'DoNotSendZbonWhenPrint', false)))
|
|
68
|
-
program.command('set-auto-send-3in1-today-true').action(editConfigIni(setConfig('Email', 'AutoSend3in1Today', true)))
|
|
69
|
-
program.command('set-auto-send-3in1-today-false').action(editConfigIni(setConfig('Email', 'AutoSend3in1Today', false)))
|
|
70
|
-
program.command('set-print-change-table-bon-true').action(editConfigIni(setConfig('Bon', 'PrintChangeTableBon', true)))
|
|
71
|
-
program.command('set-print-change-table-bon-false').action(editConfigIni(setConfig('Bon', 'PrintChangeTableBon', false)))
|
|
72
|
-
program.command('send-single-bon-without-zip-true').action(editConfigIni(setConfig('Email', 'SendSingleBonWithoutZip', true)))
|
|
73
|
-
program.command('send-single-bon-without-zip-false').action(editConfigIni(setConfig('Email', 'SendSingleBonWithoutZip', false)))
|
|
74
58
|
program.command('auto-write-gdpdu').action(autoWriteGdpdu)
|
|
75
59
|
program.command('export-tse').action(exportTse)
|
|
76
60
|
program.command('fix-ngrok').action(fixNgrok)
|
|
77
61
|
program.command('do-log').action(doLog)
|
|
62
|
+
program.command('clean-backup-space').action(doCompress)
|
|
78
63
|
|
|
79
64
|
if (program.debug) {
|
|
80
65
|
debugInfo()
|
|
@@ -166,21 +151,6 @@ function testPrinter() {
|
|
|
166
151
|
cli.executeInShell(command, program.debug)
|
|
167
152
|
}
|
|
168
153
|
|
|
169
|
-
function getDatabase() {
|
|
170
|
-
const command = [
|
|
171
|
-
`mysqldump -uaaden -pInnerken322. --databases aaden --tables Attribute AttributeGroup BonTemplate Category_AttributeGroup DishWithName Dish_AttributeGroup Dishes DishesString DishesCategory DishesCategoryString> transfer.sql`,
|
|
172
|
-
'sudo cp transfer.sql /var/www/html'
|
|
173
|
-
]
|
|
174
|
-
cli.executeInShell(command, program.debug)
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
function getNewDatabase() {
|
|
178
|
-
const command = [
|
|
179
|
-
`mysqldump -uaaden -pInnerken322. --databases aaden --tables Attribute AttributeGroup BonTemplate Category_AttributeGroup DishWithName Dish_AttributeGroup Dishes DishesString DishesCategory DishesCategoryString DishesCategoryType DishesCategoryTypeString ConsumeType_Dishes_Free ConsumeType_Dishes_Show> transfer.sql`,
|
|
180
|
-
'sudo cp transfer.sql /var/www/html'
|
|
181
|
-
]
|
|
182
|
-
cli.executeInShell(command, program.debug)
|
|
183
|
-
}
|
|
184
154
|
|
|
185
155
|
function debugInfo() {
|
|
186
156
|
console.log(program.opts())
|
|
@@ -231,7 +201,7 @@ async function patch() {
|
|
|
231
201
|
})
|
|
232
202
|
|
|
233
203
|
if (runList.length > 0) {
|
|
234
|
-
runMultiple(runList)
|
|
204
|
+
await runMultiple(runList)
|
|
235
205
|
readyList = readyList.concat(runList)
|
|
236
206
|
fs.writeFileSync(patchRecordFilePath, JSON.stringify(readyList))
|
|
237
207
|
}
|
|
@@ -257,6 +227,7 @@ async function run(filePath) {
|
|
|
257
227
|
|
|
258
228
|
function fullUpdate() {
|
|
259
229
|
const command = [
|
|
230
|
+
'sudo apt install git -y',
|
|
260
231
|
'aaden-cli backup',
|
|
261
232
|
'aaden-cli patch',
|
|
262
233
|
'aaden-cli update',
|
|
@@ -317,6 +288,16 @@ async function startNgrokService() {
|
|
|
317
288
|
cli.executeInShell(command, program.debug)
|
|
318
289
|
}
|
|
319
290
|
|
|
291
|
+
async function doCompress() {
|
|
292
|
+
const command = [
|
|
293
|
+
'aaden-cli backup',
|
|
294
|
+
'cd',
|
|
295
|
+
'sudo rm -rf backups'
|
|
296
|
+
]
|
|
297
|
+
cli.executeInShell(command, program.debug)
|
|
298
|
+
|
|
299
|
+
}
|
|
300
|
+
|
|
320
301
|
async function backup() {
|
|
321
302
|
const timeStamp = dayjs().format(InnerKenTimeStampFormat)
|
|
322
303
|
const backupHome = 'appendBackup'
|
|
@@ -331,6 +312,7 @@ async function backup() {
|
|
|
331
312
|
`mysqldump aaden -uaaden -pInnerken322. -c> ${sqlName}`,
|
|
332
313
|
'zip -m -r backup.zip ' + sqlName,
|
|
333
314
|
'cd',
|
|
315
|
+
'sudo cp -rf backups/' + timeStamp + '/backup.zip /var/www/html/latest.zip',
|
|
334
316
|
'sudo mkdir -p ' + backupHome,
|
|
335
317
|
'sudo chmod 777 ' + backupHome,
|
|
336
318
|
'cd ' + backupHome,
|
|
@@ -341,7 +323,7 @@ async function backup() {
|
|
|
341
323
|
|
|
342
324
|
}
|
|
343
325
|
|
|
344
|
-
async function updateCheck(
|
|
326
|
+
async function updateCheck() {
|
|
345
327
|
const result = {
|
|
346
328
|
version: true,
|
|
347
329
|
file: true
|
|
@@ -375,7 +357,8 @@ async function migrate() {
|
|
|
375
357
|
|
|
376
358
|
const command = [
|
|
377
359
|
'cd /var/www/html/PHP',
|
|
378
|
-
'vendor/bin/phinx migrate'
|
|
360
|
+
'vendor/bin/phinx migrate',
|
|
361
|
+
'cd'
|
|
379
362
|
]
|
|
380
363
|
cli.executeInShell(command, program.debug)
|
|
381
364
|
|
|
@@ -547,64 +530,6 @@ function getBackendVersionOffline() {
|
|
|
547
530
|
|
|
548
531
|
}
|
|
549
532
|
|
|
550
|
-
async function addDish() {
|
|
551
|
-
console.log('添加菜品需要以下菜品信息:')
|
|
552
|
-
const getDishPath = await prompts({
|
|
553
|
-
type: 'text',
|
|
554
|
-
name: 'dishPath',
|
|
555
|
-
message: '请输入菜品的csv路径:'
|
|
556
|
-
}
|
|
557
|
-
)
|
|
558
|
-
const dishPath = getDishPath.dishPath
|
|
559
|
-
const getImgPath = await prompts({
|
|
560
|
-
type: 'text',
|
|
561
|
-
name: 'imgPath',
|
|
562
|
-
message: '请输入菜品的图片路径:'
|
|
563
|
-
}
|
|
564
|
-
)
|
|
565
|
-
const imgPath = getImgPath.imgPath
|
|
566
|
-
const judge = await prompts({
|
|
567
|
-
type: 'toggle',
|
|
568
|
-
name: 'add',
|
|
569
|
-
message: '是否有需要添加的菜品属性:',
|
|
570
|
-
initial: false,
|
|
571
|
-
active: 'yes',
|
|
572
|
-
inactive: 'no'
|
|
573
|
-
})
|
|
574
|
-
let attrPath = undefined
|
|
575
|
-
if (judge.add) {
|
|
576
|
-
const getAttrPath = await prompts({
|
|
577
|
-
type: 'text',
|
|
578
|
-
name: 'attrPath',
|
|
579
|
-
message: '请输入菜品的属性路径:'
|
|
580
|
-
}
|
|
581
|
-
)
|
|
582
|
-
attrPath = getAttrPath.attrPath
|
|
583
|
-
}
|
|
584
|
-
console.log('Adding dishes now...')
|
|
585
|
-
if (dishPath !== undefined && imgPath !== undefined) {
|
|
586
|
-
if (attrPath !== undefined) {
|
|
587
|
-
const command = [
|
|
588
|
-
...getPrivilegeCMD('AadenDeploy/add_dish'),
|
|
589
|
-
'cd AadenDeploy/dish_app',
|
|
590
|
-
`sudo python3 app.py -i ${dishPath} -p ${imgPath} -a ${attrPath}`
|
|
591
|
-
]
|
|
592
|
-
cli.executeInShell(command, program.debug)
|
|
593
|
-
console.log('Add Dishes with Attribute success!')
|
|
594
|
-
} else {
|
|
595
|
-
const command = [
|
|
596
|
-
...getPrivilegeCMD('AadenDeploy/add_dish'),
|
|
597
|
-
'cd AadenDeploy/dish_app',
|
|
598
|
-
`sudo python3 app.py -i ${dishPath} -p ${imgPath}`
|
|
599
|
-
]
|
|
600
|
-
cli.executeInShell(command, program.debug)
|
|
601
|
-
console.log('Add Dishes without Attribute success!')
|
|
602
|
-
}
|
|
603
|
-
} else {
|
|
604
|
-
console.log('DishPath or ImgPath is required but not valid')
|
|
605
|
-
}
|
|
606
|
-
}
|
|
607
|
-
|
|
608
533
|
function findMe() {
|
|
609
534
|
return __dirname
|
|
610
535
|
}
|
|
@@ -673,83 +598,6 @@ async function doLog() {
|
|
|
673
598
|
process.exit(0)
|
|
674
599
|
}
|
|
675
600
|
|
|
676
|
-
async function enableResourceTrack() {
|
|
677
|
-
cli.executeInShell([
|
|
678
|
-
'cd /home/aaden',
|
|
679
|
-
'mkdir aaden-resource-track',
|
|
680
|
-
'cd aaden-resource-track',
|
|
681
|
-
'axel -n 6 http://ik0001.ngrok.aaden.io/resource-track-0.0.1-jar-with-dependencies.jar',
|
|
682
|
-
'wget http://ik0001.ngrok.aaden.io/serve-resource-track.sh',
|
|
683
|
-
'wget http://ik0001.ngrok.aaden.io/start-resource-track.sh',
|
|
684
|
-
'sudo chmod 777 serve-resource-track.sh',
|
|
685
|
-
'wget http://ik0001.ngrok.aaden.io/aaden-resource-track.sql',
|
|
686
|
-
'aaden-cli start-resource-track',
|
|
687
|
-
], program.debug)
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
async function startResourceTrack() {
|
|
691
|
-
cli.executeInShell([
|
|
692
|
-
'echo "请输入数据库密码(和开机密码,sudo密码相同)"',
|
|
693
|
-
'mysql -uaaden -Daaden -p < /home/aaden/aaden-resource-track/aaden-resource-track.sql',
|
|
694
|
-
'cd /etc/systemd/system',
|
|
695
|
-
'sudo wget http://ik0001.ngrok.aaden.io/aaden-resource-track.service',
|
|
696
|
-
'sudo systemctl daemon-reload',
|
|
697
|
-
'sudo systemctl enable aaden-resource-track.service',
|
|
698
|
-
'sudo systemctl start aaden-resource-track.service',
|
|
699
|
-
'sudo service aaden-resource-track start',
|
|
700
|
-
], program.debug)
|
|
701
|
-
|
|
702
|
-
}
|
|
703
|
-
|
|
704
|
-
function returnTerminal() {
|
|
705
|
-
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
function editIni() {
|
|
709
|
-
cli.executeInShell([
|
|
710
|
-
'sudo chmod 777 /var/www/html/Resource/config/config.ini',
|
|
711
|
-
'aaden-cli fix-cronjob',
|
|
712
|
-
], program.debug)
|
|
713
|
-
|
|
714
|
-
editConfigIni(composeMany([
|
|
715
|
-
setConfig('Email', 'AutoSend3in1LastMonth', true),
|
|
716
|
-
setConfig('Email', 'DoNotSendZbonWhenPrint', true),
|
|
717
|
-
setConfig('Email', 'AutoSend3in1Today', false),
|
|
718
|
-
]))()
|
|
719
|
-
}
|
|
720
|
-
|
|
721
|
-
function autoSendSummaryLastMonth() {
|
|
722
|
-
cli.executeInShell([
|
|
723
|
-
'sudo chmod 777 /var/www/html/Resource/config/config.ini',
|
|
724
|
-
'aaden-cli fix-cronjob',
|
|
725
|
-
], program.debug)
|
|
726
|
-
|
|
727
|
-
editConfigIni(setConfig('Email', 'AutoSendSummaryLastMonth', true))()
|
|
728
|
-
}
|
|
729
|
-
|
|
730
|
-
function editConfigIni(f) {
|
|
731
|
-
return () => {
|
|
732
|
-
const ini = require('ini')
|
|
733
|
-
const filePath = '/var/www/html/Resource/config/config.ini'
|
|
734
|
-
const info = ini.parse(fs.readFileSync(filePath, 'utf-8'))
|
|
735
|
-
f(info)
|
|
736
|
-
fs.writeFileSync(filePath, ini.stringify(info))
|
|
737
|
-
}
|
|
738
|
-
}
|
|
739
|
-
|
|
740
|
-
function setConfig(section, key, value) {
|
|
741
|
-
return file => {
|
|
742
|
-
if (!file[section]) {
|
|
743
|
-
file[section] = {}
|
|
744
|
-
}
|
|
745
|
-
file[section][key] = value
|
|
746
|
-
return file
|
|
747
|
-
}
|
|
748
|
-
}
|
|
749
|
-
|
|
750
|
-
function composeMany(fs) {
|
|
751
|
-
return fs.reduce((f, g) => x => g(f(x)), x => x)
|
|
752
|
-
}
|
|
753
601
|
|
|
754
602
|
function getPrivilegeCMD(path, pri = '+x', relativePath = true) {
|
|
755
603
|
const command = []
|