feat: add secure per-server custom headers for Cloudflare Access (#1273)
This commit is contained in:
1 parent
1ba1a62f31
commit
0bc0117c89
13 files changed
+693
-2
No files matched your search
@@ -265,6 +265,15 @@ class SettingsViewModel(
|
||||
ApiClient.rebuild()
|
||||
}
|
||||
|
||||
fun onCustomHeadersSaved() {
|
||||
val editedEndpoint = ServerEndpoint.parseForBuild(_uiState.value.dialogProfileBaseUrl)
|
||||
if (editedEndpoint.baseUrl == AuthManager.endpointForBuild().baseUrl) {
|
||||
ApiClient.rebuild()
|
||||
HermesWsClient.disconnect()
|
||||
HermesWsClient.connect()
|
||||
}
|
||||
}
|
||||
|
||||
// ── Delete confirmation ──────────────────────────────────────────────
|
||||
|
||||
fun requestDeleteProfile(profileId: String) {
|
||||
|
||||
@@ -175,6 +175,7 @@ internal fun ConnectionSection(
|
||||
onTokenChange = viewModel::onDialogProfileTokenChange,
|
||||
onSave = viewModel::saveProfileFromDialog,
|
||||
onDismiss = viewModel::closeProfileDialog,
|
||||
onHeadersSaved = viewModel::onCustomHeadersSaved,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ import androidx.compose.ui.text.input.PasswordVisualTransformation
|
||||
import androidx.compose.ui.text.input.VisualTransformation
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.m57.hermescontrol.R
|
||||
import com.m57.hermescontrol.ui.common.CustomHeadersButton
|
||||
|
||||
@Composable
|
||||
internal fun ProfileEditorDialog(
|
||||
@@ -33,6 +34,7 @@ internal fun ProfileEditorDialog(
|
||||
onTokenChange: (String) -> Unit,
|
||||
onSave: () -> Unit,
|
||||
onDismiss: () -> Unit,
|
||||
onHeadersSaved: () -> Unit,
|
||||
) {
|
||||
val title =
|
||||
if (isEditing) {
|
||||
@@ -63,6 +65,7 @@ internal fun ProfileEditorDialog(
|
||||
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Uri),
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
)
|
||||
CustomHeadersButton(baseUrl = baseUrl, onSaved = onHeadersSaved)
|
||||
if (error != null) {
|
||||
Text(
|
||||
text = error,
|
||||
|
||||
Reference in new issue
Block a user