@syngrisi/syngrisi 2.2.3 → 2.2.5
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/tsconfig.tsbuildinfo +1 -1
- package/mvc/views/react/admin/index.html +4 -4
- package/mvc/views/react/assets/{LogicalGroup.6c0a9f4a.js → LogicalGroup.0c7b572b.js} +20 -27
- package/mvc/views/react/assets/{PasswordInput.b97a4ef7.js → PasswordInput.85496f1d.js} +1 -1
- package/mvc/views/react/assets/{admin.6d843d1b.js → admin.a2a37a4a.js} +3 -3
- package/mvc/views/react/assets/{auth.ecf25364.js → auth.6b8a01d6.js} +2 -2
- package/mvc/views/react/assets/{root.25abcc85.js → root.b5915ec0.js} +2 -2
- package/mvc/views/react/assets/{use-form.10003abf.js → use-form.2c921e76.js} +361 -229
- package/mvc/views/react/auth/index.html +3 -3
- package/mvc/views/react/index2/index.html +3 -3
- package/package.json +2 -2
- package/src/server/controllers/auth.controller.ts.bak +83 -0
- package/src/ui-app/package-lock.json +292 -386
- package/src/ui-app/package.json +1 -1
- package/src/ui-app/tsconfig.node.json.bak +12 -0
- package/src/server/lib/parseDiff.js.bak +0 -72
- package/src/tasks/backup.js.bak +0 -84
- package/src/tasks/restore.js.bak +0 -100
- package/static/data/custom_devices.json +0 -14
- /package/{static → src/server/static/static}/js/canvasjs.min.js.bak +0 -0
- /package/{static → src/server/static/static}/js/chart.js.bak +0 -0
- /package/{static → src/server/static/static}/js/jquery-3.3.1.slim.js.bak +0 -0
- /package/{static → src/server/static/static}/js/jquery-3.3.1.slim.min.js.bak +0 -0
- /package/{static → src/server/static/static}/js/moment.min.js.bak +0 -0
package/src/ui-app/package.json
CHANGED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
const Canvas = require('canvas');
|
|
2
|
-
|
|
3
|
-
const loop = function loop(w, h, callback) {
|
|
4
|
-
let x;
|
|
5
|
-
let y;
|
|
6
|
-
|
|
7
|
-
for (x = 0; x < w; x++) {
|
|
8
|
-
for (y = 0; y < h; y++) {
|
|
9
|
-
callback(x, y);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const parseDiff = function (dataDiff) {
|
|
15
|
-
console.log('Start parse diff - prepare data');
|
|
16
|
-
Img = Canvas.Image;
|
|
17
|
-
let image = new Img();
|
|
18
|
-
image.src = dataDiff;
|
|
19
|
-
const width = image.width;
|
|
20
|
-
const height = image.height;
|
|
21
|
-
|
|
22
|
-
const canvas = Canvas.createCanvas(width, height);
|
|
23
|
-
const ctx = canvas.getContext('2d');
|
|
24
|
-
ctx.drawImage(image, 0, 0);
|
|
25
|
-
|
|
26
|
-
const sourceImageData = ctx.getImageData(0, 0, width, height).data;
|
|
27
|
-
|
|
28
|
-
let diffPixCount = 0;
|
|
29
|
-
let allPixCount = 0;
|
|
30
|
-
let positions = [];
|
|
31
|
-
let s = {};
|
|
32
|
-
console.log('Start collect diff pixel positions');
|
|
33
|
-
loop(width, height, async function (horizontalPos, verticalPos) {
|
|
34
|
-
let offset = (verticalPos * width + horizontalPos) * 4;
|
|
35
|
-
let red = sourceImageData[offset];
|
|
36
|
-
let green = sourceImageData[offset + 1];
|
|
37
|
-
let blue = sourceImageData[offset + 2];
|
|
38
|
-
let alpha = sourceImageData[offset + 3];
|
|
39
|
-
if (!s[`${red}, ${green}, ${blue}, ${alpha}`]) {
|
|
40
|
-
s[`${red}, ${green}, ${blue}, ${alpha}`] = 1;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
s[`${red}, ${green}, ${blue}, ${alpha}`] = s[`${red}, ${green}, ${blue}, ${alpha}`] + 1;
|
|
44
|
-
|
|
45
|
-
if
|
|
46
|
-
(
|
|
47
|
-
((red === 252) && (green === 0) && (blue === 236)) ||
|
|
48
|
-
((red === 196) && (green === 0) && (blue === 132)) ||
|
|
49
|
-
((red === 255) && (green === 0) && (blue === 255))
|
|
50
|
-
) {
|
|
51
|
-
|
|
52
|
-
diffPixCount++;
|
|
53
|
-
positions.push({
|
|
54
|
-
x: horizontalPos,
|
|
55
|
-
y: verticalPos
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
allPixCount++;
|
|
60
|
-
});
|
|
61
|
-
console.log(s);
|
|
62
|
-
console.log(`'${diffPixCount}' diff pixels positions of '${allPixCount}' was collected`);
|
|
63
|
-
console.log('Start sorting pixel positions by "y"');
|
|
64
|
-
const out = positions.sort((a, b) => (a.y > b.y) ? 1 : -1);
|
|
65
|
-
console.log('End of sorting');
|
|
66
|
-
return out;
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
module.exports = {
|
|
70
|
-
parseDiff,
|
|
71
|
-
loop,
|
|
72
|
-
};
|
package/src/tasks/backup.js.bak
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-console */
|
|
2
|
-
// const inquirer = require('inquirer');
|
|
3
|
-
const inquirer2 = require('@inquirer/prompts');
|
|
4
|
-
const { input, confirm } = require('@inquirer/prompts');
|
|
5
|
-
console.log(inquirer2)
|
|
6
|
-
|
|
7
|
-
const fs = require('fs');
|
|
8
|
-
const path = require('path');
|
|
9
|
-
const { execSync } = require('child_process');
|
|
10
|
-
const { config } = require('../../config');
|
|
11
|
-
|
|
12
|
-
const backupFolder = config.backupsFolder;
|
|
13
|
-
if (!fs.existsSync(backupFolder)) {
|
|
14
|
-
fs.mkdirSync(backupFolder, { recursive: true });
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
console.log('Please be sure that \'mongodump\', \'mongorestore\' and \'rsync\' tools are present in your system.');
|
|
18
|
-
const currDate = new Date().toLocaleString('en-US', { year: 'numeric', month: '2-digit', day: 'numeric' })
|
|
19
|
-
.replace(/[/]/gm, '_');
|
|
20
|
-
const backupSubFolder = `${currDate}_${Date.now()}`;
|
|
21
|
-
|
|
22
|
-
const answers = {
|
|
23
|
-
firstName: input({ message: "What's your first name?" }),
|
|
24
|
-
allowEmail: confirm({ message: 'Do you allow us to send you email?' }),
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
console.log(answers.firstName);
|
|
28
|
-
|
|
29
|
-
inquirer2
|
|
30
|
-
.confirm([
|
|
31
|
-
{ type: 'string', name: 'folder', message: 'Enter the Backup Folder name Filename', default: backupSubFolder },
|
|
32
|
-
{
|
|
33
|
-
type: 'string',
|
|
34
|
-
name: 'connectionString',
|
|
35
|
-
message: 'Enter the Database Connection String URI',
|
|
36
|
-
default: config.connectionString,
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
type: 'string',
|
|
40
|
-
name: 'imagesPath',
|
|
41
|
-
message: 'Enter the Images Folder',
|
|
42
|
-
default: config.defaultImagesPath,
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
type: 'string',
|
|
46
|
-
name: 'confirm',
|
|
47
|
-
message: 'Continue? (y/N)',
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
])
|
|
51
|
-
.then(async (answers) => {
|
|
52
|
-
const { confirm } = answers;
|
|
53
|
-
|
|
54
|
-
if (!confirm) return;
|
|
55
|
-
|
|
56
|
-
const fullBackupPath = path.join(backupFolder, answers.folder);
|
|
57
|
-
|
|
58
|
-
if (fs.existsSync(fullBackupPath)) {
|
|
59
|
-
console.log('The folder is already exists, please enter another folder ');
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
fs.mkdirSync(fullBackupPath, { recursive: true });
|
|
63
|
-
const destDatabasePath = path.join(fullBackupPath, 'database');
|
|
64
|
-
fs.mkdirSync(destDatabasePath, { recursive: true });
|
|
65
|
-
|
|
66
|
-
const destImagesPath = path.join(fullBackupPath, 'images');
|
|
67
|
-
fs.mkdirSync(fullBackupPath, { recursive: true });
|
|
68
|
-
|
|
69
|
-
console.log('Backup the Database');
|
|
70
|
-
const dbDumpResult = execSync(`mongodump --uri=${answers.connectionString} --gzip --out ${destDatabasePath}`).toString();
|
|
71
|
-
console.log(dbDumpResult);
|
|
72
|
-
|
|
73
|
-
console.log('Backup the Images');
|
|
74
|
-
const imagesBackupResult = execSync(`rsync -vah --progress ${answers.imagesPath} ${destImagesPath}`)
|
|
75
|
-
.toString('utf8');
|
|
76
|
-
console.log(imagesBackupResult);
|
|
77
|
-
})
|
|
78
|
-
.catch((e) => {
|
|
79
|
-
if (e.isTtyError) {
|
|
80
|
-
console.log('cannot render the menu on this environment', e);
|
|
81
|
-
} else {
|
|
82
|
-
console.log(e);
|
|
83
|
-
}
|
|
84
|
-
});
|
package/src/tasks/restore.js.bak
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-console */
|
|
2
|
-
const inquirer = require('inquirer');
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
const path = require('path');
|
|
5
|
-
const { execSync } = require('child_process');
|
|
6
|
-
const { config } = require('../../config');
|
|
7
|
-
|
|
8
|
-
const backupFolder = config.backupsFolder;
|
|
9
|
-
if (!fs.existsSync(backupFolder)) {
|
|
10
|
-
fs.mkdirSync(backupFolder, { recursive: true });
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
console.log('Be sure that Application is down and \'mongodump\', \'mongorestore\' and \'rsync\' tools are present in your system.');
|
|
14
|
-
|
|
15
|
-
const backupsFolders = fs.readdirSync(backupFolder, { withFileTypes: true })
|
|
16
|
-
.filter((x) => x.isDirectory())
|
|
17
|
-
.map((x) => x.name);
|
|
18
|
-
|
|
19
|
-
const questions = [
|
|
20
|
-
{
|
|
21
|
-
type: 'list',
|
|
22
|
-
name: 'backupSubFolder',
|
|
23
|
-
message: 'Choose the Backup Folder',
|
|
24
|
-
choices: backupsFolders,
|
|
25
|
-
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
type: 'string',
|
|
29
|
-
name: 'destConnectionString',
|
|
30
|
-
message: 'Enter the Destination Database Connection String URI',
|
|
31
|
-
default: config.connectionString,
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
type: 'string',
|
|
35
|
-
name: 'destImagesSubFolder',
|
|
36
|
-
message: 'Enter the Destination Images Folder',
|
|
37
|
-
default: config.defaultImagesPath,
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
type: 'string',
|
|
41
|
-
name: 'confirm',
|
|
42
|
-
message: '⚠️ Caution! All current Application Data will be removed, before the Restoring! Continue? (y/N)',
|
|
43
|
-
},
|
|
44
|
-
];
|
|
45
|
-
|
|
46
|
-
inquirer
|
|
47
|
-
.prompt(questions)
|
|
48
|
-
.then(async (answers) => {
|
|
49
|
-
console.log({ answers });
|
|
50
|
-
if (!answers.confirm) return;
|
|
51
|
-
|
|
52
|
-
const fullBackupPath = path.join(backupFolder, answers.backupSubFolder);
|
|
53
|
-
console.log({ fullBackupPath });
|
|
54
|
-
|
|
55
|
-
const fullSourceDatabasePath = path.join(fullBackupPath, 'database');
|
|
56
|
-
if (!fs.existsSync(fullSourceDatabasePath)) {
|
|
57
|
-
console.log('The Source Database Folder is not exists, please select tha another folder');
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const fullSourceImagesPath = path.join(fullBackupPath, 'images');
|
|
62
|
-
if (!fs.existsSync(fullSourceImagesPath)) {
|
|
63
|
-
console.log('The Source Images Folder is not exists, please select tha another folder');
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
if (!fs.existsSync(answers.destImagesSubFolder)) {
|
|
68
|
-
console.log('The Destination Images Folder is not exists, please select tha another folder');
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
console.log('Remove the Destination Database');
|
|
73
|
-
const removeDbResult = execSync(`mongosh '${answers.destConnectionString}' --eval "db.dropDatabase();"`)
|
|
74
|
-
.toString();
|
|
75
|
-
console.log(removeDbResult);
|
|
76
|
-
|
|
77
|
-
console.log('Restore the Database');
|
|
78
|
-
const restoreDbResult = execSync(`mongorestore --uri ${answers.destConnectionString} --gzip ${fullSourceDatabasePath}/*`)
|
|
79
|
-
.toString();
|
|
80
|
-
console.log(restoreDbResult);
|
|
81
|
-
|
|
82
|
-
console.log('Clean the Destination Images Folder');
|
|
83
|
-
// eslint-disable-next-line max-len
|
|
84
|
-
const removeImagesResult = execSync(`ls ${answers.destImagesSubFolder};rm -rfv ${answers.destImagesSubFolder} && mkdir ${answers.destImagesSubFolder}`)
|
|
85
|
-
.toString();
|
|
86
|
-
console.log(removeImagesResult);
|
|
87
|
-
|
|
88
|
-
console.log('Restore the Images');
|
|
89
|
-
console.log({ fullSourceImagesPath });
|
|
90
|
-
const restoreImagesResult = execSync(`rsync -vah --progress ${fullSourceImagesPath}/ ${answers.destImagesSubFolder}`)
|
|
91
|
-
.toString('utf8');
|
|
92
|
-
console.log(restoreImagesResult);
|
|
93
|
-
})
|
|
94
|
-
.catch((e) => {
|
|
95
|
-
if (e.isTtyError) {
|
|
96
|
-
console.log('cannot render the menu on this environment', e);
|
|
97
|
-
} else {
|
|
98
|
-
console.log(e);
|
|
99
|
-
}
|
|
100
|
-
});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|