Kareadita / Kavita

Kavita is a fast, feature rich, cross platform reading server. Built with the goal of being a full solution for all your reading needs. Setup your own server and share your reading collection with your friends and family.
http://www.kavitareader.com
GNU General Public License v3.0
5.88k stars 300 forks source link

Double Dark Theme in Theme Manager #3044

Open X-Xadro opened 1 month ago

X-Xadro commented 1 month ago

What happened?

Just updated to v0.8.2 (from the previous version) and wanted to try out Themes because i never tried it before and then i got this:

2024-07-08 12_20_07-Kavita - User Preferences - Brave

What did you expect?

A List of Themes to be honestly.

Kavita Version Number - If you don not see your version number listed, please update Kavita and see if your issue still persists.

0.8.1 - Stable

What operating system is Kavita being hosted from?

Docker (Dockerhub Container)

If the issue is being seen on Desktop, what OS are you running where you see the issue?

None

If the issue is being seen in the UI, what browsers are you seeing the problem on?

Chrome

If the issue is being seen on Mobile, what OS are you running where you see the issue?

None

If the issue is being seen on the Mobile UI, what browsers are you seeing the problem on?

No response

Relevant log output

[Kavita] [2024-07-08 12:15:29.473 +02:00  56] [Error] API.Middleware.ExceptionMiddleware There was an exception
System.ArgumentException: An item with the same key has already been added. Key: Dark
   at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
   at System.Linq.Enumerable.ToDictionary[TSource,TKey](List`1 source, Func`2 keySelector, IEqualityComparer`1 comparer)
   at API.Services.Tasks.ThemeService.GetDownloadableThemes() in C:\Users\josep\Documents\Projects\KavitaOrg\Kavita\API\Services\Tasks\SiteThemeService.cs:line 123
   at API.Controllers.ThemeController.BrowseThemes() in C:\Users\josep\Documents\Projects\KavitaOrg\Kavita\API\Controllers\ThemeController.cs:line 94
   at lambda_method1726(Closure, Object)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at API.Startup.<>c__DisplayClass4_0.<<Configure>b__5>d.MoveNext() in C:\Users\josep\Documents\Projects\KavitaOrg\Kavita\API\Startup.cs:line 405
--- End of stack trace from previous location ---
   at Serilog.AspNetCore.RequestLoggingMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.ResponseCaching.ResponseCachingMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware.InvokeCore(HttpContext context)
   at API.Middleware.SecurityEventMiddleware.InvokeAsync(HttpContext context) in C:\Users\josep\Documents\Projects\KavitaOrg\Kavita\API\Middleware\SecurityMiddleware.cs:line 25
   at API.Middleware.ExceptionMiddleware.InvokeAsync(HttpContext context) in C:\Users\josep\Documents\Projects\KavitaOrg\Kavita\API\Middleware\ExceptionMiddleware.cs:line 18

Additional Notes

Repository: linuxserver/docker-kavita · Tag: v0.8.2-ls41

acaranta commented 1 month ago

updated docker image to latest 0.8.2 and got the "same" problem except it's not just 2 image but dozens.

Same error show up in logs.

majora2007 commented 1 month ago

This is a migration issue where somehow the old Dark themes weren't removed. You can either remove them in your DB or wait till the next release where I will add a custom migration to remove the old ones. This theme manager implementation required switching from how System (provided) themes worked and thus something must have slipped through and no one from nightly testing group saw this.

acaranta commented 1 month ago

indeed, empting the SiteTheme table and restarting the container allowed to cleanup the list and let kavita retreve/repopulate properly it's themes :)

X-Xadro commented 1 month ago

Can confirm, after deleting all entries from SiteTheme table and restarting the container it showed all available themes (which it did not do before) and only a single Dark theme :)

majora2007 commented 1 month ago

Going to reopen this and add a migration so users don't need to do this manually, something I thought I had done but must have forgotten.