Misc Enhancements (#1525)
* Moved the data connection for the Database out of appsettings.json and hardcoded it. This will allow for more customization and cleaner update process. * Removed unneeded code * Updated pdf viewer to 15.0.0 (pdf 2.6), which now supports east-asian fonts * Fixed up some regex parsing for volumes that have a float number. * Fixed a bug where the tooltip for Publication Status wouldn't show * Fixed some weird parsing rules where v1.1 would parse as volume 1 chapter 1 * Fixed a bug where bookmarking button was hidden for admins without bookmark role (due to migration) * Unified the star rating component in series detail to match metadata filter. * Fixed a bug in the bulk selection code when using shift selection, where the inverse of what was selected would be toggled. * Fixed some old code where if on all series page, only English as a language would return. We now return all languages of all libraries. * Updated api/metadata/languages documentation * Refactored some bookmark api names: get-bookmarks -> chapter-bookmarks, get-all-bookmarks -> all-bookmarks, get-series-bookmarks -> series-bookmarks, etc. * Refactored all cases of createSeriesFilter to filterUtiltityService. Added ability to search for a series on Bookmarks page. Fixed a bug where people filters wouldn't respect the disable flag froms ettings. * Cleaned up a bit of the circular downloader code. * Implemented Russian Parsing * Fixed an issue where some users that had a missing theme entry wouldn't be able to update their user preferences. * Refactored normalization to exclude !, thus allowing series with ! to be different from each other. * Fixed a migration exit case * Fixed broken unit test
This commit is contained in:
parent
b7d88f08d8
commit
00f0ad5a3f
50 changed files with 508 additions and 419 deletions
|
@ -29,13 +29,6 @@ public static class Configuration
|
|||
set => SetJwtToken(GetAppSettingFilename(), value);
|
||||
}
|
||||
|
||||
|
||||
public static string DatabasePath
|
||||
{
|
||||
get => GetDatabasePath(GetAppSettingFilename());
|
||||
set => SetDatabasePath(GetAppSettingFilename(), value);
|
||||
}
|
||||
|
||||
private static string GetAppSettingFilename()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(AppSettingsFilename))
|
||||
|
@ -191,52 +184,4 @@ public static class Configuration
|
|||
/* Swallow Exception */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static string GetDatabasePath(string filePath)
|
||||
{
|
||||
const string defaultFile = "config/kavita.db";
|
||||
|
||||
try
|
||||
{
|
||||
var json = File.ReadAllText(filePath);
|
||||
var jsonObj = JsonSerializer.Deserialize<dynamic>(json);
|
||||
|
||||
if (jsonObj.TryGetProperty("ConnectionStrings", out JsonElement tokenElement))
|
||||
{
|
||||
foreach (var property in tokenElement.EnumerateObject())
|
||||
{
|
||||
if (!property.Name.Equals("DefaultConnection")) continue;
|
||||
return property.Value.GetString();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("Error writing app settings: " + ex.Message);
|
||||
}
|
||||
|
||||
return defaultFile;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This should NEVER be called except by MigrateConfigFiles
|
||||
/// </summary>
|
||||
/// <param name="filePath"></param>
|
||||
/// <param name="updatedPath"></param>
|
||||
private static void SetDatabasePath(string filePath, string updatedPath)
|
||||
{
|
||||
try
|
||||
{
|
||||
var existingString = GetDatabasePath(filePath);
|
||||
var json = File.ReadAllText(filePath)
|
||||
.Replace(existingString,
|
||||
"Data source=" + updatedPath);
|
||||
File.WriteAllText(filePath, json);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
/* Swallow Exception */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue