Windows Installer tweaks
|
@ -5499,6 +5499,10 @@
|
|||
"message": "Failed to uninstall old application files. Please try running the installer again.",
|
||||
"description": "Displayed when Windows installer cannot uninstall the old application"
|
||||
},
|
||||
"icu:NSIS__semver-downgrade": {
|
||||
"messageformat": "A newer version of Signal is already installed. Are you sure you want to continue?",
|
||||
"description": "A text of the dialog displayed when user tries to overwrite Signal installation with an older version."
|
||||
},
|
||||
"CrashReportDialog__title": {
|
||||
"message": "Application crashed",
|
||||
"description": "A title of the dialog displayed when starting an application after a recent crash"
|
||||
|
|
83
build/SignalStrings.nsh
Normal file
|
@ -0,0 +1,83 @@
|
|||
# Copyright 2023 Signal Messenger, LLC
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
#
|
||||
# DO NOT EDIT. This is a generated file.
|
||||
|
||||
# en_US
|
||||
LangString signalMinWinVersionErr 1033 "Signal desktop no longer works on this computer. To use Signal desktop again, update your computer’s version of Windows."
|
||||
LangString signalMinAppVersionErr 1033 "A newer version of Signal is already installed. Are you sure you want to continue?"
|
||||
# de_DE
|
||||
LangString signalMinWinVersionErr 1031 "Signal Desktop funktioniert auf diesem Computer nicht mehr. Um Signal Desktop wieder verwenden zu können, aktualisiere die Windows-Version deines Computers."
|
||||
LangString signalMinAppVersionErr 1031 "A newer version of Signal is already installed. Are you sure you want to continue?"
|
||||
# fr_FR
|
||||
LangString signalMinWinVersionErr 1036 "La version Desktop de Signal ne fonctionne plus sur cet ordinateur. Pour continuer d’utiliser la version Desktop de Signal, veuillez mettre à jour la version Windows de votre ordinateur."
|
||||
LangString signalMinAppVersionErr 1036 "A newer version of Signal is already installed. Are you sure you want to continue?"
|
||||
# es_ES
|
||||
LangString signalMinWinVersionErr 3082 "Signal para Escritorio ya no funciona en este ordenador. Para volver a usar Signal para Escritorio, actualiza la versión de Windows de tu ordenador."
|
||||
LangString signalMinAppVersionErr 3082 "A newer version of Signal is already installed. Are you sure you want to continue?"
|
||||
# zh_CN
|
||||
LangString signalMinWinVersionErr 2052 "Signal desktop 无法在此电脑上运行。如您希望再次使用 Signal desktop,请更新您电脑的 Windows 版本。"
|
||||
LangString signalMinAppVersionErr 2052 "A newer version of Signal is already installed. Are you sure you want to continue?"
|
||||
# zh_TW
|
||||
LangString signalMinWinVersionErr 1028 "Signal 桌面版不再適用於此電腦。如要再次使用 Signal 桌面版,請更新電腦的 Windows 版本。"
|
||||
LangString signalMinAppVersionErr 1028 "A newer version of Signal is already installed. Are you sure you want to continue?"
|
||||
# ja_JP
|
||||
LangString signalMinWinVersionErr 1041 "このコンピュータではSignal desktopは動作しなくなりました。Signal desktopを再びご利用になる場合は、お使いのコンピュータのバージョンWindowsをアップデートしてください。"
|
||||
LangString signalMinAppVersionErr 1041 "A newer version of Signal is already installed. Are you sure you want to continue?"
|
||||
# ko_KR
|
||||
LangString signalMinWinVersionErr 1042 "Signal 데스크톱이 이 컴퓨터에서 더 이상 작동하지 않습니다. Signal 데스크톱을 다시 사용하려면 컴퓨터의 Windows 버전을 업데이트하세요."
|
||||
LangString signalMinAppVersionErr 1042 "A newer version of Signal is already installed. Are you sure you want to continue?"
|
||||
# it_IT
|
||||
LangString signalMinWinVersionErr 1040 "Signal desktop non funziona più su questo computer. Per usare di nuovo Signal desktop, aggiorna la versione di Windows presente sul tuo computer."
|
||||
LangString signalMinAppVersionErr 1040 "A newer version of Signal is already installed. Are you sure you want to continue?"
|
||||
# nl_NL
|
||||
LangString signalMinWinVersionErr 1043 "Signal Desktop werkt niet meer op deze computer. Werk de versie van Windows op je computer bij om Signal Desktop weer te gebruiken."
|
||||
LangString signalMinAppVersionErr 1043 "A newer version of Signal is already installed. Are you sure you want to continue?"
|
||||
# da_DK
|
||||
LangString signalMinWinVersionErr 1030 "Signal Desktop fungerer ikke længere på denne computer. Hvis du vil bruge Signal Desktop igen, skal du opdatere din computers version af Windows."
|
||||
LangString signalMinAppVersionErr 1030 "A newer version of Signal is already installed. Are you sure you want to continue?"
|
||||
# sv_SE
|
||||
LangString signalMinWinVersionErr 1053 "Signal Desktop fungerar inte längre på den här datorn. Uppdatera datorns version av Windows för att använda Signal Desktop igen."
|
||||
LangString signalMinAppVersionErr 1053 "A newer version of Signal is already installed. Are you sure you want to continue?"
|
||||
# nb_NO
|
||||
LangString signalMinWinVersionErr 1044 "Signal Desktop fungerer ikke lenger på denne datamaskinen. Du må oppdatere til en nyere versjon av Windows for å kunne bruke Signal igjen."
|
||||
LangString signalMinAppVersionErr 1044 "A newer version of Signal is already installed. Are you sure you want to continue?"
|
||||
# fi_FI
|
||||
LangString signalMinWinVersionErr 1035 "Signalin työpöytäsovellus ei enää toimi tässä tietokoneessa. Jos haluat käyttää Signalin työpöytäsovellusta uudelleen, päivitä tietokoneesi Windows-versio."
|
||||
LangString signalMinAppVersionErr 1035 "A newer version of Signal is already installed. Are you sure you want to continue?"
|
||||
# ru_RU
|
||||
LangString signalMinWinVersionErr 1049 "Signal Desktop больше не работает на этом компьютере. Чтобы продолжить использовать Signal Desktop, обновите версию Windows на своём компьютере."
|
||||
LangString signalMinAppVersionErr 1049 "A newer version of Signal is already installed. Are you sure you want to continue?"
|
||||
# pt_PT
|
||||
LangString signalMinWinVersionErr 2070 "A versão desktop do Signal já não funciona neste computador. Para usar a versão desktop do Signal outra vez, atualize a versão do Windows do seu computador."
|
||||
LangString signalMinAppVersionErr 2070 "A newer version of Signal is already installed. Are you sure you want to continue?"
|
||||
# pt_BR
|
||||
LangString signalMinWinVersionErr 1046 "O Signal para desktop não funciona mais neste computador. Para usar o Signal para desktop novamente, atualize a versão do Windows do seu computador."
|
||||
LangString signalMinAppVersionErr 1046 "A newer version of Signal is already installed. Are you sure you want to continue?"
|
||||
# pl_PL
|
||||
LangString signalMinWinVersionErr 1045 "Signal Desktop już nie działa na tym komputerze. Aby móc znów obsługiwać Signal Desktop, zaktualizuj Windows na swoim komputerze."
|
||||
LangString signalMinAppVersionErr 1045 "A newer version of Signal is already installed. Are you sure you want to continue?"
|
||||
# uk_UA
|
||||
LangString signalMinWinVersionErr 1058 "Signal більше не працює на цьому комп'ютері. Щоб знову користуватися Signal, оновіть версію Windows вашого комп'ютера."
|
||||
LangString signalMinAppVersionErr 1058 "A newer version of Signal is already installed. Are you sure you want to continue?"
|
||||
# cs_CZ
|
||||
LangString signalMinWinVersionErr 1029 "Aplikace Signal desktop již na tomto počítači nefunguje. Pokud chcete aplikaci Signal desktop opět používat, aktualizujte na svém počítači verzi Windows."
|
||||
LangString signalMinAppVersionErr 1029 "A newer version of Signal is already installed. Are you sure you want to continue?"
|
||||
# sk_SK
|
||||
LangString signalMinWinVersionErr 1051 "Signal desktop už na tomto počítači nefunguje. Ak chcete znova používať Signal desktop, aktualizujte verziu Windows na svojom počítači."
|
||||
LangString signalMinAppVersionErr 1051 "A newer version of Signal is already installed. Are you sure you want to continue?"
|
||||
# hu_HU
|
||||
LangString signalMinWinVersionErr 1038 "A Signal asztali számítógépről elérhető változata már nem működik ezen a számítógépen. A Signal asztali számítógépről elérhető változatának ismételt használatához frissítsd a számítógépeden a(z) Windows verzióját."
|
||||
LangString signalMinAppVersionErr 1038 "A newer version of Signal is already installed. Are you sure you want to continue?"
|
||||
# ar_SA
|
||||
LangString signalMinWinVersionErr 1025 "لم يعُد تطبيق Signal يَعمل على هذا الحاسوب. لاستخدام تطبيق Signal الخاص بالحاسوب مرة أخرى، يُرجى تحديث إصدار Windows لحاسوبك."
|
||||
LangString signalMinAppVersionErr 1025 "A newer version of Signal is already installed. Are you sure you want to continue?"
|
||||
# tr_TR
|
||||
LangString signalMinWinVersionErr 1055 "Signal masaüstü artık bu bilgisayarda çalışmıyor. Signal masaüstünü tekrar kullanmak için bilgisayarının Windows sürümünü güncelle."
|
||||
LangString signalMinAppVersionErr 1055 "A newer version of Signal is already installed. Are you sure you want to continue?"
|
||||
# th_TH
|
||||
LangString signalMinWinVersionErr 1054 "คอมพิวเตอร์เครื่องนี้ไม่รองรับการใช้งาน Signal เดสก์ท็อปอีกต่อไป หากต้องการใช้งาน Signal เดสก์ท็อปต่อ กรุณาอัปเดตเวอร์ชันของ Windows ที่คอมพิวเตอร์คุณใช้งานอยู่"
|
||||
LangString signalMinAppVersionErr 1054 "A newer version of Signal is already installed. Are you sure you want to continue?"
|
||||
# vi_VN
|
||||
LangString signalMinWinVersionErr 1066 "Signal desktop không còn hoạt động được trên máy tính này. Để có thể tiếp tục sử dụng Signal desktop, cập nhật phiên bản của hệ điều hành Windows trên máy tính bạn."
|
||||
LangString signalMinAppVersionErr 1066 "A newer version of Signal is already installed. Are you sure you want to continue?"
|
BIN
build/icon.ico
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 281 KiB |
Before Width: | Height: | Size: 128 KiB After Width: | Height: | Size: 164 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 8.3 KiB |
Before Width: | Height: | Size: 978 B After Width: | Height: | Size: 651 B |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 1 KiB |
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 69 KiB |
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 120 KiB After Width: | Height: | Size: 281 KiB |
|
@ -1,64 +1,47 @@
|
|||
# DO NOT EDIT. This is a generated file.
|
||||
# Copyright 2023 Signal Messenger, LLC
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
!include WinVer.nsh
|
||||
!include SignalStrings.nsh
|
||||
|
||||
# en_US
|
||||
LangString signalMinWinVersionErr 1033 "Signal desktop no longer works on this computer. To use Signal desktop again, update your computer’s version of Windows."
|
||||
# de_DE
|
||||
LangString signalMinWinVersionErr 1031 "Signal Desktop funktioniert auf diesem Computer nicht mehr. Um Signal Desktop wieder verwenden zu können, aktualisiere die Windows-Version deines Computers."
|
||||
# fr_FR
|
||||
LangString signalMinWinVersionErr 1036 "La version Desktop de Signal ne fonctionne plus sur cet ordinateur. Pour continuer d’utiliser la version Desktop de Signal, veuillez mettre à jour la version Windows de votre ordinateur."
|
||||
# es_ES
|
||||
LangString signalMinWinVersionErr 3082 "Signal para Escritorio ya no funciona en este ordenador. Para volver a usar Signal para Escritorio, actualiza la versión de Windows de tu ordenador."
|
||||
# zh_CN
|
||||
LangString signalMinWinVersionErr 2052 "Signal desktop 无法在此电脑上运行。如您希望再次使用 Signal desktop,请更新您电脑的 Windows 版本。"
|
||||
# zh_TW
|
||||
LangString signalMinWinVersionErr 1028 "Signal 桌面版不再適用於此電腦。如要再次使用 Signal 桌面版,請更新電腦的 Windows 版本。"
|
||||
# ja_JP
|
||||
LangString signalMinWinVersionErr 1041 "このコンピュータではSignal desktopは動作しなくなりました。Signal desktopを再びご利用になる場合は、お使いのコンピュータのバージョンWindowsをアップデートしてください。"
|
||||
# ko_KR
|
||||
LangString signalMinWinVersionErr 1042 "Signal 데스크톱이 이 컴퓨터에서 더 이상 작동하지 않습니다. Signal 데스크톱을 다시 사용하려면 컴퓨터의 Windows 버전을 업데이트하세요."
|
||||
# it_IT
|
||||
LangString signalMinWinVersionErr 1040 "Signal desktop non funziona più su questo computer. Per usare di nuovo Signal desktop, aggiorna la versione di Windows presente sul tuo computer."
|
||||
# nl_NL
|
||||
LangString signalMinWinVersionErr 1043 "Signal Desktop werkt niet meer op deze computer. Werk de versie van Windows op je computer bij om Signal Desktop weer te gebruiken."
|
||||
# da_DK
|
||||
LangString signalMinWinVersionErr 1030 "Signal Desktop fungerer ikke længere på denne computer. Hvis du vil bruge Signal Desktop igen, skal du opdatere din computers version af Windows."
|
||||
# sv_SE
|
||||
LangString signalMinWinVersionErr 1053 "Signal Desktop fungerar inte längre på den här datorn. Uppdatera datorns version av Windows för att använda Signal Desktop igen."
|
||||
# nb_NO
|
||||
LangString signalMinWinVersionErr 1044 "Signal Desktop fungerer ikke lenger på denne datamaskinen. Du må oppdatere til en nyere versjon av Windows for å kunne bruke Signal igjen."
|
||||
# fi_FI
|
||||
LangString signalMinWinVersionErr 1035 "Signalin työpöytäsovellus ei enää toimi tässä tietokoneessa. Jos haluat käyttää Signalin työpöytäsovellusta uudelleen, päivitä tietokoneesi Windows-versio."
|
||||
# ru_RU
|
||||
LangString signalMinWinVersionErr 1049 "Signal Desktop больше не работает на этом компьютере. Чтобы продолжить использовать Signal Desktop, обновите версию Windows на своём компьютере."
|
||||
# pt_PT
|
||||
LangString signalMinWinVersionErr 2070 "A versão desktop do Signal já não funciona neste computador. Para usar a versão desktop do Signal outra vez, atualize a versão do Windows do seu computador."
|
||||
# pt_BR
|
||||
LangString signalMinWinVersionErr 1046 "O Signal para desktop não funciona mais neste computador. Para usar o Signal para desktop novamente, atualize a versão do Windows do seu computador."
|
||||
# pl_PL
|
||||
LangString signalMinWinVersionErr 1045 "Signal Desktop już nie działa na tym komputerze. Aby móc znów obsługiwać Signal Desktop, zaktualizuj Windows na swoim komputerze."
|
||||
# uk_UA
|
||||
LangString signalMinWinVersionErr 1058 "Signal більше не працює на цьому комп'ютері. Щоб знову користуватися Signal, оновіть версію Windows вашого комп'ютера."
|
||||
# cs_CZ
|
||||
LangString signalMinWinVersionErr 1029 "Aplikace Signal desktop již na tomto počítači nefunguje. Pokud chcete aplikaci Signal desktop opět používat, aktualizujte na svém počítači verzi Windows."
|
||||
# sk_SK
|
||||
LangString signalMinWinVersionErr 1051 "Signal desktop už na tomto počítači nefunguje. Ak chcete znova používať Signal desktop, aktualizujte verziu Windows na svojom počítači."
|
||||
# hu_HU
|
||||
LangString signalMinWinVersionErr 1038 "A Signal asztali számítógépről elérhető változata már nem működik ezen a számítógépen. A Signal asztali számítógépről elérhető változatának ismételt használatához frissítsd a számítógépeden a(z) Windows verzióját."
|
||||
# ar_SA
|
||||
LangString signalMinWinVersionErr 1025 "لم يعُد تطبيق Signal يَعمل على هذا الحاسوب. لاستخدام تطبيق Signal الخاص بالحاسوب مرة أخرى، يُرجى تحديث إصدار Windows لحاسوبك."
|
||||
# tr_TR
|
||||
LangString signalMinWinVersionErr 1055 "Signal masaüstü artık bu bilgisayarda çalışmıyor. Signal masaüstünü tekrar kullanmak için bilgisayarının Windows sürümünü güncelle."
|
||||
# th_TH
|
||||
LangString signalMinWinVersionErr 1054 "คอมพิวเตอร์เครื่องนี้ไม่รองรับการใช้งาน Signal เดสก์ท็อปอีกต่อไป หากต้องการใช้งาน Signal เดสก์ท็อปต่อ กรุณาอัปเดตเวอร์ชันของ Windows ที่คอมพิวเตอร์คุณใช้งานอยู่"
|
||||
# vi_VN
|
||||
LangString signalMinWinVersionErr 1066 "Signal desktop không còn hoạt động được trên máy tính này. Để có thể tiếp tục sử dụng Signal desktop, cập nhật phiên bản của hệ điều hành Windows trên máy tính bạn."
|
||||
ManifestDPIAware true
|
||||
|
||||
!macro preInit
|
||||
Var /Global OLD_SIGNAL_VERSION
|
||||
|
||||
# Check minimum OS version
|
||||
${IfNot} ${AtLeastWin7}
|
||||
MessageBox MB_OK|MB_ICONEXCLAMATION "$(signalMinWinVersionErr)"
|
||||
DetailPrint `Windows version check failed`
|
||||
Abort
|
||||
${EndIf}
|
||||
|
||||
# If previously installed
|
||||
ReadRegStr $OLD_SIGNAL_VERSION SHELL_CONTEXT "${UNINSTALL_REGISTRY_KEY}" \
|
||||
"DisplayVersion"
|
||||
StrCmp $OLD_SIGNAL_VERSION "" end_semver_check
|
||||
|
||||
# Check that we are not overwriting newer version of the app.
|
||||
${StdUtils.ScanStr3} $R0 $R1 $R2 "%d.%d.%d" $OLD_SIGNAL_VERSION 0 0 0
|
||||
${StdUtils.ScanStr3} $R3 $R4 $R5 "%d.%d.%d" ${VERSION} 0 0 0
|
||||
|
||||
# Compare major number
|
||||
IntCmp $R0 $R3 same_major end_semver_check downgrade
|
||||
|
||||
# Compare minor number
|
||||
same_major:
|
||||
IntCmp $R1 $R4 same_minor end_semver_check downgrade
|
||||
|
||||
# Compare patch number
|
||||
same_minor:
|
||||
IntCmp $R2 $R5 end_semver_check end_semver_check downgrade
|
||||
|
||||
# Detected downgrade - show message box
|
||||
downgrade:
|
||||
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
|
||||
"$(signalMinAppVersionErr)" /SD IDCANCEL IDOK end_semver_check
|
||||
DetailPrint `SemVer check failed`
|
||||
Abort
|
||||
|
||||
end_semver_check:
|
||||
!macroend
|
||||
|
|
BIN
build/installerHeaderIcon.ico
Normal file
After Width: | Height: | Size: 84 KiB |
BIN
build/installerIcon.ico
Normal file
After Width: | Height: | Size: 281 KiB |
|
@ -12,7 +12,7 @@ index ffcc8bd..bafab0e 100644
|
|||
}
|
||||
const desktopMeta = {
|
||||
diff --git a/node_modules/app-builder-lib/scheme.json b/node_modules/app-builder-lib/scheme.json
|
||||
index 4ce62d9..e9729c1 100644
|
||||
index 4ce62d9..aea0e0b 100644
|
||||
--- a/node_modules/app-builder-lib/scheme.json
|
||||
+++ b/node_modules/app-builder-lib/scheme.json
|
||||
@@ -4749,6 +4749,10 @@
|
||||
|
@ -39,6 +39,50 @@ index 1536059..555f8f5 100644
|
|||
-
|
||||
update-mime-database /usr/share/mime || true
|
||||
update-desktop-database /usr/share/applications || true
|
||||
diff --git a/node_modules/app-builder-lib/templates/nsis/installSection.nsh b/node_modules/app-builder-lib/templates/nsis/installSection.nsh
|
||||
index 96f913a..ee95419 100644
|
||||
--- a/node_modules/app-builder-lib/templates/nsis/installSection.nsh
|
||||
+++ b/node_modules/app-builder-lib/templates/nsis/installSection.nsh
|
||||
@@ -22,10 +22,37 @@ StrCpy $appExe "$INSTDIR\${APP_EXECUTABLE_FILENAME}"
|
||||
SpiderBanner::Show /MODERN
|
||||
!endif
|
||||
|
||||
+ # Set text (1000 is the id of text element of SpiderBanner)
|
||||
FindWindow $0 "#32770" "" $hwndparent
|
||||
FindWindow $0 "#32770" "" $hwndparent $0
|
||||
- GetDlgItem $0 $0 1000
|
||||
- SendMessage $0 ${WM_SETTEXT} 0 "STR:$(installing)"
|
||||
+ GetDlgItem $1 $0 1000
|
||||
+ SendMessage $1 ${WM_SETTEXT} 0 "STR:$(installing)"
|
||||
+
|
||||
+ # Set header image compatible with "ManifestDPIAware" mode.
|
||||
+ !ifdef HEADER_ICO
|
||||
+ # Convert 24 Dialog Units to pixels:
|
||||
+ # See https://github.com/mozilla/gecko-dev/blob/8de0e699002872d969aebf1bc8407e5c839a4472/toolkit/mozapps/installer/windows/nsis/common.nsh#L8801
|
||||
+
|
||||
+ # rect = LPRect { .left = 0, .top = 0, .right = 24, .bottom = 0 }
|
||||
+ # See https://nsis.sourceforge.io/Docs/System/System.html#faq
|
||||
+ System::Call "*(i 0, i 0, i 24, i 0) p.r1"
|
||||
+
|
||||
+ # Call `MapDialogRect(window, &rect)`
|
||||
+ System::Call `user32::MapDialogRect(p $0, p r1)`
|
||||
+
|
||||
+ # rect.right now contains the converted value (24du => ?px).
|
||||
+ # Place `rect.right` into `r2`
|
||||
+ System::Call "*$1(i, i, i.r2, i)"
|
||||
+ System::Free $1
|
||||
+
|
||||
+ # Load image and pass `r2` as both width and height, get the image handle
|
||||
+ # back to `r2` register.
|
||||
+ System::Call `user32::LoadImage(i 0, t "$PLUGINSDIR\installerHeaderico.ico", i ${IMAGE_ICON}, i r2, i r2, i ${LR_LOADFROMFILE}) i.r2`
|
||||
+
|
||||
+ # 1025 is the id of the icon of SpiderBanner.
|
||||
+ GetDlgItem $1 $0 1025
|
||||
+ SendMessage $1 ${STM_SETIMAGE} ${IMAGE_ICON} $2
|
||||
+ !endif
|
||||
${endif}
|
||||
!insertmacro CHECK_APP_RUNNING
|
||||
!else
|
||||
diff --git a/node_modules/app-builder-lib/templates/nsis/messages.yml b/node_modules/app-builder-lib/templates/nsis/messages.yml
|
||||
index 87fa6b5..ad560bd 100644
|
||||
--- a/node_modules/app-builder-lib/templates/nsis/messages.yml
|
||||
|
|
|
@ -13,6 +13,25 @@ import fs from 'fs';
|
|||
// `app-builder-lib`.
|
||||
import { REQUIRED_LANGUAGES, LCID } from '../util/nsis';
|
||||
|
||||
const STRING_VARS = new Map([
|
||||
[
|
||||
'signalMinWinVersionErr',
|
||||
{
|
||||
id: 'icu:UnsupportedOSErrorToast',
|
||||
replacements: {
|
||||
OS: 'Windows',
|
||||
},
|
||||
},
|
||||
],
|
||||
[
|
||||
'signalMinAppVersionErr',
|
||||
{
|
||||
id: 'icu:NSIS__semver-downgrade',
|
||||
replacements: {},
|
||||
},
|
||||
],
|
||||
]);
|
||||
|
||||
console.log('Generating updates NSIS script');
|
||||
console.log();
|
||||
|
||||
|
@ -21,13 +40,17 @@ const USED = new Set<number>();
|
|||
const ROOT_DIR = path.join(__dirname, '..', '..');
|
||||
const LOCALES_DIR = path.join(ROOT_DIR, '_locales');
|
||||
|
||||
const fallbackMessages = JSON.parse(
|
||||
fs.readFileSync(path.join(LOCALES_DIR, 'en', 'messages.json')).toString()
|
||||
);
|
||||
|
||||
const nsisStrings = new Array<string>();
|
||||
for (const lang of REQUIRED_LANGUAGES) {
|
||||
const id = LCID[lang] ?? LCID.en_US;
|
||||
if (USED.has(id)) {
|
||||
const langId = LCID[lang] ?? LCID.en_US;
|
||||
if (USED.has(langId)) {
|
||||
continue;
|
||||
}
|
||||
USED.add(id);
|
||||
USED.add(langId);
|
||||
|
||||
// We use "-" in folder names
|
||||
const folder = lang.replace(/_/g, '-');
|
||||
|
@ -47,9 +70,16 @@ for (const lang of REQUIRED_LANGUAGES) {
|
|||
if (!json) {
|
||||
throw new Error(`No messages for ${folder}`);
|
||||
}
|
||||
const { 'icu:UnsupportedOSErrorToast': message } = JSON.parse(
|
||||
json.toString()
|
||||
);
|
||||
|
||||
const messages = JSON.parse(json.toString());
|
||||
|
||||
nsisStrings.push(`# ${lang}`);
|
||||
for (const [varName, { id, replacements }] of STRING_VARS) {
|
||||
let message = messages[id];
|
||||
if (!message) {
|
||||
console.error(`No string for ${id} in ${folder}, using english version`);
|
||||
message = fallbackMessages[id];
|
||||
}
|
||||
|
||||
const intl = createIntl({
|
||||
locale: folder,
|
||||
|
@ -58,35 +88,22 @@ for (const lang of REQUIRED_LANGUAGES) {
|
|||
},
|
||||
});
|
||||
|
||||
const text = intl.formatMessage({ id: 'message' }, { OS: 'Windows' });
|
||||
nsisStrings.push(`# ${lang}`);
|
||||
nsisStrings.push(
|
||||
`LangString signalMinWinVersionErr ${id} ${JSON.stringify(text)}`
|
||||
);
|
||||
const text = intl.formatMessage({ id: 'message' }, replacements);
|
||||
nsisStrings.push(`LangString ${varName} ${langId} ${JSON.stringify(text)}`);
|
||||
}
|
||||
}
|
||||
|
||||
// See: https://www.electron.build/configuration/nsis.html#custom-nsis-script
|
||||
// for description of what `build/installer.nsh` does.
|
||||
fs.writeFileSync(
|
||||
path.join(ROOT_DIR, 'build', 'installer.nsh'),
|
||||
path.join(ROOT_DIR, 'build', 'SignalStrings.nsh'),
|
||||
[
|
||||
'# Copyright 2023 Signal Messenger, LLC',
|
||||
'# SPDX-License-Identifier: AGPL-3.0-only',
|
||||
'#',
|
||||
'# DO NOT EDIT. This is a generated file.',
|
||||
'',
|
||||
'!include WinVer.nsh',
|
||||
'',
|
||||
...nsisStrings,
|
||||
'',
|
||||
'!macro preInit',
|
||||
// TODO: DESKTOP-5092
|
||||
// See: https://github.com/NSIS-Dev/Documentation/tree/42d8b48c4706b295b68879f7d83bd174c52ac8d7/docs/Includes/WinVer
|
||||
// eslint-disable-next-line no-template-curly-in-string
|
||||
' ${IfNot} ${AtLeastWin7}',
|
||||
' MessageBox MB_OK|MB_ICONEXCLAMATION "$(signalMinWinVersionErr)"',
|
||||
' DetailPrint `Windows version check failed`',
|
||||
' Abort',
|
||||
// eslint-disable-next-line no-template-curly-in-string
|
||||
' ${EndIf}',
|
||||
'!macroend',
|
||||
'',
|
||||
].join('\n')
|
||||
);
|
||||
|
|