forked from open-dash/open-dash-diy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.js
76 lines (68 loc) · 23 KB
/
install.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
console.log("Installing config files for a blank install")
var fs = require('fs');
var settings = { "settings": { "version": "0.5", "token": "", "apiUrl": "", "clientId": "", "clientSecret": "", "port": "3000" } };
var updates = { "updates": "" };
var smartthings = { "devices": "", "locations": "", "modes": "", "routines": "" };
var dashboards = { "dashboards": [] };
var cameras = { "cameras": [] };
var styles = { "styles": { "global": "LmJvcmRlciB7CiAgICBib3JkZXI6IDFweCAjMDAwIHNvbGlkOwp9CgoudGFiY29udHJvbD4uZnJhbWVzIC5mcmFtZSB7CiAgICBiYWNrZ3JvdW5kLWNvbG9yOiBpbmhlcml0ICFpbXBvcnRhbnQ7CiAgICBib3JkZXI6IDFweCBzb2xpZCAjMWJhMWUyOwp9CgoudGlsZS1ncm91cCB7CgltYXJnaW4tbGVmdDogMjBweCAhaW1wb3J0YW50Owp9", "dashboards": [{ "id": 0, "name": "Image", "css": "LnRpbGUgewogICAgZGlzcGxheTogYmxvY2s7CiAgICBmbG9hdDogbGVmdDsKICAgIG1hcmdpbjogMHB4OwogICAgYm9yZGVyOiAxcHggc29saWQgcmdiYSgyNTUsIDI1NSwgMjU1LCAwLjI4KTsKICAgIGN1cnNvcjogcG9pbnRlcjsKICAgIHBvc2l0aW9uOiByZWxhdGl2ZTsKICAgIG92ZXJmbG93OiBoaWRkZW47Cn0KCi50aWxlLXdpZGUgewogICAgd2lkdGg6IDMwMHB4Owp9CgojZGFzaGJvYXJkIHsKYmFja2dyb3VuZC1pbWFnZSA6IHVybChodHRwczovL2xoNC5nb29nbGV1c2VyY29udGVudC5jb20vLU4wSWMxVmJOMlVFL1VpX2VKSHVnWjJJL0FBQUFBQUFBRnpnL1A5Ti1RTlFpc1ZJL3MxMjgwLXcxMjgwLWMtaDcyMC9mYXJtX2luX3RoZV9wcmFpcmllLmpwZyk7Cn0KCgoKLnRpbGUtbGFiZWwgewogICAgZm9udC1zaXplOiAuOWVtOwogICAgcGFkZGluZzogMCAhaW1wb3J0YW50OwogICAgbGVmdDogNSAhaW1wb3J0YW50OwogICAgcGFkZGluZy1ib3R0b206IDVweCAhaW1wb3J0YW50OwogICAgdGV4dC1hbGlnbjogbGVmdCAhaW1wb3J0YW50Owp9CgoudGV4dC1zaGFkb3cgewogICAgdGV4dC1zaGFkb3c6IDFweCAxcHggMXB4IHJnYigyNTUsIDI1NSwgMjU1KTsKfQoKI2Rhc2hib2FyZCB7CiAgICBiYWNrZ3JvdW5kLXJlcGVhdDogbm8tcmVwZWF0OwogICAgYmFja2dyb3VuZC1hdHRhY2htZW50OiBmaXhlZDsKICAgIGJhY2tncm91bmQtcG9zaXRpb246IGNlbnRlciBjZW50ZXI7CiAgICBiYWNrZ3JvdW5kLXNpemU6IGNvdmVyOwogICAgaGVpZ2h0OiAxMDAlOwogICAgbWluLWhlaWdodDogMTAwJTsKfQoKLnRpbGUgewogICAgb3BhY2l0eTogLjg7CiAgICBjb2xvcjogI2NjYzsKICAgIGJhY2tncm91bmQtY29sb3I6ICMwMDA7Cn0KCi50aWxlLAoudGlsZS1zbWFsbCwKLnRpbGUtc3F1YXJlLAoudGlsZS13aWRlLAoudGlsZS1sYXJnZSwKLnRpbGUtYmlnLAoudGlsZS1zdXBlciB7CiAgICBvcGFjaXR5OiAwOwogICAgLXdlYmtpdC10cmFuc2Zvcm06IHNjYWxlKC41KTsKICAgIHRyYW5zZm9ybTogc2NhbGUoLjUpOwp9CgoK" }, { "id": 1, "name": "Plain", "css": "Ym9keSB7IGJhY2tncm91bmQ6IGJsYWNrIH0=" }] } }
var templates = { "templates": [{ "id": "default", "content": "PGRpdiBpZD0ie3tkZXZpY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QoJyNkZXRhaWxzX3t7ZGV2aWNlLmRhc2hJZH19JykuZmluZCgiLiIgKyBpKS5odG1sKGF0dHJpYnMuYXR0cmlidXRlc1tpXSk7CiAgICAgICAgfQogICAgICAgICQoIiNkZXRhaWxzX3t7ZGV2aWNlLmRhc2hEZXZJZH19IikuZmluZCgnaW5wdXRbdHlwZT1yYW5nZV0nKS52YWwoYXR0cmlicy5hdHRyaWJ1dGVzLmxldmVsKTsKICAgICAgICB2YXIgY2hlY2tlZCA9IChhdHRyaWJzLmF0dHJpYnV0ZXMuc3dpdGNoID09ICJvZmYiKSA/IGZhbHNlIDogdHJ1ZTsKICAgICAgICAkKCIje3tkZXZpY2UuZGFzaERldklkfX0iKS5maW5kKCdpbnB1dFt0eXBlPWNoZWNrYm94XScpLnByb3AoImNoZWNrZWQiLCBjaGVja2VkKSAKCiAgICAgICAgJCgnI2RldGFpbHNfe3tkZXZpY2UuZGFzaERldklkfX0gLmxldmVsJykub24oImNoYW5nZSIsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgICQoIiNkZXRhaWxzX3t7ZGV2aWNlLmRhc2hJZH19IikuZmluZCgnaW5wdXRbdHlwZT1yYW5nZV0nKS52YWwoZS50YXJnZXQuaW5uZXJIVE1MKTsKICAgICAgICB9KTsKICAgICAgICAkKCcjZGV0YWlsc197e2RldmljZS5kYXNoRGV2SWR9fSAuc3dpdGNoJykub24oImNoYW5nZSIsIGZ1bmN0aW9uIChlKSB7CiAgICAgICAgICAgIHZhciBjaGVja2VkID0gKGUudGFyZ2V0LmlubmVySFRNTCA9PSAib2ZmIikgPyBmYWxzZSA6IHRydWU7CiAgICAgICAgICAgICQoIiN7e2RldmljZS5kYXNoSWR9fSIpLmZpbmQoJ2lucHV0W3R5cGU9Y2hlY2tib3hdJykucHJvcCgiY2hlY2tlZCIsIGNoZWNrZWQpOwogICAgICAgIH0pOwogICAgfSk7Cgo8L3NjcmlwdD4=" }, { "id": "lock", "content": "PGRpdiBpZD0ie3tkZ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7CiAgICBmb3IgKHZhciBpIGluIGF0dHJpYnMuYXR0cmlidXRlcykgewogICAgICAgICQoJyNkZXRhaWxzX3t7ZGV2aWNlLmRhc2hEZXZJZH19JykuYXBwZW5kKGkgKyAiOiA8c3BhbiBjbGFzcz0nIiArIGkgKyAiJz4iICsgYXR0cmlicy5hdHRyaWJ1dGVzW2ldICsgIjwvc3Bhbj4gIik7CiAgICB9Cgo8L3NjcmlwdD4=" }, { "id": "routine", "content": "PGRpdiBpZD0ie3tkZXZpY2UuZGFzaERldklkfX0iIGNsYXNzPSJ0aWxlIHRleHQtc2hhZG93IiBkYXRhLXJvbGU9InRpbGUiIGRhdGEtaWQ9Int7ZGV2aWNlLmlkfX0iPgogICAgPGRpdiBjbGFzcz0idGlsZS1jb250ZW50IiBkYXRhLWFjdGlvbj0icm91dGluZSIgZGF0YS1hcGk9Int7ZGV2aWNlLmFwaX19IiBkYXRhLWNvbW1hbmQ9InRvZ2dsZSI+CiAgICB7e2RldmljZS50eXBlfX0KICAgICAgICA8c3BhbiBjbGFzcz0idGlsZS1sYWJlbCI+e3tkZXZpY2UubmFtZX19PC9zcGFuPgogICAgICAgIDxzcGFuIGlkPSJkZXRhaWxzX3t7ZGV2aWNlLmRhc2hEZXZJZH19Ij4KICAgICAgICA8L3NwYW4+CiAgICA8L2Rpdj4KPC9kaXY+Cgo8IS0tIFJlcXVpcmVkIFNjcmlwdHMgLS0+CjxzY3JpcHQ+Cjwvc2NyaXB0Pg==" }] };
if (!fs.existsSync('data')) {
fs.mkdirSync('data');
}
if (!fs.existsSync('data/settings.json')) {
//create settings.json
fs.writeFile('data/settings.json', JSON.stringify(settings), function(err) {
if (err) {
return console.log(err);
}
});
};
if (!fs.existsSync('data/updates.json')) {
//create settings.json
fs.writeFile('data/updates.json', JSON.stringify(updates), function(err) {
if (err) {
return console.log(err);
}
});
};
if (!fs.existsSync('data/smartthings.json')) {
//create settings.json
fs.writeFile('data/smartthings.json', JSON.stringify(smartthings), function(err) {
if (err) {
return console.log(err);
}
});
};
if (!fs.existsSync('data/dashboards.json')) {
//create settings.json
fs.writeFile('data/dashboards.json', JSON.stringify(dashboards), function(err) {
if (err) {
return console.log(err);
}
});
};
if (!fs.existsSync('data/cameras.json')) {
//create settings.json
fs.writeFile('data/cameras.json', JSON.stringify(cameras), function(err) {
if (err) {
return console.log(err);
}
});
};
if (!fs.existsSync('data/templates.json')) {
//create settings.json
fs.writeFile('data/templates.json', JSON.stringify(templates), function(err) {
if (err) {
return console.log(err);
}
});
};
if (!fs.existsSync('data/styles.json')) {
//create settings.json
fs.writeFile('data/styles.json', JSON.stringify(styles), function(err) {
if (err) {
return console.log(err);
}
});
};