iobroker.javascript 9.0.9 → 9.0.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/README.md +8 -6
- package/admin/assets/{OpenAiDialog-CDDsvlCe.js → OpenAiDialog-BYXyaWDU.js} +1 -1
- package/admin/assets/{Save-D3ZQadHC.js → Save--0ldNXLf.js} +1 -1
- package/admin/assets/{ScriptEditor-Ciz-_SvX.js → ScriptEditor-CpRWvDSw.js} +1 -1
- package/admin/assets/{ScriptEditorVanillaMonaco-Cs6PL8eZ.js → ScriptEditorVanillaMonaco-BWe9MiKn.js} +1 -1
- package/admin/assets/{createSvgIcon-BDXN8whp.js → createSvgIcon-C_ElRFrf.js} +1 -1
- package/admin/assets/index-BLZa2V1g.js +1 -0
- package/admin/assets/{index-quKi7QsD.js → index-BUU5hWiL.js} +95 -95
- package/admin/assets/{index-DOeHpve2.js → index-CMttI-gM.js} +4 -4
- package/admin/assets/index-DeFm7TiX.js +5 -0
- package/admin/assets/{index-PhbDiVdG.js → index-T5pCS60x.js} +1 -1
- package/admin/assets/index-fhg5Z_KX.js +930 -0
- package/admin/assets/{inheritsLoose-BLb-YnoJ.js → inheritsLoose-CLw44UEv.js} +1 -1
- package/admin/assets/useTheme-CpAj0H76.js +1 -0
- package/admin/custom/assets/index-DsPFm5o5.js +904 -0
- package/admin/custom/customComponents.js +2 -2
- package/admin/google-blockly/own/blocks_procedures.js +162 -0
- package/admin/google-blockly/own/blocks_system.js +1 -1
- package/admin/mf-manifest.json +1 -1
- package/admin/remoteEntry.js +2 -2
- package/admin/tab.html +4 -4
- package/build-backend/lib/javascript.d.ts +1504 -147
- package/build-backend/lib/protectFs.js +111 -104
- package/build-backend/lib/protectFs.js.map +1 -1
- package/io-package.json +14 -14
- package/package.json +3 -3
- package/admin/assets/index-BZGWELt0.js +0 -930
- package/admin/assets/index-BxkzUxCi.js +0 -27
- package/admin/assets/index-DsS-er0h.js +0 -5
- package/admin/assets/useTheme-BbFVG4-1.js +0 -1
- package/admin/custom/assets/index-FOcWxrRT.js +0 -904
|
@@ -40,8 +40,11 @@ class ProtectFs {
|
|
|
40
40
|
ioBrokerDataDir;
|
|
41
41
|
promises;
|
|
42
42
|
constants;
|
|
43
|
+
static log = null;
|
|
44
|
+
static staticIoBrokerDataDir = '';
|
|
43
45
|
constructor(log, ioBrokerDataDir) {
|
|
44
46
|
this.ioBrokerDataDir = ioBrokerDataDir;
|
|
47
|
+
ProtectFs.staticIoBrokerDataDir = ioBrokerDataDir;
|
|
45
48
|
this.log = log || {
|
|
46
49
|
silly: (message) => console.log(message),
|
|
47
50
|
debug: (message) => console.debug(message),
|
|
@@ -50,114 +53,115 @@ class ProtectFs {
|
|
|
50
53
|
error: (message) => console.error(message),
|
|
51
54
|
level: 'info',
|
|
52
55
|
};
|
|
56
|
+
ProtectFs.log = this.log;
|
|
53
57
|
this.promises = {
|
|
54
58
|
access: async (path, mode) => {
|
|
55
|
-
|
|
59
|
+
ProtectFs.checkProtected(path, true);
|
|
56
60
|
return nodeFS.promises.access(path, mode);
|
|
57
61
|
},
|
|
58
62
|
cp: async (source, destination, opts) => {
|
|
59
|
-
|
|
60
|
-
|
|
63
|
+
ProtectFs.checkProtected(source, false);
|
|
64
|
+
ProtectFs.checkProtected(destination, false);
|
|
61
65
|
return nodeFS.promises.cp(source, destination, opts);
|
|
62
66
|
},
|
|
63
67
|
readFile: async (path, options) => {
|
|
64
|
-
|
|
68
|
+
ProtectFs.checkProtected(path, true);
|
|
65
69
|
return nodeFS.promises.readFile(path, options); // async function readFile(path, options) {
|
|
66
70
|
},
|
|
67
71
|
readlink: async (path, options) => {
|
|
68
|
-
|
|
72
|
+
ProtectFs.checkProtected(path, true);
|
|
69
73
|
return nodeFS.promises.readlink(path, options); // async function readlink(path, options) {
|
|
70
74
|
},
|
|
71
75
|
symlink: async (target, path, type) => {
|
|
72
|
-
|
|
73
|
-
|
|
76
|
+
ProtectFs.checkProtected(target, true);
|
|
77
|
+
ProtectFs.checkProtected(path, false);
|
|
74
78
|
return nodeFS.promises.symlink(target, path, type); // async function symlink(target, path, type_) {
|
|
75
79
|
},
|
|
76
80
|
writeFile: async (file, data, options) => {
|
|
77
|
-
|
|
81
|
+
ProtectFs.checkProtected(file, true);
|
|
78
82
|
return nodeFS.promises.writeFile.call(this, file, data, options); // async function writeFile(path, data, options) {
|
|
79
83
|
},
|
|
80
84
|
unlink: async (path) => {
|
|
81
|
-
|
|
85
|
+
ProtectFs.checkProtected(path, false);
|
|
82
86
|
return nodeFS.promises.unlink.call(this, path); // async function unlink(path) {
|
|
83
87
|
},
|
|
84
88
|
appendFile: async (path, data, options) => {
|
|
85
|
-
|
|
89
|
+
ProtectFs.checkProtected(path, false);
|
|
86
90
|
return nodeFS.promises.appendFile.call(this, path, data, options); // async function appendFile(path, data, options) {
|
|
87
91
|
},
|
|
88
92
|
chmod: async (path, mode) => {
|
|
89
|
-
|
|
93
|
+
ProtectFs.checkProtected(path, false);
|
|
90
94
|
return nodeFS.promises.chmod.call(this, path, mode); // async function chmod(path, mode) {
|
|
91
95
|
},
|
|
92
96
|
copyFile: async (src, dest, mode) => {
|
|
93
|
-
|
|
94
|
-
|
|
97
|
+
ProtectFs.checkProtected(src, false);
|
|
98
|
+
ProtectFs.checkProtected(dest, false);
|
|
95
99
|
return nodeFS.promises.copyFile.call(this, src, dest, mode); // async function copyFile(src, dest, mode) {
|
|
96
100
|
},
|
|
97
101
|
rename: async (oldPath, newPath) => {
|
|
98
|
-
|
|
99
|
-
|
|
102
|
+
ProtectFs.checkProtected(oldPath, false);
|
|
103
|
+
ProtectFs.checkProtected(newPath, false);
|
|
100
104
|
return nodeFS.promises.rename.call(this, oldPath, newPath); // async function rename(oldPath, newPath) {
|
|
101
105
|
},
|
|
102
106
|
open: async (path, flags, mode) => {
|
|
103
|
-
|
|
107
|
+
ProtectFs.checkProtected(path, true);
|
|
104
108
|
return nodeFS.promises.open.call(this, path, flags, mode); // async function open(path, flags, mode) {
|
|
105
109
|
},
|
|
106
110
|
truncate: async (path, len) => {
|
|
107
|
-
|
|
111
|
+
ProtectFs.checkProtected(path, false);
|
|
108
112
|
return nodeFS.promises.truncate.call(this, path, len); // async function truncate(path, len = 0) {
|
|
109
113
|
},
|
|
110
114
|
stat: async (path, opts) => {
|
|
111
|
-
|
|
115
|
+
ProtectFs.checkProtected(path, true);
|
|
112
116
|
const result = await nodeFS.promises.stat.call(this, path, opts); // async function stat(path, options = { bigint: false }) {
|
|
113
117
|
return result;
|
|
114
118
|
},
|
|
115
119
|
utimes: async (path, atime, mtime) => {
|
|
116
|
-
|
|
120
|
+
ProtectFs.checkProtected(path, false);
|
|
117
121
|
return nodeFS.promises.utimes.call(this, path, atime, mtime); // async function utimes(path, atime, mtime) {
|
|
118
122
|
},
|
|
119
123
|
readdir: async (path, options) => {
|
|
120
|
-
|
|
124
|
+
ProtectFs.checkProtected(path, true);
|
|
121
125
|
// @ts-expect-error fix later
|
|
122
126
|
return nodeFS.promises.readdir.call(this, path, options || { encoding: null, withFileTypes: true }); // async function readdir(path, options) {
|
|
123
127
|
},
|
|
124
128
|
lchmod: async (path, mode) => {
|
|
125
|
-
|
|
129
|
+
ProtectFs.checkProtected(path, false);
|
|
126
130
|
return nodeFS.promises.lchmod.call(this, path, mode); // async function lchmod(path, mode) {
|
|
127
131
|
},
|
|
128
132
|
lchown: async (path, uid, gid) => {
|
|
129
|
-
|
|
133
|
+
ProtectFs.checkProtected(path, false);
|
|
130
134
|
return nodeFS.promises.lchown.call(this, path, uid, gid); // async function lchown(path, uid, gid) {
|
|
131
135
|
},
|
|
132
136
|
link: async (existingPath, newPath) => {
|
|
133
|
-
|
|
134
|
-
|
|
137
|
+
ProtectFs.checkProtected(existingPath, false);
|
|
138
|
+
ProtectFs.checkProtected(newPath, false);
|
|
135
139
|
return nodeFS.promises.link.call(this, existingPath, newPath); // async function link(existingPath, newPath) {
|
|
136
140
|
},
|
|
137
141
|
lstat: async (path, opts) => {
|
|
138
|
-
|
|
142
|
+
ProtectFs.checkProtected(path, true);
|
|
139
143
|
const res = await nodeFS.promises.lstat.call(this, path, opts); // async function lstat(path, options = { bigint: false }) {
|
|
140
144
|
return res;
|
|
141
145
|
},
|
|
142
146
|
lutimes: async (path, atime, mtime) => {
|
|
143
|
-
|
|
147
|
+
ProtectFs.checkProtected(path, false);
|
|
144
148
|
return nodeFS.promises.lutimes.call(this, path, atime, mtime); // async function lutimes(path, atime, mtime) {
|
|
145
149
|
},
|
|
146
150
|
mkdir: async (path, options) => {
|
|
147
|
-
|
|
151
|
+
ProtectFs.checkProtected(path, false);
|
|
148
152
|
return nodeFS.promises.mkdir.call(this, path, options); // async function mkdir(path, options) {
|
|
149
153
|
},
|
|
150
154
|
mkdtemp: async (prefix, options) => {
|
|
151
|
-
|
|
155
|
+
ProtectFs.checkProtected(prefix, false);
|
|
152
156
|
const tmp = await nodeFS.promises.mkdtemp.call(this, prefix, options); // async function mkdtemp(prefix, options) {
|
|
153
157
|
return tmp.toString();
|
|
154
158
|
},
|
|
155
159
|
rm: async (path, options) => {
|
|
156
|
-
|
|
160
|
+
ProtectFs.checkProtected(path, false);
|
|
157
161
|
return nodeFS.promises.rm.call(this, path, options); // async function rm(path, options) {
|
|
158
162
|
},
|
|
159
163
|
rmdir: async (path, options) => {
|
|
160
|
-
|
|
164
|
+
ProtectFs.checkProtected(path, false);
|
|
161
165
|
return nodeFS.promises.rmdir.call(this, path, options); // async function rmdir(path, options) {
|
|
162
166
|
},
|
|
163
167
|
};
|
|
@@ -183,35 +187,38 @@ class ProtectFs {
|
|
|
183
187
|
}
|
|
184
188
|
}
|
|
185
189
|
}
|
|
186
|
-
|
|
190
|
+
static checkProtected(file, readOnly) {
|
|
187
191
|
if (file.fd) {
|
|
188
192
|
return;
|
|
189
193
|
}
|
|
190
194
|
const filePath = (0, node_path_1.normalize)(file.toString());
|
|
191
|
-
// todo: protect against file://...
|
|
192
195
|
if (filePath.endsWith(`-data${node_path_1.sep}objects.json`) || filePath.endsWith(`-data${node_path_1.sep}objects.jsonl`)) {
|
|
193
|
-
|
|
196
|
+
ProtectFs.log?.error(`May not read ${file.toString()}`);
|
|
194
197
|
throw new Error('Permission denied');
|
|
195
198
|
}
|
|
196
|
-
if (!readOnly && filePath.startsWith((0, node_path_1.join)(
|
|
197
|
-
|
|
199
|
+
if (!readOnly && filePath.startsWith((0, node_path_1.join)(ProtectFs.staticIoBrokerDataDir, 'files'))) {
|
|
200
|
+
ProtectFs.log?.error(`May not read ${file.toString()} - use writeFile instead`);
|
|
201
|
+
throw new Error('Permission denied');
|
|
202
|
+
}
|
|
203
|
+
if (!readOnly && filePath.startsWith(`file://${(0, node_path_1.join)(ProtectFs.staticIoBrokerDataDir, 'files')}`)) {
|
|
204
|
+
ProtectFs.log?.error(`May not read ${file.toString()} - use writeFile instead`);
|
|
198
205
|
throw new Error('Permission denied');
|
|
199
206
|
}
|
|
200
207
|
}
|
|
201
208
|
access(path, mode, callback) {
|
|
202
|
-
|
|
209
|
+
ProtectFs.checkProtected(path, true);
|
|
203
210
|
if (typeof callback === 'function') {
|
|
204
211
|
return nodeFS.access(path, mode, callback);
|
|
205
212
|
}
|
|
206
213
|
return nodeFS.access(path, mode);
|
|
207
214
|
}
|
|
208
215
|
accessSync(path, mode) {
|
|
209
|
-
|
|
216
|
+
ProtectFs.checkProtected(path, true);
|
|
210
217
|
return nodeFS.accessSync(path, mode);
|
|
211
218
|
}
|
|
212
219
|
cp(source, destination, opts, callback) {
|
|
213
|
-
|
|
214
|
-
|
|
220
|
+
ProtectFs.checkProtected(source, false);
|
|
221
|
+
ProtectFs.checkProtected(destination, false);
|
|
215
222
|
if (callback) {
|
|
216
223
|
return nodeFS.cp(source, destination, opts, callback);
|
|
217
224
|
}
|
|
@@ -221,13 +228,13 @@ class ProtectFs {
|
|
|
221
228
|
return nodeFS.cp(source, destination, opts);
|
|
222
229
|
}
|
|
223
230
|
cpSync(source, destination, opts) {
|
|
224
|
-
|
|
225
|
-
|
|
231
|
+
ProtectFs.checkProtected(source, false);
|
|
232
|
+
ProtectFs.checkProtected(destination, false);
|
|
226
233
|
return nodeFS.cpSync.call(this, source, destination, opts);
|
|
227
234
|
}
|
|
228
235
|
readFile(path, options, callback) {
|
|
229
236
|
if (typeof path !== 'number') {
|
|
230
|
-
|
|
237
|
+
ProtectFs.checkProtected(path, true);
|
|
231
238
|
}
|
|
232
239
|
if (typeof callback === 'function') {
|
|
233
240
|
return nodeFS.readFile.call(this, path, options,
|
|
@@ -238,12 +245,12 @@ class ProtectFs {
|
|
|
238
245
|
}
|
|
239
246
|
readFileSync(path, options) {
|
|
240
247
|
if (typeof path !== 'number') {
|
|
241
|
-
|
|
248
|
+
ProtectFs.checkProtected(path, true);
|
|
242
249
|
}
|
|
243
250
|
return nodeFS.readFileSync.call(this, path, options);
|
|
244
251
|
}
|
|
245
252
|
readlink(path, options, callback) {
|
|
246
|
-
|
|
253
|
+
ProtectFs.checkProtected(path, true);
|
|
247
254
|
if (typeof callback === 'function') {
|
|
248
255
|
// @ts-expect-error should work
|
|
249
256
|
return nodeFS.readlink.call(this, path, options, callback); //
|
|
@@ -251,12 +258,12 @@ class ProtectFs {
|
|
|
251
258
|
return nodeFS.readlink.call(this, path, options);
|
|
252
259
|
}
|
|
253
260
|
readlinkSync(path, options) {
|
|
254
|
-
|
|
261
|
+
ProtectFs.checkProtected(path, true);
|
|
255
262
|
return nodeFS.readlinkSync.call(this, path, options);
|
|
256
263
|
}
|
|
257
264
|
symlink(target, path, type, callback) {
|
|
258
|
-
|
|
259
|
-
|
|
265
|
+
ProtectFs.checkProtected(target, true);
|
|
266
|
+
ProtectFs.checkProtected(path, false);
|
|
260
267
|
if (typeof callback === 'function') {
|
|
261
268
|
// @ts-expect-error should work
|
|
262
269
|
return nodeFS.symlink.call(this, target, path, type, callback);
|
|
@@ -264,13 +271,13 @@ class ProtectFs {
|
|
|
264
271
|
return nodeFS.symlink.call(this, target, path, type);
|
|
265
272
|
}
|
|
266
273
|
symlinkSync(target, path, type) {
|
|
267
|
-
|
|
268
|
-
|
|
274
|
+
ProtectFs.checkProtected(target, true);
|
|
275
|
+
ProtectFs.checkProtected(path, false);
|
|
269
276
|
return nodeFS.symlinkSync.call(this, target, path, type);
|
|
270
277
|
}
|
|
271
278
|
writeFile(file, data, options, callback) {
|
|
272
279
|
if (typeof file !== 'number') {
|
|
273
|
-
|
|
280
|
+
ProtectFs.checkProtected(file, false);
|
|
274
281
|
}
|
|
275
282
|
if (typeof callback === 'function') {
|
|
276
283
|
// @ts-expect-error should work
|
|
@@ -280,21 +287,21 @@ class ProtectFs {
|
|
|
280
287
|
}
|
|
281
288
|
writeFileSync(file, data, options) {
|
|
282
289
|
if (typeof file !== 'number') {
|
|
283
|
-
|
|
290
|
+
ProtectFs.checkProtected(file, false);
|
|
284
291
|
}
|
|
285
292
|
return nodeFS.writeFileSync.call(this, file, data, options);
|
|
286
293
|
}
|
|
287
294
|
unlink(path, callback) {
|
|
288
|
-
|
|
295
|
+
ProtectFs.checkProtected(path, false);
|
|
289
296
|
return nodeFS.unlink.call(this, path, callback || ((_err) => { }));
|
|
290
297
|
}
|
|
291
298
|
unlinkSync(path) {
|
|
292
|
-
|
|
299
|
+
ProtectFs.checkProtected(path, false);
|
|
293
300
|
return nodeFS.unlinkSync.call(this, path);
|
|
294
301
|
}
|
|
295
302
|
appendFile(file, data, options, callback) {
|
|
296
303
|
if (typeof file !== 'number') {
|
|
297
|
-
|
|
304
|
+
ProtectFs.checkProtected(file, false);
|
|
298
305
|
}
|
|
299
306
|
if (typeof callback === 'function') {
|
|
300
307
|
// @ts-expect-error should work
|
|
@@ -304,73 +311,73 @@ class ProtectFs {
|
|
|
304
311
|
}
|
|
305
312
|
appendFileSync(file, data, options) {
|
|
306
313
|
if (typeof file !== 'number') {
|
|
307
|
-
|
|
314
|
+
ProtectFs.checkProtected(file, false);
|
|
308
315
|
}
|
|
309
316
|
return nodeFS.appendFileSync.call(this, file, data, options);
|
|
310
317
|
}
|
|
311
318
|
chmod(path, mode, callback) {
|
|
312
|
-
|
|
319
|
+
ProtectFs.checkProtected(path, false);
|
|
313
320
|
return nodeFS.chmod.call(this, path, mode, callback || ((_err) => { }));
|
|
314
321
|
}
|
|
315
322
|
chmodSync(path, mode) {
|
|
316
|
-
|
|
323
|
+
ProtectFs.checkProtected(path, false);
|
|
317
324
|
return nodeFS.chmodSync.call(this, path, mode);
|
|
318
325
|
}
|
|
319
326
|
chown(path, uid, gid, callback) {
|
|
320
|
-
|
|
327
|
+
ProtectFs.checkProtected(path, false);
|
|
321
328
|
return nodeFS.chown.call(this, path, uid, gid, callback || ((_err) => { }));
|
|
322
329
|
}
|
|
323
330
|
chownSync(path, uid, gid) {
|
|
324
|
-
|
|
331
|
+
ProtectFs.checkProtected(path, false);
|
|
325
332
|
return nodeFS.chownSync.call(this, path, uid, gid);
|
|
326
333
|
}
|
|
327
334
|
copyFile(src, dest, mode, callback) {
|
|
328
|
-
|
|
329
|
-
|
|
335
|
+
ProtectFs.checkProtected(src, true);
|
|
336
|
+
ProtectFs.checkProtected(dest, false);
|
|
330
337
|
// @ts-expect-error should work
|
|
331
338
|
return nodeFS.copyFile.call(this, src, dest, mode, callback);
|
|
332
339
|
}
|
|
333
340
|
copyFileSync(src, dest, mode) {
|
|
334
|
-
|
|
335
|
-
|
|
341
|
+
ProtectFs.checkProtected(src, true);
|
|
342
|
+
ProtectFs.checkProtected(dest, false);
|
|
336
343
|
return nodeFS.copyFileSync.call(this, src, dest, mode);
|
|
337
344
|
}
|
|
338
345
|
rename(oldPath, newPath, callback) {
|
|
339
|
-
|
|
340
|
-
|
|
346
|
+
ProtectFs.checkProtected(oldPath, false);
|
|
347
|
+
ProtectFs.checkProtected(newPath, false);
|
|
341
348
|
return nodeFS.rename.call(this, oldPath, newPath, callback || ((_err) => { }));
|
|
342
349
|
}
|
|
343
350
|
renameSync(oldPath, newPath) {
|
|
344
|
-
|
|
345
|
-
|
|
351
|
+
ProtectFs.checkProtected(oldPath, false);
|
|
352
|
+
ProtectFs.checkProtected(newPath, false);
|
|
346
353
|
return nodeFS.renameSync.call(this, oldPath, newPath);
|
|
347
354
|
}
|
|
348
355
|
open(path, callback) {
|
|
349
|
-
|
|
356
|
+
ProtectFs.checkProtected(path, true);
|
|
350
357
|
return nodeFS.open.call(this, path, callback);
|
|
351
358
|
}
|
|
352
359
|
openSync(path, flags, mode) {
|
|
353
|
-
|
|
360
|
+
ProtectFs.checkProtected(path, true);
|
|
354
361
|
return nodeFS.openSync.call(this, path, flags, mode);
|
|
355
362
|
}
|
|
356
363
|
truncate(path, callback) {
|
|
357
|
-
|
|
364
|
+
ProtectFs.checkProtected(path, false);
|
|
358
365
|
return nodeFS.truncate.call(this, path, callback || ((_err) => { }));
|
|
359
366
|
}
|
|
360
367
|
truncateSync(path) {
|
|
361
|
-
|
|
368
|
+
ProtectFs.checkProtected(path, false);
|
|
362
369
|
return nodeFS.truncateSync.call(this, path);
|
|
363
370
|
}
|
|
364
371
|
exists(path, callback) {
|
|
365
|
-
|
|
372
|
+
ProtectFs.checkProtected(path, true);
|
|
366
373
|
return nodeFS.exists.call(this, path, callback);
|
|
367
374
|
}
|
|
368
375
|
existsSync(path) {
|
|
369
|
-
|
|
376
|
+
ProtectFs.checkProtected(path, true);
|
|
370
377
|
return nodeFS.existsSync.call(this, path);
|
|
371
378
|
}
|
|
372
379
|
stat(path, options, callback) {
|
|
373
|
-
|
|
380
|
+
ProtectFs.checkProtected(path, true);
|
|
374
381
|
if (typeof callback === 'function') {
|
|
375
382
|
// @ts-expect-error should work
|
|
376
383
|
return nodeFS.stat.call(this, path, options, callback);
|
|
@@ -379,19 +386,19 @@ class ProtectFs {
|
|
|
379
386
|
return nodeFS.stat.call(this, path, options);
|
|
380
387
|
}
|
|
381
388
|
statSync(path, options) {
|
|
382
|
-
|
|
389
|
+
ProtectFs.checkProtected(path, true);
|
|
383
390
|
return nodeFS.statSync.call(this, path, options);
|
|
384
391
|
}
|
|
385
392
|
utimes(path, atime, mtime, callback) {
|
|
386
|
-
|
|
393
|
+
ProtectFs.checkProtected(path, false);
|
|
387
394
|
return nodeFS.utimes.call(this, path, atime, mtime, callback || ((_err) => { }));
|
|
388
395
|
}
|
|
389
396
|
utimesSync(path, atime, mtime) {
|
|
390
|
-
|
|
397
|
+
ProtectFs.checkProtected(path, false);
|
|
391
398
|
return nodeFS.utimesSync.call(this, path, atime, mtime);
|
|
392
399
|
}
|
|
393
400
|
readdir(path, options, callback) {
|
|
394
|
-
|
|
401
|
+
ProtectFs.checkProtected(path, true);
|
|
395
402
|
if (typeof callback === 'function') {
|
|
396
403
|
return nodeFS.readdir.call(this, path, options, callback);
|
|
397
404
|
}
|
|
@@ -399,46 +406,46 @@ class ProtectFs {
|
|
|
399
406
|
return nodeFS.readdir.call(this, path, options);
|
|
400
407
|
}
|
|
401
408
|
readdirSync(path, options) {
|
|
402
|
-
|
|
409
|
+
ProtectFs.checkProtected(path, true);
|
|
403
410
|
// @ts-expect-error should work
|
|
404
411
|
return nodeFS.readdirSync.call(this, path, options);
|
|
405
412
|
}
|
|
406
413
|
createReadStream(path, options) {
|
|
407
|
-
|
|
414
|
+
ProtectFs.checkProtected(path, true);
|
|
408
415
|
return nodeFS.createReadStream.call(this, path, options);
|
|
409
416
|
}
|
|
410
417
|
createWriteStream(path, options) {
|
|
411
|
-
|
|
418
|
+
ProtectFs.checkProtected(path, false);
|
|
412
419
|
return nodeFS.createWriteStream.call(this, path, options);
|
|
413
420
|
}
|
|
414
421
|
lchmod(path, mode, callback) {
|
|
415
|
-
|
|
422
|
+
ProtectFs.checkProtected(path, false);
|
|
416
423
|
return nodeFS.lchmod.call(this, path, mode, callback || ((_err) => { }));
|
|
417
424
|
}
|
|
418
425
|
lchmodSync(path, mode) {
|
|
419
|
-
|
|
426
|
+
ProtectFs.checkProtected(path, false);
|
|
420
427
|
return nodeFS.lchmodSync.call(this, path, mode);
|
|
421
428
|
}
|
|
422
429
|
lchown(path, uid, gid, callback) {
|
|
423
|
-
|
|
430
|
+
ProtectFs.checkProtected(path, false);
|
|
424
431
|
return nodeFS.lchown.call(this, path, uid, gid, callback || ((_err) => { }));
|
|
425
432
|
}
|
|
426
433
|
lchownSync(path, uid, gid) {
|
|
427
|
-
|
|
434
|
+
ProtectFs.checkProtected(path, false);
|
|
428
435
|
return nodeFS.lchownSync.call(this, path, uid, gid);
|
|
429
436
|
}
|
|
430
437
|
link(existingPath, newPath, callback) {
|
|
431
|
-
|
|
432
|
-
|
|
438
|
+
ProtectFs.checkProtected(existingPath, false);
|
|
439
|
+
ProtectFs.checkProtected(newPath, false);
|
|
433
440
|
return nodeFS.link.call(this, existingPath, newPath, callback || ((_err) => { }));
|
|
434
441
|
}
|
|
435
442
|
linkSync(existingPath, newPath) {
|
|
436
|
-
|
|
437
|
-
|
|
443
|
+
ProtectFs.checkProtected(existingPath, false);
|
|
444
|
+
ProtectFs.checkProtected(newPath, false);
|
|
438
445
|
return nodeFS.linkSync.call(this, existingPath, newPath);
|
|
439
446
|
}
|
|
440
447
|
lstat(path, options, callback) {
|
|
441
|
-
|
|
448
|
+
ProtectFs.checkProtected(path, true);
|
|
442
449
|
if (typeof callback === 'function') {
|
|
443
450
|
// @ts-expect-error should work
|
|
444
451
|
return nodeFS.lstat.call(this, path, options, callback);
|
|
@@ -447,19 +454,19 @@ class ProtectFs {
|
|
|
447
454
|
return nodeFS.lstat.call(this, path, options);
|
|
448
455
|
}
|
|
449
456
|
lstatSync(path, options) {
|
|
450
|
-
|
|
457
|
+
ProtectFs.checkProtected(path, true);
|
|
451
458
|
return nodeFS.lstatSync.call(this, path, options);
|
|
452
459
|
}
|
|
453
460
|
lutimes(path, atime, mtime, callback) {
|
|
454
|
-
|
|
461
|
+
ProtectFs.checkProtected(path, false);
|
|
455
462
|
return nodeFS.lutimes.call(this, path, atime, mtime, callback || ((_err) => { }));
|
|
456
463
|
}
|
|
457
464
|
lutimesSync(path, atime, mtime) {
|
|
458
|
-
|
|
465
|
+
ProtectFs.checkProtected(path, false);
|
|
459
466
|
return nodeFS.lutimesSync.call(this, path, atime, mtime);
|
|
460
467
|
}
|
|
461
468
|
mkdir(path, options, callback) {
|
|
462
|
-
|
|
469
|
+
ProtectFs.checkProtected(path, false);
|
|
463
470
|
if (typeof callback === 'function') {
|
|
464
471
|
// @ts-expect-error should work
|
|
465
472
|
return nodeFS.mkdir.call(this, path, options, callback);
|
|
@@ -467,11 +474,11 @@ class ProtectFs {
|
|
|
467
474
|
return nodeFS.mkdir.call(this, path, options);
|
|
468
475
|
}
|
|
469
476
|
mkdirSync(path, options) {
|
|
470
|
-
|
|
477
|
+
ProtectFs.checkProtected(path, false);
|
|
471
478
|
return nodeFS.mkdirSync.call(this, path, options);
|
|
472
479
|
}
|
|
473
480
|
mkdtemp(prefix, options, callback) {
|
|
474
|
-
|
|
481
|
+
ProtectFs.checkProtected(prefix, false);
|
|
475
482
|
if (typeof callback === 'function') {
|
|
476
483
|
// @ts-expect-error should work
|
|
477
484
|
return nodeFS.mkdtemp.call(this, prefix, options, callback);
|
|
@@ -479,11 +486,11 @@ class ProtectFs {
|
|
|
479
486
|
return nodeFS.mkdtemp.call(this, prefix, options);
|
|
480
487
|
}
|
|
481
488
|
mkdtempSync(prefix, options) {
|
|
482
|
-
|
|
489
|
+
ProtectFs.checkProtected(prefix, false);
|
|
483
490
|
return nodeFS.mkdtempSync.call(this, prefix, options);
|
|
484
491
|
}
|
|
485
492
|
rm(path, options, callback) {
|
|
486
|
-
|
|
493
|
+
ProtectFs.checkProtected(path, false);
|
|
487
494
|
if (typeof callback === 'function') {
|
|
488
495
|
return nodeFS.rm.call(this, path, options, callback);
|
|
489
496
|
}
|
|
@@ -491,11 +498,11 @@ class ProtectFs {
|
|
|
491
498
|
return nodeFS.rm.call(this, path, options);
|
|
492
499
|
}
|
|
493
500
|
rmSync(path, options) {
|
|
494
|
-
|
|
501
|
+
ProtectFs.checkProtected(path, false);
|
|
495
502
|
return nodeFS.rmSync.call(this, path, options);
|
|
496
503
|
}
|
|
497
504
|
rmdir(path, options, callback) {
|
|
498
|
-
|
|
505
|
+
ProtectFs.checkProtected(path, false);
|
|
499
506
|
if (typeof callback === 'function') {
|
|
500
507
|
return nodeFS.rmdir.call(this, path, options, callback);
|
|
501
508
|
}
|
|
@@ -503,11 +510,11 @@ class ProtectFs {
|
|
|
503
510
|
return nodeFS.rmdir.call(this, path, options);
|
|
504
511
|
}
|
|
505
512
|
rmdirSync(path, options) {
|
|
506
|
-
|
|
513
|
+
ProtectFs.checkProtected(path, false);
|
|
507
514
|
return nodeFS.rmdirSync.call(this, path, options);
|
|
508
515
|
}
|
|
509
516
|
watch(filename, options, listener) {
|
|
510
|
-
|
|
517
|
+
ProtectFs.checkProtected(filename, true);
|
|
511
518
|
if (typeof listener === 'function') {
|
|
512
519
|
// @ts-expect-error should work
|
|
513
520
|
return nodeFS.watch.call(this, filename, options, listener);
|
|
@@ -515,11 +522,11 @@ class ProtectFs {
|
|
|
515
522
|
return nodeFS.watch.call(this, filename, options);
|
|
516
523
|
}
|
|
517
524
|
watchFile(filename, listener) {
|
|
518
|
-
|
|
525
|
+
ProtectFs.checkProtected(filename, true);
|
|
519
526
|
return nodeFS.watchFile.call(this, filename, listener);
|
|
520
527
|
}
|
|
521
528
|
unwatchFile(filename, listener) {
|
|
522
|
-
|
|
529
|
+
ProtectFs.checkProtected(filename, true);
|
|
523
530
|
return nodeFS.unwatchFile.call(this, filename, listener);
|
|
524
531
|
}
|
|
525
532
|
}
|