fix electron registration

This commit is contained in:
Nicolas Constant 2020-01-01 18:35:15 +01:00
parent 3fc0b5f34f
commit 975b3a6e2b
1 changed files with 8 additions and 2 deletions

View File

@ -102,14 +102,20 @@ export class AddNewAccountComponent implements OnInit {
return Promise.resolve(instanceApps[0].app);
} else {
let redirect_uri = this.getLocalHostname();
if (process && process.versions && typeof((<any>process.versions).electron) === 'string') {
let userAgent = navigator.userAgent.toLowerCase();
console.log(`userAgent ${userAgent}`);
if (userAgent.includes(' electron/')) {
redirect_uri += '/register';
}
return this.authService.createNewApplication(instance, 'Sengi', redirect_uri, 'read write follow', 'https://nicolasconstant.github.io/sengi/')
.then((appData: AppData) => {
return this.saveNewApp(instance, appData)
.then(() => { return appData; });
.then(() => {
return new Promise<AppData>(resolve => setTimeout(resolve, 1000, appData));
});
})
.catch((err: HttpErrorResponse) => {
if (err.status === 0) {