Various QoL fixes for Desktop App (#2999)

* Some ESLint fixes

* Add login/logout signal to API, clear mentions on logout and flush cookies on login/logout

* Fix issue where local and HTTP-only servers would not validate correctly

* Reduce noise of renderer logging, adjust a few local renderer logs to be louder when needed

* Fallback to beginning of hostname for servers that don't change the site name

* Fix Save Image crash

* Update the name for insecure servers too

* Fix test

* Fix lint

* Reduce repetition
This commit is contained in:
Devin Binnie
2024-04-08 09:12:35 -04:00
committed by GitHub
parent 2456e68ae9
commit e1c957e774
21 changed files with 116 additions and 74 deletions

View File

@@ -43,6 +43,7 @@ import {getFormattedPathName, parseURL} from 'common/utils/url';
import Utils from 'common/utils/util';
import type {MattermostView} from 'common/views/View';
import {TAB_MESSAGING} from 'common/views/View';
import {flushCookiesStore} from 'main/app/utils';
import {localizeMessage} from 'main/i18nManager';
import MainWindow from 'main/windows/mainWindow';
@@ -471,11 +472,24 @@ export class ViewManager {
};
private handleAppLoggedIn = (event: IpcMainEvent) => {
this.getViewByWebContentsId(event.sender.id)?.onLogin(true);
log.debug('handleAppLoggedIn', event.sender.id);
const view = this.getViewByWebContentsId(event.sender.id);
if (!view) {
return;
}
view.onLogin(true);
flushCookiesStore();
};
private handleAppLoggedOut = (event: IpcMainEvent) => {
this.getViewByWebContentsId(event.sender.id)?.onLogin(false);
log.debug('handleAppLoggedOut', event.sender.id);
const view = this.getViewByWebContentsId(event.sender.id);
if (!view) {
return;
}
view.onLogin(false);
AppState.clear(view.id);
flushCookiesStore();
};
private handleBrowserHistoryPush = (e: IpcMainEvent, pathName: string) => {