% local au = require 'valibox.autonta_util' local vu = require 'valibox.valibox_update' local mio = require 'valibox.mio' local current_version = vu.get_current_version() local currently_beta = false if current_version:find("beta") then currently_beta = true end local board_name = vu.get_board_name() local firmware_info = vu.get_firmware_board_info(currently_beta, "", true, board_name) local other_firmware_info = vu.get_firmware_board_info(not currently_beta, "", true, board_name) local update_check_failed = false local update_available = false local other_version = "" local update_version = vu.update_available(firmware_info) local update_info = "" if not firmware_info or not other_firmware_info then update_check_failed = true else if update_version and current_version ~= update_version then update_available = true update_info = vu.fetch_update_info_txt(firmware_info, "") else -- include changelog for current release local fr = mio.file_reader("/valibox_changelog.txt") if fr ~= nil then update_info = fr:read_lines_single_str() else update_info = "" end fr:close() end end -- CSRF protection; set a random string in the cookie and the form -- values must match for anything to be done after post local dst = au.randomstring(12) luci.http.header("Set-Cookie", "valibox_nta=" .. dst .."; SameSite=strict; Max-Age=3600") %> <%+header%>
<%: Update available %>: <%= update_version %> <%: Current version %>: <%= current_version %>
<%= update_info %>
<%: No updates available. Current version: %> <%= current_version %>
<%: Download and reinstall firmware %>
<%= update_info %>