Merge pull request #182 from BinaryAlley/feature/theme-driven-application

Feature/theme driven application
This commit is contained in:
BinaryAlley authored and GitHub committed 2026-08-29 04:06:31 -07:00
commit 3f69693332
46 files changed
+469 -3344

No files matched your search

+22 -7
View File
@@ -40,7 +40,7 @@ my-theme/
theme.json
assets/
preview.svg
theme.css
site.css
templates/
index.html
shared/
@@ -90,7 +90,7 @@ The manifest is a JSON object describing the theme. The example below is the man
| `author` | yes | Author of the theme, up to 80 characters. |
| `version` | yes | Semantic version form, for example `1.0.0`. Up to 40 characters. |
| `preview` | no | Path to a preview image, relative to the pack root and under `assets/`. Shown on the administration page. |
| `templates` | yes | A mapping from template key to a file under `templates/`, with 1 to 32 entries. Must include the `default` key. |
| `templates` | no | An optional mapping from template key to a file under `templates/`, with up to 32 entries. Templates can also be provided as mirrored files under `templates/` without a manifest entry. |
All text fields must be non-empty and must not contain control characters. Template keys follow the same lowercase kebab-case rule as the theme id and are at most 40 characters. Template paths are normalized and must point to an existing file under `templates/`.
@@ -149,9 +149,10 @@ Every themed page is identified by a page key that mirrors the path of the corre
1. An explicit mapping in `templates` when the manifest declares the page key.
2. A mirrored template file at `templates/{pageKey}.html`, walking up the scope of the path when the exact mirror does not exist.
3. The `default` template from the manifest.
For example, the books index page has the page key `library/written-content-library/book-library/books/index`. The engine tries, in order: the explicit `templates` entry for that key, `templates/library/written-content-library/book-library/books/index.html`, then the parent scopes such as `templates/library/written-content-library/book-library/books.html`, and finally the `default` template.
When neither an explicit mapping nor a mirrored file exists, the theme has no template for that page, and the application renders its own fallback unstylied Razor view instead.
For example, the books index page has the page key `library/written-content-library/book-library/books/index`. The engine tries, in order: the explicit `templates` entry for that key, `templates/library/written-content-library/book-library/books/index.html`, then the parent scopes such as `templates/library/written-content-library/book-library/books.html`. When none exists, the application renders the books page view itself.
Known page keys:
@@ -188,7 +189,7 @@ The layout template of the bundled theme shows the intended shape:
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{title}} - Lumina</title>
{{&appHead}}
<link rel="stylesheet" href="{{assetBase}}/theme.css">
<link rel="stylesheet" href="{{assetBase}}/site.css">
</head>
<body>
<div id="page">
@@ -262,10 +263,24 @@ JavaScript is always allowed in themes: script elements in templates are served
## Assets
Static files under `assets/` are served to the browser. The asset base URL is available to the layout and page templates as `assetBase`, so a stylesheet is referenced as `{{assetBase}}/theme.css`. Assets are served only from within the pack, and paths that would escape the pack are rejected.
Static files under `assets/` are served to the browser. The asset base URL is available to the layout and page templates as `assetBase`, so a stylesheet is referenced as `{{assetBase}}/site.css`. Assets are served only from within the pack, and paths that would escape the pack are rejected.
A theme owns its behavior as much as its look: the theme script, for example `{{assetBase}}/theme.js`, carries the behavior of the theme chrome, such as the desktop menu bar.
A theme ships the images its stylesheets use as assets too, referenced with paths relative to the stylesheet. For example a stylesheet at `assets/combobox.css` references `images/ui/metal-plate.png`, which is served from `assets/images/ui/metal-plate.png`.
The `preview` field of the manifest points at an asset that is shown as the theme thumbnail on the administration page.
### The top offset contract
The application translates page coordinates into the content coordinate space of some widgets (for example the selection rectangle of the file system browser) by subtracting the height of the fixed top bar of the theme. A theme that renders a fixed top bar declares that height on the root element as the `--theme-top-offset` custom property, for example in its theme script:
```js
document.documentElement.style.setProperty('--theme-top-offset', window.getComputedStyle(menubar).height);
```
When the property is absent it is treated as `0`, which is correct for a theme without a fixed top bar.
## Configuration Options
The theme engine is configured through the `ThemeEngine` section of the API configuration (`appsettings.shared.json`):
@@ -284,7 +299,7 @@ The theme engine is configured through the `ThemeEngine` section of the API conf
1. Create a directory for the theme with `theme.json`, a `templates/` directory and an `assets/` directory, following the layout of `editorial-paper`.
2. Write the manifest following the field rules in [The Manifest (theme.json)](#the-manifest-themejson).
3. Author the templates. Start with `templates/shared/layout.html` and `templates/shared/nav-menu.html`, then add page templates and the `default` template.
3. Author the templates. Start with `templates/shared/layout.html` and `templates/shared/nav-menu.html`, then add page templates.
4. Add the static files under `assets/`, for example a stylesheet referenced from the layout.
5. Keep the pack within the size limits: the archive at most 8 MB, the extracted pack at most 24 MB, no single file larger than 6 MB and at most 250 entries.
6. Compress the directory into a ZIP archive with `theme.json` at the root of the archive, not nested inside an extra folder.
@@ -57,7 +57,7 @@ public interface IThemeService
Task<Result<ThemeManifestDto>> LoadManifestAsync(string themeId, CancellationToken cancellationToken);
/// <summary>
/// Gets the sanitized content of the template selected by a page key, falling back to the default template when the key is missing.
/// Gets the sanitized content of the template selected by a page key, returning an error when the theme provides no template for the page.
/// </summary>
/// <param name="themeId">The manifest id of the theme.</param>
/// <param name="pageKey">The page key that selects the template.</param>
@@ -14,6 +14,7 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using DomainErrors = Lumina.Domain.Common.Errors.Errors;
using Microsoft.Extensions.Logging;
#endregion
namespace Lumina.Application.Core.Themes.Management.Queries.GetThemeTemplate;
@@ -26,6 +27,7 @@ public class GetThemeTemplateQueryHandler : IQueryHandler<GetThemeTemplateQuery,
private readonly IUnitOfWork _unitOfWork;
private readonly IThemeService _themeService;
private readonly IValidator<GetThemeTemplateQuery> _validator;
private readonly ILogger<GetThemeTemplateQueryHandler> _logger;
/// <summary>
/// Initializes a new instance of the <see cref="GetThemeTemplateQueryHandler"/> class.
@@ -33,11 +35,13 @@ public class GetThemeTemplateQueryHandler : IQueryHandler<GetThemeTemplateQuery,
/// <param name="unitOfWork">Injected unit of work for interacting with the data access layer repositories.</param>
/// <param name="themeService">Injected service for the server-side storage and serving of theme packs.</param>
/// <param name="validator">Injected validator for application validation rules.</param>
public GetThemeTemplateQueryHandler(IUnitOfWork unitOfWork, IThemeService themeService, IValidator<GetThemeTemplateQuery> validator)
/// <param name="logger">Injected logger for the handler.</param>
public GetThemeTemplateQueryHandler(IUnitOfWork unitOfWork, IThemeService themeService, IValidator<GetThemeTemplateQuery> validator, ILogger<GetThemeTemplateQueryHandler> logger)
{
_unitOfWork = unitOfWork;
_themeService = themeService;
_validator = validator;
_logger = logger;
}
/// <summary>
@@ -66,8 +70,12 @@ public class GetThemeTemplateQueryHandler : IQueryHandler<GetThemeTemplateQuery,
if (templateResult.IsFailure)
{
// the stored files of a bundled theme removed externally are restored, and if the broken theme was the
// active one, the configured default theme is activated, so clients always have a renderable theme
if (theme.InstallSource == ThemeInstallSource.Bundled && await TryRestoreBundledThemeAsync(theme, cancellationToken).ConfigureAwait(false))
// active one, the configured default theme is activated, so clients always have a renderable theme; a
// theme that simply does not provide a template for the page is not broken, so it is not restored and the
// caller falls back to the application's default unstyled Razor view instead
if (templateResult.FirstError != DomainErrors.Themes.ThemeTemplateNotFound
&& theme.InstallSource == ThemeInstallSource.Bundled
&& await TryRestoreBundledThemeAsync(theme, cancellationToken).ConfigureAwait(false))
templateResult = await _themeService.GetTemplateAsync(theme.ThemeId, query.PageKey!, cancellationToken).ConfigureAwait(false);
if (templateResult.IsFailure)
@@ -85,29 +93,43 @@ public class GetThemeTemplateQueryHandler : IQueryHandler<GetThemeTemplateQuery,
/// <returns><see langword="true"/> when the theme was restored; <see langword="false"/> otherwise.</returns>
private async Task<bool> TryRestoreBundledThemeAsync(ThemeEntity theme, CancellationToken cancellationToken)
{
Result<Success> restoreResult = await _themeService.RestoreBundledThemeAsync(theme.ThemeId, cancellationToken).ConfigureAwait(false);
if (restoreResult.IsFailure)
return false;
if (theme.IsCurrent == true)
try
{
Result<ThemeEntity?> getDefaultResult = await _unitOfWork.ThemeRepository.GetByThemeIdAsync(_themeService.DefaultThemeId, cancellationToken).ConfigureAwait(false);
if (getDefaultResult.IsFailure)
return true;
Result<Success> restoreResult = await _themeService.RestoreBundledThemeAsync(theme.ThemeId, cancellationToken).ConfigureAwait(false);
if (restoreResult.IsFailure)
return false;
ThemeEntity? defaultTheme = getDefaultResult.Value;
if (defaultTheme is not null && !defaultTheme.IsDeleted && defaultTheme.Id != theme.Id)
if (theme.IsCurrent == true)
{
theme.IsCurrent = null;
await _unitOfWork.ThemeRepository.UpdateAsync(theme, cancellationToken).ConfigureAwait(false);
Result<ThemeEntity?> getDefaultResult = await _unitOfWork.ThemeRepository.GetByThemeIdAsync(_themeService.DefaultThemeId, cancellationToken).ConfigureAwait(false);
if (getDefaultResult.IsFailure)
return true;
defaultTheme.IsCurrent = true;
await _unitOfWork.ThemeRepository.UpdateAsync(defaultTheme, cancellationToken).ConfigureAwait(false);
ThemeEntity? defaultTheme = getDefaultResult.Value;
if (defaultTheme is not null && !defaultTheme.IsDeleted && defaultTheme.Id != theme.Id)
{
theme.IsCurrent = null;
await _unitOfWork.ThemeRepository.UpdateAsync(theme, cancellationToken).ConfigureAwait(false);
await _unitOfWork.SaveChangesAsync(cancellationToken).ConfigureAwait(false);
defaultTheme.IsCurrent = true;
await _unitOfWork.ThemeRepository.UpdateAsync(defaultTheme, cancellationToken).ConfigureAwait(false);
await _unitOfWork.SaveChangesAsync(cancellationToken).ConfigureAwait(false);
}
}
}
return true;
return true;
}
catch (OperationCanceledException)
{
throw;
}
catch (Exception exception)
{
// the restore is best effort: an unexpected failure must not fail the request, so the caller falls back to
// the application view instead of returning an error to the browser
_logger.LogWarning(exception, "Failed to restore the files of bundled theme '{ThemeId}'.", theme.ThemeId);
return false;
}
}
}
@@ -21,6 +21,7 @@ public static partial class Errors
public static Error ThemeCannotBeRestored => Error.Forbidden(description: nameof(ThemeCannotBeRestored));
public static Error ThemeArchiveNotReadable => Error.Failure(description: nameof(ThemeArchiveNotReadable));
public static Error ThemeFilesUnreadable => Error.Failure(description: nameof(ThemeFilesUnreadable));
public static Error ThemeTemplateNotFound => Error.NotFound(description: nameof(ThemeTemplateNotFound));
public static Error ThemeNotAvailable => Error.Failure(description: nameof(ThemeNotAvailable));
}
}
@@ -147,41 +147,54 @@ internal sealed class ThemeDetectionSyncJob : BackgroundService
foreach (ThemeEntity brokenTheme in brokenThemes)
{
if (brokenTheme.InstallSource == ThemeInstallSource.Bundled)
try
{
// the files of a bundled theme that was not deleted by the user are restored from its shipped archive
Result<Success> restoreResult = await _themeService.RestoreBundledThemeAsync(brokenTheme.ThemeId, cancellationToken);
if (restoreResult.IsSuccess)
continue;
_logger.LogWarning("Failed to restore the files of bundled theme '{ThemeId}': {Error}", brokenTheme.ThemeId, restoreResult.FirstError.Description);
// at least one bundled theme must always remain available, so the application never ends up without any theme;
// the last remaining bundled theme is kept even when its files cannot be recovered
int availableBundledThemes = themes.Count(availableTheme => !availableTheme.IsDeleted && availableTheme.InstallSource == ThemeInstallSource.Bundled);
if (availableBundledThemes <= 1)
if (brokenTheme.InstallSource == ThemeInstallSource.Bundled)
{
_logger.LogWarning("Bundled theme '{ThemeId}' is the last remaining bundled theme and its files could not be restored, so it is kept.", brokenTheme.ThemeId);
continue;
}
// the files of a bundled theme that was not deleted by the user are restored from its shipped archive
Result<Success> restoreResult = await _themeService.RestoreBundledThemeAsync(brokenTheme.ThemeId, cancellationToken);
if (restoreResult.IsSuccess)
continue;
// a bundled theme whose files could not be recovered is soft deleted, so it is not shown anymore, but can be restored later
brokenTheme.IsDeleted = true;
brokenTheme.IsCurrent = null;
brokenTheme.UpdatedOnUtc = DateTime.UtcNow;
brokenTheme.UpdatedBy = default;
Result<Updated> updateResult = await unitOfWork.ThemeRepository.UpdateAsync(brokenTheme, cancellationToken);
if (updateResult.IsFailure)
_logger.LogWarning("Failed to delete theme '{ThemeId}': {Error}", brokenTheme.ThemeId, updateResult.FirstError.Description);
_logger.LogWarning("Failed to restore the files of bundled theme '{ThemeId}': {Error}", brokenTheme.ThemeId, restoreResult.FirstError.Description);
// at least one bundled theme must always remain available, so the application never ends up without any theme;
// the last remaining bundled theme is kept even when its files cannot be recovered
int availableBundledThemes = themes.Count(availableTheme => !availableTheme.IsDeleted && availableTheme.InstallSource == ThemeInstallSource.Bundled);
if (availableBundledThemes <= 1)
{
_logger.LogWarning("Bundled theme '{ThemeId}' is the last remaining bundled theme and its files could not be restored, so it is kept.", brokenTheme.ThemeId);
continue;
}
// a bundled theme whose files could not be recovered is soft deleted, so it is not shown anymore, but can be restored later
brokenTheme.IsDeleted = true;
brokenTheme.IsCurrent = null;
brokenTheme.UpdatedOnUtc = DateTime.UtcNow;
brokenTheme.UpdatedBy = default;
Result<Updated> updateResult = await unitOfWork.ThemeRepository.UpdateAsync(brokenTheme, cancellationToken);
if (updateResult.IsFailure)
_logger.LogWarning("Failed to delete theme '{ThemeId}': {Error}", brokenTheme.ThemeId, updateResult.FirstError.Description);
}
else
{
// a user theme has no shipped archive to restore from, so damage is permanent and the theme is removed entirely
_logger.LogWarning("The stored files of user theme '{ThemeId}' are missing, so the theme is deleted.", brokenTheme.ThemeId);
brokenTheme.IsCurrent = null;
Result<Deleted> deleteResult = await unitOfWork.ThemeRepository.DeleteByIdAsync(brokenTheme.Id, cancellationToken);
if (deleteResult.IsFailure)
_logger.LogWarning("Failed to delete theme '{ThemeId}': {Error}", brokenTheme.ThemeId, deleteResult.FirstError.Description);
}
}
else
catch (OperationCanceledException)
{
// a user theme has no shipped archive to restore from, so damage is permanent and the theme is removed entirely
_logger.LogWarning("The stored files of user theme '{ThemeId}' are missing, so the theme is deleted.", brokenTheme.ThemeId);
brokenTheme.IsCurrent = null;
Result<Deleted> deleteResult = await unitOfWork.ThemeRepository.DeleteByIdAsync(brokenTheme.Id, cancellationToken);
if (deleteResult.IsFailure)
_logger.LogWarning("Failed to delete theme '{ThemeId}': {Error}", brokenTheme.ThemeId, deleteResult.FirstError.Description);
throw;
}
catch (Exception exception)
{
// repairing a broken theme is best effort: an unexpected failure on one theme must not crash the host,
// so it is logged and the remaining broken themes are still processed
_logger.LogWarning(exception, "Failed to repair the broken theme '{ThemeId}'.", brokenTheme.ThemeId);
}
}
}
@@ -158,15 +158,49 @@ public sealed class ThemeService : IThemeService
_logger.LogWarning(exception, "An uploaded theme archive could not be read.");
return Errors.Themes.ThemeArchiveNotReadable;
}
catch (IOException exception)
{
// the extracted pack could not be moved into place; the install is best effort, so the caller receives an error
// instead of an unhandled exception that would crash the host or fail the request
_logger.LogWarning(exception, "The theme pack could not be installed.");
return Errors.Themes.ThemeFilesUnreadable;
}
catch (UnauthorizedAccessException exception)
{
_logger.LogWarning(exception, "The theme pack could not be installed.");
return Errors.Themes.ThemeFilesUnreadable;
}
finally
{
if (File.Exists(temporaryArchivePath))
File.Delete(temporaryArchivePath);
try
{
if (File.Exists(temporaryArchivePath))
File.Delete(temporaryArchivePath);
if (Directory.Exists(extractionPath))
Directory.Delete(extractionPath, recursive: true);
if (Directory.Exists(extractionPath))
Directory.Delete(extractionPath, recursive: true);
}
catch (Exception exception) when (exception is IOException or UnauthorizedAccessException)
{
// a locked staging file must not turn the install into an unhandled exception; the stale staging
// directory is removed on the next install attempt
_logger.LogTrace(exception, "Failed to clean up the theme staging directory.");
}
}
}
catch (IOException exception)
{
// a file system failure before or during the install (for example a locked storage or staging directory)
// must not escape as an unhandled exception, which would crash the host or fail the request; the install
// is best effort and returns an error instead
_logger.LogWarning(exception, "The theme pack could not be installed.");
return Errors.Themes.ThemeFilesUnreadable;
}
catch (UnauthorizedAccessException exception)
{
_logger.LogWarning(exception, "The theme pack could not be installed.");
return Errors.Themes.ThemeFilesUnreadable;
}
finally
{
_mutationGate.Release();
@@ -242,7 +276,7 @@ public sealed class ThemeService : IThemeService
}
/// <summary>
/// Gets the sanitized content of the template selected by a page key, falling back to the default template when the key is missing.
/// Gets the sanitized content of the template selected by a page key, returning an error when the theme provides no template for the page.
/// </summary>
/// <param name="themeId">The manifest id of the theme.</param>
/// <param name="pageKey">The page key that selects the template.</param>
@@ -259,7 +293,10 @@ public sealed class ThemeService : IThemeService
string? templatePath = manifest.Templates.TryGetValue(pageKey, out string? explicitPath)
? explicitPath
: ResolveMirroredTemplatePath(themePath, pageKey);
templatePath ??= manifest.Templates["default"]; // the manifest validation guarantees a default template
// a template is used for a page only when the theme provides one explicitly or as a mirrored file
if (templatePath is null)
return Errors.Themes.ThemeTemplateNotFound;
Result<string> fullPathResult = ResolveContainedPath(themePath, templatePath);
if (fullPathResult.IsFailure)
@@ -607,8 +644,8 @@ public sealed class ThemeService : IThemeService
if (!s_versionPattern.IsMatch(manifest.Version))
return PackageInvalid("Theme version must use semantic version form, for example 1.0.0.");
if (manifest.Templates is null || manifest.Templates.Count == 0 || manifest.Templates.Count > 32)
return PackageInvalid("A theme must declare between 1 and 32 templates.");
if (manifest.Templates is null || manifest.Templates.Count > 32)
return PackageInvalid("A theme must declare at most 32 templates.");
Dictionary<string, string> normalizedTemplates = new(StringComparer.OrdinalIgnoreCase);
foreach ((string key, string path) in manifest.Templates)
@@ -634,9 +671,6 @@ public sealed class ThemeService : IThemeService
normalizedTemplates[key] = normalizedPath;
}
if (!normalizedTemplates.ContainsKey("default"))
return PackageInvalid("The manifest must define a 'default' template fallback.");
manifest.Templates = normalizedTemplates;
if (!string.IsNullOrWhiteSpace(manifest.Preview))
@@ -796,7 +830,7 @@ public sealed class ThemeService : IThemeService
else
File.Delete(path);
}
catch (IOException exception)
catch (Exception exception) when (exception is IOException or UnauthorizedAccessException)
{
_logger.LogDebug(exception, "Could not remove stale theme staging path {StagingPath}.", path);
}
@@ -829,7 +863,7 @@ public sealed class ThemeService : IThemeService
Directory.Move(extractionPath, destination);
return;
}
catch (IOException) when (attempt < MAX_ATTEMPTS)
catch (Exception exception) when (attempt < MAX_ATTEMPTS && exception is IOException or UnauthorizedAccessException)
{
await Task.Delay(100 * attempt, cancellationToken);
}
@@ -18,4 +18,10 @@ public sealed record ThemeNavEntryDto(
string? Url,
string? CssClass,
IReadOnlyList<ThemeNavEntryDto> Children
);
)
{
/// <summary>
/// Gets whether this entry is a submenu: it has child links instead of a direct URL.
/// </summary>
public bool IsSubmenu => Children.Count > 0;
}
@@ -92,7 +92,7 @@ public class ThemeLayoutRenderer
}
/// <summary>
/// Renders the navigation menu of the active theme, falling back to the application Razor menu when the theme template cannot be rendered.
/// Renders the navigation menu of the active theme, falling back to the application Razor menu when the theme navigation template cannot be loaded or rendered.
/// </summary>
/// <param name="themeId">The manifest id of the active theme.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
@@ -100,10 +100,22 @@ public class ThemeLayoutRenderer
private async Task<string> RenderNavAsync(string themeId, CancellationToken cancellationToken)
{
ThemeNavMenuDto navModel = await _navBuilder.BuildAsync(cancellationToken);
ThemeRenderDocumentDto navDocument = await _themeService.GetRenderDocumentAsync(NAV_PAGE_KEY, themeId, cancellationToken);
Result<ThemePageRenderResultDto> navRenderResult = _templateEngine.RenderPage(navDocument.Template, navModel);
if (navRenderResult.IsSuccess)
return navRenderResult.Value.Content;
try
{
ThemeRenderDocumentDto navDocument = await _themeService.GetRenderDocumentAsync(NAV_PAGE_KEY, themeId, cancellationToken);
Result<ThemePageRenderResultDto> navRenderResult = _templateEngine.RenderPage(navDocument.Template, navModel);
if (navRenderResult.IsSuccess)
return navRenderResult.Value.Content;
}
catch (OperationCanceledException)
{
throw;
}
catch (Exception)
{
// the navigation menu is best effort: when the theme navigation template cannot be loaded or rendered,
// the application navigation menu is rendered instead, keeping the themed shell of the page intact
}
return await _viewRenderer.RenderPartialAsync("_NavMenu", cancellationToken);
}
@@ -1,46 +0,0 @@
#authorization-permissions-container {
display: flex;
margin: auto;
width: 100%;
height: 100%;
flex-direction: column;
flex-wrap: nowrap;
}
#authorization-permissions-permissions-container {
flex-grow: 1;
min-width: 135px;
min-height: 0px;
}
#authorization-permissions-permissions {
border: 1px solid var(--border-color-light-high);
border-top: 1px solid var(--border-color-dark);
border-left: 1px solid var(--border-color-dark);
margin: auto;
padding-left: 5px;
width: 100%;
height: 100%;
display: flex;
flex-direction: row;
flex-wrap: nowrap;
justify-content: left;
align-items: stretch;
}
#authorization-permissions-permissions-scroll {
background-color: #232323;
margin: auto;
width: 100%;
height: 100%;
}
#authorization-permissions-permissions-list {
margin: 1px;
display: flex;
flex-direction: column;
flex-wrap: wrap;
border: 0px solid black;
padding: 0px;
gap: 0px 10px;
}
@@ -1,46 +0,0 @@
#authorization-roles-container {
display: flex;
margin: auto;
width: 100%;
height: 100%;
flex-direction: column;
flex-wrap: nowrap;
}
#authorization-roles-permissions-container {
flex-grow: 1;
min-width: 135px;
min-height: 0px;
}
#authorization-roles-permissions {
border: 1px solid var(--border-color-light-high);
border-top: 1px solid var(--border-color-dark);
border-left: 1px solid var(--border-color-dark);
margin: auto;
padding-left: 5px;
width: 100%;
height: 100%;
display: flex;
flex-direction: row;
flex-wrap: nowrap;
justify-content: left;
align-items: stretch;
}
#authorization-roles-permissions-scroll {
background-color: #232323;
margin: auto;
width: 100%;
height: 100%;
}
#authorization-roles-permissions-list {
margin: 1px;
display: flex;
flex-direction: column;
flex-wrap: wrap;
border: 0px solid black;
padding: 0px;
gap: 0px 10px;
}
@@ -1 +0,0 @@

