mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-05 15:26:36 +08:00
[优化] 代码优化
This commit is contained in:
@@ -4,7 +4,6 @@ import (
|
|||||||
"atsflare/common"
|
"atsflare/common"
|
||||||
"atsflare/model"
|
"atsflare/model"
|
||||||
"atsflare/utils"
|
"atsflare/utils"
|
||||||
"fmt"
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"net/http"
|
"net/http"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@@ -96,7 +95,7 @@ func UploadFile(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
err = fileObj.Insert()
|
err = fileObj.Insert()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
_ = fmt.Errorf(err.Error())
|
_ = err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
c.JSON(http.StatusOK, gin.H{
|
c.JSON(http.StatusOK, gin.H{
|
||||||
|
|||||||
@@ -7,6 +7,6 @@ import (
|
|||||||
|
|
||||||
func CORS() gin.HandlerFunc {
|
func CORS() gin.HandlerFunc {
|
||||||
config := cors.DefaultConfig()
|
config := cors.DefaultConfig()
|
||||||
config.AllowOrigins = []string{"https://atsflare.vercel.app", "http://localhost:3000/"}
|
config.AllowOrigins = []string{"https://atsflare.vercel.app", "http://localhost:3000"}
|
||||||
return cors.New(config)
|
return cors.New(config)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
@@ -805,7 +806,7 @@ func persistDownloadedServerBinary(ctx context.Context, execPath string, release
|
|||||||
info := buildUploadedServerBinaryView(fileName, common.Version, detectedVersion, time.Now())
|
info := buildUploadedServerBinaryView(fileName, common.Version, detectedVersion, time.Now())
|
||||||
if !info.ReadyToUpgrade {
|
if !info.ReadyToUpgrade {
|
||||||
_ = os.Remove(tempPath)
|
_ = os.Remove(tempPath)
|
||||||
return nil, fmt.Errorf(info.ComparisonMessage)
|
return nil, errors.New(info.ComparisonMessage)
|
||||||
}
|
}
|
||||||
|
|
||||||
return &manualServerBinaryCandidate{
|
return &manualServerBinaryCandidate{
|
||||||
|
|||||||
Reference in New Issue
Block a user