mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-05-24 00:52:23 -04:00
File Created Date (#1434)
* Capture date when Kavita creates a MangaFile so we can show the date on the UI. * On startup, exit early for migration directory if it's a fresh install and we have migrations to run but no settings stored yet. * Blur summaries should apply when there isn't any read more collapsable * Fixed custom theme files not loading. * Cleaned up the logic for displaying the manga file date
This commit is contained in:
parent
79b8df1112
commit
7a026e9497
@ -1,4 +1,5 @@
|
||||
using API.Entities.Enums;
|
||||
using System;
|
||||
using API.Entities.Enums;
|
||||
|
||||
namespace API.DTOs
|
||||
{
|
||||
@ -8,6 +9,7 @@ namespace API.DTOs
|
||||
public string FilePath { get; init; }
|
||||
public int Pages { get; init; }
|
||||
public MangaFormat Format { get; init; }
|
||||
public DateTime Created { get; init; }
|
||||
|
||||
}
|
||||
}
|
||||
|
1599
API/Data/Migrations/20220814134725_MangaFileCreatedDate.Designer.cs
generated
Normal file
1599
API/Data/Migrations/20220814134725_MangaFileCreatedDate.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
27
API/Data/Migrations/20220814134725_MangaFileCreatedDate.cs
Normal file
27
API/Data/Migrations/20220814134725_MangaFileCreatedDate.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace API.Data.Migrations
|
||||
{
|
||||
public partial class MangaFileCreatedDate : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "Created",
|
||||
table: "MangaFile",
|
||||
type: "TEXT",
|
||||
nullable: false,
|
||||
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Created",
|
||||
table: "MangaFile");
|
||||
}
|
||||
}
|
||||
}
|
@ -525,6 +525,9 @@ namespace API.Data.Migrations
|
||||
b.Property<int>("ChapterId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime>("Created")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("FilePath")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
|
@ -2,13 +2,14 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using API.Entities.Enums;
|
||||
using API.Entities.Interfaces;
|
||||
|
||||
namespace API.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a wrapper to the underlying file. This provides information around file, like number of pages, format, etc.
|
||||
/// </summary>
|
||||
public class MangaFile
|
||||
public class MangaFile : IEntityDate
|
||||
{
|
||||
public int Id { get; set; }
|
||||
/// <summary>
|
||||
@ -20,6 +21,9 @@ namespace API.Entities
|
||||
/// </summary>
|
||||
public int Pages { get; set; }
|
||||
public MangaFormat Format { get; set; }
|
||||
/// <inheritdoc cref="IEntityDate.Created"/>
|
||||
public DateTime Created { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Last time underlying file was modified
|
||||
/// </summary>
|
||||
|
@ -105,6 +105,7 @@ namespace API
|
||||
string currentVersion = null;
|
||||
try
|
||||
{
|
||||
if (!await context.ServerSetting.AnyAsync()) return "vUnknown";
|
||||
currentVersion =
|
||||
(await context.ServerSetting.SingleOrDefaultAsync(s =>
|
||||
s.Key == ServerSettingKey.InstallVersion))?.Value;
|
||||
|
@ -6,6 +6,7 @@ using API.Entities;
|
||||
using API.Entities.Enums.Theme;
|
||||
using API.SignalR;
|
||||
using Kavita.Common;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
|
||||
namespace API.Services.Tasks;
|
||||
|
||||
@ -34,6 +35,7 @@ public class ThemeService : IThemeService
|
||||
/// </summary>
|
||||
/// <param name="themeId"></param>
|
||||
/// <returns></returns>
|
||||
[AllowAnonymous]
|
||||
public async Task<string> GetContent(int themeId)
|
||||
{
|
||||
var theme = await _unitOfWork.SiteThemeRepository.GetThemeDto(themeId);
|
||||
|
@ -5,4 +5,5 @@ export interface MangaFile {
|
||||
filePath: string;
|
||||
pages: number;
|
||||
format: MangaFormat;
|
||||
created: string;
|
||||
}
|
||||
|
@ -143,7 +143,15 @@
|
||||
Pages: {{file.pages | number:''}}
|
||||
</div>
|
||||
<div class="col" *ngIf="data.hasOwnProperty('created')">
|
||||
Added: {{(data.created | date: 'short') || '-'}}
|
||||
Added:
|
||||
<!-- TODO: This data.created can be removed after v0.5.5 release -->
|
||||
<ng-container *ngIf="file.created == '0001-01-01T00:00:00'; else fileDate">
|
||||
{{(data.created | date: 'short') || '-'}}
|
||||
</ng-container>
|
||||
<ng-template #fileDate>
|
||||
{{(file.created | date: 'short') || '-'}}
|
||||
</ng-template>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
|
@ -1,12 +1,11 @@
|
||||
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core';
|
||||
import { ToastrService } from 'ngx-toastr';
|
||||
import { finalize, map, Observable, Subject, take, takeWhile, takeUntil } from 'rxjs';
|
||||
import { map, Observable, Subject, takeUntil } from 'rxjs';
|
||||
import { Download } from 'src/app/shared/_models/download';
|
||||
import { DownloadEvent, DownloadService } from 'src/app/shared/_services/download.service';
|
||||
import { UtilityService } from 'src/app/shared/_services/utility.service';
|
||||
import { Chapter } from 'src/app/_models/chapter';
|
||||
import { LibraryType } from 'src/app/_models/library';
|
||||
import { Series } from 'src/app/_models/series';
|
||||
import { RelationKind } from 'src/app/_models/series-detail/relation-kind';
|
||||
import { Volume } from 'src/app/_models/volume';
|
||||
import { Action, ActionItem } from 'src/app/_services/action-factory.service';
|
||||
|
@ -30,10 +30,11 @@ export class ReadMoreComponent implements OnChanges {
|
||||
this.isCollapsed = !this.isCollapsed;
|
||||
this.determineView();
|
||||
}
|
||||
|
||||
determineView() {
|
||||
if (!this.text || this.text.length <= this.maxLength) {
|
||||
this.currentText = this.text;
|
||||
this.isCollapsed = false;
|
||||
this.isCollapsed = true;
|
||||
this.hideToggle = true;
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user