Rename ignoreRelease to skipValidation in OTA validation system
Co-authored-by: netmindz <442066+netmindz@users.noreply.github.com>
This commit is contained in:
@@ -33,8 +33,8 @@
|
||||
style="vertical-align: text-bottom; display: inline-flex;">
|
||||
<img src="https://img.shields.io/github/release/wled-dev/WLED.svg?style=flat-square"></a><br>
|
||||
<input type='file' name='update' required><br> <!--should have accept='.bin', but it prevents file upload from android app-->
|
||||
<input type='checkbox' name='ignoreRelease' id='ignoreRelease'>
|
||||
<label for='ignoreRelease'>Ignore firmware validation</label><br>
|
||||
<input type='checkbox' name='skipValidation' id='skipValidation'>
|
||||
<label for='skipValidation'>Ignore firmware validation</label><br>
|
||||
<button type="submit">Update!</button><br>
|
||||
<hr class="sml">
|
||||
<button id="rev" type="button" onclick="cR()">Revert update</button><br>
|
||||
|
||||
@@ -77,7 +77,7 @@ bool validateReleaseCompatibility(const char* extractedRelease) {
|
||||
return match;
|
||||
}
|
||||
|
||||
bool shouldAllowOTA(const uint8_t* binaryData, size_t dataSize, bool ignoreReleaseCheck, char* errorMessage) {
|
||||
bool shouldAllowOTA(const uint8_t* binaryData, size_t dataSize, bool skipValidation, char* errorMessage) {
|
||||
// Clear error message
|
||||
if (errorMessage) {
|
||||
errorMessage[0] = '\0';
|
||||
@@ -88,7 +88,7 @@ bool shouldAllowOTA(const uint8_t* binaryData, size_t dataSize, bool ignoreRelea
|
||||
(void)local_desc; // Suppress unused variable warning
|
||||
|
||||
// If user chose to ignore release check, allow OTA
|
||||
if (ignoreReleaseCheck) {
|
||||
if (skipValidation) {
|
||||
DEBUG_PRINTLN(F("OTA release check bypassed by user"));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -48,11 +48,11 @@ bool validateReleaseCompatibility(const char* extractedRelease);
|
||||
* Check if OTA should be allowed based on release compatibility using custom description
|
||||
* @param binaryData Pointer to binary file data (not modified)
|
||||
* @param dataSize Size of binary data in bytes
|
||||
* @param ignoreReleaseCheck If true, skip release validation
|
||||
* @param skipValidation If true, skip release validation
|
||||
* @param errorMessage Buffer to store error message if validation fails (should be at least 128 bytes)
|
||||
* @return true if OTA should proceed, false if it should be blocked
|
||||
*/
|
||||
bool shouldAllowOTA(const uint8_t* binaryData, size_t dataSize, bool ignoreReleaseCheck, char* errorMessage);
|
||||
bool shouldAllowOTA(const uint8_t* binaryData, size_t dataSize, bool skipValidation, char* errorMessage);
|
||||
|
||||
/**
|
||||
* Get pointer to the embedded custom description structure
|
||||
|
||||
@@ -433,11 +433,11 @@ void initServer()
|
||||
DEBUG_PRINTLN(F("OTA Update Start"));
|
||||
|
||||
// Check if user wants to ignore release check
|
||||
bool ignoreRelease = request->hasParam("ignoreRelease", true);
|
||||
bool skipValidation = request->hasParam("skipValidation", true);
|
||||
|
||||
// Validate OTA release compatibility using the first chunk data directly
|
||||
char errorMessage[128];
|
||||
releaseCheckPassed = shouldAllowOTA(data, len, ignoreRelease, errorMessage);
|
||||
releaseCheckPassed = shouldAllowOTA(data, len, skipValidation, errorMessage);
|
||||
|
||||
if (!releaseCheckPassed) {
|
||||
DEBUG_PRINTF_P(PSTR("OTA blocked: %s\n"), errorMessage);
|
||||
|
||||
Reference in New Issue
Block a user