mirror of
https://github.com/UiO-Gaming/infoscreen3.git
synced 2026-11-05 13:56:52 +01:00
add templates support
This commit is contained in:
1 parent
ea7fe05bf2
commit
a6c4327b5d
7 files changed
+45
-5
No files matched your search
+12
-1
@@ -373,6 +373,9 @@ class admin {
|
||||
let bundle = self.bundleManager.getBundle(data.bundleName);
|
||||
let bundleData = bundle.getBundleData();
|
||||
let json = "{}";
|
||||
if (fs.existsSync("./data/template.json")) {
|
||||
json = fs.readFileSync("./data/template.json").toString();
|
||||
}
|
||||
let slide = {displayTime: null};
|
||||
if (data.fileName) {
|
||||
json = bundle.getSlideJsonFile(data.fileName);
|
||||
@@ -403,6 +406,14 @@ class admin {
|
||||
self.updateDashboard(io);
|
||||
});
|
||||
|
||||
socket.on('edit.saveTemplate', function (data) {
|
||||
try {
|
||||
fs.writeFileSync("./data/template.json", JSON.stringify(data.json));
|
||||
} catch (e) {
|
||||
cli.error(e, "save template");
|
||||
}
|
||||
});
|
||||
|
||||
socket.on('edit.save', function (data) {
|
||||
|
||||
let filename = data.fileName.replace(".json", "");
|
||||
@@ -601,4 +612,4 @@ class admin {
|
||||
/**
|
||||
* @type {admin}
|
||||
*/
|
||||
module.exports = admin;
|
||||
module.exports = admin;
|
||||
Reference in new issue
Block a user