This commit is contained in:
Jiang Yio 2022-10-01 07:41:42 -04:00
parent dac1add279
commit 53812f7c85

View File

@ -138,8 +138,8 @@ export function TplFS(client, parent, desc) {
var nodes = (await client.TIU_TEMPLATE_GETITEMS(desc.IEN)).map(x => x.IEN); var nodes = (await client.TIU_TEMPLATE_GETITEMS(desc.IEN)).map(x => x.IEN);
nodes.push(nodeid); nodes.push(nodeid);
await client.TIU_TEMPLATE_SET_ITEMS(desc.IEN, nodes); await client.TIU_TEMPLATE_SET_ITEMS(desc.IEN, nodes);
nodeid = (await client.TIU_TEMPLATE_GETITEMS(desc.IEN)).find(x => (x.type == 'C') && (x.name == name)); item = (await client.TIU_TEMPLATE_GETITEMS(desc.IEN)).find(x => (x.type == 'C') && (x.name == name));
if(nodeid) return new TplFS(client, this, nodeid); if(item) return new TplFS(client, this, item);
else throw new TplFSErrorPerm('mkdir', (this.path != '' ? this.path + '/' : '') + name, 'Failed to create directory'); else throw new TplFSErrorPerm('mkdir', (this.path != '' ? this.path + '/' : '') + name, 'Failed to create directory');
} finally { } finally {
await client.TIU_TEMPLATE_UNLOCK(desc.IEN); await client.TIU_TEMPLATE_UNLOCK(desc.IEN);
@ -217,9 +217,9 @@ export function EncFS(fs, data_encrypt, data_decrypt, path_encrypt, path_decrypt
this.list = async (filter=null) => (await fs.list(filter)).map(x => new EncFS(x, data_encrypt, data_decrypt, path_encrypt, path_decrypt)); this.list = async (filter=null) => (await fs.list(filter)).map(x => new EncFS(x, data_encrypt, data_decrypt, path_encrypt, path_decrypt));
this.open = async (path) => new EncFS(await fs.open(await path_encrypt(path)), data_encrypt, data_decrypt, path_encrypt, path_decrypt); this.open = async (path) => new EncFS(await fs.open(await path_encrypt(path)), data_encrypt, data_decrypt, path_encrypt, path_decrypt);
this.mkdir = async (path, tries=5, delay=1000) => new EncFS(await fs.mkdir(await path_encrypt(path), tries=5, delay=1000), data_encrypt, data_decrypt, path_encrypt, path_decrypt); this.mkdir = async (path, tries=5, delay=1000) => new EncFS(await fs.mkdir(await path_encrypt(path), tries, delay), data_encrypt, data_decrypt, path_encrypt, path_decrypt);
this.create = async (path, data, mkdir=false, tries=5, delay=1000) => new EncFS(await fs.create(await path_encrypt(path), await data_encrypt(data), mkdir=false, tries=5, delay=1000), data_encrypt, data_decrypt, path_encrypt, path_decrypt); this.create = async (path, data, mkdir=false, tries=5, delay=1000) => new EncFS(await fs.create(await path_encrypt(path), await data_encrypt(data), mkdir, tries, delay), data_encrypt, data_decrypt, path_encrypt, path_decrypt);
this.remove = async (path, tries=5, delay=1000) => await fs.remove(await path_encrypt(path), tries=5, delay=1000); this.remove = async (path, tries=5, delay=1000) => await fs.remove(await path_encrypt(path), tries, delay);
this.update = async (path, data) => new EncFS(await fs.update(await path_encrypt(path), await data_encrypt(data)), data_encrypt, data_decrypt, path_encrypt, path_decrypt); this.update = async (path, data) => new EncFS(await fs.update(await path_encrypt(path), await data_encrypt(data)), data_encrypt, data_decrypt, path_encrypt, path_decrypt);
this.cat = async (path) => await data_decrypt(await fs.cat(await path_encrypt(path))); this.cat = async (path) => await data_decrypt(await fs.cat(await path_encrypt(path)));
} }