Co-authored-by: Robbie Davis <robbie@therobbiedavis.com>
This commit is contained in:
Joe Milazzo 2024-04-14 06:58:22 -05:00 committed by GitHub
parent 5a7fd25548
commit 8f4e1fbb36
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 92 additions and 1287 deletions

View File

@ -28,7 +28,7 @@ body:
label: Kavita Version Number - Don't see your version number listed? Then your install is out of date. Please update and see if your issue still persists.
multiple: false
options:
- 0.7.14 - Stable
- 0.8.0 - Stable
- Nightly Testing Branch
validations:
required: true

View File

@ -1,188 +0,0 @@
name: Stable Workflow
on:
push:
branches: ['release/**']
pull_request:
branches: [ 'develop' ]
types: [ closed ]
workflow_dispatch:
jobs:
debug:
runs-on: ubuntu-latest
steps:
- name: Debug Info
run: |
echo "Event Name: ${{ github.event_name }}"
echo "Ref: ${{ github.ref }}"
echo "Not Contains Release: ${{ !contains(github.head_ref, 'release') }}"
echo "Matches Develop: ${{ github.ref == 'refs/heads/develop' }}"
if_merged:
if: github.event.pull_request.merged == true && contains(github.head_ref, 'release')
runs-on: ubuntu-latest
steps:
- run: |
echo The PR was merged
build:
name: Upload Kavita.Common for Version Bump
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true && contains(github.head_ref, 'release')
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/upload-artifact@v4
with:
name: csproj
path: Kavita.Common/Kavita.Common.csproj
stable:
name: Build Stable and Nightly Docker if Release
needs: [ build ]
if: github.event.pull_request.merged == true && contains(github.head_ref, 'release')
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Find Current Pull Request
uses: jwalton/gh-find-current-pr@v1
id: findPr
with:
state: all
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Parse PR body
id: parse-body
run: |
body="${{ steps.findPr.outputs.body }}"
body=${body//\'/}
body=${body//'%'/'%25'}
body=${body//$'\n'/'%0A'}
body=${body//$'\r'/'%0D'}
body=${body//$'`'/'%60'}
body=${body//$'>'/'%3E'}
if [[ ${#body} -gt 1870 ]] ; then
body=${body:0:1870}
body="${body}...and much more.
Read full changelog: https://github.com/Kareadita/Kavita/releases/latest"
fi
echo $body
echo "BODY=$body" >> $GITHUB_OUTPUT
- name: Check Out Repo
uses: actions/checkout@v4
with:
ref: develop
- name: NodeJS to Compile WebUI
uses: actions/setup-node@v4
with:
node-version: 20
- run: |
cd UI/Web || exit
echo 'Installing web dependencies'
npm install --legacy-peer-deps
echo 'Building UI'
npm run prod
echo 'Copying back to Kavita wwwroot'
rsync -a dist/ ../../API/wwwroot/
cd ../ || exit
- name: Get csproj Version
uses: kzrnm/get-net-sdk-project-versions-action@v2
id: get-version
with:
proj-path: Kavita.Common/Kavita.Common.csproj
- name: Echo csproj version
run: echo "${{steps.get-version.outputs.assembly-version}}"
- name: Parse Version
run: |
version='${{steps.get-version.outputs.assembly-version}}'
newVersion=${version%.*}
echo $newVersion
echo "VERSION=$newVersion" >> $GITHUB_OUTPUT
id: parse-version
- name: Compile dotnet app
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Install Swashbuckle CLI
run: dotnet tool install -g --version 6.5.0 Swashbuckle.AspNetCore.Cli
- run: ./monorepo-build.sh
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Build and push stable
id: docker_build_stable
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm/v7,linux/arm64
push: true
tags: jvmilazz0/kavita:latest, jvmilazz0/kavita:${{ steps.parse-version.outputs.VERSION }}, ghcr.io/kareadita/kavita:latest, ghcr.io/kareadita/kavita:${{ steps.parse-version.outputs.VERSION }}
- name: Build and push nightly
id: docker_build_nightly
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm/v7,linux/arm64
push: true
tags: jvmilazz0/kavita:nightly, jvmilazz0/kavita:nightly-${{ steps.parse-version.outputs.VERSION }}, ghcr.io/kareadita/kavita:nightly, ghcr.io/kareadita/kavita:nightly-${{ steps.parse-version.outputs.VERSION }}
- name: Image digest
run: echo ${{ steps.docker_build_stable.outputs.digest }}
- name: Image digest
run: echo ${{ steps.docker_build_nightly.outputs.digest }}
- name: Notify Discord
uses: rjstone/discord-webhook-notify@v1
with:
severity: info
description: v${{steps.get-version.outputs.assembly-version}} - ${{ steps.findPr.outputs.title }}
details: '${{ steps.findPr.outputs.body }}'
text: <@&939225192553644133> A new stable build has been released.
webhookUrl: ${{ secrets.DISCORD_DOCKER_UPDATE_URL }}
- name: Notify Discord
uses: rjstone/discord-webhook-notify@v1
with:
severity: info
description: v${{steps.get-version.outputs.assembly-version}} - ${{ steps.findPr.outputs.title }}
details: '${{ steps.findPr.outputs.body }}'
text: <@&939225459156217917> <@&939225350775406643> A new nightly build has been released for docker.
webhookUrl: ${{ secrets.DISCORD_DOCKER_UPDATE_URL }}

View File

@ -736,12 +736,12 @@ public class DirectoryServiceTests
[InlineData(new [] {"C:/Manga/Dir 1/", "c://Manga/"},
new [] {"D:/Manga/Love Hina/Vol. 01.cbz", "D:/Manga/Vol. 01.cbz"},
null)]
[InlineData(new [] {"C:/Manga/"},
new [] {"C:/Manga//Love Hina/Vol. 01.cbz"},
"C:/Manga/Love Hina")]
[InlineData(new [] {@"C:\mount\drive\Library\Test Library\Comics\"},
new [] {@"C:\mount\drive\Library\Test Library\Comics\Bruce Lee (1994)\Bruce Lee #001 (1994).cbz"},
@"C:/mount/drive/Library/Test Library/Comics/Bruce Lee (1994)")]
[InlineData(new [] {"C:/Manga/"},
new [] {"C:/Manga/Love Hina/Vol. 01.cbz", "C:/Manga/Love Hina/Specials/Sp01.cbz"},
"C:/Manga/Love Hina")]
public void FindLowestDirectoriesFromFilesTest(string[] rootDirectories, string[] files, string expectedDirectory)
{
var fileSystem = new MockFileSystem();

View File

@ -82,6 +82,7 @@ public class AccountController : BaseApiController
{
var user = await _userManager.Users.SingleOrDefaultAsync(x => x.UserName == resetPasswordDto.UserName);
if (user == null) return Ok(); // Don't report BadRequest as that would allow brute forcing to find accounts on system
_logger.LogInformation("{UserName} is changing {ResetUser}'s password", User.GetUsername(), resetPasswordDto.UserName);
if (User.IsInRole(PolicyConstants.ReadOnlyRole))
return BadRequest(await _localizationService.Translate(User.GetUserId(), "permission-denied"));

View File

@ -0,0 +1,51 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using API.Entities;
using API.Services.Tasks.Scanner.Parser;
using Kavita.Common.EnvironmentInfo;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
namespace API.Data.ManualMigrations;
/// <summary>
/// v0.8.0 released with a bug around LowestSeriesPath. This resets it for all users.
/// </summary>
public static class MigrateLowestSeriesFolderPath
{
public static async Task Migrate(DataContext dataContext, IUnitOfWork unitOfWork, ILogger<Program> logger)
{
if (await dataContext.ManualMigrationHistory.AnyAsync(m => m.Name == "MigrateLowestSeriesFolderPath"))
{
return;
}
logger.LogCritical(
"Running MigrateLowestSeriesFolderPath migration - Please be patient, this may take some time. This is not an error");
var series = await dataContext.Series.Where(s => !string.IsNullOrEmpty(s.LowestFolderPath)).ToListAsync();
foreach (var s in series)
{
s.LowestFolderPath = string.Empty;
unitOfWork.SeriesRepository.Update(s);
}
// Save changes after processing all series
if (dataContext.ChangeTracker.HasChanges())
{
await dataContext.SaveChangesAsync();
}
dataContext.ManualMigrationHistory.Add(new ManualMigrationHistory()
{
Name = "MigrateLowestSeriesFolderPath",
ProductVersion = BuildInfo.Version.ToString(),
RanAt = DateTime.UtcNow
});
await dataContext.SaveChangesAsync();
logger.LogCritical(
"Running MigrateLowestSeriesFolderPath migration - Completed. This is not an error");
}
}

View File

@ -596,14 +596,12 @@ public class DirectoryService : IDirectoryService
/// <returns></returns>
public string? FindLowestDirectoriesFromFiles(IEnumerable<string> libraryFolders, IList<string> filePaths)
{
var stopLookingForDirectories = false;
var dirs = new Dictionary<string, string>();
foreach (var folder in libraryFolders.Select(Tasks.Scanner.Parser.Parser.NormalizePath))
var normalizedFilePaths = filePaths.Select(Parser.NormalizePath).ToList();
foreach (var folder in libraryFolders.Select(Parser.NormalizePath))
{
if (stopLookingForDirectories) break;
foreach (var file in filePaths.Select(Tasks.Scanner.Parser.Parser.NormalizePath))
foreach (var file in normalizedFilePaths)
{
if (!file.Contains(folder)) continue;
@ -619,8 +617,16 @@ public class DirectoryService : IDirectoryService
if (dirs.Keys.Count == 1) return dirs.Keys.First();
if (dirs.Keys.Count > 1)
{
return dirs.Keys.Last();
// For each key, validate that each file exists in the key path
foreach (var folder in dirs.Keys)
{
if (normalizedFilePaths.TrueForAll(filePath => filePath.Contains(Parser.NormalizePath(folder))))
{
return folder;
}
}
}
return null;
}

View File

@ -265,7 +265,7 @@ public class TaskScheduler : ITaskScheduler
public void ScheduleUpdaterTasks()
{
_logger.LogInformation("Scheduling Auto-Update tasks");
RecurringJob.AddOrUpdate(CheckForUpdateId, () => CheckForUpdate(), $"0 */{Rnd.Next(1, 2)} * * *", RecurringJobOptions);
RecurringJob.AddOrUpdate(CheckForUpdateId, () => CheckForUpdate(), $"0 */{Rnd.Next(4, 6)} * * *", RecurringJobOptions);
BackgroundJob.Enqueue(() => CheckForUpdate());
}

View File

@ -463,7 +463,7 @@ public class ParseScannedFiles
chapter.IssueOrder = counter;
counter++;
}
return;
continue;
}
@ -479,7 +479,7 @@ public class ParseScannedFiles
chapter.IssueOrder = counter;
counter++;
}
return;
continue;
}
chapters = infos

View File

@ -263,6 +263,9 @@ public class Startup
await MigrateMangaFilePath.Migrate(dataContext, logger);
await MigrateCollectionTagToUserCollections.Migrate(dataContext, unitOfWork, logger);
// v0.8.1
await MigrateLowestSeriesFolderPath.Migrate(dataContext, unitOfWork, logger);
// Update the version in the DB after all migrations are run
var installVersion = await unitOfWork.SettingsRepository.GetSettingAsync(ServerSettingKey.InstallVersion);
installVersion.Value = BuildInfo.Version.ToString();

1093
UI/Web/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -26,7 +26,7 @@
"@angular/platform-browser-dynamic": "^17.3.0",
"@angular/router": "^17.3.0",
"@fortawesome/fontawesome-free": "^6.5.1",
"@iharbeck/ngx-virtual-scroller": "^17.0.0",
"@iharbeck/ngx-virtual-scroller": "^17.0.2",
"@iplab/ngx-file-upload": "^17.0.0",
"@microsoft/signalr": "^7.0.12",
"@ng-bootstrap/ng-bootstrap": "^16.0.0",
@ -37,7 +37,7 @@
"@ngneat/transloco-preload-langs": "^5.0.1",
"@popperjs/core": "^2.11.7",
"@swimlane/ngx-charts": "^20.5.0",
"@tweenjs/tween.js": "^21.1.1",
"@tweenjs/tween.js": "^23.1.1",
"bootstrap": "^5.3.2",
"charts.css": "^1.1.0",
"file-saver": "^2.0.5",

View File

@ -116,7 +116,7 @@ export class AppComponent implements OnInit {
tap(versionOutOfDate => {
if (!this.ngbModal.hasOpenModals()) {
const ref = this.ngbModal.open(OutOfDateModalComponent, {size: 'xl', fullscreen: 'md'});
ref.componentInstance.versionsOutOfDate = 3;
ref.componentInstance.versionsOutOfDate = versionOutOfDate;
}
})
)

View File

@ -30,7 +30,6 @@
.virtual-scroller, virtual-scroller {
width: 100%;
height: calc(100vh - 85px);
max-height: calc(var(--vh)*100 - 170px);
}

View File

@ -7,7 +7,7 @@
"name": "GPL-3.0",
"url": "https://github.com/Kareadita/Kavita/blob/develop/LICENSE"
},
"version": "0.8.0.0"
"version": "0.8.0.1"
},
"servers": [
{