isite 2022.3.5 → 2022.3.8
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/app.js +24 -2
- package/apps/client-side/site_files/js/site.js +9 -1
- package/index.js +1 -0
- package/lib/words.js +2 -2
- package/package.json +2 -1
package/apps/client-side/app.js
CHANGED
|
@@ -192,10 +192,32 @@ module.exports = function (site) {
|
|
|
192
192
|
res.download(site.dir + '/../../uploads/' + req.params.category + '/files/' + req.params.name);
|
|
193
193
|
});
|
|
194
194
|
|
|
195
|
-
site.
|
|
195
|
+
site.getTLV = function (name, value) {
|
|
196
|
+
value = site.utf8.encode(value);
|
|
197
|
+
return Buffer.concat([Buffer.from([name], 'utf8'), Buffer.from([value.length], 'utf8'), Buffer.from(value, 'utf8')]);
|
|
198
|
+
};
|
|
199
|
+
site.onPOST('/x-api/zakat', (req, res) => {
|
|
200
|
+
let obj = req.data || {};
|
|
201
|
+
let value = [];
|
|
202
|
+
if (obj.name) {
|
|
203
|
+
value.push(site.getTLV('1', obj.name));
|
|
204
|
+
}
|
|
205
|
+
if (obj.vat_number) {
|
|
206
|
+
value.push(site.getTLV('2', obj.vat_number));
|
|
207
|
+
}
|
|
208
|
+
if (obj.time) {
|
|
209
|
+
value.push(site.getTLV('3', obj.time));
|
|
210
|
+
}
|
|
211
|
+
if (obj.total) {
|
|
212
|
+
value.push(site.getTLV('4', obj.total));
|
|
213
|
+
}
|
|
214
|
+
if (obj.vat_total) {
|
|
215
|
+
value.push(site.getTLV('5', obj.vat_total));
|
|
216
|
+
}
|
|
217
|
+
value = Buffer.concat([...value]).toString('base64');
|
|
196
218
|
res.json({
|
|
197
219
|
done: true,
|
|
198
|
-
value:
|
|
220
|
+
value: value,
|
|
199
221
|
});
|
|
200
222
|
});
|
|
201
223
|
};
|
|
@@ -1137,6 +1137,14 @@
|
|
|
1137
1137
|
return site.toBase64(value);
|
|
1138
1138
|
};
|
|
1139
1139
|
|
|
1140
|
+
site.zakat2 = function (obj, callback) {
|
|
1141
|
+
fetch('/x-api/zakat', { method: 'POST', body: JSON.stringify(obj) })
|
|
1142
|
+
.then((res) => res.json())
|
|
1143
|
+
.then((data) => {
|
|
1144
|
+
callback(data);
|
|
1145
|
+
});
|
|
1146
|
+
};
|
|
1147
|
+
|
|
1140
1148
|
site.barcode = function (options) {
|
|
1141
1149
|
if (!options || !options.selector || !options.text) {
|
|
1142
1150
|
console.error('qrcode need {selector , text}');
|
|
@@ -1163,7 +1171,7 @@
|
|
|
1163
1171
|
height: options.height || 256,
|
|
1164
1172
|
colorDark: options.colorDark || '#000000',
|
|
1165
1173
|
colorLight: options.colorLight || '#ffffff',
|
|
1166
|
-
correctLevel: options.correctLevel || QRCode.CorrectLevel.
|
|
1174
|
+
correctLevel: options.correctLevel || QRCode.CorrectLevel.H,
|
|
1167
1175
|
});
|
|
1168
1176
|
}
|
|
1169
1177
|
};
|
package/index.js
CHANGED
|
@@ -16,6 +16,7 @@ module.exports = function init(options) {
|
|
|
16
16
|
____0.querystring = require('querystring');
|
|
17
17
|
____0.formidable = require('formidable');
|
|
18
18
|
____0.mv = require('mv');
|
|
19
|
+
____0.utf8 = require('utf8');
|
|
19
20
|
____0.request = ____0.fetch = ____0.x0ftox = require('node-fetch');
|
|
20
21
|
____0.$ = ____0.cheerio = require('cheerio');
|
|
21
22
|
____0.md5 = ____0.hash = ____0.x0md50x = require('md5');
|
package/lib/words.js
CHANGED
|
@@ -77,7 +77,7 @@ module.exports = function init(____0) {
|
|
|
77
77
|
return response;
|
|
78
78
|
};
|
|
79
79
|
|
|
80
|
-
words.addList = function (list, db =
|
|
80
|
+
words.addList = function (list, db = false) {
|
|
81
81
|
if (typeof list === 'string') {
|
|
82
82
|
____0.readFile(list, (err, data) => {
|
|
83
83
|
if (!err) {
|
|
@@ -104,7 +104,7 @@ module.exports = function init(____0) {
|
|
|
104
104
|
};
|
|
105
105
|
|
|
106
106
|
words.addApp = function (app_path) {
|
|
107
|
-
words.addList(app_path + '/site_files/json/words.json');
|
|
107
|
+
words.addList(app_path + '/site_files/json/words.json' , false);
|
|
108
108
|
};
|
|
109
109
|
|
|
110
110
|
____0.on(____0.strings[9], () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isite",
|
|
3
|
-
"version": "2022.03.
|
|
3
|
+
"version": "2022.03.08",
|
|
4
4
|
"description": "Create Enterprise Multi-Language Web Site [Fast and Easy] ",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
"mongodb": "^4.2.2",
|
|
44
44
|
"mv": "^2.1.1",
|
|
45
45
|
"node-fetch": "^2.6.1",
|
|
46
|
+
"utf8": "^3.0.0",
|
|
46
47
|
"ws": "^8.2.3",
|
|
47
48
|
"xlsx": "^0.17.4"
|
|
48
49
|
}
|