1
0
mirror of https://github.com/rhysd/Mstdn.git synced 2025-01-21 20:52:11 +01:00

more logs

This commit is contained in:
rhysd 2017-04-18 20:39:47 +09:00
parent bf680a4b89
commit 07652e1ad4
2 changed files with 13 additions and 3 deletions

View File

@ -25,17 +25,20 @@ export class App {
}
start() {
const url = `https://${this.switcher.current.host}${this.switcher.current.default_page}`;
const a = this.switcher.current;
const url = `https://${a.host}${a.default_page}`;
this.win.open(url);
log.debug('Open URL: ', url);
log.debug('Application started', a, url);
}
private onAccountSwitch = (next: Account) => {
this.win.close();
if (this.config.hot_key) {
log.debug('Disable global shortcut for switching account');
globalShortcut.unregister(this.config.hot_key);
}
Window.create(next, this.config, this.win.menubar) .then(win => {
log.debug('Window was recreated again', next);
this.win = win;
this.start();
});

View File

@ -36,19 +36,23 @@ export default class Window {
e.preventDefault();
shell.openExternal(url);
}
log.debug('Opened URL with external browser (will-navigate)', url);
});
browser.webContents.on('new-window', (e, url) => {
e.preventDefault();
shell.openExternal(url);
log.debug('Opened URL with external browser (new-window)', url);
});
browser.webContents.session.setPermissionRequestHandler((contents, permission, callback) => {
if (permission !== 'geolocation' && permission !== 'media') {
// Granted
log.debug('Permission was granted', permission);
callback(true);
return;
}
log.debug('Create dialog for user permission', permission);
dialog.showMessageBox({
type: 'question',
buttons: ['Accept', 'Reject'],
@ -62,10 +66,12 @@ export default class Window {
}
open(url: string) {
log.debug('Open URL:', url);
this.browser.loadURL(url);
}
close() {
log.debug('Closing window:', this.account);
this.state.unmanage();
this.browser.webContents.removeAllListeners();
this.browser.removeAllListeners();
@ -216,12 +222,13 @@ function startMenuBar(account: Account, config: Config, bar: Menubar.MenubarApp
app.quit();
});
if (bar) {
log.debug('recreate menubar window with different partition:', account);
log.debug('Recreate menubar window with different partition:', account);
const pref = mb.getOption('webPreferences');
pref.partition = partitionForAccount(account);
mb.setOption('webPreferences', pref);
mb.showWindow();
} else {
log.debug('New menubar instance was created:', account);
mb.once('ready', () => mb.showWindow());
}
});