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;
|
||||
|
|
|
@ -1,17 +1,6 @@
|
|||
// All dark style overrides should live here
|
||||
|
||||
$dark-bg-color: #343a40;
|
||||
$dark-primary-color: rgba(74, 198, 148, 0.9);
|
||||
$dark-text-color: #efefef;
|
||||
$dark-hover-color: #4ac694;
|
||||
$dark-form-background: rgba(1, 4, 9, 0.5);
|
||||
$dark-form-background-no-opacity: rgb(1, 4, 9);
|
||||
$dark-form-placeholder: #efefef;
|
||||
$dark-link-color: rgb(88, 166, 255);
|
||||
$dark-icon-color: white;
|
||||
$dark-form-border: rgba(239, 239, 239, 0.125);
|
||||
$dark-form-readonly: #434648;
|
||||
$dark-item-accent-bg: #292d32;
|
||||
@import "../../theme/colors";
|
||||
|
||||
.bg-dark {
|
||||
color: $dark-text-color;
|
||||
|
@ -177,7 +166,7 @@ $dark-item-accent-bg: #292d32;
|
|||
.card {
|
||||
background-color: $dark-bg-color;
|
||||
color: $dark-text-color;
|
||||
border-color: $dark-form-border; //#343a40
|
||||
border-color: $dark-form-border;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
|
|
|
@ -32,7 +32,7 @@ label, select, .clickable {
|
|||
|
||||
@font-face {
|
||||
font-family: "EBGarmond";
|
||||
src: url(assets/fonts/EBGarmond/EBGaramond-VariableFont_wght.ttf) format("truetype");
|
||||
src: url("assets/fonts/EBGarmond/EBGaramond-VariableFont_wght.ttf") format("truetype");
|
||||
}
|
||||
|
||||
@font-face {
|
||||
|
|
|
@ -1,6 +1,19 @@
|
|||
$primary-color: #4ac694; //(74,198,148)
|
||||
$error-color: #ff4136; // #bb2929 good color for contrast rating
|
||||
|
||||
$dark-bg-color: #343a40;
|
||||
$dark-primary-color: rgba(74, 198, 148, 0.9);
|
||||
$dark-text-color: #efefef;
|
||||
$dark-hover-color: #4ac694;
|
||||
$dark-form-background: rgba(1, 4, 9, 0.5);
|
||||
$dark-form-background-no-opacity: rgb(1, 4, 9);
|
||||
$dark-form-placeholder: #efefef;
|
||||
$dark-link-color: rgb(88, 166, 255);
|
||||
$dark-icon-color: white;
|
||||
$dark-form-border: rgba(239, 239, 239, 0.125);
|
||||
$dark-form-readonly: #434648;
|
||||
$dark-item-accent-bg: #292d32;
|
||||
|
||||
$theme-colors: (
|
||||
"primary": $primary-color,
|
||||
"danger": $error-color
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue