isite 2022.1.10 → 2022.1.11
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 +9 -6
- package/lib/parser.js +13 -7
- package/package.json +1 -1
package/apps/client-side/app.js
CHANGED
|
@@ -19,12 +19,12 @@ module.exports = function (site) {
|
|
|
19
19
|
name: '/x-js',
|
|
20
20
|
path: __dirname + '/site_files/js',
|
|
21
21
|
public: true,
|
|
22
|
-
parser
|
|
22
|
+
parser: 'js',
|
|
23
23
|
});
|
|
24
24
|
site.get({
|
|
25
25
|
name: ['/x-js/all.js'],
|
|
26
26
|
public: true,
|
|
27
|
-
parser
|
|
27
|
+
parser: 'js',
|
|
28
28
|
path: [
|
|
29
29
|
__dirname + '/site_files/js/first.js',
|
|
30
30
|
__dirname + '/site_files/js/jquery.js',
|
|
@@ -42,7 +42,7 @@ module.exports = function (site) {
|
|
|
42
42
|
site.get({
|
|
43
43
|
name: ['/x-js/all.min.js'],
|
|
44
44
|
public: true,
|
|
45
|
-
parser
|
|
45
|
+
parser: 'js',
|
|
46
46
|
path: [
|
|
47
47
|
__dirname + '/site_files/js/first.js',
|
|
48
48
|
__dirname + '/site_files/js/jquery.js',
|
|
@@ -130,9 +130,10 @@ module.exports = function (site) {
|
|
|
130
130
|
};
|
|
131
131
|
let file = req.files.fileToUpload;
|
|
132
132
|
if (file) {
|
|
133
|
+
console.log(file);
|
|
133
134
|
let newName = 'image_' + new Date().getTime().toString().replace('.', '_') + '.png';
|
|
134
135
|
let newpath = site.dir + '/../../uploads/' + req.params.category + '/images/' + newName;
|
|
135
|
-
site.mv(file.
|
|
136
|
+
site.mv(file.filepath, newpath, function (err) {
|
|
136
137
|
if (err) {
|
|
137
138
|
response.error = err;
|
|
138
139
|
response.done = !1;
|
|
@@ -169,14 +170,16 @@ module.exports = function (site) {
|
|
|
169
170
|
}
|
|
170
171
|
let newName = 'file_' + new Date().getTime() + '.' + site.path.extname(file.name);
|
|
171
172
|
let newpath = site.dir + '/../../uploads/' + req.params.category + '/files/' + newName;
|
|
172
|
-
site.mv(file.
|
|
173
|
+
site.mv(file.filepath, newpath, function (err) {
|
|
173
174
|
if (err) {
|
|
174
175
|
response.error = err;
|
|
175
176
|
response.done = !1;
|
|
176
177
|
}
|
|
177
178
|
response.file = {};
|
|
178
179
|
response.file.url = '/api/file/' + req.params.category + '/' + newName;
|
|
179
|
-
response.file.name = file.
|
|
180
|
+
response.file.name = file.originalFilename;
|
|
181
|
+
response.file.mimetype = file.mimetype;
|
|
182
|
+
response.file.size = file.size;
|
|
180
183
|
res.json(response);
|
|
181
184
|
});
|
|
182
185
|
});
|
package/lib/parser.js
CHANGED
|
@@ -224,7 +224,13 @@ module.exports = function init(req, res, ____0, route) {
|
|
|
224
224
|
} else if (v == 'theme') {
|
|
225
225
|
return req.session.theme;
|
|
226
226
|
} else {
|
|
227
|
-
|
|
227
|
+
v = v.split('.');
|
|
228
|
+
if (v.length === 1) {
|
|
229
|
+
return req.session[v[0]];
|
|
230
|
+
}
|
|
231
|
+
if (v.length === 2) {
|
|
232
|
+
return req.session[v[0]][v[1]];
|
|
233
|
+
}
|
|
228
234
|
}
|
|
229
235
|
}
|
|
230
236
|
|
|
@@ -437,10 +443,10 @@ module.exports = function init(req, res, ____0, route) {
|
|
|
437
443
|
$($('[x-import]').get().reverse()).each(function (i, elem) {
|
|
438
444
|
let file = $(this).attr('x-import');
|
|
439
445
|
$(this).removeAttr('x-import');
|
|
440
|
-
$(this).attr('x-server'
|
|
446
|
+
$(this).attr('x-server', 'x-import');
|
|
441
447
|
if (file.endsWith('.html')) {
|
|
442
448
|
$(this).html(getContent(file) + $(this).html());
|
|
443
|
-
}else if (file.endsWith('.css')) {
|
|
449
|
+
} else if (file.endsWith('.css')) {
|
|
444
450
|
$(this).text(getContent(file) + $(this).html());
|
|
445
451
|
} else {
|
|
446
452
|
$(this).text(getContent(file) + $(this).text());
|
|
@@ -450,10 +456,10 @@ module.exports = function init(req, res, ____0, route) {
|
|
|
450
456
|
$($('[x-append]').get().reverse()).each(function (i, elem) {
|
|
451
457
|
let file = $(this).attr('x-append');
|
|
452
458
|
$(this).removeAttr('x-append');
|
|
453
|
-
$(this).attr('x-server'
|
|
459
|
+
$(this).attr('x-server', 'x-append');
|
|
454
460
|
if (file.endsWith('.html')) {
|
|
455
461
|
$(this).html($(this).html() + getContent(file));
|
|
456
|
-
}else if (file.endsWith('.css')) {
|
|
462
|
+
} else if (file.endsWith('.css')) {
|
|
457
463
|
$(this).text($(this).html() + getContent(file));
|
|
458
464
|
} else {
|
|
459
465
|
$(this).text($(this).text() + getContent(file));
|
|
@@ -463,10 +469,10 @@ module.exports = function init(req, res, ____0, route) {
|
|
|
463
469
|
$($('[x-replace]').get().reverse()).each(function (i, elem) {
|
|
464
470
|
let file = $(this).attr('x-replace');
|
|
465
471
|
$(this).removeAttr('x-replace');
|
|
466
|
-
$(this).attr('x-server'
|
|
472
|
+
$(this).attr('x-server', 'x-replace');
|
|
467
473
|
if (file.endsWith('.html')) {
|
|
468
474
|
$(this).html(getContent(file));
|
|
469
|
-
}else {
|
|
475
|
+
} else {
|
|
470
476
|
$(this).text(getContent(file));
|
|
471
477
|
}
|
|
472
478
|
});
|