fix: token 改为配置文件读取,不再自动生成;UI 全部汉化
This commit is contained in:
@@ -1,10 +1,7 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"crypto/rand"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"net"
|
||||
)
|
||||
|
||||
@@ -22,13 +19,3 @@ func GetLANIP() (string, error) {
|
||||
return "", fmt.Errorf("no LAN IP found")
|
||||
}
|
||||
|
||||
// GenerateToken creates a cryptographically random token for WS auth.
|
||||
func GenerateToken() string {
|
||||
b := make([]byte, 16)
|
||||
if _, err := rand.Read(b); err != nil {
|
||||
slog.Error("failed to generate token", "error", err)
|
||||
// Fallback to a less secure but functional token
|
||||
return "voicepaste-fallback-token"
|
||||
}
|
||||
return hex.EncodeToString(b)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user