mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-11-04 16:40:21 +00:00
fix: harden dashboard security boundaries
This commit is contained in:
1 parent
c726930833
commit
36b742a7e9
12 files changed
+357
-46
No files matched your search
@@ -171,6 +171,12 @@ const transferStreamPingInterval = 30 * time.Second
|
||||
// @Success 200 {object} model.ServerTransfer
|
||||
// @Router /ws/transfer [get]
|
||||
func transferStream(c *gin.Context) (any, error) {
|
||||
subID, ch, err := singleton.ServerTransferShared.Subscribe(getUid(c))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer singleton.ServerTransferShared.Unsubscribe(subID)
|
||||
|
||||
conn, err := upgrader.Upgrade(c.Writer, c.Request, nil)
|
||||
if err != nil {
|
||||
return nil, newWsError("%v", err)
|
||||
@@ -180,9 +186,6 @@ func transferStream(c *gin.Context) (any, error) {
|
||||
deregisterPAT := registerPATConnection(c, func() { _ = conn.Close() })
|
||||
defer deregisterPAT()
|
||||
|
||||
subID, ch := singleton.ServerTransferShared.Subscribe()
|
||||
defer singleton.ServerTransferShared.Unsubscribe(subID)
|
||||
|
||||
// Pings keep the socket warm even when the broker is quiet. Without this
|
||||
// a long idle period followed by a transfer event would race against
|
||||
// upstream proxy idle-timeouts that may have already closed the conn.
|
||||
|
||||
Reference in new issue
Block a user