mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-07-09 03:04:19 -04:00
Polish before Release (#2621)
This commit is contained in:
parent
295f352ab5
commit
7a6ef173e2
@ -291,4 +291,15 @@ public class ServerController : BaseApiController
|
|||||||
return Ok(await _emailService.GetVersion(emailServiceUrl));
|
return Ok(await _emailService.GetVersion(emailServiceUrl));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Checks for updates and pushes an event to the UI
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("check-for-updates")]
|
||||||
|
public async Task<ActionResult> CheckForAnnouncements()
|
||||||
|
{
|
||||||
|
await _taskScheduler.CheckForUpdate();
|
||||||
|
return Ok();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,7 @@ public interface ITaskScheduler
|
|||||||
void ScanSiteThemes();
|
void ScanSiteThemes();
|
||||||
void CovertAllCoversToEncoding();
|
void CovertAllCoversToEncoding();
|
||||||
Task CleanupDbEntries();
|
Task CleanupDbEntries();
|
||||||
|
Task CheckForUpdate();
|
||||||
|
|
||||||
}
|
}
|
||||||
public class TaskScheduler : ITaskScheduler
|
public class TaskScheduler : ITaskScheduler
|
||||||
@ -242,14 +243,14 @@ public class TaskScheduler : ITaskScheduler
|
|||||||
public void ScheduleUpdaterTasks()
|
public void ScheduleUpdaterTasks()
|
||||||
{
|
{
|
||||||
_logger.LogInformation("Scheduling Auto-Update tasks");
|
_logger.LogInformation("Scheduling Auto-Update tasks");
|
||||||
RecurringJob.AddOrUpdate(CheckForUpdateId, () => CheckForUpdate(), $"0 */{Rnd.Next(4, 6)} * * *", RecurringJobOptions);
|
RecurringJob.AddOrUpdate(CheckForUpdateId, () => CheckForUpdate(), $"0 */{Rnd.Next(1, 2)} * * *", RecurringJobOptions);
|
||||||
BackgroundJob.Enqueue(() => CheckForUpdate());
|
BackgroundJob.Enqueue(() => CheckForUpdate());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ScanFolder(string folderPath, TimeSpan delay)
|
public void ScanFolder(string folderPath, TimeSpan delay)
|
||||||
{
|
{
|
||||||
var normalizedFolder = Tasks.Scanner.Parser.Parser.NormalizePath(folderPath);
|
var normalizedFolder = Tasks.Scanner.Parser.Parser.NormalizePath(folderPath);
|
||||||
if (HasAlreadyEnqueuedTask(ScannerService.Name, "ScanFolder", new object[] { normalizedFolder }))
|
if (HasAlreadyEnqueuedTask(ScannerService.Name, "ScanFolder", [normalizedFolder]))
|
||||||
{
|
{
|
||||||
_logger.LogInformation("Skipped scheduling ScanFolder for {Folder} as a job already queued",
|
_logger.LogInformation("Skipped scheduling ScanFolder for {Folder} as a job already queued",
|
||||||
normalizedFolder);
|
normalizedFolder);
|
||||||
|
@ -15,13 +15,11 @@ function generateChecksum(str, algorithm, encoding) {
|
|||||||
const result = {};
|
const result = {};
|
||||||
|
|
||||||
glob.sync(`${jsonFilesDir}**/*.json`).forEach(path => {
|
glob.sync(`${jsonFilesDir}**/*.json`).forEach(path => {
|
||||||
console.log('Calculating hash for ', path);
|
|
||||||
let tokens = path.split('dist\\browser\\assets\\langs\\');
|
let tokens = path.split('dist\\browser\\assets\\langs\\');
|
||||||
if (tokens.length === 1) {
|
if (tokens.length === 1) {
|
||||||
tokens = path.split('dist/browser/assets/langs/');
|
tokens = path.split('dist/browser/assets/langs/');
|
||||||
}
|
}
|
||||||
const lang = tokens[1];
|
const lang = tokens[1];
|
||||||
console.log('Language: ', lang);
|
|
||||||
const content = fs.readFileSync(path, { encoding: 'utf-8' });
|
const content = fs.readFileSync(path, { encoding: 'utf-8' });
|
||||||
result[lang.replace('.json', '')] = generateChecksum(content);
|
result[lang.replace('.json', '')] = generateChecksum(content);
|
||||||
});
|
});
|
||||||
|
@ -41,6 +41,10 @@ export class ServerService {
|
|||||||
return this.httpClient.get<UpdateVersionEvent>(this.baseUrl + 'server/check-update', {});
|
return this.httpClient.get<UpdateVersionEvent>(this.baseUrl + 'server/check-update', {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
checkForUpdates() {
|
||||||
|
return this.httpClient.get(this.baseUrl + 'server/check-for-updates', {});
|
||||||
|
}
|
||||||
|
|
||||||
getChangelog() {
|
getChangelog() {
|
||||||
return this.httpClient.get<UpdateVersionEvent[]>(this.baseUrl + 'server/changelog', {});
|
return this.httpClient.get<UpdateVersionEvent[]>(this.baseUrl + 'server/changelog', {});
|
||||||
}
|
}
|
||||||
|
@ -7,11 +7,12 @@ import { NavService } from './_services/nav.service';
|
|||||||
import { filter } from 'rxjs/operators';
|
import { filter } from 'rxjs/operators';
|
||||||
import {NgbModal, NgbModalConfig, NgbOffcanvas, NgbRatingConfig} from '@ng-bootstrap/ng-bootstrap';
|
import {NgbModal, NgbModalConfig, NgbOffcanvas, NgbRatingConfig} from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { DOCUMENT, NgClass, NgIf, AsyncPipe } from '@angular/common';
|
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 {ThemeService} from "./_services/theme.service";
|
||||||
import { SideNavComponent } from './sidenav/_components/side-nav/side-nav.component';
|
import { SideNavComponent } from './sidenav/_components/side-nav/side-nav.component';
|
||||||
import {NavHeaderComponent} from "./nav/_components/nav-header/nav-header.component";
|
import {NavHeaderComponent} from "./nav/_components/nav-header/nav-header.component";
|
||||||
import {takeUntilDestroyed} from "@angular/core/rxjs-interop";
|
import {takeUntilDestroyed} from "@angular/core/rxjs-interop";
|
||||||
|
import {ServerService} from "./_services/server.service";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-root',
|
selector: 'app-root',
|
||||||
@ -28,6 +29,7 @@ export class AppComponent implements OnInit {
|
|||||||
private readonly offcanvas = inject(NgbOffcanvas);
|
private readonly offcanvas = inject(NgbOffcanvas);
|
||||||
public readonly navService = inject(NavService);
|
public readonly navService = inject(NavService);
|
||||||
public readonly cdRef = inject(ChangeDetectorRef);
|
public readonly cdRef = inject(ChangeDetectorRef);
|
||||||
|
public readonly serverService = inject(ServerService);
|
||||||
|
|
||||||
constructor(private accountService: AccountService,
|
constructor(private accountService: AccountService,
|
||||||
private libraryService: LibraryService,
|
private libraryService: LibraryService,
|
||||||
@ -95,6 +97,14 @@ export class AppComponent implements OnInit {
|
|||||||
this.libraryService.getLibraryNames().pipe(take(1), shareReplay({refCount: true, bufferSize: 1})).subscribe();
|
this.libraryService.getLibraryNames().pipe(take(1), shareReplay({refCount: true, bufferSize: 1})).subscribe();
|
||||||
// On load, make an initial call for valid license
|
// On load, make an initial call for valid license
|
||||||
this.accountService.hasValidLicense().subscribe();
|
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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -440,10 +440,6 @@ export class EditSeriesModalComponent implements OnInit {
|
|||||||
return a.isoCode == b.isoCode;
|
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);
|
const l = this.validLanguages.find(l => l.isoCode === this.metadata.language);
|
||||||
if (l !== undefined) {
|
if (l !== undefined) {
|
||||||
this.languageSettings.savedData = l;
|
this.languageSettings.savedData = l;
|
||||||
|
@ -32,7 +32,7 @@ import {StreamType} from "../../_models/dashboard/stream-type.enum";
|
|||||||
import {LoadingComponent} from "../../shared/loading/loading.component";
|
import {LoadingComponent} from "../../shared/loading/loading.component";
|
||||||
import {ScrobbleProvider, ScrobblingService} from "../../_services/scrobbling.service";
|
import {ScrobbleProvider, ScrobblingService} from "../../_services/scrobbling.service";
|
||||||
import {ToastrService} from "ngx-toastr";
|
import {ToastrService} from "ngx-toastr";
|
||||||
|
import {ServerService} from "../../_services/server.service";
|
||||||
|
|
||||||
enum StreamId {
|
enum StreamId {
|
||||||
OnDeck,
|
OnDeck,
|
||||||
@ -41,6 +41,7 @@ enum StreamId {
|
|||||||
MoreInGenre,
|
MoreInGenre,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-dashboard',
|
selector: 'app-dashboard',
|
||||||
templateUrl: './dashboard.component.html',
|
templateUrl: './dashboard.component.html',
|
||||||
@ -67,6 +68,7 @@ export class DashboardComponent implements OnInit {
|
|||||||
private readonly dashboardService = inject(DashboardService);
|
private readonly dashboardService = inject(DashboardService);
|
||||||
private readonly scrobblingService = inject(ScrobblingService);
|
private readonly scrobblingService = inject(ScrobblingService);
|
||||||
private readonly toastr = inject(ToastrService);
|
private readonly toastr = inject(ToastrService);
|
||||||
|
private readonly serverService = inject(ServerService);
|
||||||
|
|
||||||
libraries$: Observable<Library[]> = this.libraryService.getLibraries().pipe(take(1), takeUntilDestroyed(this.destroyRef))
|
libraries$: Observable<Library[]> = this.libraryService.getLibraries().pipe(take(1), takeUntilDestroyed(this.destroyRef))
|
||||||
isLoadingDashboard = true;
|
isLoadingDashboard = true;
|
||||||
|
15
openapi.json
15
openapi.json
@ -7,7 +7,7 @@
|
|||||||
"name": "GPL-3.0",
|
"name": "GPL-3.0",
|
||||||
"url": "https://github.com/Kareadita/Kavita/blob/develop/LICENSE"
|
"url": "https://github.com/Kareadita/Kavita/blob/develop/LICENSE"
|
||||||
},
|
},
|
||||||
"version": "0.7.12.5"
|
"version": "0.7.12.7"
|
||||||
},
|
},
|
||||||
"servers": [
|
"servers": [
|
||||||
{
|
{
|
||||||
@ -9869,6 +9869,19 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/api/Server/check-for-updates": {
|
||||||
|
"get": {
|
||||||
|
"tags": [
|
||||||
|
"Server"
|
||||||
|
],
|
||||||
|
"summary": "Checks for updates and pushes an event to the UI",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "Success"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/api/Settings/base-url": {
|
"/api/Settings/base-url": {
|
||||||
"get": {
|
"get": {
|
||||||
"tags": [
|
"tags": [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user