diff --git a/app/src/main/assets/web/index.html b/app/src/main/assets/web/index.html index 57cf308..d4dd4f5 100644 --- a/app/src/main/assets/web/index.html +++ b/app/src/main/assets/web/index.html @@ -66,15 +66,15 @@

Pairing via QR Code

-

Instead of typing the pairing code manually, the client can display a QR code that you confirm by scanning it with the server app. This is the recommended flow for desktop browsers and touch devices.

+

Instead of typing the pairing code manually, the client can display a QR code that you confirm by scanning it with the Radio app. This is the recommended flow for desktop browsers and touch devices.

  1. The client generates a random clientId and a random pairKey (32 bytes) and keeps both to itself.
  2. -
  3. The client calls POST /api/pair/start?clientId=YOUR_CLIENT_ID with the header X-Pair-Key: YOUR_PAIR_KEY to open a short lived pairing session.
  4. -
  5. The client calls GET /api/qr?clientId=YOUR_CLIENT_ID with the same header to obtain a PNG QR code containing radio-pair:PAIRING_CODE. The pairing code is a one time value of the session – it is not the secret of your server.
  6. +
  7. The client calls POST /api/pair/start?clientId=YOUR_CLIENT_ID with the header X-Pair-Key: YOUR_PAIR_KEY to open a short-lived pairing session.
  8. +
  9. The client calls GET /api/qr?clientId=YOUR_CLIENT_ID with the same header to obtain a PNG QR code containing radio-pair:PAIRING_CODE. The pairing code is a one time value of the session – it is not the secret of your Radio app.
  10. Open Settings → Remote Control → Verify with QR Code in the Radio app and scan the displayed code. The app approves that single session.
  11. The client polls GET /api/pair/status?clientId=YOUR_CLIENT_ID with the same header until it returns paired: true, then stores the returned token and sends it as X-Remote-Key on all further requests.
-

The pairing endpoints are exempt from the pairing code check, so they can be called before a client is approved. A session is only readable with its X-Pair-Key, expires after 15 minutes and is dropped as soon as the token was handed out, so knowing a clientId alone is not enough. Use a strong, unique pairing code and keep the server on a trusted network – the server is served over plain HTTP, so anything sent to it can be read by others on the network.

+

The pairing endpoints are exempt from the pairing code check, so they can be called before a client is approved. A session is only readable with its X-Pair-Key, expires after 15 minutes and is dropped as soon as the token was handed out, so knowing a clientId alone is not enough.

Example Usage (JavaScript):
 const clientId = crypto.randomUUID();
diff --git a/app/src/main/java/com/michatec/radio/fragments/SettingsFragment.kt b/app/src/main/java/com/michatec/radio/fragments/SettingsFragment.kt
index bc4dc47..4a26232 100644
--- a/app/src/main/java/com/michatec/radio/fragments/SettingsFragment.kt
+++ b/app/src/main/java/com/michatec/radio/fragments/SettingsFragment.kt
@@ -679,15 +679,15 @@ class SettingsFragment : PreferenceFragmentCompat(), SharedPreferences.OnSharedP
         preferenceCategoryGeneral.addPreference(preferenceCustomTheme)
         preferenceCategoryGeneral.addPreference(preferenceShaderEffect)
 
+        if (!isAndroidTV && isPermissionGranted(activity as Context, Manifest.permission.POST_NOTIFICATIONS)) {
+            preferenceCategoryGeneral.addPreference(preferenceTestNotification)
+        }
+
         screen.addPreference(preferenceCategoryRemoteControl)
         preferenceCategoryRemoteControl.addPreference(preferenceRemoteControl)
         preferenceCategoryRemoteControl.addPreference(preferenceRemoteControlAuth)
         preferenceCategoryRemoteControl.addPreference(preferenceRemoteControlSecret)
-
-        if (!isAndroidTV && isPermissionGranted(activity as Context, Manifest.permission.POST_NOTIFICATIONS)) {
-            preferenceCategoryGeneral.addPreference(preferenceTestNotification)
-            preferenceCategoryRemoteControl.addPreference(preferenceRemoteControlVerifyQr)
-        }
+        preferenceCategoryRemoteControl.addPreference(preferenceRemoteControlVerifyQr)
 
         screen.addPreference(preferenceCategoryAudioEffects)
         preferenceCategoryAudioEffects.addPreference(preferenceBassBoost)