mirror of
https://github.com/Myxelium/Bridge-Multi.git
synced 2026-07-08 02:55:09 +00:00
Google authentication
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
|
||||
<h3 class="ui header">Downloads</h3>
|
||||
<div class="ui form">
|
||||
<div class="field">
|
||||
<div *ngIf="loginAvailable" class="field">
|
||||
<label>Google rate limit delay</label>
|
||||
<div id="rateLimitInput" class="ui right labeled input">
|
||||
<input type="number" [value]="settingsService.rateLimitDelay" (input)="changeRateLimit($event)">
|
||||
@@ -28,12 +28,21 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="loginAvailable" class="field">
|
||||
<div class="ui button" data-tooltip="Removes rate limit delay" data-position="right center" (click)="googleLogin()">
|
||||
<i class="google icon"></i>Sign in with Google
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="!loginAvailable" class="field">
|
||||
<div class="ui button" (click)="googleLogout()">
|
||||
<i class="google icon"></i>Sign out
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="settingsService.rateLimitDelay < 30" class="ui warning message">
|
||||
<i class="exclamation circle icon"></i>
|
||||
<b>Warning:</b> downloading files from Google with a delay less than about 30 seconds will eventually cause Google to
|
||||
refuse download requests from this program for a few hours. This can be avoided by authenticating with your Google account.
|
||||
(this will be possible in a future update to Bridge)
|
||||
</div>
|
||||
|
||||
<!-- <h3 class="ui header">Theme</h3>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Component, OnInit, ViewChild, ElementRef, AfterViewInit, ChangeDetectorRef } from '@angular/core'
|
||||
import { Component, OnInit, AfterViewInit, ChangeDetectorRef } from '@angular/core'
|
||||
import { ElectronService } from 'src/app/core/services/electron.service'
|
||||
import { SettingsService } from 'src/app/core/services/settings.service'
|
||||
|
||||
@@ -12,6 +12,8 @@ export class SettingsComponent implements OnInit, AfterViewInit {
|
||||
|
||||
cacheSize = 'Calculating...'
|
||||
updateAvailable = false
|
||||
loginAvailable = true
|
||||
loginClicked = false
|
||||
downloadUpdateText = 'Update available'
|
||||
updateDownloading = false
|
||||
updateDownloaded = false
|
||||
@@ -35,6 +37,10 @@ export class SettingsComponent implements OnInit, AfterViewInit {
|
||||
this.updateAvailable = isAvailable
|
||||
this.ref.detectChanges()
|
||||
})
|
||||
this.electronService.invoke('get-auth-status', undefined).then(isAuthenticated => {
|
||||
this.loginAvailable = !isAuthenticated
|
||||
this.ref.detectChanges()
|
||||
})
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
@@ -64,6 +70,19 @@ export class SettingsComponent implements OnInit, AfterViewInit {
|
||||
}
|
||||
}
|
||||
|
||||
async googleLogin() {
|
||||
if (this.loginClicked) { return }
|
||||
this.loginClicked = true
|
||||
const isAuthenticated = await this.electronService.invoke('google-login', undefined)
|
||||
this.loginAvailable = !isAuthenticated
|
||||
this.loginClicked = false
|
||||
}
|
||||
|
||||
async googleLogout() {
|
||||
this.loginAvailable = true
|
||||
await this.electronService.invoke('google-logout', undefined)
|
||||
}
|
||||
|
||||
openLibraryDirectory() {
|
||||
this.electronService.openFolder(this.settingsService.libraryDirectory)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user