mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-06-21 02:01:03 +07:00
fixed PR code
This commit is contained in:
@@ -12,10 +12,6 @@ import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import kotlin.math.max
|
||||
|
||||
/**
|
||||
* iOS-style pairing scan chrome: dim outside a central square + white corner brackets.
|
||||
* Hole layout matches iOS `layoutScanOverlayGeometry` ([pairingIosStyleHoleRectF]).
|
||||
*/
|
||||
class PairingQrScanOverlayView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
@@ -27,12 +23,11 @@ class PairingQrScanOverlayView @JvmOverloads constructor(
|
||||
isFocusable = false
|
||||
}
|
||||
|
||||
/** Let taps reach [PreviewView] below for tap-to-focus. */
|
||||
@Suppress("ClickableViewAccessibility")
|
||||
override fun onTouchEvent(event: MotionEvent): Boolean = false
|
||||
|
||||
private val dimPaint = Paint(Paint.ANTI_ALIAS_FLAG).apply {
|
||||
color = 0x8C000000.toInt() // ~55% black, same role as QML dimAlpha 0.55
|
||||
color = 0x8C000000.toInt()
|
||||
style = Paint.Style.FILL
|
||||
}
|
||||
|
||||
|
||||
@@ -214,6 +214,13 @@ func handleGenerateQR(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
mu.Lock()
|
||||
cleanupExpiredSessions(time.Now())
|
||||
if _, exists := sessions[req.QRUUID]; exists {
|
||||
mu.Unlock()
|
||||
writeJSON(w, http.StatusConflict, map[string]string{
|
||||
"message": "Conflict: QR session with this UUID already exists.",
|
||||
})
|
||||
return
|
||||
}
|
||||
sessions[req.QRUUID] = session
|
||||
mu.Unlock()
|
||||
|
||||
@@ -271,7 +278,7 @@ func handleScanQR(w http.ResponseWriter, r *http.Request) {
|
||||
// Keep compatibility with current gateway behavior: key problems are mapped to 403.
|
||||
if req.AuthData.APIKey == "invalid" {
|
||||
writeJSON(w, http.StatusForbidden, map[string]string{
|
||||
"detail": "Forbidden: Invalid API key or unauthorized request.",
|
||||
"message": "Forbidden: Invalid API key or unauthorized request.",
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user