TeaSpeak-Client/modules/core/app-updater/changelog/index.ts

42 lines
1.1 KiB
TypeScript
Raw Normal View History

2019-10-25 19:51:40 -04:00
import {BrowserWindow} from "electron";
import * as electron from "electron";
import * as path from "path";
let changelog_window: BrowserWindow;
export function open() {
if(changelog_window) {
changelog_window.focus();
return;
}
changelog_window = new BrowserWindow({
show: false
});
changelog_window.setMenu(null);
let file = "";
{
const app_path = electron.app.getAppPath();
if(app_path.endsWith(".asar"))
file = path.join(path.dirname(app_path), "..", "ChangeLog.txt");
else
file = path.join(app_path, "github", "ChangeLog.txt"); /* We've the source master :D */
}
changelog_window.loadFile(file);
changelog_window.setTitle("TeaClient ChangeLog");
changelog_window.on('ready-to-show', () => {
changelog_window.show();
});
changelog_window.on('close', () => {
changelog_window = undefined;
});
}
export function close() {
if(changelog_window) {
changelog_window.close();
changelog_window = undefined;
}
}