isite 2022.3.9 → 2022.5.1
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/apps/client-side/site_files/js/site.js +21 -2
- package/lib/collection.js +11 -11
- package/lib/security.js +16 -16
- package/object-options/index.js +1 -1
- package/package.json +1 -1
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
if (
|
|
57
|
+
if (window.SOCIALBROWSER) {
|
|
58
58
|
SOCIALBROWSER.var = SOCIALBROWSER.var || {};
|
|
59
59
|
SOCIALBROWSER.var.white_list = SOCIALBROWSER.var.white_list || [];
|
|
60
60
|
if (document.location.hostname) {
|
|
@@ -92,6 +92,25 @@
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
let site = {};
|
|
95
|
+
site.printerList = [];
|
|
96
|
+
site.getPrinters = function () {
|
|
97
|
+
if (window.SOCIALBROWSER && SOCIALBROWSER.currentWindow.webContents.getPrintersAsync) {
|
|
98
|
+
SOCIALBROWSER.currentWindow.webContents.getPrintersAsync().then((arr0) => {
|
|
99
|
+
site.printerList = arr0;
|
|
100
|
+
});
|
|
101
|
+
} else if (window.SOCIALBROWSER && SOCIALBROWSER.currentWindow.webContents.getPrinters) {
|
|
102
|
+
site.printerList = SOCIALBROWSER.currentWindow.webContents.getPrinters();
|
|
103
|
+
} else {
|
|
104
|
+
fetch('http://127.0.0.1:60080/printers/all')
|
|
105
|
+
.then((res) => res.json())
|
|
106
|
+
.then((data) => {
|
|
107
|
+
site.printerList = data.list;
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return site.printerList;
|
|
112
|
+
};
|
|
113
|
+
site.getPrinters();
|
|
95
114
|
site.render = function (selector, data) {
|
|
96
115
|
let template = document.querySelector(selector);
|
|
97
116
|
if (template) {
|
|
@@ -396,7 +415,7 @@
|
|
|
396
415
|
}
|
|
397
416
|
return n;
|
|
398
417
|
};
|
|
399
|
-
site.fixed =
|
|
418
|
+
site.fixed = 3;
|
|
400
419
|
site.to_number = site.toNumber = function (_num, fixed) {
|
|
401
420
|
let _fixed = fixed || site.fixed;
|
|
402
421
|
let n = 0;
|
package/lib/collection.js
CHANGED
|
@@ -5,16 +5,15 @@ module.exports = function init(____0, option, db) {
|
|
|
5
5
|
$collection.busy = !_;
|
|
6
6
|
});
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
8
|
if (typeof option === 'string') {
|
|
11
9
|
option = {
|
|
12
|
-
collection
|
|
13
|
-
}
|
|
10
|
+
collection: option,
|
|
11
|
+
};
|
|
14
12
|
$collection.collection = option;
|
|
15
13
|
$collection.db = db || ____0.options.mongodb.db;
|
|
16
14
|
}
|
|
17
15
|
$collection.options = { ...____0.options.mongodb, ...option };
|
|
16
|
+
$collection.identityEnabled = $collection.options.identity.enabled;
|
|
18
17
|
|
|
19
18
|
$collection.db = $collection.options.db.trim().replace(' ', '');
|
|
20
19
|
$collection.collection = $collection.options.collection.trim().replace(' ', '');
|
|
@@ -83,7 +82,7 @@ module.exports = function init(____0, option, db) {
|
|
|
83
82
|
}
|
|
84
83
|
}
|
|
85
84
|
|
|
86
|
-
if ($doc.id >= ____0.mongodb.collections_indexed[$collection.collection].nextID) {
|
|
85
|
+
if ($collection.identityEnabled === !0 && $doc.id >= ____0.mongodb.collections_indexed[$collection.collection].nextID) {
|
|
87
86
|
____0.mongodb.collections_indexed[$collection.collection].nextID = $doc.id + 1;
|
|
88
87
|
}
|
|
89
88
|
|
|
@@ -396,7 +395,7 @@ module.exports = function init(____0, option, db) {
|
|
|
396
395
|
}
|
|
397
396
|
}
|
|
398
397
|
|
|
399
|
-
if ($doc.id >= ____0.mongodb.collections_indexed[$collection.collection].nextID) {
|
|
398
|
+
if ($collection.identityEnabled === !0 && $doc.id >= ____0.mongodb.collections_indexed[$collection.collection].nextID) {
|
|
400
399
|
____0.mongodb.collections_indexed[$collection.collection].nextID = $doc.id + 1;
|
|
401
400
|
}
|
|
402
401
|
});
|
|
@@ -532,7 +531,6 @@ module.exports = function init(____0, option, db) {
|
|
|
532
531
|
}
|
|
533
532
|
};
|
|
534
533
|
|
|
535
|
-
|
|
536
534
|
$collection.ObjectID = function (_id) {
|
|
537
535
|
return new ____0.mongodb.ObjectID(_id);
|
|
538
536
|
};
|
|
@@ -769,7 +767,7 @@ module.exports = function init(____0, option, db) {
|
|
|
769
767
|
|
|
770
768
|
// id Handle
|
|
771
769
|
|
|
772
|
-
if ($collection.
|
|
770
|
+
if ($collection.identityEnabled) {
|
|
773
771
|
$collection.aggregate(
|
|
774
772
|
[
|
|
775
773
|
{
|
|
@@ -819,7 +817,7 @@ module.exports = function init(____0, option, db) {
|
|
|
819
817
|
},
|
|
820
818
|
);
|
|
821
819
|
|
|
822
|
-
function
|
|
820
|
+
$collection.handleIndex = function () {
|
|
823
821
|
$collection.busy = !0;
|
|
824
822
|
$collection.identityEnabled = !0;
|
|
825
823
|
$collection.step = ____0.options.mongodb.identity.step;
|
|
@@ -854,9 +852,11 @@ module.exports = function init(____0, option, db) {
|
|
|
854
852
|
$collection.busy = !1;
|
|
855
853
|
},
|
|
856
854
|
);
|
|
857
|
-
}
|
|
855
|
+
};
|
|
858
856
|
|
|
859
|
-
handleIndex();
|
|
857
|
+
$collection.handleIndex();
|
|
858
|
+
} else {
|
|
859
|
+
____0.mongodb.collections_indexed[$collection.collection] = { nextID: 1 };
|
|
860
860
|
}
|
|
861
861
|
|
|
862
862
|
return $collection;
|
package/lib/security.js
CHANGED
|
@@ -46,7 +46,7 @@ module.exports = function init(____0) {
|
|
|
46
46
|
);
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
|
-
|
|
49
|
+
u.email = u.email.trim().toLowerCase();
|
|
50
50
|
security.getUser(
|
|
51
51
|
{
|
|
52
52
|
email: u.email,
|
|
@@ -127,9 +127,9 @@ module.exports = function init(____0) {
|
|
|
127
127
|
profile: {
|
|
128
128
|
name: key,
|
|
129
129
|
},
|
|
130
|
-
ref_info
|
|
131
|
-
_id
|
|
132
|
-
}
|
|
130
|
+
ref_info: {
|
|
131
|
+
_id: '',
|
|
132
|
+
},
|
|
133
133
|
});
|
|
134
134
|
};
|
|
135
135
|
____0.options.security.keys.forEach((key) => {
|
|
@@ -166,9 +166,9 @@ module.exports = function init(____0) {
|
|
|
166
166
|
profile: {
|
|
167
167
|
name: key,
|
|
168
168
|
},
|
|
169
|
-
ref_info
|
|
170
|
-
_id
|
|
171
|
-
}
|
|
169
|
+
ref_info: {
|
|
170
|
+
_id: '',
|
|
171
|
+
},
|
|
172
172
|
});
|
|
173
173
|
});
|
|
174
174
|
____0.options.security.users.forEach((user) => {
|
|
@@ -382,11 +382,11 @@ module.exports = function init(____0) {
|
|
|
382
382
|
|
|
383
383
|
if (
|
|
384
384
|
(userArgs.id && user.id === userArgs.id) ||
|
|
385
|
-
(!user.key && userArgs.email && user.email === userArgs.email) ||
|
|
386
|
-
(!user.key && userArgs.userName && user.userName === userArgs.userName) ||
|
|
387
|
-
(!user.key && userArgs.mobile && user.mobile === userArgs.mobile) ||
|
|
385
|
+
(!user.key && userArgs.email && user.email === userArgs.email.trim().toLowerCase()) ||
|
|
386
|
+
(!user.key && userArgs.userName && user.userName === userArgs.userName.trim().toLowerCase()) ||
|
|
387
|
+
(!user.key && userArgs.mobile && user.mobile === userArgs.mobile.trim().toLowerCase()) ||
|
|
388
388
|
(user.key && userArgs.key && user.key === userArgs.key) ||
|
|
389
|
-
(user.key && userArgs.email && user.key === ____0.x0md50x(userArgs.email))
|
|
389
|
+
(user.key && userArgs.email && user.key === ____0.x0md50x(userArgs.email.trim().toLowerCase()))
|
|
390
390
|
) {
|
|
391
391
|
user.$memory = !0;
|
|
392
392
|
user = security.handleUser(user);
|
|
@@ -421,7 +421,7 @@ module.exports = function init(____0) {
|
|
|
421
421
|
|
|
422
422
|
for (var i = 0; i < security.users.length; i++) {
|
|
423
423
|
var _user = security.users[i];
|
|
424
|
-
if (_user.email == user.email && _user.password == user.password) {
|
|
424
|
+
if (_user.email == user.email.trim().toLowerCase() && _user.password == user.password) {
|
|
425
425
|
callback(null, { ..._user });
|
|
426
426
|
return;
|
|
427
427
|
}
|
|
@@ -543,7 +543,7 @@ module.exports = function init(____0) {
|
|
|
543
543
|
callback(err);
|
|
544
544
|
} else {
|
|
545
545
|
callback({
|
|
546
|
-
message: 'email or password error',
|
|
546
|
+
message: 'email or password error ',
|
|
547
547
|
});
|
|
548
548
|
}
|
|
549
549
|
|
|
@@ -712,11 +712,11 @@ module.exports = function init(____0) {
|
|
|
712
712
|
if (user.id) {
|
|
713
713
|
where.id = user.id;
|
|
714
714
|
} else if (user.email) {
|
|
715
|
-
where.email = user.email;
|
|
715
|
+
where.email = user.email.trim().toLowerCase();
|
|
716
716
|
} else if (user.mobile) {
|
|
717
|
-
where.mobile = user.mobile;
|
|
717
|
+
where.mobile = user.mobile.trim().toLowerCase();
|
|
718
718
|
} else if (user.userName) {
|
|
719
|
-
where.userName = user.userName;
|
|
719
|
+
where.userName = user.userName.trim().toLowerCase();
|
|
720
720
|
} else {
|
|
721
721
|
callback({
|
|
722
722
|
message: 'User Info Not Correct',
|
package/object-options/index.js
CHANGED