Ver Fonte

Lock GPIO configuration UI until board profile exposes safe pins

SybexXx há 3 dias atrás
pai
commit
c355b02194
1 ficheiros alterados com 31 adições e 1 exclusões
  1. 31 1
      sd-card/html/edit_config_template.html

+ 31 - 1
sd-card/html/edit_config_template.html

@@ -1457,6 +1457,15 @@
         </tr>
 
         <!------------- GPIO ------------------>
+        <tr id="GPIO_profile_notice">
+            <td colspan="3" style="padding:10px; background:#fff3cd; border:1px solid #e0c36a;">
+                <b>GPIO configuration currently unavailable for this board.</b><br>
+                The active firmware board profile does not expose any user GPIO pins yet.
+                Board-owned pins (camera, SD card, flash LED, boot straps and serial interface)
+                are intentionally excluded. The GPIO section is locked until a board profile
+                explicitly whitelists safe pins.
+            </td>
+        </tr>
         <tr style="border-bottom: 2px solid lightgray;">
             <td colspan="3" style="padding-left: 0px; padding-bottom: 3px;">
                 <h4><input type="checkbox" id="Category_GPIO_enabled" value="1"  onclick='UpdateAfterCategoryCheck()' unchecked > 
@@ -3367,7 +3376,28 @@ function openDescription() {
 
 openDescription();
 LoadConfigNeu();
- 
+
+/*
+ * Fail closed in the UI while the active board profile exposes no user pins.
+ * The firmware performs the authoritative validation independently.
+ */
+(function lockUnprofiledGpioUi() {
+    var categoryCheckbox = document.getElementById("Category_GPIO_enabled");
+    if (categoryCheckbox) {
+        categoryCheckbox.checked = false;
+        categoryCheckbox.disabled = true;
+    }
+    if (typeof category !== "undefined" && category.GPIO) {
+        category.GPIO.enabled = false;
+    }
+    document.querySelectorAll(".GPIO_item input, .GPIO_item select, .GPIO_item textarea").forEach(function (element) {
+        element.disabled = true;
+    });
+    document.querySelectorAll(".GPIO_item").forEach(function (element) {
+        element.style.opacity = "0.55";
+    });
+})();
+
 </script>
 </body>
 </html>