First commit

This commit is contained in:
2025-12-25 11:16:59 +01:00
commit 0c5ca09a63
720 changed files with 329234 additions and 0 deletions

View File

@@ -0,0 +1,375 @@
/*
Copyright (c) 2020, 2023, The Unified Company.
This code is part of Unify.
This program is free software; you can redistribute it and/or modify
it under the terms of the ESA Software Community License - Strong Copyleft LICENSE,
as published by the ESA.
See the ESA Software Community License - Strong Copyleft LICENSE, for more details.
https://unifyjs.org
*/
import tools from '../../unify/tools.js';
import querySQL from '../../unify/querySQL.js';
import Console from '../console.js';
import database from '../database.js';
import userManager from '../userManager.js';
import filemanager from '../filemanager.js';
import path from 'path';
import fs from 'fs';
var __dirname = path.resolve();
var files = new filemanager();
export default class settingsController{
__className = "settingsController";
__sourcePath = "./framework/server/cachedControllers/settingsController.js";
__publicMethods = "setType,getCacheDateTime,recreateCache,setVisibleElements,setTheme,signOut,signIn";
setType( object, client, eventName ) {
//console.log("set type", object);
switch( object ) {
case "debug":
client.type = "debug";
break;
}
}
removeClient( object, client, eventName ) {
//client.destroy();
//console.log( "removed client", client.id );
}
getCacheDateTime() {
return fs.statSync( "./assets/cache/cache.js" ).mtime
}
recreateCache( object ) {
console.log("object.performCacheUpdate = true;", object.getClassName());
object.performCacheUpdate = true;
}
setVisibleElements( elements, client, eventName ) {
//console.log("setVisibleElements", elements);
global.visibleElements = elements.split(",");
}
setTheme( themeProfileJSON ) {
var themeProfile = JSON.parse( themeProfileJSON );
console.log("setTheme", themeProfile );
global.os = tools.CamelCase( themeProfile.os );
global.device = tools.CamelCase( themeProfile.device );
global.tint = tools.CamelCase( themeProfile.tint );
}
debugObject( path, client, eventName ){
//Console.enableLog( path );
console.log( "enable debug object", path );
}
signOut( cookieUser, client, eventName ) {
return userManager.signOut( cookieUser, client, eventName );
}
signIn( cookieUser, client, eventName ) {
return userManager.signin( cookieUser, client );
}
deleteFile( file ) {
files.removeFile( __dirname + "/application/" + file.path + "/" + file.name );
files.removeFile( __dirname + "/framework/cache/" + file.path + "/" + file.name );
this.updateCache();
}
removeDirectory( file ) {
files.removeDir( __dirname + "/application/" + file.path + "/" );
files.removeDir( __dirname + "/framework/cache/" + file.path + "/" );
this.updateCache();
}
async updateCache() {
//await files.findApplicationFiles( "./application");
//global.applicationManager.applications = files.applications;
//console.log("updated applications", files.applications);
/*
await files.removeFiles( "./framework/cache/");
await files.removeDirectories( "./framework/cache/" );
await files.createDirectories();
await files.writeFiles();
*/
}
saveFile( file ) {
fs.writeFileSync( __dirname + "/application/" + file.path + "/" + file.name, file.source );
fs.writeFileSync( __dirname + "/framework/cache/" + file.path + "/" + file.name, files.parseSource( file.source) );
this.updateCache();
}
createDirectory( file ) {
console.log( "create directory", file );
files.createDir( __dirname + "/application/" + file.path );
files.createDir( __dirname + "/framework/cache/" + file.path );
}
}