Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const path = require('path');
const StreamDeck = require('elgato-stream-deck');
const fs = require('fs');
const homedir = require('homedir');
const objChange = require('object-change');
// CREATE TXT FILE FOR MARKERS
var tcToTxt = fs.createWriteStream(homedir()+'/desktop/button-switch-log.txt', {
flags: 'a' // 'a' means appending (old data will be preserved)
});
// SETTINGS JSON FILE //
// GRAB SAVED IP ADDRESS FROM STORAGE
const dataPath = storage.getDataPath();
//console.log(dataPath);
storage.get('atem-ip-address', function(error, data) {
if (error) throw error;
if (data.atemIPAddress === undefined) {
document.getElementById('idAddressInput').value = "";
} else {
document.getElementById('idAddressInput').value = data.atemIPAddress;
};
});
storage.get('hyperdeck-ip-address', function(error, data) {
if (error) throw error;
if (data.hyperdeckIPAddress === undefined) {
document.getElementById('ipAddressInputHyperDeck').value = "";
} else {
document.getElementById('ipAddressInputHyperDeck').value = data.hyperdeckIPAddress;
};
$scope.shuffle = false;
$scope.mute = false;
$scope.theme = "dark";
// $scope.playMusic();
var slider = document.getElementById("myRange");
var sk = document.getElementById('seek');
var checkbox = document.getElementById("checkboxrn")
const ipc = require('electron').ipcRenderer;
const jsmediatags = require("jsmediatags");
const fs = require('fs')
const path = require('path')
const storage = require('electron-json-storage');
const dataPath = storage.getDataPath();
// fs.readFile('theme.txt', 'utf-8', function (err, buf) {
// if (err)
// return
// var temp = buf.toString();
// if(temp == "light")
// $location.path('/player/light')
// console.log(temp);
// });
storage.has('path', function (error, hasKey) {
if (error) throw error;
if (hasKey) {
storage.get('path', function (error, data) {
if (error) throw error;
console.log(data);
const StreamDeck = require("elgato-stream-deck");
const { ipcRenderer } = require("electron");
const storage = require("electron-json-storage");
const path = require("path");
const fs = require("fs");
const chokidar = require("chokidar");
const dataPath = storage.getDataPath();
const atem = require("./atem");
const hyperdeck = require("./hyperdeck");
// STREAM DECK CONNECT //
let myStreamDeck;
ipcRenderer.on("streamdeck-reboot", (event, arg) => {
images();
});
const connect = () => {
streamDeckConnectLED.style.backgroundColor = "#ff4d4d";
myStreamDeck = new StreamDeck();
const { app, BrowserWindow, dialog, Menu } = require('electron')
const path = require('path')
const url = require('url')
const join = require('path').join
const { autoUpdater } = require('electron-updater')
const fs = require('fs')
const openAboutWindow = require('about-window').default
const storage = require('electron-json-storage')
const dataPath = storage.getDataPath()
let win
function createWindow() {
// Create the browser window.
win = new BrowserWindow({
width: 1000,
height: 620,
icon: __dirname + '/dusk.png',
webPreferences: {
nodeIntegration: true
}
})
var light = false
var dark = false
loadLangs(callback) {
let _this = this;
if (fs.existsSync(storage.getDataPath())) {
let lng_to_load = [];
let dir = fs.readdirSync(storage.getDataPath());
for (let x = 0; x < dir.length; x++) {
if (dir[x].indexOf('lang.') >= 0) {
lng_to_load.push(dir[x].replace('.json', ''));
}
}
if (!lng_to_load.length) {
return;
}
storage.getMany(lng_to_load, function (error, langs) {
if (error) throw new Error("Can't load selected translation");
let lng;
for (lng in langs.lang) {
_this.langsCount++;
}
if (langs.lang[Config.get('lang', _this.default)] === undefined) {
_this.default = lng;
data = JSON.parse(data.response).langs;
let checked = 0;
for (let one in data) {
let name = data[one].name;
let size = data[one].size;
let loadLang = () => {
rq({uri: 'https://raw.githubusercontent.com/pumPCin/GiveawayJoiner/master/giveawayjoinerdata/' + name})
.then((lang) => {
fs.writeFile(storage.getDataPath() + '/' + name, lang, (err) => { });
checked++;
if (checked >= data.length) {
startApp();
}
});
};
if (!fs.existsSync(storage.getDataPath() + '/' + name)) {
loadLang();
}
else {
fs.stat(storage.getDataPath() + '/' + name, (err, stats) => {
if (stats.size !== size) {
loadLang();
}
else {
checked++;
}
if (checked === data.length) {
startApp();
}
});
}
}
loadLangs(callback) {
let _this = this;
if (fs.existsSync(storage.getDataPath())) {
let lng_to_load = [];
let dir = fs.readdirSync(storage.getDataPath());
for (let x = 0; x < dir.length; x++) {
if (dir[x].indexOf('lang.') >= 0) {
lng_to_load.push(dir[x].replace('.json', ''));
}
}
if (!lng_to_load.length) {
return;
}
storage.getMany(lng_to_load, function (error, langs) {
if (error) throw new Error("Can't load selected translation");
let lng;
for (lng in langs.lang) {
_this.langsCount++;
}