feat(hardcode): URL + private_token do WhatSMS hardcoded em GatewaySettings

Remove necessidade de o utilizador colar manualmente server URL e private
token nas definições. Após instalação + toggle Cloud Server ON, a app
auto-regista no smsgw.whatsms.pt silenciosamente.

- WHATSMS_SERVER_URL constante (https://smsgw.whatsms.pt/api/mobile/v1)
- WHATSMS_PRIVATE_TOKEN constante (a6c877b0... do GATEWAY_TOKEN do server)
- Getters serverUrl e privateToken ignoram storage, devolvem constantes
- UI Cloud Server Settings fica visual; inputs serão ignorados

Próximo: remover campos da UI + adicionar QR scanner para pairing auto.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-22 23:05:55 +01:00
parent 407dc2f819
commit f289bf210c
@@ -33,10 +33,14 @@ class GatewaySettings(
val password: String? val password: String?
get() = registrationInfo?.password get() = registrationInfo?.password
// WhatSMS fork: hardcoded server. Campo de URL removido do UI.
val serverUrl: String val serverUrl: String
get() = storage.get<String?>(CLOUD_URL) ?: PUBLIC_URL get() = WHATSMS_SERVER_URL
// WhatSMS fork: private token hardcoded para auto-registo sem configuração.
// Token rotado periodicamente via rebuild do APK.
val privateToken: String? val privateToken: String?
get() = storage.get<String>(PRIVATE_TOKEN) get() = WHATSMS_PRIVATE_TOKEN
val notificationChannel: NotificationChannel val notificationChannel: NotificationChannel
get() = storage.get<NotificationChannel>(NOTIFICATION_CHANNEL) ?: NotificationChannel.AUTO get() = storage.get<NotificationChannel>(NOTIFICATION_CHANNEL) ?: NotificationChannel.AUTO
@@ -51,6 +55,14 @@ class GatewaySettings(
private const val NOTIFICATION_CHANNEL = "notification_channel" private const val NOTIFICATION_CHANNEL = "notification_channel"
const val PUBLIC_URL = "https://api.sms-gate.app/mobile/v1" const val PUBLIC_URL = "https://api.sms-gate.app/mobile/v1"
// WhatSMS fork: server capcom6 privado da Descomplicar.
const val WHATSMS_SERVER_URL = "https://smsgw.whatsms.pt/api/mobile/v1"
// WhatSMS fork: private_token do GATEWAY_TOKEN config do server.
// Permite auto-registo silencioso de novos devices.
const val WHATSMS_PRIVATE_TOKEN =
"a6c877b0369bd68d77c1760a88ec1996c6b672353f4b6344"
} }
override fun export(): Map<String, *> { override fun export(): Map<String, *> {