mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-06-06 21:24:10 +00:00
fix
This commit is contained in:
parent
83a1bd2194
commit
701aceeda0
6 changed files with 14 additions and 7 deletions
|
|
@ -90,6 +90,11 @@ class DBInbound {
|
|||
return this.expiryTime < new Date().getTime();
|
||||
}
|
||||
|
||||
invalidateCache() {
|
||||
this._cachedInbound = null;
|
||||
this._clientStatsMap = null;
|
||||
}
|
||||
|
||||
toInbound() {
|
||||
if (this._cachedInbound) {
|
||||
return this._cachedInbound;
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ class WebSocketClient {
|
|||
this.ws.onmessage = (event) => {
|
||||
try {
|
||||
// Validate message size (prevent memory issues)
|
||||
const maxMessageSize = 100 * 1024 * 1024; // 100MB
|
||||
const maxMessageSize = 10 * 1024 * 1024; // 10MB
|
||||
if (event.data && event.data.length > maxMessageSize) {
|
||||
console.error('WebSocket message too large:', event.data.length, 'bytes');
|
||||
this.ws.close();
|
||||
|
|
|
|||
|
|
@ -30,9 +30,9 @@ const (
|
|||
)
|
||||
|
||||
var upgrader = ws.Upgrader{
|
||||
ReadBufferSize: 32768, // Huge buffers for huge databases
|
||||
WriteBufferSize: 32768, // Huge buffers to reduce TCP fragmentation
|
||||
EnableCompression: true, // Automatically GZIP large messages unconditionally
|
||||
ReadBufferSize: 32768,
|
||||
WriteBufferSize: 32768,
|
||||
EnableCompression: true, // Negotiate permessage-deflate compression if the client supports it
|
||||
|
||||
CheckOrigin: func(r *http.Request) bool {
|
||||
// Check origin for security
|
||||
|
|
|
|||
|
|
@ -130,6 +130,7 @@
|
|||
<a-select-option value="body">body</a-select-option>
|
||||
<a-select-option value="header">header</a-select-option>
|
||||
<a-select-option value="cookie">cookie</a-select-option>
|
||||
<a-select-option value="query">query</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
<a-form-item label="Uplink Data Key"
|
||||
|
|
|
|||
|
|
@ -1331,6 +1331,7 @@
|
|||
if (!clients || !Array.isArray(clients)) return;
|
||||
index = this.findIndexOfClient(dbInbound.protocol, clients, client);
|
||||
if (index < 0 || !clients[index]) return;
|
||||
clients[index].enable = !clients[index].enable;
|
||||
clientId = this.getClientId(dbInbound.protocol, clients[index]);
|
||||
await this.updateClient(clients[index], dbInboundId, clientId);
|
||||
this.loading(false);
|
||||
|
|
@ -1343,7 +1344,7 @@
|
|||
},
|
||||
getInboundClients(dbInbound) {
|
||||
if (!dbInbound) return null;
|
||||
const inbound = this.inbounds.find(ib => ib.id === dbInbound.id) || dbInbound.toInbound();
|
||||
const inbound = dbInbound.toInbound();
|
||||
return inbound && inbound.clients ? inbound.clients : null;
|
||||
},
|
||||
resetClientTraffic(client, dbInboundId, confirmation = true) {
|
||||
|
|
|
|||
|
|
@ -262,7 +262,7 @@ func (h *Hub) Broadcast(messageType MessageType, payload any) {
|
|||
|
||||
// If message exceeds size limit, send a lightweight invalidate notification
|
||||
// instead of dropping it entirely — the frontend will re-fetch via REST API
|
||||
const maxMessageSize = 100 * 1024 * 1024 // 100MB (User override)
|
||||
const maxMessageSize = 10 * 1024 * 1024 // 10MB
|
||||
if len(data) > maxMessageSize {
|
||||
logger.Debugf("WebSocket message too large (%d bytes) for type %s, sending invalidate signal", len(data), messageType)
|
||||
h.broadcastInvalidate(messageType)
|
||||
|
|
@ -307,7 +307,7 @@ func (h *Hub) BroadcastToTopic(messageType MessageType, payload any) {
|
|||
}
|
||||
|
||||
// If message exceeds size limit, send a lightweight invalidate notification
|
||||
const maxMessageSize = 100 * 1024 * 1024 // 100MB (User override)
|
||||
const maxMessageSize = 10 * 1024 * 1024 // 10MB
|
||||
if len(data) > maxMessageSize {
|
||||
logger.Debugf("WebSocket message too large (%d bytes) for type %s, sending invalidate signal", len(data), messageType)
|
||||
h.broadcastInvalidate(messageType)
|
||||
|
|
|
|||
Loading…
Reference in a new issue