diff --git a/README.md b/README.md
index e00c6b354..a7bca3264 100644
--- a/README.md
+++ b/README.md
@@ -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
diff --git a/src/main/java/stirling/software/SPDF/config/AppUpdateService.java b/src/main/java/stirling/software/SPDF/config/AppUpdateService.java
new file mode 100644
index 000000000..7c7a9a49c
--- /dev/null
+++ b/src/main/java/stirling/software/SPDF/config/AppUpdateService.java
@@ -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;
+ }
+}
diff --git a/src/main/java/stirling/software/SPDF/config/ShowAdminInterface.java b/src/main/java/stirling/software/SPDF/config/ShowAdminInterface.java
new file mode 100644
index 000000000..e49376e27
--- /dev/null
+++ b/src/main/java/stirling/software/SPDF/config/ShowAdminInterface.java
@@ -0,0 +1,7 @@
+package stirling.software.SPDF.config;
+
+public interface ShowAdminInterface {
+ default boolean getShowUpdateOnlyAdmins() {
+ return true;
+ }
+}
diff --git a/src/main/java/stirling/software/SPDF/config/security/AppUpdateAuthService.java b/src/main/java/stirling/software/SPDF/config/security/AppUpdateAuthService.java
new file mode 100644
index 000000000..0da07c612
--- /dev/null
+++ b/src/main/java/stirling/software/SPDF/config/security/AppUpdateAuthService.java
@@ -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 = userRepository.findByUsername(authentication.getName());
+ if (user.isPresent() && showUpdateOnlyAdmin) {
+ return "ROLE_ADMIN".equals(user.get().getRolesAsString());
+ }
+
+ return showUpdate;
+ }
+}
diff --git a/src/main/java/stirling/software/SPDF/controller/web/OtherWebController.java b/src/main/java/stirling/software/SPDF/controller/web/OtherWebController.java
index b93a89e4b..b373d17a8 100644
--- a/src/main/java/stirling/software/SPDF/controller/web/OtherWebController.java
+++ b/src/main/java/stirling/software/SPDF/controller/web/OtherWebController.java
@@ -17,6 +17,7 @@
@Controller
@Tag(name = "Misc", description = "Miscellaneous APIs")
public class OtherWebController {
+
@GetMapping("/compress-pdf")
@Hidden
public String compressPdfForm(Model model) {
diff --git a/src/main/java/stirling/software/SPDF/model/ApplicationProperties.java b/src/main/java/stirling/software/SPDF/model/ApplicationProperties.java
index a41d641c4..1a2aeaec0 100644
--- a/src/main/java/stirling/software/SPDF/model/ApplicationProperties.java
+++ b/src/main/java/stirling/software/SPDF/model/ApplicationProperties.java
@@ -210,6 +210,24 @@ public static class System {
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 String toString() {
+ maxFileSize
+ ", enableAlphaFunctionality="
+ enableAlphaFunctionality
+ + ", showUpdate="
+ + showUpdate
+ + ", showUpdateOnlyAdmin="
+ + showUpdateOnlyAdmin
+ "]";
}
}
diff --git a/src/main/resources/messages_ar_AR.properties b/src/main/resources/messages_ar_AR.properties
index 44329a7b2..ac90792a4 100644
--- a/src/main/resources/messages_ar_AR.properties
+++ b/src/main/resources/messages_ar_AR.properties
@@ -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=فتح في نفس النافذة
diff --git a/src/main/resources/messages_bg_BG.properties b/src/main/resources/messages_bg_BG.properties
index 719839555..6262d46d4 100644
--- a/src/main/resources/messages_bg_BG.properties
+++ b/src/main/resources/messages_bg_BG.properties
@@ -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=Отваряне в същия прозорец
diff --git a/src/main/resources/messages_ca_CA.properties b/src/main/resources/messages_ca_CA.properties
index 1c5fcea3c..6071b16b5 100644
--- a/src/main/resources/messages_ca_CA.properties
+++ b/src/main/resources/messages_ca_CA.properties
@@ -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
diff --git a/src/main/resources/messages_de_DE.properties b/src/main/resources/messages_de_DE.properties
index 57ea05a16..729597be5 100644
--- a/src/main/resources/messages_de_DE.properties
+++ b/src/main/resources/messages_de_DE.properties
@@ -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
diff --git a/src/main/resources/messages_el_GR.properties b/src/main/resources/messages_el_GR.properties
index dac14ac7c..93ab31e21 100644
--- a/src/main/resources/messages_el_GR.properties
+++ b/src/main/resources/messages_el_GR.properties
@@ -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=Άνοιγμα στο ίδιο παράθυρο
diff --git a/src/main/resources/messages_en_GB.properties b/src/main/resources/messages_en_GB.properties
index bae8f923a..30bcb9fdf 100644
--- a/src/main/resources/messages_en_GB.properties
+++ b/src/main/resources/messages_en_GB.properties
@@ -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
diff --git a/src/main/resources/messages_en_US.properties b/src/main/resources/messages_en_US.properties
index 1126d0ce6..3f0c7afb7 100644
--- a/src/main/resources/messages_en_US.properties
+++ b/src/main/resources/messages_en_US.properties
@@ -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
diff --git a/src/main/resources/messages_es_ES.properties b/src/main/resources/messages_es_ES.properties
index 0da4273f3..bdb42a948 100644
--- a/src/main/resources/messages_es_ES.properties
+++ b/src/main/resources/messages_es_ES.properties
@@ -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
diff --git a/src/main/resources/messages_eu_ES.properties b/src/main/resources/messages_eu_ES.properties
index ec20aa7f8..1f8f6b6de 100644
--- a/src/main/resources/messages_eu_ES.properties
+++ b/src/main/resources/messages_eu_ES.properties
@@ -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
diff --git a/src/main/resources/messages_fr_FR.properties b/src/main/resources/messages_fr_FR.properties
index 23578dcc7..3aa55d09d 100644
--- a/src/main/resources/messages_fr_FR.properties
+++ b/src/main/resources/messages_fr_FR.properties
@@ -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
diff --git a/src/main/resources/messages_hi_IN.properties b/src/main/resources/messages_hi_IN.properties
index 898e223f4..b660d678d 100644
--- a/src/main/resources/messages_hi_IN.properties
+++ b/src/main/resources/messages_hi_IN.properties
@@ -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=एक ही विंडो में खोलें
diff --git a/src/main/resources/messages_hu_HU.properties b/src/main/resources/messages_hu_HU.properties
index 03f7f2b39..c9a4957b1 100644
--- a/src/main/resources/messages_hu_HU.properties
+++ b/src/main/resources/messages_hu_HU.properties
@@ -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
diff --git a/src/main/resources/messages_id_ID.properties b/src/main/resources/messages_id_ID.properties
index 697bb17b6..3cbcc8721 100644
--- a/src/main/resources/messages_id_ID.properties
+++ b/src/main/resources/messages_id_ID.properties
@@ -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
diff --git a/src/main/resources/messages_it_IT.properties b/src/main/resources/messages_it_IT.properties
index a913d534a..fa67dcd1b 100644
--- a/src/main/resources/messages_it_IT.properties
+++ b/src/main/resources/messages_it_IT.properties
@@ -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
diff --git a/src/main/resources/messages_ja_JP.properties b/src/main/resources/messages_ja_JP.properties
index b4260c5a4..fed178836 100644
--- a/src/main/resources/messages_ja_JP.properties
+++ b/src/main/resources/messages_ja_JP.properties
@@ -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=同じウィンドウで開く
diff --git a/src/main/resources/messages_ko_KR.properties b/src/main/resources/messages_ko_KR.properties
index d78d71595..3b1d3441d 100644
--- a/src/main/resources/messages_ko_KR.properties
+++ b/src/main/resources/messages_ko_KR.properties
@@ -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=현재 창에서 열기
diff --git a/src/main/resources/messages_nl_NL.properties b/src/main/resources/messages_nl_NL.properties
index 38bdfdf01..e5668210f 100644
--- a/src/main/resources/messages_nl_NL.properties
+++ b/src/main/resources/messages_nl_NL.properties
@@ -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
diff --git a/src/main/resources/messages_pl_PL.properties b/src/main/resources/messages_pl_PL.properties
index 7f72cc23f..c94f72cbc 100644
--- a/src/main/resources/messages_pl_PL.properties
+++ b/src/main/resources/messages_pl_PL.properties
@@ -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
diff --git a/src/main/resources/messages_pt_BR.properties b/src/main/resources/messages_pt_BR.properties
index 5a8d3d1fc..b03402be5 100644
--- a/src/main/resources/messages_pt_BR.properties
+++ b/src/main/resources/messages_pt_BR.properties
@@ -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
diff --git a/src/main/resources/messages_pt_PT.properties b/src/main/resources/messages_pt_PT.properties
index 4abeed7f2..c1662afe6 100644
--- a/src/main/resources/messages_pt_PT.properties
+++ b/src/main/resources/messages_pt_PT.properties
@@ -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
diff --git a/src/main/resources/messages_ro_RO.properties b/src/main/resources/messages_ro_RO.properties
index 7edcc2d20..949f34cf8 100644
--- a/src/main/resources/messages_ro_RO.properties
+++ b/src/main/resources/messages_ro_RO.properties
@@ -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ă
diff --git a/src/main/resources/messages_ru_RU.properties b/src/main/resources/messages_ru_RU.properties
index b0d5cfc71..3d20fc0bc 100644
--- a/src/main/resources/messages_ru_RU.properties
+++ b/src/main/resources/messages_ru_RU.properties
@@ -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=Открыть в том же окне
diff --git a/src/main/resources/messages_sr_LATN_RS.properties b/src/main/resources/messages_sr_LATN_RS.properties
index db5499bcd..7cdd2f249 100644
--- a/src/main/resources/messages_sr_LATN_RS.properties
+++ b/src/main/resources/messages_sr_LATN_RS.properties
@@ -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
diff --git a/src/main/resources/messages_sv_SE.properties b/src/main/resources/messages_sv_SE.properties
index a5d7e5f29..afa342704 100644
--- a/src/main/resources/messages_sv_SE.properties
+++ b/src/main/resources/messages_sv_SE.properties
@@ -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
diff --git a/src/main/resources/messages_tr_TR.properties b/src/main/resources/messages_tr_TR.properties
index cb7cbb078..2ec0bd6b4 100644
--- a/src/main/resources/messages_tr_TR.properties
+++ b/src/main/resources/messages_tr_TR.properties
@@ -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ç
diff --git a/src/main/resources/messages_uk_UA.properties b/src/main/resources/messages_uk_UA.properties
index 8016ebd7a..8a77d064b 100644
--- a/src/main/resources/messages_uk_UA.properties
+++ b/src/main/resources/messages_uk_UA.properties
@@ -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=Відкрити в тому ж вікні
diff --git a/src/main/resources/messages_zh_CN.properties b/src/main/resources/messages_zh_CN.properties
index f1fb4ced9..f10f39309 100644
--- a/src/main/resources/messages_zh_CN.properties
+++ b/src/main/resources/messages_zh_CN.properties
@@ -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=在同一窗口打开
diff --git a/src/main/resources/messages_zh_TW.properties b/src/main/resources/messages_zh_TW.properties
index b2d09e101..c2cfbadb4 100644
--- a/src/main/resources/messages_zh_TW.properties
+++ b/src/main/resources/messages_zh_TW.properties
@@ -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=在同一視窗中開啟
diff --git a/src/main/resources/settings.yml.template b/src/main/resources/settings.yml.template
index 0a326e17e..b3d6e9544 100644
--- a/src/main/resources/settings.yml.template
+++ b/src/main/resources/settings.yml.template
@@ -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.
diff --git a/src/main/resources/static/css/home.css b/src/main/resources/static/css/home.css
index d975dd79f..ff8d1cf7d 100644
--- a/src/main/resources/static/css/home.css
+++ b/src/main/resources/static/css/home.css
@@ -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;
+ }
+}
diff --git a/src/main/resources/static/images/update.svg b/src/main/resources/static/images/update.svg
new file mode 100644
index 000000000..3edc4c67d
--- /dev/null
+++ b/src/main/resources/static/images/update.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/main/resources/static/js/githubVersion.js b/src/main/resources/static/js/githubVersion.js
index e17524d54..b312fd85e 100644
--- a/src/main/resources/static/js/githubVersion.js
+++ b/src/main/resources/static/js/githubVersion.js
@@ -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}", '' + currentVersion + '').replace("{1}", '' + latestVersion + '');
+ 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");
}
}
diff --git a/src/main/resources/static/js/homecard.js b/src/main/resources/static/js/homecard.js
index 8ac2ef443..c461af3c3 100644
--- a/src/main/resources/static/js/homecard.js
+++ b/src/main/resources/static/js/homecard.js
@@ -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;
}
diff --git a/src/main/resources/templates/fragments/navbar.html b/src/main/resources/templates/fragments/navbar.html
index 09b833dd3..414ff51fa 100644
--- a/src/main/resources/templates/fragments/navbar.html
+++ b/src/main/resources/templates/fragments/navbar.html
@@ -3,6 +3,7 @@