Initial commit

This commit is contained in:
2023-08-29 19:55:48 +02:00
commit 7c2eec4446
473 changed files with 40947 additions and 0 deletions

135
Backend/dist/Core.js vendored Normal file
View File

@@ -0,0 +1,135 @@
exports.__esModule = true;
var fs_1 = require("fs");
var fs_extra_1 = require("fs-extra");
var os_1 = require("os");
var path = require("path");
var os = require("os");
var bnj = require("bonjour");
var FileHandler_1 = require("./FileHandler");
var WebServer_1 = require("./WebServer");
var SocketServer_1 = require("./SocketServer");
var DeckManager_1 = require("./Decks/DeckManager");
var PageManager_1 = require("./Pages/PageManager");
var IntegrationsManager_1 = require("./Integrations/IntegrationsManager");
var ConnectionManager_1 = require("./ConnectionManager");
var Icons_1 = require("./Icons");
var Logger_1 = require("./Logger");
var bonjour = bnj();
Undecked = {
DEVMODE: process.argv.includes('--dev'),
quality: 96,
dataPath: path.join(os_1.homedir(), 'MorphixProductions', 'Undecked'),
FileHandler: new FileHandler_1.FileHandler(),
WebServer: new WebServer_1.WebServer(),
SocketServer: new SocketServer_1.SocketServer(),
Decks: new DeckManager_1.DeckManager(),
Pages: new PageManager_1.PageManager(),
Integrations: new IntegrationsManager_1.IntegrationsManager(),
Connections: new ConnectionManager_1.ConnectionManager(),
Icons: new Icons_1.Icons(),
getName: function () {
if (Config.name != null)
return Config.name;
if (os.userInfo().username.length > 0)
return os.userInfo().username;
return os.hostname();
}
};
Undecked.start = function () {
Logger_1.Log('info', 'Starting Undecked');
var start = function () {
return Undecked.FileHandler.load(function () {
Undecked.Decks.load(function () {
Undecked.Icons.load(function () {
Undecked.Pages.load(function () {
Undecked.Integrations.load(function () {
Undecked.Connections.load(function () {
Undecked.WebServer.start(function (server) {
Undecked.SocketServer.start(server, function () {
Logger_1.Log('info', 'Undecked started');
try {
bonjour.publish({
name: Undecked.getName(),
type: 'undecked',
port: Config.ports.http
});
}
catch (error) { }
});
});
});
});
});
});
});
});
};
fs_extra_1.pathExists(path.join(os_1.homedir(), 'GetiyoSoftware', 'Undecked'), function (err, exists) {
if (err)
throw err;
if (exists)
fs_extra_1.move(path.join(os_1.homedir(), 'GetiyoSoftware', 'Undecked'), Undecked.dataPath, function (err) {
if (err)
throw err;
start();
});
else
start();
});
};
Undecked.generateRandom = function (length, checksum, chars) {
if (chars === void 0) { chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; }
for (var i = 0; i < 1000; i++) {
var str = '';
for (var i_1 = 0; i_1 < length; i_1++) {
str += chars.charAt(Math.floor(Math.random() * chars.length));
}
if (checksum != undefined)
if (checksum(str))
return str;
else
return str;
}
};
Undecked.convert = function () {
var outputWhiteDir = path.join(__filename, '..', '..', '..', 'Static', 'materialicons', 'white');
var outputBlackDir = path.join(__filename, '..', '..', '..', 'Static', 'materialicons', 'black');
var inputWhiteDir = path.join("C:\\Users\\Mees\\Pictures\\materialicons\\white");
var inputBlackDir = path.join("C:\\Users\\Mees\\Pictures\\materialicons\\black");
fs_extra_1.ensureDir(outputWhiteDir, function (err) {
if (err)
throw err;
fs_extra_1.ensureDir(inputBlackDir, function (err) {
if (err)
throw err;
fs_1.readdir(path.join(inputBlackDir), function (err, files) {
if (err)
throw err;
console.log("Found " + files.length + " icons");
(function handleCopy(i) {
if (i === void 0) { i = 0; }
if (files[i]) {
var inputWhite = path.join(inputWhiteDir, files[i], 'sharp.png');
var inputBlack = path.join(inputBlackDir, files[i], 'sharp.png');
var outputWhite = path.join(outputWhiteDir, files[i] + "_low.png");
var outputBlack = path.join(outputBlackDir, files[i] + "_low.png");
fs_extra_1.copy(inputWhite, outputWhite, function (err) {
if (err)
console.log("Error whilst copying white '" + files[i] + "'");
fs_extra_1.copy(inputBlack, outputBlack, function (err) {
if (err)
console.log("Error whilst copying black '" + files[i] + "'");
console.log("Completed convertion on " + (i + 1) + "/" + files.length);
handleCopy(i + 1);
});
});
}
else
console.log('--- Convertion completed ---');
})();
});
});
});
};
Undecked.start();
//# sourceMappingURL=Core.js.map