42 lines
1.1 KiB
TypeScript
42 lines
1.1 KiB
TypeScript
|
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;
|
||
|
}
|
||
|
}
|