mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2024-11-14 03:20:14 +01:00
UI: settings show/hide update display (#1072)
* UI: settings show/hide update display This PR replaces the PR #1003 In this PR, the visual for available update is added to the foreground. There are new settings to generally show/hide the update display, and only administrators receive the update display. * change to `Bean` * Update AppUpdateShowService.java * add update message * revision service * change shouldShow * Update githubVersion.js * rm folder * Update AppUpdateService.java
This commit is contained in:
parent
e74a8e434b
commit
a5000fbbc5
@ -225,6 +225,8 @@ system:
|
||||
defaultLocale: 'en-US' # Set the default language (e.g. 'de-DE', 'fr-FR', etc)
|
||||
googlevisibility: false # 'true' to allow Google visibility (via robots.txt), 'false' to disallow
|
||||
customStaticFilePath: '/customFiles/static/' # Directory path for custom static files
|
||||
showUpdate: true # see when a new update is available
|
||||
showUpdateOnlyAdmin: false # Only admins can see when a new update is available, depending on showUpdate it must be set to 'true'
|
||||
|
||||
#ui:
|
||||
# appName: exampleAppName # Application's visible name
|
||||
|
@ -0,0 +1,25 @@
|
||||
package stirling.software.SPDF.config;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import stirling.software.SPDF.model.ApplicationProperties;
|
||||
|
||||
@Service
|
||||
class AppUpdateService {
|
||||
|
||||
@Autowired private ApplicationProperties applicationProperties;
|
||||
|
||||
@Autowired(required = false)
|
||||
ShowAdminInterface showAdmin;
|
||||
|
||||
@Bean(name = "shouldShow")
|
||||
@Scope("request")
|
||||
public boolean shouldShow() {
|
||||
boolean showUpdate = applicationProperties.getSystem().getShowUpdate();
|
||||
boolean showAdminResult = (showAdmin != null) ? showAdmin.getShowUpdateOnlyAdmins() : true;
|
||||
return showUpdate && showAdminResult;
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package stirling.software.SPDF.config;
|
||||
|
||||
public interface ShowAdminInterface {
|
||||
default boolean getShowUpdateOnlyAdmins() {
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package stirling.software.SPDF.config.security;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import stirling.software.SPDF.config.ShowAdminInterface;
|
||||
import stirling.software.SPDF.model.ApplicationProperties;
|
||||
import stirling.software.SPDF.model.User;
|
||||
import stirling.software.SPDF.repository.UserRepository;
|
||||
|
||||
@Service
|
||||
class AppUpdateAuthService implements ShowAdminInterface {
|
||||
|
||||
@Autowired private UserRepository userRepository;
|
||||
@Autowired private ApplicationProperties applicationProperties;
|
||||
|
||||
public boolean getShowUpdateOnlyAdmins() {
|
||||
boolean showUpdate = applicationProperties.getSystem().getShowUpdate();
|
||||
if (!showUpdate) {
|
||||
return showUpdate;
|
||||
}
|
||||
|
||||
boolean showUpdateOnlyAdmin = applicationProperties.getSystem().getShowUpdateOnlyAdmin();
|
||||
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
|
||||
if (authentication == null || !authentication.isAuthenticated()) {
|
||||
return !showUpdateOnlyAdmin;
|
||||
}
|
||||
|
||||
if (authentication.getName().equalsIgnoreCase("anonymousUser")) {
|
||||
return !showUpdateOnlyAdmin;
|
||||
}
|
||||
|
||||
Optional<User> user = userRepository.findByUsername(authentication.getName());
|
||||
if (user.isPresent() && showUpdateOnlyAdmin) {
|
||||
return "ROLE_ADMIN".equals(user.get().getRolesAsString());
|
||||
}
|
||||
|
||||
return showUpdate;
|
||||
}
|
||||
}
|
@ -17,6 +17,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@Controller
|
||||
@Tag(name = "Misc", description = "Miscellaneous APIs")
|
||||
public class OtherWebController {
|
||||
|
||||
@GetMapping("/compress-pdf")
|
||||
@Hidden
|
||||
public String compressPdfForm(Model model) {
|
||||
|
@ -210,6 +210,24 @@ public class ApplicationProperties {
|
||||
private String rootURIPath;
|
||||
private String customStaticFilePath;
|
||||
private Integer maxFileSize;
|
||||
private boolean showUpdate;
|
||||
private Boolean showUpdateOnlyAdmin;
|
||||
|
||||
public boolean getShowUpdateOnlyAdmin() {
|
||||
return showUpdateOnlyAdmin;
|
||||
}
|
||||
|
||||
public void setShowUpdateOnlyAdmin(boolean showUpdateOnlyAdmin) {
|
||||
this.showUpdateOnlyAdmin = showUpdateOnlyAdmin;
|
||||
}
|
||||
|
||||
public boolean getShowUpdate() {
|
||||
return showUpdate;
|
||||
}
|
||||
|
||||
public void setShowUpdate(boolean showUpdate) {
|
||||
this.showUpdate = showUpdate;
|
||||
}
|
||||
|
||||
private Boolean enableAlphaFunctionality;
|
||||
|
||||
@ -275,6 +293,10 @@ public class ApplicationProperties {
|
||||
+ maxFileSize
|
||||
+ ", enableAlphaFunctionality="
|
||||
+ enableAlphaFunctionality
|
||||
+ ", showUpdate="
|
||||
+ showUpdate
|
||||
+ ", showUpdateOnlyAdmin="
|
||||
+ showUpdateOnlyAdmin
|
||||
+ "]";
|
||||
}
|
||||
}
|
||||
|
@ -112,6 +112,7 @@ navbar.settings=إعدادات
|
||||
#############
|
||||
settings.title=الإعدادات
|
||||
settings.update=التحديث متاح
|
||||
settings.updateAvailable={0} is the current installed version. A new version ({1}) is available.
|
||||
settings.appVersion=إصدار التطبيق:
|
||||
settings.downloadOption.title=تحديد خيار التنزيل (للتنزيلات ذات الملف الواحد غير المضغوط):
|
||||
settings.downloadOption.1=فتح في نفس النافذة
|
||||
|
@ -112,6 +112,7 @@ navbar.settings=Настройки
|
||||
#############
|
||||
settings.title=Настройки
|
||||
settings.update=Налична актуализация
|
||||
settings.updateAvailable={0} is the current installed version. A new version ({1}) is available.
|
||||
settings.appVersion=Версия на приложението:
|
||||
settings.downloadOption.title=Изберете опция за изтегляне (за изтегляния на един файл без да е архивиран):
|
||||
settings.downloadOption.1=Отваряне в същия прозорец
|
||||
|
@ -112,6 +112,7 @@ navbar.settings=Opcions
|
||||
#############
|
||||
settings.title=Opcions
|
||||
settings.update=Actualització Disponible
|
||||
settings.updateAvailable={0} is the current installed version. A new version ({1}) is available.
|
||||
settings.appVersion=Versió App:
|
||||
settings.downloadOption.title=Trieu l'opció de descàrrega (per a descàrregues d'un sol fitxer no zip):
|
||||
settings.downloadOption.1=Obre mateixa finestra
|
||||
|
@ -112,6 +112,7 @@ navbar.settings=Einstellungen
|
||||
#############
|
||||
settings.title=Einstellungen
|
||||
settings.update=Update verfügbar
|
||||
settings.updateAvailable={0} ist die aktuelle installierte Version. Eine neue Version ({1}) ist verfügbar.
|
||||
settings.appVersion=App-Version:
|
||||
settings.downloadOption.title=Download-Option wählen (für einzelne Dateien, die keine Zip-Downloads sind):
|
||||
settings.downloadOption.1=Im selben Fenster öffnen
|
||||
|
@ -112,6 +112,7 @@ navbar.settings=Ρυθμίσεις
|
||||
#############
|
||||
settings.title=Ρυθμίσεις
|
||||
settings.update=Υπάρχει διαθέσιμη ενημέρωση
|
||||
settings.updateAvailable={0} is the current installed version. A new version ({1}) is available.
|
||||
settings.appVersion=Έκδοση εφαρμογής:
|
||||
settings.downloadOption.title=Επιλέξετε την επιλογή λήψης (Για λήψεις μεμονωμένων αρχείων χωρίς zip):
|
||||
settings.downloadOption.1=Άνοιγμα στο ίδιο παράθυρο
|
||||
|
@ -112,6 +112,7 @@ navbar.settings=Settings
|
||||
#############
|
||||
settings.title=Settings
|
||||
settings.update=Update available
|
||||
settings.updateAvailable={0} is the current installed version. A new version ({1}) is available.
|
||||
settings.appVersion=App Version:
|
||||
settings.downloadOption.title=Choose download option (For single file non zip downloads):
|
||||
settings.downloadOption.1=Open in same window
|
||||
|
@ -112,6 +112,7 @@ navbar.settings=Settings
|
||||
#############
|
||||
settings.title=Settings
|
||||
settings.update=Update available
|
||||
settings.updateAvailable={0} is the current installed version. A new version ({1}) is available.
|
||||
settings.appVersion=App Version:
|
||||
settings.downloadOption.title=Choose download option (For single file non zip downloads):
|
||||
settings.downloadOption.1=Open in same window
|
||||
|
@ -112,6 +112,7 @@ navbar.settings=Configuración
|
||||
#############
|
||||
settings.title=Configuración
|
||||
settings.update=Actualización disponible
|
||||
settings.updateAvailable={0} is the current installed version. A new version ({1}) is available.
|
||||
settings.appVersion=Versión de la aplicación:
|
||||
settings.downloadOption.title=Elegir la opción de descarga (para descargas de un solo archivo sin ZIP):
|
||||
settings.downloadOption.1=Abrir en la misma ventana
|
||||
|
@ -112,6 +112,7 @@ navbar.settings=Ezarpenak
|
||||
#############
|
||||
settings.title=Ezarpenak
|
||||
settings.update=Eguneratze eskuragarria
|
||||
settings.updateAvailable={0} is the current installed version. A new version ({1}) is available.
|
||||
settings.appVersion=Aplikazioaren bertsioa:
|
||||
settings.downloadOption.title=Hautatu deskargatzeko aukera (fitxategi bakarra deskargatzeko ZIP gabe):
|
||||
settings.downloadOption.1=Ireki leiho berean
|
||||
|
@ -112,6 +112,7 @@ navbar.settings=Paramètres
|
||||
#############
|
||||
settings.title=Paramètres
|
||||
settings.update=Mise à jour disponible
|
||||
settings.updateAvailable={0} is the current installed version. A new version ({1}) is available.
|
||||
settings.appVersion=Version de l’application :
|
||||
settings.downloadOption.title=Choisissez l’option de téléchargement (pour les téléchargements à fichier unique non ZIP) :
|
||||
settings.downloadOption.1=Ouvrir dans la même fenêtre
|
||||
|
@ -112,6 +112,7 @@ navbar.settings=सेटिंग्स
|
||||
#############
|
||||
settings.title=सेटिंग्स
|
||||
settings.update=अपडेट उपलब्ध है
|
||||
settings.updateAvailable={0} is the current installed version. A new version ({1}) is available.
|
||||
settings.appVersion=ऐप संस्करण:
|
||||
settings.downloadOption.title=डाउनलोड विकल्प चुनें (एकल फ़ाइल गैर-ज़िप डाउनलोड के लिए):
|
||||
settings.downloadOption.1=एक ही विंडो में खोलें
|
||||
|
@ -112,6 +112,7 @@ navbar.settings=Beállítások
|
||||
#############
|
||||
settings.title=Beállítások
|
||||
settings.update=Frisítés elérhető
|
||||
settings.updateAvailable={0} is the current installed version. A new version ({1}) is available.
|
||||
settings.appVersion=App Verzió:
|
||||
settings.downloadOption.title=Válassza ki a letöltési lehetőséget (Egyetlen fájl esetén a nem tömörített letöltésekhez):
|
||||
settings.downloadOption.1=Nyissa meg ugyanabban az ablakban
|
||||
|
@ -112,6 +112,7 @@ navbar.settings=Pengaturan
|
||||
#############
|
||||
settings.title=Pengaturan
|
||||
settings.update=Pembaruan tersedia
|
||||
settings.updateAvailable={0} is the current installed version. A new version ({1}) is available.
|
||||
settings.appVersion=Versi Aplikasi:
|
||||
settings.downloadOption.title=Pilih opsi unduhan (Untuk unduhan berkas tunggal non zip):
|
||||
settings.downloadOption.1=Buka di jendela yang sama
|
||||
|
@ -112,6 +112,7 @@ navbar.settings=Impostazioni
|
||||
#############
|
||||
settings.title=Impostazioni
|
||||
settings.update=Aggiornamento disponibile
|
||||
settings.updateAvailable={0} is the current installed version. A new version ({1}) is available.
|
||||
settings.appVersion=Versione App:
|
||||
settings.downloadOption.title=Scegli opzione di download (Per file singoli non compressi):
|
||||
settings.downloadOption.1=Apri in questa finestra
|
||||
|
@ -112,6 +112,7 @@ navbar.settings=設定
|
||||
#############
|
||||
settings.title=設定
|
||||
settings.update=利用可能なアップデート
|
||||
settings.updateAvailable={0} is the current installed version. A new version ({1}) is available.
|
||||
settings.appVersion=Appバージョン:
|
||||
settings.downloadOption.title=ダウンロードオプション (zip以外の単一ファイル):
|
||||
settings.downloadOption.1=同じウィンドウで開く
|
||||
|
@ -112,6 +112,7 @@ navbar.settings=설정
|
||||
#############
|
||||
settings.title=설정
|
||||
settings.update=업데이트 가능
|
||||
settings.updateAvailable={0} is the current installed version. A new version ({1}) is available.
|
||||
settings.appVersion=앱 버전:
|
||||
settings.downloadOption.title=다운로드 옵션 선택 (zip 파일이 아닌 단일 파일 다운로드 시):
|
||||
settings.downloadOption.1=현재 창에서 열기
|
||||
|
@ -112,6 +112,7 @@ navbar.settings=Instellingen
|
||||
#############
|
||||
settings.title=Instellingen
|
||||
settings.update=Update beschikbaar
|
||||
settings.updateAvailable={0} is the current installed version. A new version ({1}) is available.
|
||||
settings.appVersion=App versie:
|
||||
settings.downloadOption.title=Kies download optie (Voor enkelvoudige bestanddownloads zonder zip):
|
||||
settings.downloadOption.1=Open in hetzelfde venster
|
||||
|
@ -112,6 +112,7 @@ navbar.settings=Ustawienia
|
||||
#############
|
||||
settings.title=Ustawienia
|
||||
settings.update=Dostępna aktualizacja
|
||||
settings.updateAvailable={0} is the current installed version. A new version ({1}) is available.
|
||||
settings.appVersion=Wersia aplikacji:
|
||||
settings.downloadOption.title=Wybierz opcję pobierania (w przypadku pobierania pojedynczych plików innych niż ZIP):
|
||||
settings.downloadOption.1=Otwórz w tym samym oknie
|
||||
|
@ -112,6 +112,7 @@ navbar.settings=Configurações
|
||||
#############
|
||||
settings.title=Configurações
|
||||
settings.update=Atualização disponível
|
||||
settings.updateAvailable={0} is the current installed version. A new version ({1}) is available.
|
||||
settings.appVersion=Versão do aplicativo:
|
||||
settings.downloadOption.title=Escolha a opção de download (para downloads não compactados de arquivo único):
|
||||
settings.downloadOption.1=Abrir na mesma janela
|
||||
|
@ -112,6 +112,7 @@ navbar.settings=Configurações
|
||||
#############
|
||||
settings.title=Configurações
|
||||
settings.update=Atualização disponível
|
||||
settings.updateAvailable={0} is the current installed version. A new version ({1}) is available.
|
||||
settings.appVersion=Versão da aplicação:
|
||||
settings.downloadOption.title=Escolha a opção de download (para downloads não compactados de ficheiro único):
|
||||
settings.downloadOption.1=Abrir na mesma janela
|
||||
|
@ -112,6 +112,7 @@ navbar.settings=Setări
|
||||
#############
|
||||
settings.title=Setări
|
||||
settings.update=Actualizare disponibilă
|
||||
settings.updateAvailable={0} is the current installed version. A new version ({1}) is available.
|
||||
settings.appVersion=Versiune aplicație:
|
||||
settings.downloadOption.title=Alege opțiunea de descărcare (pentru descărcarea unui singur fișier non-zip):
|
||||
settings.downloadOption.1=Deschide în aceeași fereastră
|
||||
|
@ -112,6 +112,7 @@ navbar.settings=Настройки
|
||||
#############
|
||||
settings.title=Настройки
|
||||
settings.update=Доступно обновление
|
||||
settings.updateAvailable={0} is the current installed version. A new version ({1}) is available.
|
||||
settings.appVersion=Версия приложения:
|
||||
settings.downloadOption.title=Выберите вариант загрузки (для загрузки одного файла без zip):
|
||||
settings.downloadOption.1=Открыть в том же окне
|
||||
|
@ -112,6 +112,7 @@ navbar.settings=Podešavanja
|
||||
#############
|
||||
settings.title=Podešavanja
|
||||
settings.update=Dostupno ažuriranje
|
||||
settings.updateAvailable={0} is the current installed version. A new version ({1}) is available.
|
||||
settings.appVersion=Verzija aplikacije:
|
||||
settings.downloadOption.title=Odaberite opciju preuzimanja (Za preuzimanje pojedinačnih fajlova bez zip formata):
|
||||
settings.downloadOption.1=Otvori u istom prozoru
|
||||
|
@ -112,6 +112,7 @@ navbar.settings=Inställningar
|
||||
#############
|
||||
settings.title=Inställningar
|
||||
settings.update=Uppdatering tillgänglig
|
||||
settings.updateAvailable={0} is the current installed version. A new version ({1}) is available.
|
||||
settings.appVersion=Appversion:
|
||||
settings.downloadOption.title=Välj nedladdningsalternativ (för nedladdning av en fil utan zip):
|
||||
settings.downloadOption.1=Öppnas i samma fönster
|
||||
|
@ -112,6 +112,7 @@ navbar.settings=Ayarlar
|
||||
#############
|
||||
settings.title=Ayarlar
|
||||
settings.update=Güncelleme mevcut
|
||||
settings.updateAvailable={0} is the current installed version. A new version ({1}) is available.
|
||||
settings.appVersion=Uygulama Sürümü:
|
||||
settings.downloadOption.title=İndirme seçeneği seçin (Zip olmayan tek dosya indirmeler için):
|
||||
settings.downloadOption.1=Aynı pencerede aç
|
||||
|
@ -112,6 +112,7 @@ navbar.settings=Налаштування
|
||||
#############
|
||||
settings.title=Налаштування
|
||||
settings.update=Доступне оновлення
|
||||
settings.updateAvailable={0} is the current installed version. A new version ({1}) is available.
|
||||
settings.appVersion=Версія додатку:
|
||||
settings.downloadOption.title=Виберіть варіант завантаження (для завантаження одного файлу без zip):
|
||||
settings.downloadOption.1=Відкрити в тому ж вікні
|
||||
|
@ -112,6 +112,7 @@ navbar.settings=设置
|
||||
#############
|
||||
settings.title=设置
|
||||
settings.update=可更新
|
||||
settings.updateAvailable={0} is the current installed version. A new version ({1}) is available.
|
||||
settings.appVersion=应用程序版本:
|
||||
settings.downloadOption.title=选择下载选项(单个文件非压缩文件):
|
||||
settings.downloadOption.1=在同一窗口打开
|
||||
|
@ -112,6 +112,7 @@ navbar.settings=設定
|
||||
#############
|
||||
settings.title=設定
|
||||
settings.update=有更新可用
|
||||
settings.updateAvailable={0} is the current installed version. A new version ({1}) is available.
|
||||
settings.appVersion=應用版本:
|
||||
settings.downloadOption.title=選擇下載選項(對於單一檔案非壓縮下載):
|
||||
settings.downloadOption.1=在同一視窗中開啟
|
||||
|
@ -12,7 +12,9 @@ system:
|
||||
defaultLocale: 'en-US' # Set the default language (e.g. 'de-DE', 'fr-FR', etc)
|
||||
googlevisibility: false # 'true' to allow Google visibility (via robots.txt), 'false' to disallow
|
||||
enableAlphaFunctionality: false # Set to enable functionality which might need more testing before it fully goes live (This feature might make no changes)
|
||||
|
||||
showUpdate: true # see when a new update is available
|
||||
showUpdateOnlyAdmin: false # Only admins can see when a new update is available, depending on showUpdate it must be set to 'true'
|
||||
|
||||
#ui:
|
||||
# appName: exampleAppName # Application's visible name
|
||||
# homeDescription: I am a description # Short description or tagline shown on homepage.
|
||||
|
@ -89,3 +89,38 @@
|
||||
.jumbotron {
|
||||
padding: 3rem 3rem; /* Reduce vertical padding */
|
||||
}
|
||||
|
||||
.lookatme {
|
||||
opacity: 1;
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.lookatme::after {
|
||||
color: #e33100;
|
||||
text-shadow: 0 0 5px #e33100;
|
||||
/* in the html, the data-lookatme-text attribute must */
|
||||
/* contain the same text as the .lookatme element */
|
||||
content: attr(data-lookatme-text);
|
||||
padding: inherit;
|
||||
position: absolute;
|
||||
inset: 0 0 0 0;
|
||||
z-index: 1;
|
||||
/* 20 steps / 2 seconds = 10fps */
|
||||
-webkit-animation: 2s infinite Pulse steps(20);
|
||||
animation: 2s infinite Pulse steps(20);
|
||||
}
|
||||
|
||||
@keyframes Pulse {
|
||||
from {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
50% {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
to {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
1
src/main/resources/static/images/update.svg
Normal file
1
src/main/resources/static/images/update.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M21,10.12H14.22L16.96,7.3C14.23,4.6 9.81,4.5 7.08,7.2C4.35,9.91 4.35,14.28 7.08,17C9.81,19.7 14.23,19.7 16.96,17C18.32,15.65 19,14.08 19,12.1H21C21,14.08 20.12,16.65 18.36,18.39C14.85,21.87 9.15,21.87 5.64,18.39C2.14,14.92 2.11,9.28 5.62,5.81C9.13,2.34 14.76,2.34 18.27,5.81L21,3V10.12M12.5,8V12.25L16,14.33L15.28,15.54L11,13V8H12.5Z" /></svg>
|
After Width: | Height: | Size: 412 B |
@ -30,19 +30,39 @@ async function getLatestReleaseVersion() {
|
||||
|
||||
async function checkForUpdate() {
|
||||
// Initialize the update button as hidden
|
||||
var updateBtn = document.getElementById("update-btn");
|
||||
var updateBtn = document.getElementById("update-btn") || null;
|
||||
var updateLink = document.getElementById("update-link") || null;
|
||||
if (updateBtn !== null) {
|
||||
updateBtn.style.display = "none";
|
||||
}
|
||||
if (updateLink !== null) {
|
||||
console.log("hidden!");
|
||||
if (!updateLink.classList.contains("visually-hidden")) {
|
||||
updateLink.classList.add("visually-hidden");
|
||||
}
|
||||
}
|
||||
|
||||
const latestVersion = await getLatestReleaseVersion();
|
||||
console.log("latestVersion=" + latestVersion);
|
||||
console.log("currentVersion=" + currentVersion);
|
||||
console.log("compareVersions(latestVersion, currentVersion) > 0)=" + compareVersions(latestVersion, currentVersion));
|
||||
if (latestVersion && compareVersions(latestVersion, currentVersion) > 0) {
|
||||
document.getElementById("update-btn").style.display = "block";
|
||||
if (updateBtn != null) {
|
||||
document.getElementById("update-btn").style.display = "block";
|
||||
}
|
||||
if (updateLink !== null) {
|
||||
document.getElementById("app-update").innerHTML = updateAvailable.replace("{0}", '<b>' + currentVersion + '</b>').replace("{1}", '<b>' + latestVersion + '</b>');
|
||||
if (updateLink.classList.contains("visually-hidden")) {
|
||||
updateLink.classList.remove("visually-hidden");
|
||||
}
|
||||
}
|
||||
console.log("visible");
|
||||
} else {
|
||||
if (updateLink !== null) {
|
||||
if (!updateLink.classList.contains("visually-hidden")) {
|
||||
updateLink.classList.add("visually-hidden");
|
||||
}
|
||||
}
|
||||
console.log("hidden");
|
||||
}
|
||||
}
|
||||
|
@ -46,6 +46,12 @@ function reorderCards() {
|
||||
cards.sort(function (a, b) {
|
||||
var aIsFavorite = localStorage.getItem(a.id) === "favorite";
|
||||
var bIsFavorite = localStorage.getItem(b.id) === "favorite";
|
||||
if (a.id === "update-link") {
|
||||
return -1;
|
||||
}
|
||||
if (b.id === "update-link") {
|
||||
return 1;
|
||||
}
|
||||
if (aIsFavorite && !bIsFavorite) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
<script th:inline="javascript">
|
||||
const currentVersion = /*[[${@appVersion}]]*/ '';
|
||||
const noFavourites = /*[[#{noFavourites}]]*/ '';
|
||||
const updateAvailable = /*[[#{settings.updateAvailable}]]*/ '';
|
||||
</script>
|
||||
<script th:src="@{js/githubVersion.js}"></script>
|
||||
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
||||
@ -194,7 +195,7 @@
|
||||
<p class="mb-0" th:utext="#{settings.appVersion} + ' ' + ${@appVersion}"></p>
|
||||
<a href="https://github.com/sponsors/Frooodle" class="btn btn-sm btn-outline-primary" role="button" target="_blank" th:text="#{sponsor}+' Stirling-PDF'"></a>
|
||||
<a href="swagger-ui/index.html" class="btn btn-sm btn-outline-primary" role="button" target="_blank">API</a>
|
||||
<a href="https://github.com/Stirling-Tools/Stirling-PDF/releases" class="btn btn-sm btn-outline-primary" id="update-btn" th:utext="#{settings.update}" role="button" target="_blank"></a>
|
||||
<a th:if="${@shouldShow}" href="https://github.com/Stirling-Tools/Stirling-PDF/releases" class="btn btn-sm btn-outline-primary" id="update-btn" th:utext="#{settings.update}" role="button" target="_blank" rel="noopener"></a>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="downloadOption" th:utext="#{settings.downloadOption.title}"></label>
|
||||
@ -210,7 +211,7 @@
|
||||
<span id="zipThresholdValue" class="ms-2"></span>
|
||||
</div>
|
||||
<div class="mb-3 form-check">
|
||||
<input type="checkbox" class="form-check-input" id="boredWaiting" th:title="#{settings.bored.help}">
|
||||
<input type="checkbox" class="form-check-input"id="boredWaiting" th:title="#{settings.bored.help}">
|
||||
<label class="form-check-label" for="boredWaiting" th:text="#{bored}"></label>
|
||||
</div>
|
||||
<div class="mb-3 form-check">
|
||||
|
@ -23,6 +23,15 @@
|
||||
<br>
|
||||
<input type="text" id="searchBar" onkeyup="filterCards()" th:placeholder="#{home.searchBar}" autofocus>
|
||||
<div class="features-container">
|
||||
<div th:if="${@shouldShow}" class="feature-card favorite" id="update-link" style="display: none;">
|
||||
<a href="https://github.com/Stirling-Tools/Stirling-PDF/releases" target="_blank" class="nav-link text-body-secondary px-2" rel="noopener">
|
||||
<div class="d-flex align-items-center">
|
||||
<img class="card-icon home-card-icon home-card-icon-colour" src="images/update.svg" alt="Icon" width="30" height="30">
|
||||
<h5 class="card-title lookatme ms-2" th:text="#{settings.update}" th:data-lookatme-text="#{settings.update}"></h5>
|
||||
</div>
|
||||
<p class="card-text" id="app-update"></p>
|
||||
</a>
|
||||
</div>
|
||||
<div th:replace="~{fragments/card :: card(id='pipeline', cardTitle=#{home.pipeline.title}, cardText=#{home.pipeline.desc}, cardLink='pipeline', svgPath='images/pipeline.svg', tags=#{pipeline.tags})}"></div>
|
||||
|
||||
<div th:replace="~{fragments/card :: card(id='view-pdf', cardTitle=#{home.viewPdf.title}, cardText=#{home.viewPdf.desc}, cardLink='view-pdf', svgPath='images/book-opened.svg', tags=#{viewPdf.tags})}"></div>
|
||||
|
Loading…
Reference in New Issue
Block a user