;title='OmniNX Updater'
;creator=NiklasCFW, Woody2408
;version=1.0.0
;about='OmniNX Updater'

[@CFW Pack]

[Version]
;mode=table
;background=true
;gap=20
ini_file '/config/omninx/manifest.ini'
'Installierte Variante' = '{ini_file(OmniNX,current_pack)}'
'Update-Kanal' = '{ini_file(OmniNX,channel_pack)}'
'Installierte Version' = '{ini_file(OmniNX,version)}'

[OmniNX]
try:
download https://git.niklascfw.de/api/v1/repos/OmniNX/OmniNX/releases?limit=1 /config/ultrahand/downloads/omninx-api.json
json_file /config/ultrahand/downloads/omninx-api.json
ini_file '/config/omninx/manifest.ini'
download {json_file(0,assets,{ini_file(OmniNX,update_channel)},browser_download_url)} /config/ultrahand/downloads/OmniNX.zip
unzip /config/ultrahand/downloads/OmniNX.zip /
delete /config/ultrahand/downloads/omninx-api.json
delete /config/ultrahand/downloads/OmniNX.zip
notify '{WARNING_SYMBOL} Führe in Hekate fort' 24

[*Update Kanal ändern]
;mini=true
;mode=forwarder
package_source ./change_channel.ini
refresh-to *Update Kanal ändern

[gap]
;mode=table
;background=false
;gap=30

[Version]
;mode=table
;background=true
;gap=20
'Installierte Firmware Version' = '{hos_version}'

[Switch Firmware]
try:
ini_file ./RELEASE.ini
download https://git.niklascfw.de/api/v1/repos/OmniNX/NX_Firmware/releases?limit=1 /config/ultrahand/downloads/firmware-api.json
json_file /config/ultrahand/downloads/firmware-api.json
download {json_file(0,assets,0,browser_download_url)} /config/ultrahand/downloads/firmware.zip
mkdir '/Firmware.{ini_file(Release Info,firmware_version)}/'
unzip '/config/ultrahand/downloads/firmware.zip' '/Firmware.{ini_file(Release Info,firmware_version)}/'
delete '/config/ultrahand/downloads/firmware-api.json'
delete '/config/ultrahand/downloads/firmware.zip'
notify '{WARNING_SYMBOL} Führe in Daybreak fort' 24

[gap]
;mode=table
;background=false
;gap=30

[Changelog]
;mode=table
;background=true
;gap=20
ini_file './include/updater/config.ini'
'Changelog' = ''

[*Neuste Änderungen]
;mode=forwarder
exec boot ./changelog/boot_package.ini
package_source ./changelog/changelog.ini

[@Erweitert]

[Version]
;mode=table
;background=true
;gap=20
ini_file './CURRENT.ini'
'Zurzeit installiert' = '{ini_file(Current,omninx_downloader)}'

[OmniNX Downloader]
try:
download https://git.niklascfw.de/api/v1/repos/OmniNX/OmniNX-Downloader/releases?limit=1 /config/ultrahand/downloads/omni-downloader-api.json
json_file /config/ultrahand/downloads/omni-downloader-api.json
download {json_file(0,assets,0,browser_download_url)} /config/ultrahand/downloads/omni-downloader.zip
unzip /config/ultrahand/downloads/omni-downloader.zip '/switch/.packages/'
delete /config/ultrahand/downloads/omni-downloader-api.json
delete /config/ultrahand/downloads/omni-downloader.zip

[gap]
;mode=table
;background=false
;gap=30

[*Firmware Archiv]
;mode=option
json_file_source './firmware-archive.json' 'label'
try:
download '{json_file_source(*,download)}' './firmware.zip'
mkdir '/Firmware {json_file_source(*,tag)}/'
unzip './firmware.zip' '/Firmware {json_file_source(*,tag)}/'
delete './firmware.zip'
notify '{WARNING_SYMBOL} Führe in Daybreak fort' 24

[gap]
;mode=table
;background=false
;gap=30

[Firmware Archiv — Hinweis]
;mode=table
;alignment=left
;header=false
;scrollable=true
;wrapping_mode=word
;background=true
;info_text_color=warning
list_file_source './fw_warning.txt'

[Package Info]