Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Open the DevTools automatically if developing
if (dev) {
mainWindow.webContents.openDevTools();
}
});
// Emitted when the window is closed.
mainWindow.on('closed', function () {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null;
});
//check for default settings
if (!settings.has("loginInfo")) {
console.log("No Settings exists, creating them")
var setting = {
serverName: "localhost",
serverPort: 8182,
userName: "",
password: "",
opProcessor: "",
useSSL: false
};
settings.set("loginInfo", setting);
} else {
console.log("Settings Exist");
console.log(settings.get("loginInfo"));
}
}
function loadDatabase() {
if (!settings.has('dbPath')) {
settings.set('dbPath', app.getPath('userData'));
}
if (!fs.existsSync(settings.get('dbPath'))) {
showMessage('Reverted to Default DB Location', `Failed to load database at ${settings.get('dbPath')}. The Database location was reset. You may change the Database location in settings`, { sticky: true, class: 'negative' });
settings.set('dbPath', app.getPath('userData'));
}
if (settings.get('completeDownload') === true) {
setLoadMessage('Completing Download and Extraction of Online DB');
finishCopyZipContents();
settings.set('completeDownload', false);
}
const dbPath = settings.get('dbPath');
console.log("Database loading from " + dbPath);
function register(host, titlekey, title, link, thumbnail_uri, subscribed=false) {
let key_path = "comic." + host + "." + titlekey;
if (!settings.has(key_path)) {
settings.set(key_path, {
"title": title,
"link": link,
"thumbnail": thumbnail_uri,
"subscribed": subscribed,
"lastread": "",
"lastpage": "",
"chapters": {},
"chapters_count": 0,
"newestchapter": "",
"hasupdate": true
});
}
return settings.get(key_path);
}
function setup_editor_theme() {
if(!settings.has('editor.theme')) {
settings.set('editor', { theme: 'twilight' });
}
}