Polish before Release (#2621)

This commit is contained in:
Joe Milazzo 2024-01-18 16:02:21 -06:00 committed by GitHub
parent 295f352ab5
commit 7a6ef173e2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 46 additions and 11 deletions

View file

@ -15,13 +15,11 @@ function generateChecksum(str, algorithm, encoding) {
const result = {};
glob.sync(`${jsonFilesDir}**/*.json`).forEach(path => {
console.log('Calculating hash for ', path);
let tokens = path.split('dist\\browser\\assets\\langs\\');
if (tokens.length === 1) {
tokens = path.split('dist/browser/assets/langs/');
}
const lang = tokens[1];
console.log('Language: ', lang);
const content = fs.readFileSync(path, { encoding: 'utf-8' });
result[lang.replace('.json', '')] = generateChecksum(content);
});

View file

@ -41,6 +41,10 @@ export class ServerService {
return this.httpClient.get<UpdateVersionEvent>(this.baseUrl + 'server/check-update', {});
}
checkForUpdates() {
return this.httpClient.get(this.baseUrl + 'server/check-for-updates', {});
}
getChangelog() {
return this.httpClient.get<UpdateVersionEvent[]>(this.baseUrl + 'server/changelog', {});
}

View file

@ -7,11 +7,12 @@ import { NavService } from './_services/nav.service';
import { filter } from 'rxjs/operators';
import {NgbModal, NgbModalConfig, NgbOffcanvas, NgbRatingConfig} from '@ng-bootstrap/ng-bootstrap';
import { DOCUMENT, NgClass, NgIf, AsyncPipe } from '@angular/common';
import { Observable } from 'rxjs';
import {interval, Observable, switchMap} from 'rxjs';
import {ThemeService} from "./_services/theme.service";
import { SideNavComponent } from './sidenav/_components/side-nav/side-nav.component';
import {NavHeaderComponent} from "./nav/_components/nav-header/nav-header.component";
import {takeUntilDestroyed} from "@angular/core/rxjs-interop";
import {ServerService} from "./_services/server.service";
@Component({
selector: 'app-root',
@ -28,6 +29,7 @@ export class AppComponent implements OnInit {
private readonly offcanvas = inject(NgbOffcanvas);
public readonly navService = inject(NavService);
public readonly cdRef = inject(ChangeDetectorRef);
public readonly serverService = inject(ServerService);
constructor(private accountService: AccountService,
private libraryService: LibraryService,
@ -95,6 +97,14 @@ export class AppComponent implements OnInit {
this.libraryService.getLibraryNames().pipe(take(1), shareReplay({refCount: true, bufferSize: 1})).subscribe();
// On load, make an initial call for valid license
this.accountService.hasValidLicense().subscribe();
interval(4 * 60 * 60 * 1000) // 4 hours in milliseconds
.pipe(
switchMap(() => this.accountService.currentUser$),
filter(u => this.accountService.hasAdminRole(u!)),
switchMap(_ => this.serverService.checkForUpdates())
)
.subscribe();
}
}
}

View file

@ -440,10 +440,6 @@ export class EditSeriesModalComponent implements OnInit {
return a.isoCode == b.isoCode;
}
if (this.metadata.language === undefined || this.metadata.language === null || this.metadata.language === '') {
this.metadata.language = 'en';
}
const l = this.validLanguages.find(l => l.isoCode === this.metadata.language);
if (l !== undefined) {
this.languageSettings.savedData = l;

View file

@ -32,7 +32,7 @@ import {StreamType} from "../../_models/dashboard/stream-type.enum";
import {LoadingComponent} from "../../shared/loading/loading.component";
import {ScrobbleProvider, ScrobblingService} from "../../_services/scrobbling.service";
import {ToastrService} from "ngx-toastr";
import {ServerService} from "../../_services/server.service";
enum StreamId {
OnDeck,
@ -41,6 +41,7 @@ enum StreamId {
MoreInGenre,
}
@Component({
selector: 'app-dashboard',
templateUrl: './dashboard.component.html',
@ -67,6 +68,7 @@ export class DashboardComponent implements OnInit {
private readonly dashboardService = inject(DashboardService);
private readonly scrobblingService = inject(ScrobblingService);
private readonly toastr = inject(ToastrService);
private readonly serverService = inject(ServerService);
libraries$: Observable<Library[]> = this.libraryService.getLibraries().pipe(take(1), takeUntilDestroyed(this.destroyRef))
isLoadingDashboard = true;