Code cleanup

This commit is contained in:
Dominic Ferrando
2025-04-24 00:14:09 -04:00
parent eb770416d0
commit 27fc9476fa
6 changed files with 85 additions and 78 deletions
+3 -11
View File
@@ -1,8 +1,6 @@
package util
import (
"crypto/rand"
"encoding/hex"
"sync"
"time"
)
@@ -17,17 +15,11 @@ var (
AdminMutex = sync.RWMutex{}
)
func GenToken() (string, error) {
bytes := make([]byte, 32)
_, err := rand.Read(bytes)
if err != nil {
return "", err
func IsAdminSessionValid(token string) bool {
if DevMode {
return true
}
return hex.EncodeToString(bytes), nil
}
func IsAdminSessionValid(token string) bool {
AdminMutex.RLock()
session, exists := AdminSessions[token]
AdminMutex.RUnlock()