Update changelog & Clone Main
This commit is contained in:
25
changelog
25
changelog
@ -1,19 +1,18 @@
|
|||||||
# [1.16.0] - 2025-08-19
|
# [1.17.0] - 2025-08-24
|
||||||
|
|
||||||
#### ✨ New Features
|
|
||||||
|
|
||||||
* 📊 **Dashboard Redesign**
|
#### ⚡ Authentication
|
||||||
|
|
||||||
* Modernized UI with detailed server stats
|
* 🚀 **Implemented Go HTTP Auth Server** for **maximum performance**
|
||||||
* 🖥️ **Server API Enhancements**
|
* ⚡ Removed old command-based auth system
|
||||||
|
|
||||||
* Added uptime and traffic-since-reboot metrics
|
#### 👥 User Management
|
||||||
* ⚡ **System Monitor Optimization**
|
|
||||||
|
|
||||||
* Improved performance with async I/O
|
* ✨ **Bulk User Creation** added across:
|
||||||
* Accurate traffic tracking since reboot
|
|
||||||
|
|
||||||
#### 🐛 Fixes
|
* 🖥️ **Frontend UI**
|
||||||
|
* 📡 **API Endpoint**
|
||||||
* 🔧 Correctly count **actual device connections** instead of unique users
|
* 💻 **CLI Command**
|
||||||
* 🔥 Fixed subscription blocked page to display the right user data
|
* 📜 **Automation Script**
|
||||||
|
* 🔍 New **Online User Filter & Sort** on the Users page
|
||||||
|
* 🐛 Fixed: underscores now supported in usernames
|
||||||
@ -81,33 +81,28 @@ func authHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
user, ok := userCache[username]
|
user, ok := userCache[username]
|
||||||
cacheMutex.RUnlock()
|
cacheMutex.RUnlock()
|
||||||
|
|
||||||
// 1. Check existence
|
|
||||||
if !ok {
|
if !ok {
|
||||||
json.NewEncoder(w).Encode(httpAuthResponse{OK: false})
|
json.NewEncoder(w).Encode(httpAuthResponse{OK: false})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. Check if blocked
|
|
||||||
if user.Blocked {
|
if user.Blocked {
|
||||||
json.NewEncoder(w).Encode(httpAuthResponse{OK: false})
|
json.NewEncoder(w).Encode(httpAuthResponse{OK: false})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. Check password (constant time)
|
|
||||||
if subtle.ConstantTimeCompare([]byte(user.Password), []byte(password)) != 1 {
|
if subtle.ConstantTimeCompare([]byte(user.Password), []byte(password)) != 1 {
|
||||||
time.Sleep(5 * time.Second) // Slow down brute-force attacks
|
time.Sleep(5 * time.Second) // Slow down brute-force attacks
|
||||||
json.NewEncoder(w).Encode(httpAuthResponse{OK: false})
|
json.NewEncoder(w).Encode(httpAuthResponse{OK: false})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. Check if unlimited (if so, grant access)
|
|
||||||
if user.UnlimitedUser {
|
if user.UnlimitedUser {
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
json.NewEncoder(w).Encode(httpAuthResponse{OK: true, ID: username})
|
json.NewEncoder(w).Encode(httpAuthResponse{OK: true, ID: username})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 5. Check expiration
|
|
||||||
if user.ExpirationDays > 0 {
|
if user.ExpirationDays > 0 {
|
||||||
creationDate, err := time.Parse("2006-01-02", user.AccountCreationDate)
|
creationDate, err := time.Parse("2006-01-02", user.AccountCreationDate)
|
||||||
if err == nil && time.Now().After(creationDate.AddDate(0, 0, user.ExpirationDays)) {
|
if err == nil && time.Now().After(creationDate.AddDate(0, 0, user.ExpirationDays)) {
|
||||||
@ -116,19 +111,17 @@ func authHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 6. Check traffic limit
|
|
||||||
if user.MaxDownloadBytes > 0 && (user.DownloadBytes+user.UploadBytes) >= user.MaxDownloadBytes {
|
if user.MaxDownloadBytes > 0 && (user.DownloadBytes+user.UploadBytes) >= user.MaxDownloadBytes {
|
||||||
json.NewEncoder(w).Encode(httpAuthResponse{OK: false})
|
json.NewEncoder(w).Encode(httpAuthResponse{OK: false})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// All checks passed
|
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
json.NewEncoder(w).Encode(httpAuthResponse{OK: true, ID: username})
|
json.NewEncoder(w).Encode(httpAuthResponse{OK: true, ID: username})
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
log.SetOutput(io.Discard) // Disable logging for max performance
|
log.SetOutput(io.Discard)
|
||||||
loadUsersToCache()
|
loadUsersToCache()
|
||||||
|
|
||||||
ticker := time.NewTicker(cacheTTL)
|
ticker := time.NewTicker(cacheTTL)
|
||||||
@ -140,7 +133,6 @@ func main() {
|
|||||||
|
|
||||||
http.HandleFunc("/auth", authHandler)
|
http.HandleFunc("/auth", authHandler)
|
||||||
if err := http.ListenAndServe(listenAddr, nil); err != nil {
|
if err := http.ListenAndServe(listenAddr, nil); err != nil {
|
||||||
// If we can't start, log to stderr so systemd can see it
|
|
||||||
log.SetOutput(os.Stderr)
|
log.SetOutput(os.Stderr)
|
||||||
log.Fatalf("Failed to start server: %v", err)
|
log.Fatalf("Failed to start server: %v", err)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,7 +8,7 @@ HYSTERIA_INSTALL_DIR="/etc/hysteria"
|
|||||||
HYSTERIA_VENV_DIR="$HYSTERIA_INSTALL_DIR/hysteria2_venv"
|
HYSTERIA_VENV_DIR="$HYSTERIA_INSTALL_DIR/hysteria2_venv"
|
||||||
AUTH_BINARY_DIR="$HYSTERIA_INSTALL_DIR/core/scripts/auth"
|
AUTH_BINARY_DIR="$HYSTERIA_INSTALL_DIR/core/scripts/auth"
|
||||||
REPO_URL="https://github.com/ReturnFI/Blitz"
|
REPO_URL="https://github.com/ReturnFI/Blitz"
|
||||||
REPO_BRANCH="auth"
|
REPO_BRANCH="main"
|
||||||
GEOSITE_URL="https://raw.githubusercontent.com/Chocolate4U/Iran-v2ray-rules/release/geosite.dat"
|
GEOSITE_URL="https://raw.githubusercontent.com/Chocolate4U/Iran-v2ray-rules/release/geosite.dat"
|
||||||
GEOIP_URL="https://raw.githubusercontent.com/Chocolate4U/Iran-v2ray-rules/release/geoip.dat"
|
GEOIP_URL="https://raw.githubusercontent.com/Chocolate4U/Iran-v2ray-rules/release/geoip.dat"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user