Stats Rework (#765)

* Fixed a duplicate check for updates. Changed checking from weekly to daily.

* Refactored how dark variables were accessed to reduce size of component css. Refactored Stats code to use lesser information for reporting.

* Use the installId from the database which is most unlikely to change.

* Fixed a missing interface with stat service

* Added DotnetVersion back into collection

* Updated url to new host.
This commit is contained in:
Joseph Milazzo 2021-11-16 15:11:17 -06:00 committed by GitHub
parent b2831c7606
commit 1ada34984f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 44 additions and 349 deletions

View file

@ -1,41 +0,0 @@
import { HttpClient } from "@angular/common/http";
import { Injectable } from "@angular/core";
import * as Bowser from "bowser";
import { take } from "rxjs/operators";
import { environment } from "src/environments/environment";
import { ClientInfo } from "../_models/stats/client-info";
import { DetailsVersion } from "../_models/stats/details-version";
import { NavService } from "./nav.service";
import { version } from '../../../package.json';
@Injectable({
providedIn: 'root'
})
export class StatsService {
baseUrl = environment.apiUrl;
constructor(private httpClient: HttpClient, private navService: NavService) { }
public sendClientInfo(data: ClientInfo) {
return this.httpClient.post(this.baseUrl + 'stats/client-info', data);
}
public async getInfo(): Promise<ClientInfo> {
const screenResolution = `${window.screen.width} x ${window.screen.height}`;
const browser = Bowser.getParser(window.navigator.userAgent);
const usingDarkTheme = await this.navService.darkMode$.pipe(take(1)).toPromise();
return {
os: browser.getOS() as DetailsVersion,
browser: browser.getBrowser() as DetailsVersion,
platformType: browser.getPlatformType(),
kavitaUiVersion: version,
screenResolution,
usingDarkTheme
};
}
}