mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-07-09 03:04:19 -04:00
parent
27be13a201
commit
c2d84ed0eb
@ -18,12 +18,11 @@ export class StatsService {
|
||||
|
||||
constructor(private httpClient: HttpClient, private navService: NavService) { }
|
||||
|
||||
public async sendClientInfo() {
|
||||
const data = await this.getInfo();
|
||||
this.httpClient.post(this.baseUrl + 'stats/client-info', data);
|
||||
public sendClientInfo(data: ClientInfo) {
|
||||
return this.httpClient.post(this.baseUrl + 'stats/client-info', data);
|
||||
}
|
||||
|
||||
private async getInfo(): Promise<ClientInfo> {
|
||||
public async getInfo(): Promise<ClientInfo> {
|
||||
const screenResolution = `${window.screen.width} x ${window.screen.height}`;
|
||||
|
||||
const browser = Bowser.getParser(window.navigator.userAgent);
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { AccountService } from './_services/account.service';
|
||||
import { NavService } from './_services/nav.service';
|
||||
import { StatsService } from './_services/stats.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
@ -9,10 +10,14 @@ import { NavService } from './_services/nav.service';
|
||||
})
|
||||
export class AppComponent implements OnInit {
|
||||
|
||||
constructor(private accountService: AccountService, public navService: NavService) { }
|
||||
constructor(private accountService: AccountService, public navService: NavService, private statsService: StatsService) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
this.setCurrentUser();
|
||||
|
||||
this.statsService.getInfo().then(data => {
|
||||
this.statsService.sendClientInfo(data).subscribe(() => {/* No Operation */});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
@ -4,7 +4,6 @@ import { Router } from '@angular/router';
|
||||
import { take } from 'rxjs/operators';
|
||||
import { MemberService } from '../_services/member.service';
|
||||
import { AccountService } from '../_services/account.service';
|
||||
import { StatsService } from '../_services/stats.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-home',
|
||||
@ -20,7 +19,7 @@ export class HomeComponent implements OnInit {
|
||||
password: new FormControl('', [Validators.required])
|
||||
});
|
||||
|
||||
constructor(public accountService: AccountService, private memberService: MemberService, private router: Router, private statsService: StatsService) {
|
||||
constructor(public accountService: AccountService, private memberService: MemberService, private router: Router) {
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
@ -33,9 +32,6 @@ export class HomeComponent implements OnInit {
|
||||
}
|
||||
|
||||
this.accountService.currentUser$.pipe(take(1)).subscribe(user => {
|
||||
|
||||
this.statsService.sendClientInfo();
|
||||
|
||||
if (user) {
|
||||
this.router.navigateByUrl('/library');
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user