mirror of
https://github.com/rhysd/Mstdn.git
synced 2025-01-21 20:52:11 +01:00
more logs
This commit is contained in:
parent
bf680a4b89
commit
07652e1ad4
@ -25,17 +25,20 @@ export class App {
|
|||||||
}
|
}
|
||||||
|
|
||||||
start() {
|
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);
|
this.win.open(url);
|
||||||
log.debug('Open URL: ', url);
|
log.debug('Application started', a, url);
|
||||||
}
|
}
|
||||||
|
|
||||||
private onAccountSwitch = (next: Account) => {
|
private onAccountSwitch = (next: Account) => {
|
||||||
this.win.close();
|
this.win.close();
|
||||||
if (this.config.hot_key) {
|
if (this.config.hot_key) {
|
||||||
|
log.debug('Disable global shortcut for switching account');
|
||||||
globalShortcut.unregister(this.config.hot_key);
|
globalShortcut.unregister(this.config.hot_key);
|
||||||
}
|
}
|
||||||
Window.create(next, this.config, this.win.menubar) .then(win => {
|
Window.create(next, this.config, this.win.menubar) .then(win => {
|
||||||
|
log.debug('Window was recreated again', next);
|
||||||
this.win = win;
|
this.win = win;
|
||||||
this.start();
|
this.start();
|
||||||
});
|
});
|
||||||
|
@ -36,19 +36,23 @@ export default class Window {
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
shell.openExternal(url);
|
shell.openExternal(url);
|
||||||
}
|
}
|
||||||
|
log.debug('Opened URL with external browser (will-navigate)', url);
|
||||||
});
|
});
|
||||||
browser.webContents.on('new-window', (e, url) => {
|
browser.webContents.on('new-window', (e, url) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
shell.openExternal(url);
|
shell.openExternal(url);
|
||||||
|
log.debug('Opened URL with external browser (new-window)', url);
|
||||||
});
|
});
|
||||||
|
|
||||||
browser.webContents.session.setPermissionRequestHandler((contents, permission, callback) => {
|
browser.webContents.session.setPermissionRequestHandler((contents, permission, callback) => {
|
||||||
if (permission !== 'geolocation' && permission !== 'media') {
|
if (permission !== 'geolocation' && permission !== 'media') {
|
||||||
// Granted
|
// Granted
|
||||||
|
log.debug('Permission was granted', permission);
|
||||||
callback(true);
|
callback(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.debug('Create dialog for user permission', permission);
|
||||||
dialog.showMessageBox({
|
dialog.showMessageBox({
|
||||||
type: 'question',
|
type: 'question',
|
||||||
buttons: ['Accept', 'Reject'],
|
buttons: ['Accept', 'Reject'],
|
||||||
@ -62,10 +66,12 @@ export default class Window {
|
|||||||
}
|
}
|
||||||
|
|
||||||
open(url: string) {
|
open(url: string) {
|
||||||
|
log.debug('Open URL:', url);
|
||||||
this.browser.loadURL(url);
|
this.browser.loadURL(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
close() {
|
close() {
|
||||||
|
log.debug('Closing window:', this.account);
|
||||||
this.state.unmanage();
|
this.state.unmanage();
|
||||||
this.browser.webContents.removeAllListeners();
|
this.browser.webContents.removeAllListeners();
|
||||||
this.browser.removeAllListeners();
|
this.browser.removeAllListeners();
|
||||||
@ -216,12 +222,13 @@ function startMenuBar(account: Account, config: Config, bar: Menubar.MenubarApp
|
|||||||
app.quit();
|
app.quit();
|
||||||
});
|
});
|
||||||
if (bar) {
|
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');
|
const pref = mb.getOption('webPreferences');
|
||||||
pref.partition = partitionForAccount(account);
|
pref.partition = partitionForAccount(account);
|
||||||
mb.setOption('webPreferences', pref);
|
mb.setOption('webPreferences', pref);
|
||||||
mb.showWindow();
|
mb.showWindow();
|
||||||
} else {
|
} else {
|
||||||
|
log.debug('New menubar instance was created:', account);
|
||||||
mb.once('ready', () => mb.showWindow());
|
mb.once('ready', () => mb.showWindow());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user