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:
parent
b2831c7606
commit
1ada34984f
17 changed files with 44 additions and 349 deletions
|
|
@ -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
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -5,7 +5,6 @@ import { AccountService } from './_services/account.service';
|
|||
import { LibraryService } from './_services/library.service';
|
||||
import { MessageHubService } from './_services/message-hub.service';
|
||||
import { NavService } from './_services/nav.service';
|
||||
import { StatsService } from './_services/stats.service';
|
||||
import { filter } from 'rxjs/operators';
|
||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||
|
||||
|
|
@ -17,8 +16,8 @@ import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
|||
export class AppComponent implements OnInit {
|
||||
|
||||
constructor(private accountService: AccountService, public navService: NavService,
|
||||
private statsService: StatsService, private messageHub: MessageHubService,
|
||||
private libraryService: LibraryService, private router: Router, private ngbModal: NgbModal) {
|
||||
private messageHub: MessageHubService, private libraryService: LibraryService,
|
||||
private router: Router, private ngbModal: NgbModal) {
|
||||
|
||||
// Close any open modals when a route change occurs
|
||||
router.events
|
||||
|
|
@ -32,10 +31,6 @@ export class AppComponent implements OnInit {
|
|||
|
||||
ngOnInit(): void {
|
||||
this.setCurrentUser();
|
||||
|
||||
this.statsService.getInfo().then(data => {
|
||||
this.statsService.sendClientInfo(data).subscribe(() => {/* No Operation */});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
@import "../../../theme/colors";
|
||||
@import "../../../assets/themes/dark.scss";
|
||||
|
||||
.bulk-select {
|
||||
background-color: $dark-form-background-no-opacity;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
@import '../../assets/themes/dark.scss';
|
||||
@import "../../theme/colors";
|
||||
|
||||
input {
|
||||
width: 15px;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue