app commands works

This commit is contained in:
Jan Prochazka
2022-01-27 17:01:58 +01:00
parent 595c9424df
commit a76ba60272
10 changed files with 174 additions and 25 deletions

View File

@@ -7,6 +7,7 @@ const hasPermission = require('../utility/hasPermission');
const socket = require('../utility/socket');
const scheduler = require('./scheduler');
const getDiagramExport = require('../utility/getDiagramExport');
const apps = require('./apps');
function serialize(format, data) {
if (format == 'text') return data;
@@ -94,8 +95,10 @@ module.exports = {
socket.emitChanged(`archive-files-changed-${folder.substring('archive:'.length)}`);
return true;
} else if (folder.startsWith('app:')) {
await fs.writeFile(path.join(appdir(), folder.substring('app:'.length), file), serialize(format, data));
socket.emitChanged(`app-files-changed-${folder.substring('app:'.length)}`);
const app = folder.substring('app:'.length);
await fs.writeFile(path.join(appdir(), app, file), serialize(format, data));
socket.emitChanged(`app-files-changed-${app}`);
apps.emitChangedDbApp(folder);
return true;
} else {
if (!hasPermission(`files/${folder}/write`)) return false;