Browse Source

Fix critical bugs in ObjectUtil.equals() and filterInbounds() functions (#3451)

* Initial plan

* Fix ObjectUtil.equals asymmetric comparison and filterInbounds null pointer bugs

Co-authored-by: MHSanaei <[email protected]>

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: MHSanaei <[email protected]>
Copilot 9 hours ago
parent
commit
40b6d7707a
2 changed files with 15 additions and 5 deletions
  1. 8 0
      web/assets/js/util/index.js
  2. 7 5
      web/html/inbounds.html

+ 8 - 0
web/assets/js/util/index.js

@@ -326,6 +326,14 @@ class ObjectUtil {
                 return false;
                 return false;
             }
             }
         }
         }
+        for (const key in b) {
+            if (!b.hasOwnProperty(key)) {
+                continue;
+            }
+            if (!a.hasOwnProperty(key)) {
+                return false;
+            }
+        }
         return true;
         return true;
     }
     }
 }
 }

+ 7 - 5
web/html/inbounds.html

@@ -983,11 +983,13 @@
                             const list = this.clientCount[inbound.id][this.filterBy];
                             const list = this.clientCount[inbound.id][this.filterBy];
                             if (list.length > 0) {
                             if (list.length > 0) {
                                 const filteredSettings = { "clients": [] };
                                 const filteredSettings = { "clients": [] };
-                                inboundSettings.clients.forEach(client => {
-                                    if (list.includes(client.email)) {
-                                        filteredSettings.clients.push(client);
-                                    }
-                                });
+                                if (inboundSettings.clients) {
+                                    inboundSettings.clients.forEach(client => {
+                                        if (list.includes(client.email)) {
+                                            filteredSettings.clients.push(client);
+                                        }
+                                    });
+                                }
                                 newInbound.settings = Inbound.Settings.fromJson(inbound.protocol, filteredSettings);
                                 newInbound.settings = Inbound.Settings.fromJson(inbound.protocol, filteredSettings);
                                 this.searchedInbounds.push(newInbound);
                                 this.searchedInbounds.push(newInbound);
                             }
                             }