Adds a trust warning and a source column to the themes page

This commit is contained in:
BinaryAlley committed 2026-08-21 04:06:16 -07:00
1 parent 148377a69f
commit 67ceee53b7
12 files changed
+154 -4

No files matched your search

@@ -156,4 +156,16 @@
<data name="Preview" xml:space="preserve">
<value>Vorschau</value>
</data>
<data name="ThemeTrustWarning" xml:space="preserve">
<value>Themes sind Inhalte von Drittanbietern und können Code, einschließlich JavaScript, in Ihrem Browser ausführen. Installieren Sie nur Themes aus vertrauenswürdigen Quellen. Die mit der Anwendung gebündelten Themes sind geprüft und sicher.</value>
</data>
<data name="Source" xml:space="preserve">
<value>Quelle</value>
</data>
<data name="Bundled" xml:space="preserve">
<value>Gebündelt</value>
</data>
<data name="UserProvided" xml:space="preserve">
<value>Benutzer</value>
</data>
</root>
@@ -156,4 +156,16 @@
<data name="Preview" xml:space="preserve">
<value>Preview</value>
</data>
<data name="ThemeTrustWarning" xml:space="preserve">
<value>Themes are third-party content and can execute code, including JavaScript, in your browser. Install only themes from sources you trust. The themes bundled with the application are reviewed and safe.</value>
</data>
<data name="Source" xml:space="preserve">
<value>Source</value>
</data>
<data name="Bundled" xml:space="preserve">
<value>Bundled</value>
</data>
<data name="UserProvided" xml:space="preserve">
<value>User</value>
</data>
</root>
@@ -156,4 +156,16 @@
<data name="Preview" xml:space="preserve">
<value>Vista previa</value>
</data>
<data name="ThemeTrustWarning" xml:space="preserve">
<value>Los temas son contenido de terceros y pueden ejecutar código, incluido JavaScript, en su navegador. Instale solo temas de fuentes confiables. Los temas incluidos con la aplicación están revisados y son seguros.</value>
</data>
<data name="Source" xml:space="preserve">
<value>Origen</value>
</data>
<data name="Bundled" xml:space="preserve">
<value>Incluido</value>
</data>
<data name="UserProvided" xml:space="preserve">
<value>Usuario</value>
</data>
</root>
@@ -156,4 +156,16 @@
<data name="Preview" xml:space="preserve">
<value>Aperçu</value>
</data>
<data name="ThemeTrustWarning" xml:space="preserve">
<value>Les thèmes sont des contenus tiers et peuvent exécuter du code, y compris du JavaScript, dans votre navigateur. N'installez que des thèmes provenant de sources fiables. Les thèmes fournis avec l'application sont vérifiés et sûrs.</value>
</data>
<data name="Source" xml:space="preserve">
<value>Source</value>
</data>
<data name="Bundled" xml:space="preserve">
<value>Intégré</value>
</data>
<data name="UserProvided" xml:space="preserve">
<value>Utilisateur</value>
</data>
</root>
@@ -156,4 +156,16 @@
<data name="Preview" xml:space="preserve">
<value>Anteprima</value>
</data>
<data name="ThemeTrustWarning" xml:space="preserve">
<value>I temi sono contenuti di terze parti e possono eseguire codice, incluso JavaScript, nel tuo browser. Installa solo temi da fonti affidabili. I temi inclusi con l'applicazione sono revisionati e sicuri.</value>
</data>
<data name="Source" xml:space="preserve">
<value>Origine</value>
</data>
<data name="Bundled" xml:space="preserve">
<value>Incluso</value>
</data>
<data name="UserProvided" xml:space="preserve">
<value>Utente</value>
</data>
</root>
@@ -156,4 +156,16 @@
<data name="Preview" xml:space="preserve">
<value>プレビュー</value>
</data>
<data name="ThemeTrustWarning" xml:space="preserve">
<value>テーマはサードパーティのコンテンツであり、ブラウザでJavaScriptなどのコードを実行する可能性があります。信頼できるソースからのテーマのみをインストールしてください。アプリケーションにバンドルされているテーマは審査済みで安全です。</value>
</data>
<data name="Source" xml:space="preserve">
<value>ソース</value>
</data>
<data name="Bundled" xml:space="preserve">
<value>同梱</value>
</data>
<data name="UserProvided" xml:space="preserve">
<value>ユーザー</value>
</data>
</root>
@@ -156,4 +156,16 @@
<data name="Preview" xml:space="preserve">
<value>Preview</value>
</data>
<data name="ThemeTrustWarning" xml:space="preserve">
<value>Themes are third-party content and can execute code, including JavaScript, in your browser. Install only themes from sources you trust. The themes bundled with the application are reviewed and safe.</value>
</data>
<data name="Source" xml:space="preserve">
<value>Source</value>
</data>
<data name="Bundled" xml:space="preserve">
<value>Bundled</value>
</data>
<data name="UserProvided" xml:space="preserve">
<value>User</value>
</data>
</root>
@@ -156,4 +156,16 @@
<data name="Preview" xml:space="preserve">
<value>Previzualizare</value>
</data>
<data name="ThemeTrustWarning" xml:space="preserve">
<value>Temele sunt conținut de la terți și pot executa cod, inclusiv JavaScript, în browser. Instalați numai teme din surse de încredere. Temele incluse cu aplicația sunt verificate și sigure.</value>
</data>
<data name="Source" xml:space="preserve">
<value>Sursă</value>
</data>
<data name="Bundled" xml:space="preserve">
<value>Încorporat</value>
</data>
<data name="UserProvided" xml:space="preserve">
<value>Utilizator</value>
</data>
</root>
@@ -156,4 +156,16 @@
<data name="Preview" xml:space="preserve">
<value>Предпросмотр</value>
</data>
<data name="ThemeTrustWarning" xml:space="preserve">
<value>Темы являются сторонним содержимым и могут выполнять код, включая JavaScript, в вашем браузере. Устанавливайте только темы из надежных источников. Темы, поставляемые с приложением, проверены и безопасны.</value>
</data>
<data name="Source" xml:space="preserve">
<value>Источник</value>
</data>
<data name="Bundled" xml:space="preserve">
<value>Встроенный</value>
</data>
<data name="UserProvided" xml:space="preserve">
<value>Пользователь</value>
</data>
</root>
@@ -156,4 +156,16 @@
<data name="Preview" xml:space="preserve">
<value>预览</value>
</data>
<data name="ThemeTrustWarning" xml:space="preserve">
<value>主题是第三方内容,可能在您的浏览器中执行代码(包括 JavaScript)。请只安装来自可信来源的主题。随应用程序附带的主题已经过审查,是安全的。</value>
</data>
<data name="Source" xml:space="preserve">
<value>来源</value>
</data>
<data name="Bundled" xml:space="preserve">
<value>内置</value>
</data>
<data name="UserProvided" xml:space="preserve">
<value>用户</value>
</data>
</root>
@@ -47,6 +47,27 @@
#themes-table td {
vertical-align: middle;
}
.theme-trust-warning {
display: flex;
align-items: flex-start;
gap: 0.5rem;
width: 100%;
padding: 0.5rem 0.75rem;
border: 1px solid #b8860b;
border-radius: 4px;
background-color: rgba(184, 134, 11, 0.15);
color: var(--text-foreground);
font-family: monospace;
font-size: 0.85rem;
}
.theme-trust-warning-icon {
width: 20px;
height: 20px;
flex-shrink: 0;
margin-top: 1px;
}
</style>
<div style="display: grid; grid-template-rows: auto 1fr;">
@@ -60,6 +81,12 @@
<button id="btn-upload-theme" type="button" class="confirm-button">@_localizer["Upload"]</button>
<input id="theme-upload-input" type="file" accept=".zip" hidden />
</div>
<div class="form-row" style="margin-bottom: 0.75rem;">
<div class="theme-trust-warning">
<img class="theme-trust-warning-icon" src="~/images/ui/warning.svg" alt="" />
<span>@_localizer["ThemeTrustWarning"]</span>
</div>
</div>
<div class="form-row">
@if (themes is null || themes.Count == 0)
{
@@ -71,10 +98,11 @@
<thead class="text-light-two">
<tr>
<th class="w-10">@_localizer["Preview"]</th>
<th class="w-25">@_localizer["Name"]</th>
<th class="w-20">@_localizer["Name"]</th>
<th class="w-15">@_localizer["Version"]</th>
<th class="w-25">@_localizer["Author"]</th>
<th class="w-25">@_localizer["Actions"]</th>
<th class="w-20">@_localizer["Author"]</th>
<th class="w-15">@_localizer["Source"]</th>
<th class="w-20">@_localizer["Actions"]</th>
</tr>
</thead>
<tbody>
@@ -91,6 +119,7 @@
<td>@theme.Name</td>
<td>@theme.Version</td>
<td>@theme.Author</td>
<td>@(theme.IsBundled ? _localizer["Bundled"] : _localizer["UserProvided"])</td>
<td class="text-end">
<div class="form-row">
<button type="button" class="confirm-button activate-theme-button" data-url="@_urlService.GetAbsoluteUrl(WebRoutes.Themes.SET_CURRENT_THEME)" @(isCurrent ? "disabled" : null)>@_localizer["Activate"]</button>
@@ -46,7 +46,7 @@ public class LuminaDbContextTests : IDisposable
// Assert
// The count assertion fails when a table is added or removed, reminding to update the assertions below.
Assert.Equal(23, tableNames.Length);
Assert.Equal(24, tableNames.Length);
Assert.Contains("Books", tableNames);
Assert.Contains("Users", tableNames);
Assert.Contains("UserSettings", tableNames);
@@ -70,6 +70,7 @@ public class LuminaDbContextTests : IDisposable
Assert.Contains("BookGenres", tableNames);
Assert.Contains("BookRatings", tableNames);
Assert.Contains("BookISBNs", tableNames);
Assert.Contains("Themes", tableNames);
}
[Fact]