@@ -1,230 +1,53 @@
@using Lumina.Presentation.Web.Common.Authorization
@using Lumina.Presentation.Web.Common.Enums.Authorization
@using Lumina.Presentation.Web.Common.Services
@using Microsoft.AspNetCore.Mvc.Localization
@*
FALLBACK NAVIGATION MENU - READ BEFORE EDITING
This view is rendered ONLY when the active theme's navigation template
(shared/nav-menu.html) cannot be rendered, for example when the theme is
broken, missing or unavailable. On a healthy site, the navigation menu is
built by ThemeNavBuilder and rendered by the theme's shared/nav-menu.html
template, so changes made in this file do NOT show up on a working site.
To change the menu, edit ThemeNavBuilder. To restyle the menu, edit the
theme. This fallback is intentionally plain, unstyled HTML, so that a
broken theme is obvious to the user while navigation still works.
*@
@using Lumina.Presentation.Web.Common.DTO.Themes
@using Lumina.Presentation.Web.Core.Themes
@using System.Threading
@inject ThemeNavBuilder _navBuilder
@inject IUrlService _urlService
@inject IViewLocalizer _localizer
@inject IAuthorizationService _auth
@{
ThemeNavMenuDto menu = await _navBuilder.BuildAsync(CancellationToken.None);
}
<input type="checkbox" id="hamburger-input" class="burger-shower" />
<label id="hamburger-menu" for="hamburger-input">
<span></span>
<span></span>
<span></span>
<nav id="mobile-menu">
<div id="mobile-menu-content">
<div class="mobile-menu-heading">
Lumina
</div>
<ul>
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Home.INDEX_CULTURED)" class="nav-link"><span>@_localizer["Home"]</span></a></li>
</ul>
<div class="mobile-menu-heading">
@_localizer["Account"]
</div>
<ul>
@if (User?.Identity?.IsAuthenticated == false)
{
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Authentication.LOGIN_VIEW)"><span>@_localizer["Login"]</span></a></li>
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Authentication.LOGIN_VIEW)"><span>@_localizer["RecoverPassword"]</span></a></li>
}
else
{
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Authentication.LOGOUT)"><span>@_localizer["Logout"]</span></a></li>
}
@if (User?.Identity?.IsAuthenticated == true)
{
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Authentication.REGISTER_VIEW)" class="nav-link"><span>@_localizer["Register"]</span></a></li>
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Authentication.CHANGE_PASSWORD_VIEW)" class="nav-link"><span>@_localizer["ChangePassword"]</span></a></li>
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Authentication.PROFILE_VIEW)" class="nav-link"><span>@_localizer["Profile"]</span></a></li>
}
</ul>
@if (User?.Identity?.IsAuthenticated == true)
{
@if (await _auth.IsInRoleAsync("Admin", CancellationToken.None))
{
<div class="mobile-menu-heading">
@_localizer["Administrator"]
</div>
<ul>
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Admin.MANAGE_ROLES)" class="nav-link"><span>@_localizer["ManageRoles"]</span></a></li>
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Admin.MANAGE_PERMISSIONS)" class="nav-link"><span>@_localizer["ManagePermissions"]</span></a></li>
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Plugins.INDEX)" class="nav-link"><span>@_localizer["Plugins"]</span></a></li>
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Admin.MANAGE_THEMES)" class="nav-link"><span>@_localizer["Themes"]</span></a></li>
</ul>
}
<div class="mobile-menu-heading">
@_localizer["Library"]
</div>
<ul>
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.LibraryManagement.INDEX)" class="nav-link"><span>@_localizer["ManageLibraries"]</span></a></li>
@if (await _auth.IsInRoleAsync("Admin", CancellationToken.None) || await _auth.HasPermissionAsync(AuthorizationPermission.CanCreateLibraries, CancellationToken.None))
{
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.LibraryManagement.ADD_LIBRARY)" class="nav-link"><span>@_localizer["AddNewLibrary"]</span></a></li>
}
</ul>
<div class="mobile-menu-heading">
@_localizer["WrittenContent"]
</div>
<ul>
<li><a href="library/written-content-library/books-library/books" class="nav-link"><span>@_localizer["Books"]</span></a></li>
<li><a href="library/written-content/magazines" class="nav-link"><span>@_localizer["Magazines"]</span></a></li>
</ul>
<div class="mobile-menu-heading">
@_localizer["Audio"]
</div>
<ul>
<li><a href="library/audio/music" class="nav-link"><span>@_localizer["Music"]</span></a></li>
<li><a href="library/audio/interviews" class="nav-link"><span>@_localizer["Interviews"]</span></a></li>
</ul>
<div class="mobile-menu-heading">
@_localizer["Video"]
</div>
<ul>
<li><a href="library/video/movies" class="nav-link"><span>@_localizer["Movies"]</span></a></li>
<li><a href="library/video/tvshows" class="nav-link"><span>@_localizer["TvShows"]</span></a></li>
</ul>
}
<div class="mobile-menu-heading">
@_localizer["Language"]
</div>
<ul>
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Language.SET_LANGUAGE)?newCulture=ar-sa&returnUrl=@Uri.EscapeDataString(Context.Request.Path + Context.Request.QueryString)" class="lang-set"><span>العربية</span></a></li><!--AR-->
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Language.SET_LANGUAGE)?newCulture=zh-cn&returnUrl=@Uri.EscapeDataString(Context.Request.Path + Context.Request.QueryString)" class="lang-set"><span>简体中文</span></a></li><!--CN-->
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Language.SET_LANGUAGE)?newCulture=de-de&returnUrl=@Uri.EscapeDataString(Context.Request.Path + Context.Request.QueryString)" class="lang-set"><span>Deutsch</span></a></li><!--DE-->
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Language.SET_LANGUAGE)?newCulture=en-us&returnUrl=@Uri.EscapeDataString(Context.Request.Path + Context.Request.QueryString)" class="lang-set"><span>English</span></a></li><!--EN-->
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Language.SET_LANGUAGE)?newCulture=es-es&returnUrl=@Uri.EscapeDataString(Context.Request.Path + Context.Request.QueryString)" class="lang-set"><span>Español</span></a></li><!--ES-->
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Language.SET_LANGUAGE)?newCulture=fr-fr&returnUrl=@Uri.EscapeDataString(Context.Request.Path + Context.Request.QueryString)" class="lang-set"><span>Français</span></a></li><!--FR-->
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Language.SET_LANGUAGE)?newCulture=it-it&returnUrl=@Uri.EscapeDataString(Context.Request.Path + Context.Request.QueryString)" class="lang-set"><span>Italiano</span></a></li><!--IT-->
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Language.SET_LANGUAGE)?newCulture=ja-jp&returnUrl=@Uri.EscapeDataString(Context.Request.Path + Context.Request.QueryString)" class="lang-set"><span>日本語</span></a></li><!--JP-->
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Language.SET_LANGUAGE)?newCulture=ro-ro&returnUrl=@Uri.EscapeDataString(Context.Request.Path + Context.Request.QueryString)" class="lang-set"><span>Română</span></a></li><!--RO-->
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Language.SET_LANGUAGE)?newCulture=uk-ua&returnUrl=@Uri.EscapeDataString(Context.Request.Path + Context.Request.QueryString)" class="lang-set"><span>Українська</span></a></li><!--UK-->
</ul>
@if (User?.Identity?.IsAuthenticated == true)
{
<div class="mobile-menu-heading">
@_localizer["Tools"]
</div>
<ul>
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Settings.INDEX)" class="nav-link"><span>@_localizer["Settings"]</span></a></li>
</ul>
}
<div class="mobile-menu-heading">
@_localizer["Help"]
</div>
<ul>
<li><a href="help/documentation" class="nav-link"><span>@_localizer["Documentation"]</span></a></li>
<li><a href="help/about" class="nav-link"><span>@_localizer["About"]</span></a></li>
</ul>
</div>
</nav>
</label>
<nav class="menubar">
<nav>
<ul>
<li tabindex="0" class="top-level-menuitem">
<label for="account-menu">Lumina</label>
<ul>
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Home.INDEX_CULTURED)" class="nav-link">@_localizer["Home"]</a></li>
</ul>
</li>
<li tabindex="0" class="top-level-menuitem">
<label for="account-menu">@_localizer["Account"]</label>
<ul>
@if (User?.Identity?.IsAuthenticated == false)
{
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Authentication.LOGIN_VIEW)">@_localizer["Login"]</a></li>
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Authentication.RECOVER_PASSWORD_VIEW)">@_localizer["RecoverPassword"]</a></li>
}
else
{
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Authentication.LOGOUT)">@_localizer["Logout"]</a></li>
}
@if (User?.Identity?.IsAuthenticated == true)
{
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Authentication.REGISTER_VIEW)" class="nav-link">@_localizer["Register"]</a></li>
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Authentication.CHANGE_PASSWORD_VIEW)" class="nav-link">@_localizer["ChangePassword"]</a></li>
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Authentication.PROFILE_VIEW)" class="nav-link">@_localizer["Profile"]</a></li>
}
</ul>
</li>
@if (User?.Identity?.IsAuthenticated == true)
@foreach (ThemeNavSectionDto menuSection in menu.MenubarSections)
{
@if (await _auth.IsInRoleAsync("Admin", CancellationToken.None))
{
<li tabindex="1" class="top-level-menuitem">
<label for="administrator-menu">@_localizer["Administrator"]</label>
<ul>
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Admin.MANAGE_ROLES)" class="nav-link">@_localizer["ManageRoles"]</a></li>
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Admin.MANAGE_PERMISSIONS)" class="nav-link">@_localizer["ManagePermissions"]</a></li>
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Plugins.INDEX)" class="nav-link">@_localizer["Plugins"]</a></li>
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Admin.MANAGE_THEMES)" class="nav-link">@_localizer["Themes"]</a></li>
</ul>
</li>
}
<li tabindex="2" class="top-level-menuitem">
<label for="library-menu">@_localizer["Library"]</label>
<li>
<span>@menuSection.Label</span>
<ul>
<li tabindex="0"><a href="@_urlService.GetAbsoluteUrl(WebRoutes.LibraryManagement.INDEX)" class="nav-link">@_localizer["ManageLibraries"]</a></li>
@if (await _auth.IsInRoleAsync("Admin", CancellationToken.None) || await _auth.HasPermissionAsync(AuthorizationPermission.CanCreateLibraries, CancellationToken.None))
@foreach (ThemeNavEntryDto item in menuSection.Items)
{
<li tabindex="0"><a href="@_urlService.GetAbsoluteUrl(WebRoutes.LibraryManagement.ADD_LIBRARY)" class="nav-link">@_localizer["AddNewLibrary"]</a></li>
<li>
@if (item.Children.Count > 0)
{
<span>@item.Label</span>
<ul>
@foreach (ThemeNavEntryDto child in item.Children)
{
<li><a href="@child.Url">@child.Label</a></li>
}
</ul>
}
else
{
<a href="@item.Url">@item.Label</a>
}
</li>
}
<li class="has-submenu" tabindex="0">
<label>@_localizer["WrittenContent"]</label>
<ul>
<li><a href="library/written-content-library/books-library/books" class="nav-link">@_localizer["Books"]</a></li>
<li><a href="library/written-content/magazines" class="nav-link">@_localizer["Magazines"]</a></li>
</ul>
</li>
<li class="has-submenu" tabindex="0">
<label>@_localizer["Audio"]</label>
<ul>
<li><a href="library/audio/music" class="nav-link">@_localizer["Music"]</a></li>
<li><a href="library/audio/interviews" class="nav-link">@_localizer["Interviews"]</a></li>
</ul>
</li>
<li class="has-submenu" tabindex="0">
<label>@_localizer["Video"]</label>
<ul>
<li><a href="library/video/movies" class="nav-link">@_localizer["Movies"]</a></li>
<li><a href="library/video/tvshows" class="nav-link">@_localizer["TvShows"]</a></li>
</ul>
</li>
</ul>
</li>
}
<li tabindex="3" class="top-level-menuitem">
<label for="tools-menu">@_localizer["Tools"]</label>
<ul>
<li class="has-submenu" tabindex="0">
<label>@_localizer["Language"]</label>
<ul>
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Language.SET_LANGUAGE)?newCulture=ar-sa&returnUrl=@Uri.EscapeDataString(Context.Request.Path + Context.Request.QueryString)" class="lang-set">العربية</a></li><!--AR-->
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Language.SET_LANGUAGE)?newCulture=zh-cn&returnUrl=@Uri.EscapeDataString(Context.Request.Path + Context.Request.QueryString)" class="lang-set">简体中文</a></li><!--CN-->
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Language.SET_LANGUAGE)?newCulture=de-de&returnUrl=@Uri.EscapeDataString(Context.Request.Path + Context.Request.QueryString)" class="lang-set">Deutsch</a></li><!--DE-->
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Language.SET_LANGUAGE)?newCulture=en-us&returnUrl=@Uri.EscapeDataString(Context.Request.Path + Context.Request.QueryString)" class="lang-set">English</a></li><!--EN-->
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Language.SET_LANGUAGE)?newCulture=es-es&returnUrl=@Uri.EscapeDataString(Context.Request.Path + Context.Request.QueryString)" class="lang-set">Español</a></li><!--ES-->
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Language.SET_LANGUAGE)?newCulture=fr-fr&returnUrl=@Uri.EscapeDataString(Context.Request.Path + Context.Request.QueryString)" class="lang-set">Français</a></li><!--FR-->
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Language.SET_LANGUAGE)?newCulture=it-it&returnUrl=@Uri.EscapeDataString(Context.Request.Path + Context.Request.QueryString)" class="lang-set">Italiano</a></li><!--IT-->
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Language.SET_LANGUAGE)?newCulture=ja-jp&returnUrl=@Uri.EscapeDataString(Context.Request.Path + Context.Request.QueryString)" class="lang-set">日本語</a></li><!--JP-->
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Language.SET_LANGUAGE)?newCulture=ro-ro&returnUrl=@Uri.EscapeDataString(Context.Request.Path + Context.Request.QueryString)" class="lang-set">Română</a></li><!--RO-->
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Language.SET_LANGUAGE)?newCulture=uk-ua&returnUrl=@Uri.EscapeDataString(Context.Request.Path + Context.Request.QueryString)" class="lang-set">Українська</a></li><!--UK-->
</ul>
</li>
@if (User?.Identity?.IsAuthenticated == true)
{
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Settings.INDEX)" class="nav-link">@_localizer["Settings"]</a></li>
}
</ul>
</li>
<li tabindex="4" class="top-level-menuitem">
<label for="help-menu">@_localizer["Help"]</label>
<ul>
<li><a href="help/documentation" class="nav-link">@_localizer["Documentation"]</a></li>
<li><a href="help/about" class="nav-link">@_localizer["About"]</a></li>
</ul>
</li>
</ul>
</nav>
@@ -1,12 +1 @@
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
<link rel="stylesheet" href="~/css/button.css" asp-append-version="true" />
<link rel="stylesheet" href="~/css/checkbox.css" asp-append-version="true" />
<link rel="stylesheet" href="~/css/combobox.css" asp-append-version="true" />
<link rel="stylesheet" href="~/css/file-system-browser.css" asp-append-version="true" />
<link rel="stylesheet" href="~/css/file-system-tree-view-node.css" asp-append-version="true" />
<link rel="stylesheet" href="~/css/navigation-menu.css" asp-append-version="true" />
<link rel="stylesheet" href="~/css/notification.css" asp-append-version="true" />
<link rel="stylesheet" href="~/css/dialog.css" asp-append-version="true" />
<link rel="stylesheet" href="~/css/image-viewer.css" asp-append-version="true" />
<link rel="stylesheet" href="~/css/textbox.css" asp-append-version="true" />
<link rel="stylesheet" href="~/Lumina.Presentation.Web.styles.css" asp-append-version="true" />
@@ -1,161 +0,0 @@
.abort-button {
text-decoration: none;
border-radius: 4px;
border: solid 1px;
border-color: #006666 #004030 #003020 #006666;
background: linear-gradient(to bottom, #90AEA6 0%, #336659 50%, #004030 50%, #004030 100%);
color: #999999;
position: relative;
overflow: hidden;
transition: all 0.3s;
cursor: pointer;
outline: none;
box-shadow: 0 4px 4px rgba(0, 0, 0, 0.5);
z-index: 1;
}
.abort-button:before {
content: "";
position: absolute;
bottom: 0;
left: 0;
right: 0;
height: 50%;
background: radial-gradient(circle at center, #00FF00, transparent);
background-size: 120% 100%;
transform: translateY(100%);
background-position: center;
transition: transform 0.3s, opacity 0.8s;
pointer-events: none;
opacity: 0;
filter: blur(8px);
}
.abort-button:hover {
color: #fff;
}
.abort-button:hover:before {
transform: translateY(50%);
opacity: 1;
}
.abort-button:active {
background: #CC009F58;
font-style: italic;
}
.abort-button:disabled {
background: #333333;
border-color: #333333;
color: #777;
cursor: not-allowed;
}
.abort-button:disabled:hover:before {
transform: translateY(100%);
opacity: 0;
}
.abort-button:disabled:active {
font-style: normal;
}
.abort-button[disabled] {
background: #333333;
border-color: #333333;
color: #777;
cursor: not-allowed;
pointer-events: none;
text-decoration: none;
}
.abort-button[disabled]:hover:before {
transform: translateY(100%);
opacity: 0;
}
.abort-button[disabled]:active {
font-style: normal;
}
.confirm-button {
text-decoration: none;
border-radius: 4px;
border: solid 1px;
border-color: #363636 #000 #000 #363636;
background: linear-gradient(to bottom, #AAAAAA 0%, #363636 50%, #000 50%, #000 100%);
color: #AAAAAA;
position: relative;
overflow: hidden;
transition: all 0.3s;
cursor: pointer;
outline: none;
box-shadow: 0 4px 4px rgba(0, 0, 0, 0.5);
z-index: 1;
}
.confirm-button:before {
content: "";
position: absolute;
bottom: 0;
left: 0;
right: 0;
height: 50%;
background: radial-gradient(circle at center, #00FF8B, transparent);
background-size: 120% 100%;
transform: translateY(100%);
background-position: center;
transition: transform 0.3s, opacity 0.8s;
pointer-events: none;
opacity: 0;
filter: blur(8px);
}
.confirm-button:hover {
color: #fff;
}
.confirm-button:hover:before {
transform: translateY(50%);
opacity: 1;
}
.confirm-button:active {
background: #CC000000;
font-style: italic;
}
.confirm-button:disabled {
background: #333333;
border-color: #333333;
color: #777;
cursor: not-allowed;
}
.confirm-button:disabled:hover:before {
transform: translateY(100%);
opacity: 0;
}
.confirm-button:disabled:active {
font-style: normal;
}
confirm-button[disabled] {
background: #333333;
border-color: #333333;
color: #777;
cursor: not-allowed;
pointer-events: none;
text-decoration: none;
}
.confirm-button[disabled]:hover:before {
transform: translateY(100%);
opacity: 0;
}
.confirm-button[disabled]:active {
font-style: normal;
}
@@ -1,36 +0,0 @@
/* Basic styles for the label and the hidden checkbox */
.enlightenment-checkbox-label {
display: flex;
align-items: center;
cursor: pointer;
font-size: 14px;
color: #6DCBFE;
user-select: none;
}
.enlightenment-checkbox-hidden {
display: none;
}
/* Custom checkbox appearance */
.enlightenment-checkbox {
width: 14px;
height: 14px;
border-top: #000000 1px solid;
border-bottom: #333333 1px solid;
border-left: #000000 1px solid;
border-right: #333333 1px solid;
border-radius: 0;
margin-right: 10px;
position: relative;
background: linear-gradient(to bottom, #111, #222 50%, #333);
}
/* Update the custom checkbox appearance when checked */
.enlightenment-checkbox-hidden:checked + .enlightenment-checkbox {
background-image: linear-gradient(180deg, #5E5D5D, #505050, #424343);
border-top: #888888 1px solid;
border-bottom: #333333 1px solid;
border-left: #666666 1px solid;
border-right: #444444 1px solid;
}
@@ -1,171 +0,0 @@
.enlightenment-combobox {
position: relative;
font-family: Arial, sans-serif;
padding: 0;
margin: 0;
box-sizing: border-box;
}
.enlightenment-toggle-checkbox {
display: none;
}
.enlightenment-toggle-checkbox:checked + .enlightenment-toggle + .enlightenment-dropdown {
display: block;
}
.enlightenment-toggle-checkbox:checked + .enlightenment-toggle .enlightenment-arrow {
background-size: 9px 11px;
background-position: 3px -2px;
transform: rotate(90deg);
}
.enlightenment-toggle {
display: flex;
align-items: center;
justify-content: space-between;
cursor: pointer;
font-family: Arial, sans-serif;
font-size: 14px;
border-radius: 3px;
box-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
color: #6DCBFE;
padding: 3px 24px 3px 18px;
width: 100%;
border: none;
outline: none;
appearance: none;
border-top: #989898 1px solid;
border-bottom: #151515 1px solid;
border-left: #878787 1px solid;
border-right: #202020 1px solid;
background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2212%22%20height%3D%225%22%3E%3Cpath%20fill%3D%22none%22%20stroke%3D%22%23fff%22%20stroke-width%3D%222%22%20d%3D%22M2%2C0L6%2C4L10%2C0%22%2F%3E%3C%2Fsvg%3E'), url('../images/ui/scrollbar_dots_v.png'), linear-gradient(180deg, #606060, #555555, #4C4C4C, #414141);
background-repeat: no-repeat, no-repeat, repeat;
background-position: right 10px top 50%, left 7px top 50%, 0 0;
background-size: 12px 6px, 3px auto, 100%;
user-select: none;
box-sizing: border-box;
}
.enlightenment-toggle:hover {
background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2212%22%20height%3D%225%22%3E%3Cpath%20fill%3D%22none%22%20stroke%3D%22%23fff%22%20stroke-width%3D%222%22%20d%3D%22M2%2C0L6%2C4L10%2C0%22%2F%3E%3C%2Fsvg%3E'), url('../images/ui/scrollbar_dots_lit_v.png'), linear-gradient(180deg, #606060, #555555, #4C4C4C, #414141);
background-repeat: no-repeat, no-repeat, repeat;
background-position: right 10px top 50%, left 7px top 50%, 0 0;
background-size: 12px 6px, 3px auto, 100%;
}
.enlightenment-arrow {
display: inline-block;
width: 12px;
height: 9px;
background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%22545%20-32.5%2027.5%2065%22%3E%3Cpath%20fill%3D%22%23FFF%22%20d%3D%22M568.254,-7.43524%20568.159,-7.34277%20567.977,-7.52246%20546.559,-28.9417%20525.484,-28.9417%20549.787,-4.63446%20557.439,3.01532%20557.619,3.19629%20550.067,10.7549%20525.758,35.0583%20546.834,35.0583%20568.254,13.6429%20578.792,3.10254%20568.254,-7.43524z%22%2F%3E%3C%2Fsvg%3E');
background-size: 10px 9px;
background-repeat: no-repeat;
background-position: 3px -0px;
transition: transform 0.3s ease;
}
.enlightenment-toggle-checkbox:checked + .enlightenment-toggle .enlightenment-arrow {
transform: rotate(90deg);
}
.enlightenment-selected-text {
flex: 1;
text-align: right;
}
.enlightenment-dropdown {
display: none;
position: absolute;
top: 100%;
left: 0;
width: 100%;
box-sizing: border-box;
background-image: url('../images/ui/metal-plate.png'), linear-gradient(180deg, #505050, #464646, #404040, #363636);
background-repeat: repeat, no-repeat;
background-position: 3px 3px, 0 0; /* offset the metal-plate image by 3 pixels from the top and left */
background-clip: content-box, border-box; /* clip the metal-plate image to the content box */
border-top: #989898 1px solid;
border-bottom: #151515 1px solid;
border-left: #878787 1px solid;
border-right: #202020 1px solid;
padding: 3px;
z-index: 999;
}
.enlightenment-option {
display: block;
border-left: 1px solid #232323;
border-right: 1px solid #777777;
border-top: 1px solid #232323;
border-bottom: 1px solid #777777;
color: #FFFFFF;
padding: 5px 10px;
width: 100%;
box-sizing: border-box;
user-select: none;
cursor: pointer;
}
.enlightenment-option.first-option {
border-top: 1px solid #232323;
margin-top: -1px;
}
.enlightenment-option.last-option {
border-bottom: 1px solid #777777;
}
.enlightenment-option.disabled {
color: #AAAAAA; /* Gray color */
}
.enlightenment-option:hover {
background-image: none;
background: linear-gradient(to bottom, #505050, #464646, #404040, #363636);
color: #1D8AF9;
box-shadow: inset 1px 0 0 0 #777777, /* left */
inset -1px 0 0 0 #232323, /* right */
inset 0 1px 0 0 #989898, /* top */
inset 0 -1px 0 0 #151515; /* bottom */
}
.enlightenment-combobox > .shine-effect:first-child {
opacity: 0;
transition: opacity 0.5s;
}
.enlightenment-combobox:hover > .shine-effect:first-child {
opacity: 1;
}
.enlightenment-combobox > .shine-effect::before,
.enlightenment-combobox > .shine-effect::after {
content: "";
position: absolute;
top: -1px;
left: 50%;
transform: translateX(-50%);
opacity: 0;
transition: opacity 0.5s;
}
.enlightenment-combobox > .shine-effect::before {
width: 3px;
height: 2px;
border-radius: 5px 5px 0 0;
background-color: #FFFFFF;
}
.enlightenment-combobox > .shine-effect::after {
width: 10px;
height: 3px;
border-radius: 5px 5px 0 0;
background-color: #FFFFFF;
filter: blur(3px);
}
.enlightenment-combobox:hover > .shine-effect::before,
.enlightenment-combobox:hover > .shine-effect::after {
opacity: 1;
}
@@ -1,127 +0,0 @@
.dialog-modal-background {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: #000000;
opacity: 0.6;
z-index: 998;
}
.dialog-container {
display: none;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 999;
width: 400px;
max-width: 90%;
}
.dialog {
background: linear-gradient(135deg, #404040, #232323);
border-radius: 4px;
border-top: 1px solid #505050;
border-left: 1px solid #505050;
border-right: 1px solid #000;
border-bottom: 1px solid #000;
box-shadow: 5px 5px 5px var(--shadow-color);
overflow: hidden;
animation: fadeIn 0.3s ease-out;
position: relative;
}
.dialog-content {
padding: 20px;
display: flex;
flex-direction: column;
}
.dialog-header {
padding-bottom: 15px;
position: relative;
}
.dialog-header h2 {
margin: 0;
color: var(--text-foreground);
font-family: monospace;
font-size: 1.1rem;
}
.dialog-shine-effect {
background: linear-gradient(to right, transparent, #fff, transparent);
width: 100%;
top: -1px;
height: 1px;
position: absolute;
pointer-events: none;
}
.dialog-body {
border-top: 1px solid #000;
border-left: 1px solid #000;
border-right: 1px solid #505050;
border-bottom: 1px solid #505050;
padding: 5px;
color: var(--text-foreground);
font-family: monospace;
display: block;
position: relative;
overflow-y: auto;
padding-left: 34px;
}
.dialog-icon {
position: sticky;
top: 5px;
float: left;
margin-bottom: 5px;
width: 24px;
height: 24px;
margin-left: -29px;
}
.dialog-icon.info {
background-image: url('../images/ui/information.svg');
}
.dialog-icon.warning {
background-image: url('../images/ui/warning.svg');
}
.dialog-icon.error {
background-image: url('../images/ui/error.svg');
}
.dialog-icon.question {
background-image: url('../images/ui/question.svg');
}
.dialog-message {
overflow-wrap: break-word;
word-break: break-word;
white-space: pre-wrap;
}
.dialog-buttons {
display: flex;
justify-content: flex-end;
padding-top: 15px;
gap: 10px;
}
.dialog-button {
padding: 2px 16px;
font-weight: 500;
}
@keyframes dialogAppear {
to {
opacity: 1;
transform: translateY(0);
}
}
File diff suppressed because it is too large. Load diff
@@ -1,78 +0,0 @@
.tree-node {
padding: 2px 0;
}
.node-content {
display: flex;
align-items: flex-start;
cursor: pointer;
padding: 0px;
border-radius: 2px;
border: 1px solid transparent;
flex-wrap: wrap;
min-width: 100%;
display: inline-block;
white-space: nowrap;
}
.node-content:hover {
background-color: #131313;
border-top: 1px solid var(--border-color-light);
border-left: 1px solid var(--border-color-light);
border-right: 1px solid var(--border-color-dark);
background-color: var(--container-background);
}
.node-content.selected {
background-color: #131313;
border-bottom: 1px solid var(--border-color-light);
border-right: 1px solid var(--border-color-light);
border-left: 1px solid var(--border-color-dark);
background-color: var(--container-background);
}
.node-icon {
margin-right: 5px;
width: 16px;
text-align: center;
flex-shrink: 0;
}
.node-icon, .expand-button {
flex-shrink: 0;
align-self: center;
}
.child-nodes {
padding-left: 20px;
border-left: 1px dotted #ccc;
margin-left: 7px;
}
.expand-button {
display: inline-flex;
width: 10px;
height: 10px;
margin-right: 5px;
background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='%231E90FF' d='M6 4l4 4-4 4z'/></svg>");
background-size: contain;
transition: transform 0.2s ease;
}
.expand-button.expanded {
background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='%23f00' d='M6 4l4 4-4 4z'/></svg>");
transform: rotate(90deg);
}
.spacer {
display: inline-block;
width: 15px;
}
.node-name {
margin-left: 3px;
overflow-wrap: break-word;
word-break: break-all;
flex: 1;
align-self: end;
}
@@ -1,146 +0,0 @@
.image-viewer-overlay {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1001;
background-color: rgba(0, 0, 0, 0.85);
align-items: center;
justify-content: center;
}
.image-viewer-overlay.open {
display: flex;
animation: fadeIn 0.3s ease-out;
}
.image-viewer-stage {
position: relative;
display: flex;
flex-direction: column;
align-items: center;
max-width: 92%;
max-height: 92%;
}
.image-viewer-image {
max-width: 100%;
max-height: 88vh;
object-fit: contain;
opacity: 0;
border: 1px solid #505050;
background-color: #000;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.6);
}
.image-viewer-image.loaded {
opacity: 1;
transition: opacity 0.2s ease-out;
}
.image-viewer-caption {
margin-top: 12px;
color: var(--text-foreground);
font-family: monospace;
font-size: 0.95rem;
text-align: center;
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}
.image-viewer-spinner {
position: absolute;
top: 50%;
left: 50%;
width: 40px;
height: 40px;
margin: -20px 0 0 -20px;
border: 4px solid rgba(255, 255, 255, 0.25);
border-top-color: #fff;
border-radius: 50%;
animation: image-viewer-spin 0.8s linear infinite;
}
@keyframes image-viewer-spin {
to {
transform: rotate(360deg);
}
}
.image-viewer-button {
position: absolute;
width: 44px;
height: 44px;
border: 1px solid #505050;
border-radius: 50%;
background-color: rgba(0, 0, 0, 0.5);
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
}
.image-viewer-button:hover {
border-color: var(--text-foreground);
background-color: rgba(0, 0, 0, 0.75);
}
.image-viewer-button:disabled {
opacity: 0.35;
cursor: default;
}
.image-viewer-close {
top: 18px;
right: 18px;
}
.image-viewer-close::before,
.image-viewer-close::after {
content: '';
position: absolute;
width: 20px;
height: 2px;
background-color: var(--text-foreground);
}
.image-viewer-close::before {
transform: rotate(45deg);
}
.image-viewer-close::after {
transform: rotate(-45deg);
}
.image-viewer-prev {
left: 18px;
top: 50%;
transform: translateY(-50%);
}
.image-viewer-prev::before {
content: '';
width: 12px;
height: 12px;
margin-left: 5px;
border-left: 3px solid var(--text-foreground);
border-bottom: 3px solid var(--text-foreground);
transform: rotate(45deg);
}
.image-viewer-next {
right: 18px;
top: 50%;
transform: translateY(-50%);
}
.image-viewer-next::before {
content: '';
width: 12px;
height: 12px;
margin-right: 5px;
border-right: 3px solid var(--text-foreground);
border-top: 3px solid var(--text-foreground);
transform: rotate(45deg);
}
@@ -1,356 +0,0 @@
.overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0;
visibility: hidden;
transition: opacity 0.50s, visibility 0.50s, height 0.50s;
-webkit-transition: opacity 0.50s, visibility 0.50s, height 0.50s;
overflow: hidden;
background: black;
z-index: -1;
}
#hamburger-input {
display: none;
}
#hamburger-menu {
cursor: pointer;
position: fixed;
border-radius: 4px;
border: 1px solid #777777;
border-bottom-color: #000000;
border-right-color: #000000;
top: 10px;
left: 10px;
width: 46px;
height: 46px;
display: none;
z-index: 999;
padding: 5px 0;
margin: 0px;
font-family: 'Cabin', Sans-serif;
background: linear-gradient(to top, #424343 0%, #505050 50%, #5E5D5D 100%);
}
#hamburger-menu > span {
display: block;
width: 30px;
height: 4px;
margin: 6px auto;
background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.4));
border-radius: 2px;
box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.2), 0 1px 0 rgba(255, 255, 255, 0.2);
}
#hamburger-menu:hover {
background: linear-gradient(to top, #505050 0%, #5E5D5D 50%, #6A6969 100%);
}
#hamburger-menu:hover > span {
background: linear-gradient(to bottom, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.5));
box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.3), 0 1px 0 rgba(255, 255, 255, 0.3);
}
#hamburger-menu #mobile-menu {
visibility: hidden;
position: fixed;
margin: 0px;
top: 0;
left: -100%;
width: 100%;
border: 1px solid #777777;
border-bottom-color: #000000;
border-right-color: #000000;
overflow: auto;
color: #6DCBFE;
text-align: center;
background: #4F4F4F;
transition: 0.50s;
-webkit-transition: 0.50s;
padding: 0px 10px;
box-sizing: border-box;
}
#mobile-menu-content {
border: 1px solid #777777;
border-top-color: #000000;
border-left-color: #000000;
margin-top: 4px;
margin-left: -6px;
margin-right: -5px;
margin-bottom: 3px;
color: #6DCBFE;
text-align: center;
font-size: 18px;
font-family: 'Trebuchet MS', 'Lucida Grande', Verdana, Arial, Sans-Serif;
font-weight: bold;
text-shadow: 0px 0px 2px rgba(0,0,0,1);
/*background: #000 url(../images/metal-plate.png);*/
}
.mobile-menu-heading {
height: 35px;
font-size: 28px;
background: rgb(10, 11, 11);
border: 1px solid #777777;
border-bottom-color: #000000;
border-right-color: #000000;
width: 100%;
background-image: linear-gradient(180deg, #505050, #464646, #404040, #363636);
}
#hamburger-menu ul {
margin-left: 0px;
margin-top: 0px;
margin-bottom: 0px;
padding: 0px;
width: 100%;
}
#hamburger-menu li {
width: 100%;
list-style-type: none;
line-height: 2rem;
display: flex;
font-weight: normal;
font-size: 10px;
text-shadow: none;
text-align: left;
border: 1px solid #333333;
border-bottom-color: #000000;
border-right-color: #000000;
}
#hamburger-menu li:nth-child(even) {
background-color: #191E21;
}
#hamburger-menu li:nth-child(odd) {
background-color: #28292B;
}
#hamburger-menu a {
padding-left: 5px;
width: 100%;
color: #6DCBFE;
font-weight: normal;
font-size: 18px;
font-family: 'Arial';
text-decoration: none;
display: inline-block;
margin-left: 0.3em;
}
#hamburger-menu a:focus,
#hamburger-menu a:active {
color: #7CACF8;
}
#hamburger-menu a:hover {
color: #FFFFFF;
background: rgb(10, 11, 11);
background-image: linear-gradient(180deg, #505050, #464646, #404040, #363636);
}
#hamburger-input:checked + #hamburger-menu {
background: linear-gradient(to bottom, #424343 0%, #505050 50%, #5E5D5D 100%);
border: 1px solid #777777;
border-top: 1px solid #000000;
border-left: 1px solid #000000;
}
#hamburger-input:checked + #hamburger-menu #mobile-menu {
visibility: visible;
left: 0;
top: 71px;
}
#hamburger-input:checked + #hamburger-menu {
z-index: 2;
}
#hamburger-input:checked ~ .overlay {
visibility: visible;
opacity: 0.5;
z-index: 1;
}
.menubar {
background: linear-gradient( to bottom, #505050 0%, #464646 35%, #404040 55%, #363636 100% );
padding: 0;
position: fixed;
top: 0px;
left: 0px;
max-height: 22px;
width: 100%;
z-index: 900;
}
.menubar li.open > ul {
display: block; /* show submenu when parent has 'open' class */
}
.menubar ul {
list-style-type: none;
margin: 0;
padding: 0;
}
.menubar > ul > li {
display: inline-block;
position: relative;
}
.menubar label,
.menubar a {
display: block;
padding: 2px 10px;
text-decoration: none;
cursor: default;
color: #6DCBFE;
position: relative;
user-select: none;
border: 1px solid transparent;
}
.menubar > ul > li > label:hover,
.menubar > ul > li > a:hover {
background: linear-gradient( to bottom, #505050 0%, #464646 35%, #404040 55%, #363636 100% );
border-left: 1px solid #777777;
border-right: 1px solid #000000;
border-top: 1px solid #505050;
border-bottom: 1px solid #222222;
color: #FFFFFF;
}
.menubar input[type="checkbox"] {
display: none;
}
.menubar ul ul {
display: none;
position: absolute;
top: 100%;
left: 0;
min-width: 150px;
background: #4F4F4F;
border: 1px solid #777777;
border-bottom-color: #000000;
border-right-color: #000000;
padding-top: 4px;
padding-left: 4px;
padding-bottom: 4px;
padding-right: 4px;
}
.menubar ul ul li {
background: #232323;
border-left: 1px solid #000000;
border-right: 1px solid #777777;
position: relative;
}
/* show submenus on hover */
.menubar ul ul li.open > ul {
display: block;
}
.menubar ul ul li:first-child {
border-top: 1px solid #000000;
}
.menubar ul ul li:last-child {
border-bottom: 1px solid #777777;
}
.menubar ul ul li > label:hover,
.menubar ul ul li > a:hover {
background: linear-gradient( to bottom, #505050 0%, #464646 35%, #404040 55%, #363636 100% );
border: 1px solid #777777;
border-right-color: #000000;
border-bottom-color: #000000;
color: #FFFFFF;
}
.menubar ul ul ul {
left: 100%;
top: 0;
}
.menubar > ul > li.hovered > label,
.menubar > ul > li.hovered > a {
background-color: #28292B;
background: radial-gradient( 115% 115% at 68% 70%, #30303088 0%, #20202044 50%, #101010 100% );
border: 1px solid #777777;
border-top: 1px solid #000000;
border-left: 1px solid #000000;
color: #FFFFFF;
}
.menubar .has-submenu > label::after,
.menubar .has-submenu > a::after {
content: " ▶";
font-size: 0.6em;
position: absolute;
right: 5px;
top: 50%;
transform: translateY(-50%);
transition: transform 0.3s ease;
}
.menubar .has-submenu:focus-within > label,
.menubar .has-submenu:focus-within,
.menubar .has-submenu:hover > label,
.menubar .has-submenu:hover > a {
background: linear-gradient( to bottom, #505050 0%, #464646 35%, #404040 55%, #363636 100% );
border: 1px solid #777777;
border-right-color: #000000;
border-bottom-color: #000000;
}
.menubar .has-submenu:focus-within > label::after,
.menubar .has-submenu:focus-within > a::after,
.menubar .has-submenu:hover > label::after,
.menubar .has-submenu:hover > a::after {
content: " ▼";
color: #FF0000;
transform: translateY(-50%) rotate(0deg);
}
.menubar .has-submenu:focus-within > label,
.menubar .has-submenu:focus-within > a,
.menubar .has-submenu:hover > label,
.menubar .has-submenu:hover > a {
color: #7CACF8;
}
/* For phones */
@media only screen and (max-width: 768px) {
.menubar {
visibility: hidden;
max-height: 0px;
}
#hamburger-menu {
display: block;
}
#mobile-menu {
height: calc(100% - 70px);
}
}
/* For desktop: */
@media only screen and (min-width: 768px) {
.menubar {
visibility: visible;
}
.overlay {
visibility: hidden !important;
}
}
@@ -1,106 +0,0 @@
.notification-container {
position: fixed;
bottom: 10px;
left: 20px;
z-index: 1000;
width: 300px;
max-height: calc(100vh - 40px); /* full viewport height minus 40px */
overflow-y: auto; /* add vertical scrollbar if content exceeds max-height */
}
.notification {
border-radius: 4px;
margin-bottom: 10px;
margin-right: 10px;
display: flex;
flex-direction: row; /* stack content horizontally */
align-items: flex-start; /* align items to the top */
background: linear-gradient(135deg, #404040, #232323) !important;
border-top: 1px solid #505050 !important;
border-left: 1px solid #505050 !important;
border-right: 1px solid #000 !important;
border-bottom: 1px solid #000 !important;
box-shadow: 5px 5px 5px var(--shadow-color);
animation: fadeIn 0.3s, fadeOut 0.3s 9.7s; /* animation for notifications fade out effect */
flex-direction: column;
flex-wrap: nowrap;
align-items: stretch;
justify-content: flex-start;
position: relative;
}
.notification-body {
padding: 15px;
display: flex;
flex-direction: row; /* stack content horizontally */
align-items: flex-start; /* align items to the top */
word-wrap: break-word; /* allow long words to break and wrap */
overflow-wrap: break-word; /* modern browsers */
word-break: break-word; /* for very long words or URLs */
}
.notification-message {
flex-grow: 1; /* allow message to take up available space */
margin-right: 3px; /* add some space between message and close button */
overflow-wrap: break-word; /* modern browsers */
word-break: break-word; /* for very long words or URLs */
hyphens: auto; /* enable automatic hyphenation */
white-space: pre-wrap; /* preserve line breaks */
font-family: monospace;
}
.close-button {
background: none;
color: var(--text-foreground);
border: none;
font-size: 20px;
cursor: pointer;
padding: 0;
line-height: 1;
flex-shrink: 0; /* prevent button from shrinking */
}
.notification-shine-effect {
background: linear-gradient(to right, transparent, #fff, transparent);
width: 100%;
top: -1px;
height: 1px;
flex-shrink: 0;
pointer-events: none; /* ensure it doesn't interfere with interactions */
}
.info {
color: #2196F3;
}
.success {
color: #4CAF50;
}
.warning {
color: #FFC107;
}
.error {
color: #F44336;
}
@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes fadeOut {
from {
opacity: 1;
}
to {
opacity: 0;
}
}
@@ -1,213 +1,11 @@
:root {
--background-color: #222;
--container-background: #232323;
--border-color-light: #363636;
--border-color-light-medium: #555555;
--border-color-light-high: #777777;
--border-color-dark: #000000;
--border-color-dialog: #1E90FF;
--shadow-color: #000000;
--highlight-color: #383838AA;
--text-foreground: #6DCBFE;
--light-row-background: #28292B;
--dark-row-background: #191E21;
}
html,
body {
margin: 0px;
padding: 0px;
min-height: 100%;
height: 100%;
font-family: 'Arial';
}
body {
font-size: 14px;
background-color: var(--background-color);
color: #6DCBFE;
margin: 0px;
}
* {
box-sizing: border-box;
}
#app {
margin: auto;
min-width: 399px;
min-height: 100vh;
height: 100vh;
background-color: var(--background-color);
}
#page {
border-style: solid;
border-width: 1px;
border-color: var(--border-color-light-high) var(--border-color-dark) var(--border-color-dark) var(--border-color-light-high);
background-color: #222;
min-width: 100%;
min-height: 100%;
height: 100%;
position: relative;
display: flex;
flex-direction: column;
}
main {
position: fixed;
top: 20px;
bottom: 50px;
width: 100%;
overflow-y: auto;
transition: bottom 1s ease, height 1s ease;
}
main.audio-player-not-shown {
bottom: 0;
}
main.audio-player-full-height {
bottom: calc(100% - 22px); /* full height minus menu height */
}
.cotton-candy {
min-height: 100%;
background-image: radial-gradient(ellipse at 10% 90%, #3c2d83 0%, transparent 55%), radial-gradient(ellipse at 90% 90%, #c33c65 0%, transparent 55%), radial-gradient(ellipse at 90% 10%, #4a74dc 0%, transparent 55%), radial-gradient(ellipse at 10% 10%, #35244f 0%, transparent 55%);
}
.audio-player-container {
position: fixed;
bottom: 0;
width: 100%;
height: 50px;
transition: height 1s ease;
}
.audio-player-container.not-shown {
height: 0px;
}
.audio-player-container.full-height {
height: calc(100% - 22px); /* full height minus menu height */
}
#modal-background-menu {
display: none;
z-index: 998;
position: absolute;
top: 0px;
left: 0px;
min-width: 100%;
min-height: 22px;
background-color: #000000;
opacity: 0.6;
}
#modal-background-article {
display: none;
z-index: 998;
position: fixed;
top: 0px;
left: 0px;
min-width: 100%;
min-height: 100%;
background-color: #000000;
opacity: 0.6;
}
.above-modal {
z-index: 999;
}
.shine-effect {
position: relative;
top: -11px;
left: 0;
right: 0;
height: 1px;
background: linear-gradient(to right, transparent, #fff, transparent);
z-index: 1;
}
.shadow-effect {
box-shadow: 3px 3px 5px 0 rgba(0, 0, 0, 0.5);
}
.enlightenment-panel {
border-radius: 5px;
background: linear-gradient(135deg, #404040, var(--container-background));
border-top: 1px solid #505050;
border-left: 1px solid #505050;
border-right: 1px solid #000;
border-bottom: 1px solid #000;
padding: 10px;
}
.container-background {
background-color: var(--container-background);
}
.panel {
background-color: #00000033;
border-radius: 5px;
padding: 10px;
}
.media-panel {
border-radius: 5px;
background-color: #00000033;
width: 300px;
height: 200px;
display: flex;
flex-direction: column;
gap: 0.2rem;
cursor: pointer;
user-select: none;
}
.media-panel:hover {
background-color: #00000066;
}
.media-panel img {
width: 100%;
flex-grow: 1;
}
.media-panel span {
height: 26px;
display: flex;
align-items: center;
justify-content: center;
}
#audio-player-full-height-toggle, #audio-player-close {
cursor: pointer;
}
.text-light-one {
color: #6DCBFE;
}
.text-light-two {
color: #FFFFFF;
}
.text-light-three {
color: #FFD764;
}
.text-disabled {
color: #777777;
}
.invalid-feedback {
margin-top: 0.25rem;
font-size: 0.875em;
color: #FF0000;
}
.transparent {
background-color: transparent !important;
}
@@ -219,163 +17,6 @@ main {
.no-underline {
text-decoration: none !important;
}
.cards-container {
display: flex;
flex-wrap: wrap;
flex-direction: row;
gap: 0.5rem;
}
.form-container {
display: flex;
flex-direction: column;
gap: 0.2rem;
}
.form-row {
display: flex;
flex-wrap: wrap;
justify-content: flex-end;
align-items: center;
gap: 0.5rem;
}
.form-row-align-start {
display: flex;
flex-wrap: wrap;
justify-content: flex-start;
align-items: center;
gap: 0.5rem;
}
.form-label {
flex: 2 0 27%;
min-width: 200px;
display: flex;
align-items: center;
}
.form-field {
flex: 0 0 70%;
min-width: 0;
}
.form-field input[type="text"],
.form-field input[type="number"],
.form-field input[type="date"],
.form-field input[type="datetime"],
.form-field input[type="datetime-local"],
.form-field textarea,
.form-field input[type="password"] {
width: 100%;
}
.form-table {
max-height: 150px;
overflow-y: auto;
}
.form-table > div:nth-child(even) {
background-color: var(--dark-row-background);
}
.form-table > div:nth-child(odd) {
background-color: var(--light-row-background);
}
.form-description {
margin-left: 25px;
}
.invalid-feedback {
flex: 0 0 100%;
}
.mandatory-field {
color: red;
}
.engraved-title {
margin: 0px;
font-size: 3rem;
background-color: var(--shadow-color);
background-clip: text;
-webkit-background-clip: text;
color: transparent;
text-shadow: var(--highlight-color) 2px 2px 2px;
}
.inset-panel {
border-top: #000 1px solid;
border-left: #000 1px solid;
border-right: #777 1px solid;
border-bottom: #999 1px solid;
}
.engraved-panel {
background-color: #00000033;
border-radius: 5px;
min-height: 70px;
padding: 10px;
-webkit-box-shadow: 0 0 7px 0px var(--shadow-color) inset;
-moz-box-shadow: 0 0 7px 0px var(--shadow-color) inset;
box-shadow: 0 0 7px 0px var(--shadow-color) inset;
flex: 0 0 70%;
}
.form-table-row {
padding: 3px 8px;
gap: 8px;
width: 100%;
display: flex;
align-items: center;
border-top: 1px solid var(--border-color-light);
border-left: 1px solid var(--border-color-light);
border-bottom: 1px solid var(--border-color-dark);
border-right: 1px solid var(--border-color-dark);
}
.form-table-row span {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
flex: 1;
min-width: 0;
}
.remove-form-table-row-icon {
width: 15px;
flex-shrink: 0;
cursor: pointer;
}
.add-form-table-row-icon {
width: 15px;
cursor: pointer;
}
table {
border-spacing: 0px;
width: 100%;
}
th, td {
border-top: 1px solid var(--border-color-light);
border-left: 1px solid var(--border-color-light);
border-bottom: 1px solid var(--border-color-dark);
border-right: 1px solid var(--border-color-dark);
padding: 3px 8px;
}
tr:nth-child(even) {
background-color: var(--dark-row-background);
}
tr:nth-child(odd) {
background-color: var(--light-row-background);
}
/* Margins */
.mt-0 {
margin-top: 0px;
@@ -552,7 +193,6 @@ th, td {
.ml-10 {
margin-left: 10px;
}
/* Paddings */
.pt-0 {
padding-top: 0px;
@@ -729,7 +369,6 @@ th, td {
.pl-10 {
padding-left: 10px;
}
/* Widths (1 to 10, then 5 by 5 until 100) */
.w-0px {
width: 0px;
@@ -1252,7 +891,6 @@ th, td {
.w-100 {
width: 100%;
}
/* Heights (1 to 10, then 5 by 5 until 100) */
.h-1 {
height: 1%;
@@ -1365,7 +1003,6 @@ th, td {
.h-100 {
height: 100%;
}
.f-8 {
font-size: 8px !important;
}
@@ -1409,7 +1046,6 @@ th, td {
.f-24 {
font-size: 24px !important;
}
.bold {
font-weight: bold;
}
@@ -1433,7 +1069,6 @@ th, td {
.inline-block {
display: inline-block !important;
}
.mx-auto {
margin-left: auto;
margin-right: auto;
@@ -1487,37 +1122,3 @@ th, td {
.h-align-r {
margin-left: auto !important;
}
.alpha-picker {
display: flex;
flex-direction: column;
gap: 0.1rem;
overflow-y: auto;
}
.alpha-key {
padding: 0 0.6rem;
cursor: pointer;
text-align: center;
user-select: none;
}
.alpha-key:hover,
.alpha-key.alpha-key-active {
background-color: #00000066;
}
/* For phones */
@media only screen and (max-width: 768px) {
main {
top: 0px;
}
#app {
max-width: 100%;
width: 99.5%;
}
}
/* For desktop: */
@media only screen and (min-width: 768px) {
}
@@ -1,56 +0,0 @@
.enlightenment-input {
font-size: 14px;
padding: 5px;
border: 1px solid;
border-color: var(--border-color-dark) var(--border-color-light) var(--border-color-light) var(--border-color-dark);
border-radius: 3px;
background: linear-gradient(0deg, #90c247, #509c00);
transition: background 0.3s, color 0.3s;
color: #000;
outline: none;
position: relative;
box-sizing: border-box;
}
.enlightenment-input:hover {
background: var(--window-button-over-color);
}
.enlightenment-input:not(:focus) {
background: linear-gradient(0deg, #6b7579, #576b65);
color: #000;
}
.enlightenment-input:focus {
font-style: italic;
color: #333;
background: linear-gradient(0deg, #6AAFF8, #82E9F7);
box-shadow: inset 4px 6px 8px rgba(0,0,0,0.6);
border-color: var(--border-color-dark) var(--border-color-light) var(--border-color-light) var(--border-color-dark);
outline: none;
}
.enlightenment-input::placeholder {
color: #999;
}
.enlightenment-input:disabled {
color: #999;
background: var(--container-background);
}
.enlightenment-input[readonly] {
color: #999;
background: var(--container-background);
border-color: var(--border-color-light) var(--border-color-dark) var(--border-color-dark) var(--border-color-light);
}
.enlightenment-input[data-has-error="true"] {
border-color: #f00;
color: #FFF;
background: #700;
}
textarea {
resize: vertical;
}
@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
<svg width="24px" height="24px" viewBox="0 0 512 512" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>error-filled</title>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="add" fill="#D41919" transform="translate(42.666667, 42.666667)">
<path d="M213.333333,3.55271368e-14 C331.136,3.55271368e-14 426.666667,95.5306667 426.666667,213.333333 C426.666667,331.136 331.136,426.666667 213.333333,426.666667 C95.5306667,426.666667 3.55271368e-14,331.136 3.55271368e-14,213.333333 C3.55271368e-14,95.5306667 95.5306667,3.55271368e-14 213.333333,3.55271368e-14 Z M262.250667,134.250667 L213.333333,183.168 L164.416,134.250667 L134.250667,164.416 L183.168,213.333333 L134.250667,262.250667 L164.416,292.416 L213.333333,243.498667 L262.250667,292.416 L292.416,262.250667 L243.498667,213.333333 L292.416,164.416 L262.250667,134.250667 Z" id="Combined-Shape">
</path>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

@@ -1,2 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
<svg width="24px" height="24px" viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--emojione-monotone" preserveAspectRatio="xMidYMid meet"><path d="M32 2C15.432 2 2 15.432 2 32s13.432 30 30 30s30-13.432 30-30S48.568 2 32 2m5 49.75H27v-24h10v24m-5-29.5a5 5 0 1 1 0-10a5 5 0 0 1 0 10" fill="#22B14C"></path></svg>

Before

Width:  |  Height:  |  Size: 530 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
<svg width="24px" height="24px" viewBox="0 0 512 512" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>question-filled</title>
<g id="Page-1" stroke="none" stroke-width="1" fill="red" fill-rule="evenodd">
<g id="add" fill="#3F48CC" transform="translate(42.666667, 42.666667)">
<path d="M213.333333,3.55271368e-14 C331.153707,3.55271368e-14 426.666667,95.51168 426.666667,213.333333 C426.666667,331.153707 331.153707,426.666667 213.333333,426.666667 C95.51296,426.666667 3.55271368e-14,331.153707 3.55271368e-14,213.333333 C3.55271368e-14,95.51168 95.51296,3.55271368e-14 213.333333,3.55271368e-14 Z M213.332053,282.666667 C198.60416,282.666667 186.665387,294.60544 186.665387,309.333333 C186.665387,324.061227 198.60416,336 213.332053,336 C228.059947,336 239.99872,324.061227 239.99872,309.333333 C239.99872,294.60544 228.059947,282.666667 213.332053,282.666667 Z M209.77344,93.3346133 C189.007787,93.3346133 171.554773,98.9922133 157.43488,110.274773 C140.703147,123.790507 132.34368,143.751253 132.34368,170.173227 L132.34368,170.173227 L177.7056,170.173227 L177.7056,169.868587 C177.7056,159.787733 179.829333,151.518293 184.065067,145.069013 C189.911467,136.398507 199.39328,132.059947 212.501333,132.059947 C220.56768,132.059947 227.4336,134.177067 233.070293,138.404907 C240.125013,144.26304 243.664,153.13024 243.664,165.028693 C243.664,172.49216 241.839787,179.143253 238.214827,184.994773 C235.188693,190.2368 230.350293,195.374933 223.686187,200.42048 C209.571627,210.098773 200.394453,219.679573 196.165333,229.162667 C192.53504,237.027413 190.710827,249.530027 190.710827,266.666667 L190.710827,266.666667 L233.376213,266.666667 C233.376213,255.371093 234.87744,246.90624 237.916587,241.257813 C240.331947,236.618667 245.378987,231.682347 253.042987,226.434987 C266.358187,216.549547 275.828267,207.371093 281.479253,198.90112 C288.33216,188.82176 291.76704,177.01952 291.76704,163.504 C291.76704,135.494827 280.37504,115.62624 257.571627,103.9232 C243.865813,96.86848 227.933653,93.3346133 209.77344,93.3346133 Z" id="Combined-Shape">
</path>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

@@ -13,7 +13,6 @@
const fileSystemBrowserTreeview = document.getElementById('file-system-browser-treeview');
const pathSegmentsContainer = document.getElementById('navigator-path-segments');
const article = document.querySelector('article');
const menubar = document.getElementsByClassName('menubar')[0];
const fileSystemTreeViewContainer = document.getElementById('file-system-browser-file-system-treeview-container');
const fileSystemExplorerContainer = document.getElementById('file-system-browser-file-system-explorer-container');
@@ -1075,6 +1074,14 @@
//| Selection |
//+======================================================================================+
/**
* Gets the height of the fixed top bar of the active theme, declared by the theme script, used to translate
* page coordinates into the content coordinate space of the file system browser.
*/
function getThemeTopOffset() {
return parseInt(window.getComputedStyle(document.documentElement).getPropertyValue('--theme-top-offset')) || 0;
}
/**
* Handler for the file system browser dialog selection start.
* @param {MouseEvent} e - The mousedown event object.
@@ -1092,16 +1099,16 @@
document.body.style.overflowY = 'hidden'; // needed in order to not put a vertical scrollbar on the document, while in vertical layout selection
document.documentElement.style.overflowY = 'hidden';
selectionStartPosition.x = e.pageX + fileSystemExplorer.scrollLeft;
selectionStartPosition.y = (e.pageY - parseInt(window.getComputedStyle(menubar).height)) + fileSystemExplorerContainer.scrollTop; // not a mistake - in vertical mode, this is the overflow container!
selectionStartPosition.y = (e.pageY - getThemeTopOffset()) + fileSystemExplorerContainer.scrollTop; // not a mistake - in vertical mode, this is the overflow container!
// place the selection rectangle at the clicked location (relative to the whole page, and taking into account scroll offset), with 0 size
visibleSelectionRectangle.style.left = e.pageX + 'px';
visibleSelectionRectangle.style.top = (e.pageY - parseInt(window.getComputedStyle(menubar).height)) + 'px';
visibleSelectionRectangle.style.top = (e.pageY - getThemeTopOffset()) + 'px';
visibleSelectionRectangle.style.width = '0px';
visibleSelectionRectangle.style.height = '0px';
visibleSelectionRectangle.style.visibility = 'visible';
selectionRectangle.style.left = e.pageX + 'px';
selectionRectangle.style.top = (e.pageY - parseInt(window.getComputedStyle(menubar).height)) + 'px';
selectionRectangle.style.top = (e.pageY - getThemeTopOffset()) + 'px';
selectionRectangle.style.width = '0px';
selectionRectangle.style.height = '0px';
}
@@ -1114,7 +1121,7 @@
if (!isSelecting)
return;
currentMousePosition.x = e.pageX;
currentMousePosition.y = e.pageY - parseInt(window.getComputedStyle(menubar).height);
currentMousePosition.y = e.pageY - getThemeTopOffset();
handleSelection();
}
@@ -1205,10 +1212,10 @@
if (right > containerRect.right)
visibleSelectionRectangle.style.width = (containerRect.right - left) + 'px';
if (top < containerRect.top - parseInt(window.getComputedStyle(menubar).height)) {
const difference = containerRect.top - top - parseInt(window.getComputedStyle(menubar).height);
if (top < containerRect.top - getThemeTopOffset()) {
const difference = containerRect.top - top - getThemeTopOffset();
visibleSelectionRectangle.style.height = (parseFloat(visibleSelectionRectangle.style.height) - difference) + 'px';
visibleSelectionRectangle.style.top = (containerRect.top - parseInt(window.getComputedStyle(menubar).height)) + 'px';
visibleSelectionRectangle.style.top = (containerRect.top - getThemeTopOffset()) + 'px';
}
if (bottom > containerRect.bottom)
visibleSelectionRectangle.style.height = (containerRect.bottom - top) + 'px';
@@ -440,109 +440,6 @@ function updateLanguageUrls() {
});
}
//+======================================================================================+
//| Website menu |
//+======================================================================================+
/**
* Handles the navigation through the website desktop menu bar
*/
function handleWebsiteDesktopMenu() {
const menuBar = document.querySelector('.menubar');
const topLevelItems = menuBar.querySelectorAll('.menubar > ul > li');
const hasSubmenuItems = menuBar.querySelectorAll('.has-submenu');
const submenuNavigationItems = menuBar.querySelectorAll('li:not(.has-submenu):not(.top-level-menuitem)');
function closeAllDropdowns() { // close all top level or submenu dropdowns
topLevelItems.forEach(item => {
item.classList.remove('open');
item.classList.remove('hovered');
});
hasSubmenuItems.forEach(submenu => {
submenu.classList.remove('open');
});
}
// handle clicks on top-level menu items
topLevelItems.forEach(item => {
const labelOrAnchor = item.querySelector('label, a');
labelOrAnchor.addEventListener('click', function (event) {
event.stopPropagation();
// close all menu drop down
const isOpen = item.classList.contains('open');
closeAllDropdowns();
// if the item was not already opened, toggle it (mark it as opened)
if (!isOpen) {
item.classList.add('open');
// immediately add 'hovered' class on click to maintain visual feedback
item.classList.add('hovered');
}
});
// Handle hover on top-level menu items
item.addEventListener('mouseenter', function () {
if (Array.from(topLevelItems).some(li => li.classList.contains('open') && li !== this)) {
closeAllDropdowns();
this.classList.add('open');
this.classList.add('hovered');
}
});
item.addEventListener('mouseleave', function () {
// Remove 'hovered' only if the dropdown is not open
if (!this.classList.contains('open')) {
this.classList.remove('hovered');
}
});
});
// handle hover on submenu items
hasSubmenuItems.forEach(item => {
item.addEventListener('mouseenter', function () {
const parentUl = this.closest('ul');
if (parentUl) {
// if the current menu item has multiple items with subemnus, close them if they are not the hovered one
const otherSubmenus = parentUl.querySelectorAll('.has-submenu.open');
otherSubmenus.forEach(submenu => {
if (submenu !== this && !this.contains(submenu))
submenu.classList.remove('open');
});
}
this.classList.add('open'); // show the current menu item as opened
});
item.addEventListener('mouseleave', function (event) {
// on mouse exit, simplu close menu items
if (!this.contains(event.relatedTarget))
this.classList.remove('open');
});
});
submenuNavigationItems.forEach(item => {
item.addEventListener('click', function (event) {
if (!item.classList.contains('has-submenu'))
closeAllDropdowns();
});
});
// close all menus when clicking outside the menubar
document.addEventListener('click', function (event) {
if (!menuBar.contains(event.target))
closeAllDropdowns();
});
// keep the 'hovered' class on the open menu item, if no other item is hovered
menuBar.addEventListener('mouseleave', function(event) {
if (!menuBar.contains(event.relatedTarget)) {
// if there is an item with a visible drop down, mark it as opened, but not if its the last hovered item
topLevelItems.forEach(item => {
if (item.classList.contains('open'))
item.classList.add('hovered');
else
item.classList.remove('hovered');
});
}
});
}
//+======================================================================================+
//| Common Helper Functions |
//+======================================================================================+
@@ -861,4 +758,3 @@ document.addEventListener('click', function (e) {
});
document.addEventListener('DOMContentLoaded', initializeNavigation);
document.addEventListener('DOMContentLoaded', handleWebsiteDesktopMenu);
@@ -17,7 +17,7 @@ namespace Lumina.Presentation.Api.IntegrationTests.Common.Setup;
public static class ThemeTestHelpers
{
/// <summary>
/// Waits until the bundled 'editorial-paper' theme has been installed and activated by the theme detection job at startup.
/// Waits until the bundled 'lumina-default' theme has been installed and activated by the theme detection job at startup.
/// </summary>
/// <param name="apiFactory">The shared API factory whose database is polled.</param>
/// <returns>A task representing the asynchronous operation.</returns>
@@ -31,12 +31,12 @@ public static class ThemeTestHelpers
using IServiceScope scope = apiFactory.Services.CreateScope();
LuminaDbContext dbContext = scope.ServiceProvider.GetRequiredService<LuminaDbContext>();
if (await dbContext.Themes.AnyAsync(theme => theme.ThemeId == "editorial-paper" && theme.IsCurrent == true))
if (await dbContext.Themes.AnyAsync(theme => theme.ThemeId == "lumina-default" && theme.IsCurrent == true))
return;
await Task.Delay(DELAY_MILLISECONDS);
}
Assert.Fail("The bundled theme 'editorial-paper' was not installed and activated within the expected time.");
Assert.Fail("The bundled theme 'lumina-default' was not installed and activated within the expected time.");
}
}
@@ -114,8 +114,12 @@ public class DeleteThemeEndpointTests : IClassFixture<AuthenticatedLuminaApiFact
// Arrange
await ThemeTestHelpers.WaitForBundledThemeAsync(_apiFactory);
// Act
HttpResponseMessage response = await _client.DeleteAsync("/api/v1/themes/editorial-paper");
// deleting a bundled theme that is not the last remaining one is allowed, so only the last one is protected
HttpResponseMessage firstDeletionResponse = await _client.DeleteAsync("/api/v1/themes/editorial-paper");
Assert.Equal(HttpStatusCode.NoContent, firstDeletionResponse.StatusCode);
// Act: the last remaining bundled theme cannot be deleted
HttpResponseMessage response = await _client.DeleteAsync("/api/v1/themes/lumina-default");
// Assert
Assert.Equal(HttpStatusCode.Forbidden, response.StatusCode);
@@ -127,9 +131,13 @@ public class DeleteThemeEndpointTests : IClassFixture<AuthenticatedLuminaApiFact
Assert.Equal("https://tools.ietf.org/html/rfc9110#section-15.5.4", problemDetails["type"].GetString());
Assert.Equal("General.Forbidden", problemDetails["title"].GetString());
Assert.Equal("LastBundledThemeCannotBeDeleted", problemDetails["detail"].GetString());
Assert.Equal("/api/v1/themes/editorial-paper", problemDetails["instance"].GetString());
Assert.Equal("/api/v1/themes/lumina-default", problemDetails["instance"].GetString());
Assert.NotNull(problemDetails["traceId"].GetString());
Assert.NotEmpty(problemDetails["traceId"].GetString()!);
// restore the soft-deleted bundled theme, so the following tests start from a clean state
HttpResponseMessage restoreResponse = await _client.PostAsJsonAsync("/api/v1/themes/editorial-paper/restore", new { });
Assert.Equal(HttpStatusCode.NoContent, restoreResponse.StatusCode);
}
[Fact]
@@ -220,8 +220,8 @@ public class SetCurrentThemeEndpointTests : IClassFixture<AuthenticatedLuminaApi
}
}
// restore the bundled theme as the active one, so the following tests start from a clean state
ThemeEntity? bundledTheme = await dbContext.Themes.FirstOrDefaultAsync(t => t.ThemeId == "editorial-paper");
// restore the bundled default theme as the active one, so the following tests start from a clean state
ThemeEntity? bundledTheme = await dbContext.Themes.FirstOrDefaultAsync(t => t.ThemeId == "lumina-default");
if (bundledTheme is not null)
bundledTheme.IsCurrent = true;
@@ -60,7 +60,7 @@ public class GetCurrentThemeEndpointTests : IClassFixture<AuthenticatedLuminaApi
ThemeResponse? theme = await response.Content.ReadFromJsonAsync<ThemeResponse>(_jsonOptions);
Assert.NotNull(theme);
Assert.Equal("editorial-paper", theme!.ThemeId);
Assert.Equal("lumina-default", theme!.ThemeId);
Assert.True(theme.IsCurrent);
}
@@ -65,7 +65,7 @@ public class GetThemesEndpointTests : IClassFixture<AuthenticatedLuminaApiFactor
List<ThemeResponse>? themes = await response.Content.ReadFromJsonAsync<List<ThemeResponse>>(_jsonOptions);
Assert.NotNull(themes);
ThemeResponse? bundledTheme = themes!.FirstOrDefault(theme => theme.ThemeId == "editorial-paper");
ThemeResponse? bundledTheme = themes!.FirstOrDefault(theme => theme.ThemeId == "lumina-default");
Assert.NotNull(bundledTheme);
Assert.NotEmpty(bundledTheme!.Name);
Assert.Equal(ThemeInstallSource.Bundled, bundledTheme.InstallSource);
@@ -52,7 +52,9 @@ public class GetPathRootEndpointTests : IClassFixture<LuminaWebFactory>
// Arrange
_apiFactory.ApiClientStub.Reset();
string expectedEndpoint = $"path/get-path-root?path={Uri.EscapeDataString(maliciousPath)}";
_apiFactory.ApiClientStub.RegisterGetResponse(expectedEndpoint, _pathSegmentDtoFixture.Create());
// a deterministic path keeps the content assertions independent of randomized fixture data, which could
// otherwise contain one of the forbidden substrings by coincidence
_apiFactory.ApiClientStub.RegisterGetResponse(expectedEndpoint, _pathSegmentDtoFixture.Create(path: "/documents/reports/final-report.pdf"));
AuthenticatedWebClient webClient = await WebTestHelpers.CreateAuthenticatedClientAsync(_apiFactory);
HttpRequestMessage getRequest = new(HttpMethod.Get, $"/path/api-get-path-root?path={Uri.EscapeDataString(maliciousPath)}");
getRequest.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
@@ -11,10 +11,12 @@ using Lumina.Contracts.Responses.Themes;
using Lumina.Domain.Common.Errors;
using Lumina.Domain.Common.Primitives;
using Lumina.Domain.SharedKernel.Common.Enums.Themes;
using Microsoft.Extensions.Logging;
using NSubstitute;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
#endregion
@@ -31,6 +33,7 @@ public class GetThemeTemplateQueryHandlerTests
private readonly IThemeService _mockThemeService;
private readonly IValidator<GetThemeTemplateQuery> _mockValidator;
private readonly IThemeRepository _mockThemeRepository;
private readonly ILogger<GetThemeTemplateQueryHandler> _mockLogger;
private readonly GetThemeTemplateQueryHandler _sut;
private readonly GetThemeTemplateQueryFixture _getThemeTemplateQueryFixture = new();
private readonly ThemeEntityFixture _themeEntityFixture = new();
@@ -44,12 +47,13 @@ public class GetThemeTemplateQueryHandlerTests
_mockThemeService = Substitute.For<IThemeService>();
_mockValidator = Substitute.For<IValidator<GetThemeTemplateQuery>>();
_mockThemeRepository = Substitute.For<IThemeRepository>();
_mockLogger = Substitute.For<ILogger<GetThemeTemplateQueryHandler>>();
_mockValidator.Validate(Arg.Any<GetThemeTemplateQuery>())
.Returns([]);
_mockUnitOfWork.ThemeRepository.Returns(_mockThemeRepository);
_sut = new GetThemeTemplateQueryHandler(_mockUnitOfWork, _mockThemeService, _mockValidator);
_sut = new GetThemeTemplateQueryHandler(_mockUnitOfWork, _mockThemeService, _mockValidator, _mockLogger);
}
[Fact]
@@ -166,6 +170,51 @@ public class GetThemeTemplateQueryHandlerTests
await _mockThemeService.DidNotReceive().RestoreBundledThemeAsync(Arg.Any<string>(), Arg.Any<CancellationToken>());
}
[Fact]
public async Task HandleAsync_WhenTemplateIsNotFoundForBundledTheme_ShouldNotRestoreBundledTheme()
{
// Arrange
GetThemeTemplateQuery query = _getThemeTemplateQueryFixture.Create();
ThemeEntity theme = _themeEntityFixture.Create(themeId: query.ThemeId, installSource: ThemeInstallSource.Bundled, isDeleted: false);
_mockThemeRepository.GetByThemeIdAsync(query.ThemeId!, Arg.Any<CancellationToken>())
.Returns(Result.From<ThemeEntity?>(theme));
_mockThemeService.GetTemplateAsync(theme.ThemeId, query.PageKey!, Arg.Any<CancellationToken>())
.Returns(Errors.Themes.ThemeTemplateNotFound);
// Act
Result<ThemeTemplateResponse> result = await _sut.HandleAsync(query, CancellationToken.None);
// Assert
Assert.True(result.IsFailure);
Assert.Equal(Errors.Themes.ThemeTemplateNotFound, result.FirstError);
await _mockThemeService.DidNotReceive().RestoreBundledThemeAsync(Arg.Any<string>(), Arg.Any<CancellationToken>());
await _mockThemeService.Received(1).GetTemplateAsync(theme.ThemeId, query.PageKey!, Arg.Any<CancellationToken>());
}
[Fact]
public async Task HandleAsync_WhenRestoreThrowsForBundledTheme_ShouldReturnTemplateErrorInsteadOfThrowing()
{
// Arrange
GetThemeTemplateQuery query = _getThemeTemplateQueryFixture.Create();
ThemeEntity theme = _themeEntityFixture.Create(themeId: query.ThemeId, installSource: ThemeInstallSource.Bundled, isDeleted: false);
Error templateError = Errors.Themes.ThemeFilesUnreadable;
_mockThemeRepository.GetByThemeIdAsync(query.ThemeId!, Arg.Any<CancellationToken>())
.Returns(Result.From<ThemeEntity?>(theme));
_mockThemeService.GetTemplateAsync(theme.ThemeId, query.PageKey!, Arg.Any<CancellationToken>())
.Returns(templateError);
_mockThemeService.RestoreBundledThemeAsync(theme.ThemeId, Arg.Any<CancellationToken>())
.Returns(Task.FromException<Result<Success>>(new IOException("The theme storage is locked.")));
// Act
Result<ThemeTemplateResponse> result = await _sut.HandleAsync(query, CancellationToken.None);
// Assert
Assert.True(result.IsFailure);
Assert.Equal(templateError, result.FirstError);
await _mockThemeService.Received(1).RestoreBundledThemeAsync(theme.ThemeId, Arg.Any<CancellationToken>());
await _mockThemeService.Received(1).GetTemplateAsync(theme.ThemeId, query.PageKey!, Arg.Any<CancellationToken>());
}
[Fact]
public async Task HandleAsync_WhenTemplateLoadFailsAndRestoreFails_ShouldReturnTemplateError()
{
@@ -275,6 +275,26 @@ public class ThemeDetectionSyncJobTests : IDisposable
await _mockUnitOfWork.Received(1).SaveChangesAsync(Arg.Any<CancellationToken>());
}
[Fact]
public async Task StartAsync_WhenRestoringBundledThemeThrows_ShouldNotCrashTheJob()
{
// Arrange
ThemeEntity brokenTheme = _themeEntityFixture.Create(themeId: "bundled-theme", installSource: ThemeInstallSource.Bundled, isDeleted: false);
_mockThemeRepository.GetAllAsync(Arg.Any<CancellationToken>()).Returns(Result.From<IEnumerable<ThemeEntity>>([brokenTheme]));
_mockThemeService.HasThemePack("bundled-theme").Returns(false);
_mockThemeService.GetBundledThemeArchivePaths().Returns([]);
_mockThemeService.RestoreBundledThemeAsync("bundled-theme", Arg.Any<CancellationToken>())
.Returns(Task.FromException<Result<Success>>(new IOException("The theme storage is locked.")));
_mockThemeRepository.UpdateAsync(Arg.Any<ThemeEntity>(), Arg.Any<CancellationToken>()).Returns(Result.From(Result.Updated));
// Act
await StartAndWaitForExecutionAsync(CreateSut());
// Assert
await _mockThemeService.Received(1).RestoreBundledThemeAsync("bundled-theme", Arg.Any<CancellationToken>());
await _mockUnitOfWork.Received(1).SaveChangesAsync(Arg.Any<CancellationToken>());
}
[Fact]
public async Task StartAsync_WhenLastBundledThemePackCannotBeRestored_ShouldKeepAndActivateTheTheme()
{
@@ -1,5 +1,6 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Application.Common.Infrastructure.Models.DTO.Themes;
using Lumina.Domain.Common.Errors;
using Lumina.Domain.Common.Primitives;
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.Services;
using Lumina.Domain.Core.BoundedContexts.FileSystemManagementBoundedContext.FileSystemManagementAggregate.ValueObjects;
@@ -200,7 +201,7 @@ public class ThemeServiceTests : IDisposable
// Act
await InstallValidThemeAsync(firstArchive);
await InstallValidThemeAsync(secondArchive);
Result<string> templateResult = await _sut.GetTemplateAsync("test-theme", "unknown-page", CancellationToken.None);
Result<string> templateResult = await _sut.GetTemplateAsync("test-theme", "default", CancellationToken.None);
// Assert
Assert.True(templateResult.IsSuccess);
@@ -210,6 +211,23 @@ public class ThemeServiceTests : IDisposable
Assert.Equal("test-theme", Path.GetFileName(themeDirectories[0]));
}
[Fact]
public async Task InstallAsync_WhenThemeDestinationIsBlocked_ShouldReturnThemeFilesUnreadableInsteadOfThrowing()
{
// Arrange
byte[] archive = _themePackFixture.Create(themeId: "test-theme");
// the destination path is blocked by an existing file, so the extracted pack cannot be moved into place
Directory.CreateDirectory(_options.StoragePath);
File.WriteAllText(Path.Combine(_options.StoragePath, "test-theme"), "blocked");
// Act
Result<ThemeManifestDto> result = await _sut.InstallAsync(new MemoryStream(archive), CancellationToken.None);
// Assert
Assert.True(result.IsFailure);
Assert.Equal("ThemeFilesUnreadable", result.FirstError.Description);
}
[Fact]
public async Task InstallAsync_WhenArchiveExceedsMaxArchiveBytes_ShouldReturnArchiveTooLargeError()
{
@@ -558,7 +576,7 @@ public class ThemeServiceTests : IDisposable
}
[Fact]
public async Task InstallAsync_WhenManifestDeclaresNoTemplates_ShouldReturnPackageInvalidError()
public async Task InstallAsync_WhenManifestDeclaresNoTemplates_ShouldInstallSuccessfully()
{
// Arrange
byte[] archive = _themePackFixture.Create(templates: new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase));
@@ -567,7 +585,7 @@ public class ThemeServiceTests : IDisposable
Result<ThemeManifestDto> result = await _sut.InstallAsync(new MemoryStream(archive), CancellationToken.None);
// Assert
AssertPackageInvalid(result, "between 1 and 32");
Assert.True(result.IsSuccess);
}
[Fact]
@@ -583,7 +601,7 @@ public class ThemeServiceTests : IDisposable
Result<ThemeManifestDto> result = await _sut.InstallAsync(new MemoryStream(archive), CancellationToken.None);
// Assert
AssertPackageInvalid(result, "between 1 and 32");
AssertPackageInvalid(result, "at most 32");
}
[Fact]
@@ -641,7 +659,7 @@ public class ThemeServiceTests : IDisposable
}
[Fact]
public async Task InstallAsync_WhenManifestLacksDefaultTemplate_ShouldReturnPackageInvalidError()
public async Task InstallAsync_WhenManifestLacksDefaultTemplate_ShouldInstallSuccessfully()
{
// Arrange
Dictionary<string, string> templates = new(StringComparer.OrdinalIgnoreCase)
@@ -654,7 +672,7 @@ public class ThemeServiceTests : IDisposable
Result<ThemeManifestDto> result = await _sut.InstallAsync(new MemoryStream(archive), CancellationToken.None);
// Assert
AssertPackageInvalid(result, "default");
Assert.True(result.IsSuccess);
}
[Fact]
@@ -889,7 +907,7 @@ public class ThemeServiceTests : IDisposable
}
[Fact]
public async Task GetTemplateAsync_WhenNoTemplateResolves_ShouldFallBackToDefaultTemplate()
public async Task GetTemplateAsync_WhenNoTemplateResolves_ShouldReturnThemeTemplateNotFound()
{
// Arrange
byte[] archive = CreateThemeWithTemplates();
@@ -899,15 +917,15 @@ public class ThemeServiceTests : IDisposable
Result<string> result = await _sut.GetTemplateAsync("test-theme", "unknown-page", CancellationToken.None);
// Assert
Assert.True(result.IsSuccess);
Assert.Equal(DEFAULT_TEMPLATE, result.Value);
Assert.True(result.IsFailure);
Assert.Equal(Errors.Themes.ThemeTemplateNotFound, result.FirstError);
}
[Theory]
[InlineData("../secret")] // parent scope traversal attempt
[InlineData("/etc/passwd")] // rooted path attempt
[InlineData("templates//nested")] // empty segment attempt
public async Task GetTemplateAsync_WhenPageKeyAttemptsToEscapeTheThemePack_ShouldFallBackToDefaultTemplate(string pageKey)
public async Task GetTemplateAsync_WhenPageKeyAttemptsToEscapeTheThemePack_ShouldReturnThemeTemplateNotFound(string pageKey)
{
// Arrange
byte[] archive = CreateThemeWithTemplates();
@@ -916,9 +934,58 @@ public class ThemeServiceTests : IDisposable
// Act
Result<string> result = await _sut.GetTemplateAsync("test-theme", pageKey, CancellationToken.None);
// Assert
Assert.True(result.IsFailure);
Assert.Equal(Errors.Themes.ThemeTemplateNotFound, result.FirstError);
}
[Fact]
public async Task GetTemplateAsync_WhenSharedLayoutTemplateIsMissing_ShouldReturnThemeTemplateNotFound()
{
// Arrange
byte[] archive = CreateThemeWithTemplates();
await InstallValidThemeAsync(archive);
// Act
Result<string> result = await _sut.GetTemplateAsync("test-theme", "shared/layout", CancellationToken.None);
// Assert
Assert.True(result.IsFailure);
Assert.Equal(Errors.Themes.ThemeTemplateNotFound, result.FirstError);
}
[Fact]
public async Task GetTemplateAsync_WhenSharedNavMenuTemplateIsMissing_ShouldReturnThemeTemplateNotFound()
{
// Arrange
byte[] archive = CreateThemeWithTemplates();
await InstallValidThemeAsync(archive);
// Act
Result<string> result = await _sut.GetTemplateAsync("test-theme", "shared/nav-menu", CancellationToken.None);
// Assert
Assert.True(result.IsFailure);
Assert.Equal(Errors.Themes.ThemeTemplateNotFound, result.FirstError);
}
[Fact]
public async Task GetTemplateAsync_WhenSharedNavMenuMirrorExists_ShouldReturnTheMirroredTemplate()
{
// Arrange
const string NAV_TEMPLATE = "<html><body>nav menu</body></html>";
byte[] archive = _themePackFixture.Create(additionalFiles: new Dictionary<string, string>
{
["templates/shared/nav-menu.html"] = NAV_TEMPLATE
});
await InstallValidThemeAsync(archive);
// Act
Result<string> result = await _sut.GetTemplateAsync("test-theme", "shared/nav-menu", CancellationToken.None);
// Assert
Assert.True(result.IsSuccess);
Assert.Equal(DEFAULT_TEMPLATE, result.Value);
Assert.Equal(NAV_TEMPLATE, result.Value);
}
[Fact]
@@ -953,7 +1020,7 @@ public class ThemeServiceTests : IDisposable
}
[Fact]
public async Task GetTemplateAsync_WhenMirroredTemplateFileWasRemoved_ShouldFallBackToDefaultTemplate()
public async Task GetTemplateAsync_WhenMirroredTemplateFileWasRemoved_ShouldReturnThemeTemplateNotFound()
{
// Arrange
byte[] archive = CreateThemeWithTemplates();
@@ -964,8 +1031,8 @@ public class ThemeServiceTests : IDisposable
Result<string> result = await _sut.GetTemplateAsync("test-theme", "library/book", CancellationToken.None);
// Assert
Assert.True(result.IsSuccess);
Assert.Equal(DEFAULT_TEMPLATE, result.Value);
Assert.True(result.IsFailure);
Assert.Equal(Errors.Themes.ThemeTemplateNotFound, result.FirstError);
}
[Fact]
@@ -20,6 +20,7 @@ using NSubstitute;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
#endregion
@@ -139,6 +140,29 @@ public class ThemeLayoutRendererTests
_mockViewEngine.Received(1).FindView(Arg.Any<ActionContext>(), "_NavMenu", false);
}
[Fact]
public async Task RenderAsync_WhenNavDocumentCannotBeLoaded_ShouldFallBackToApplicationNavMenu()
{
// Arrange
_mockHttpContextAccessor.HttpContext.Returns(TestHttpContextFactory.Create(user: null));
ThemeResponseDto theme = _themeResponseDtoFixture.Create(themeId: "editorial");
SetupRenderDocuments(theme, layoutTemplate: "{{title}}|{{{nav}}}", navTemplate: "nav:{{siteName}}");
string navEndpoint = ApiRoutes.Themes.GET_THEME_TEMPLATE
.Replace("{themeId}", "editorial")
.Replace("{*pageKey}", "shared/nav-menu");
_mockApiHttpClient.GetAsync<ThemeTemplateResponseDto>(navEndpoint, Arg.Any<CancellationToken>())
.Returns(Task.FromException<ThemeTemplateResponseDto>(new HttpRequestException("The navigation template is unavailable.")));
ThemeLayoutPageDto page = _themeLayoutPageDtoFixture.Create(title: "My Page", content: "<main>", script: string.Empty);
// Act
Result<string> result = await _sut.RenderAsync(page, "editorial", CancellationToken.None);
// Assert
Assert.True(result.IsSuccess);
Assert.Equal("My Page|<nav-menu-fragment>", result.Value);
_mockViewEngine.Received(1).FindView(Arg.Any<ActionContext>(), "_NavMenu", false);
}
[Fact]
public async Task RenderAsync_WhenCalled_ShouldResolveLayoutAndNavDocumentsFromTheme()
{
@@ -2,6 +2,7 @@
using Lumina.Presentation.Web.Common.DTO.Themes;
using Lumina.Presentation.Web.Common.Primitives;
using Lumina.Presentation.Web.Core.Themes;
using Lumina.Presentation.Web.Fixtures.Common.DTO.Themes;
using Lumina.Presentation.Web.Fixtures.Common.Models;
using System;
using System.Collections.Generic;
@@ -19,6 +20,9 @@ public class ThemeTemplateEngineTests
{
private readonly ThemeTemplateEngine _sut;
private readonly SectionModelFixture _sectionModelFixture = new();
private readonly ThemeNavMenuDtoFixture _themeNavMenuDtoFixture = new();
private readonly ThemeNavSectionDtoFixture _themeNavSectionDtoFixture = new();
private readonly ThemeNavEntryDtoFixture _themeNavEntryDtoFixture = new();
/// <summary>
/// Initializes a new instance of the <see cref="ThemeTemplateEngineTests"/> class.
@@ -120,6 +124,40 @@ public class ThemeTemplateEngineTests
Assert.Equal("3", result.Value.Content);
}
[Fact]
public void RenderPage_WhenMenuEntryHasChildren_ShouldRenderEntryLabelOnceWithNestedChildren()
{
// Arrange
ThemeNavMenuDto model = _themeNavMenuDtoFixture.Create(
siteName: "Lumina",
mobileSections: [],
menubarSections:
[
_themeNavSectionDtoFixture.Create(
label: "Tools",
items:
[
_themeNavEntryDtoFixture.Create(
label: "Language",
includeUrl: false,
children:
[
_themeNavEntryDtoFixture.Create(label: "English", includeUrl: true, url: "/en", cssClass: "lang-set", includeCssClass: true),
_themeNavEntryDtoFixture.Create(label: "Francais", includeUrl: true, url: "/fr", cssClass: "lang-set", includeCssClass: true)
]),
_themeNavEntryDtoFixture.Create(label: "Settings", includeUrl: true, url: "/settings", cssClass: "nav-link", includeCssClass: true)
])
]);
string template = "{{#menubarSections}}{{label}}:{{#items}}{{#isSubmenu}}[{{label}}]{{#children}}{{label}},{{/children}}{{/isSubmenu}}{{^isSubmenu}}{{label}}{{/isSubmenu}}{{/items}}{{/menubarSections}}";
// Act
Result<ThemePageRenderResultDto> result = _sut.RenderPage(template, model);
// Assert
Assert.True(result.IsSuccess);
Assert.Equal("Tools:[Language]English,Francais,Settings", result.Value.Content);
}
[Fact]
public void RenderPage_WhenSectionIsTruthy_ShouldRenderChildren()
{