mirror of
https://github.com/therealaleph/MasterHttpRelayVPN-RUST.git
synced 2026-05-18 06:24:35 +03:00
feat: added bulk parser for ids on android (#257)
This commit is contained in:
@@ -718,9 +718,15 @@ private fun ConnectionModeDropdown(
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// Deployment IDs editor — one row per ID, with add/remove buttons.
|
||||
// Deployment IDs editor — one row per ID, with add/remove buttons. The
|
||||
// "+ Add" field accepts a single ID OR a bulk paste of many separated by
|
||||
// whitespace / newline / comma / semicolon — useful when migrating from
|
||||
// the desktop config or pasting a freshly-deployed batch (issue: bulk add).
|
||||
// =========================================================================
|
||||
|
||||
/** Split a bulk-pasted blob into individual entries. */
|
||||
private val ID_SEPARATORS = Regex("[\\s,;]+")
|
||||
|
||||
@Composable
|
||||
private fun DeploymentIdsField(
|
||||
urls: List<String>,
|
||||
@@ -736,6 +742,8 @@ private fun DeploymentIdsField(
|
||||
)
|
||||
|
||||
// Existing entries — each with its own row and a remove button.
|
||||
// A bulk paste into an existing row also expands into multiple
|
||||
// entries, so users don't have to find the "+ Add" field to do it.
|
||||
urls.forEachIndexed { index, url ->
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
@@ -744,8 +752,18 @@ private fun DeploymentIdsField(
|
||||
OutlinedTextField(
|
||||
value = url,
|
||||
onValueChange = { edited ->
|
||||
val parts = edited.split(ID_SEPARATORS).filter { it.isNotBlank() }
|
||||
val updated = urls.toMutableList()
|
||||
updated[index] = edited
|
||||
if (parts.size > 1) {
|
||||
// Bulk paste into this row: expand in place.
|
||||
updated.removeAt(index)
|
||||
updated.addAll(index, parts)
|
||||
} else {
|
||||
// Normal typing — preserve raw input so the
|
||||
// caret/whitespace doesn't get reformatted on
|
||||
// every keystroke.
|
||||
updated[index] = edited
|
||||
}
|
||||
onChange(updated)
|
||||
},
|
||||
enabled = enabled,
|
||||
@@ -765,9 +783,11 @@ private fun DeploymentIdsField(
|
||||
}
|
||||
}
|
||||
|
||||
// "Add" row: text field + button.
|
||||
// "Add" row: multi-line text field + button. Multi-line so a user
|
||||
// can paste a long list at once (newline-separated is the natural
|
||||
// form when copying out of the desktop UI's textarea).
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
verticalAlignment = Alignment.Top,
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
) {
|
||||
OutlinedTextField(
|
||||
@@ -775,15 +795,17 @@ private fun DeploymentIdsField(
|
||||
onValueChange = { newEntry = it },
|
||||
enabled = enabled,
|
||||
modifier = Modifier.weight(1f),
|
||||
singleLine = true,
|
||||
placeholder = { Text("Paste URL or ID") },
|
||||
singleLine = false,
|
||||
minLines = 1,
|
||||
maxLines = 6,
|
||||
placeholder = { Text(stringResource(R.string.placeholder_paste_ids)) },
|
||||
)
|
||||
Spacer(Modifier.width(8.dp))
|
||||
Button(
|
||||
onClick = {
|
||||
val trimmed = newEntry.trim()
|
||||
if (trimmed.isNotBlank()) {
|
||||
onChange(urls + trimmed)
|
||||
val parts = newEntry.split(ID_SEPARATORS).filter { it.isNotBlank() }
|
||||
if (parts.isNotEmpty()) {
|
||||
onChange(urls + parts)
|
||||
newEntry = ""
|
||||
}
|
||||
},
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
|
||||
<!-- Field labels -->
|
||||
<string name="field_deployment_urls">آدرس(های) Deployment یا Script ID</string>
|
||||
<string name="placeholder_paste_ids">یک URL/ID، یا چند مورد با خط جدید/فاصله/ویرگول/نقطهویرگول جدا کنید</string>
|
||||
<string name="field_auth_key">کلید احراز (auth_key)</string>
|
||||
<string name="field_google_ip">google_ip</string>
|
||||
<string name="field_front_domain">دامنهٔ فرانت</string>
|
||||
@@ -53,7 +54,7 @@
|
||||
<string name="lang_toggle_cd">تغییر زبان</string>
|
||||
|
||||
<!-- Supporting / helper text -->
|
||||
<string name="help_deployment_urls">URL کامل (https://script.google.com/macros/s/.../exec) یا فقط ID خام. چند ID بهصورت چرخشی استفاده میشوند — بیشتر ID = سرعت بیشتر در حالت تونل کامل.</string>
|
||||
<string name="help_deployment_urls">URL کامل (https://script.google.com/macros/s/.../exec) یا فقط ID خام. میتوانید چند مورد را یکجا در فیلد افزودن جایگذاری کنید — با خط جدید/فاصله/ویرگول/نقطهویرگول جدا میشوند. چند ID بهصورت چرخشی استفاده میشوند — بیشتر ID = سرعت بیشتر در حالت تونل کامل.</string>
|
||||
<string name="help_auth_key">همان رمز مشترکی که داخل Apps Script گذاشتید.</string>
|
||||
<string name="help_mode_vpn_tun">هنگام اتصال، مجوز VPN سیستم درخواست میشود. تمام ترافیک دستگاه بهصورت خودکار رد میشود.</string>
|
||||
<string name="help_mode_proxy_only">بدون VPN سیستم. بعد از اتصال، پروکسی Wi-Fi را روی 127.0.0.1:%1$d (HTTP) یا %2$d (SOCKS5) تنظیم کنید. فقط برنامههایی که تنظیمات پروکسی را رعایت میکنند رد میشوند.</string>
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
|
||||
<!-- Field labels -->
|
||||
<string name="field_deployment_urls">Deployment URL(s) or script ID(s)</string>
|
||||
<string name="placeholder_paste_ids">Paste one URL/ID, or many separated by newline / space / comma / semicolon</string>
|
||||
<string name="field_auth_key">auth_key</string>
|
||||
<string name="field_google_ip">google_ip</string>
|
||||
<string name="field_front_domain">front_domain</string>
|
||||
@@ -53,7 +54,7 @@
|
||||
<string name="lang_toggle_cd">Switch language</string>
|
||||
|
||||
<!-- Supporting / helper text -->
|
||||
<string name="help_deployment_urls">Full URLs (https://script.google.com/macros/s/.../exec) or bare IDs. Multiple IDs are rotated round-robin — more IDs = more pipeline throughput in full mode.</string>
|
||||
<string name="help_deployment_urls">Full URLs (https://script.google.com/macros/s/.../exec) or bare IDs. Paste many at once into the Add field — they\'ll be split on newline / space / comma / semicolon. Multiple IDs are rotated round-robin — more IDs = more pipeline throughput in full mode.</string>
|
||||
<string name="help_auth_key">The shared secret you set in the Apps Script.</string>
|
||||
<string name="help_mode_vpn_tun">Requests the OS VPN grant on Connect. All device traffic is routed automatically.</string>
|
||||
<string name="help_mode_proxy_only">No OS VPN. Set your Wi-Fi proxy to 127.0.0.1:%1$d (HTTP) or %2$d (SOCKS5) after Connect. Only apps that honour the proxy settings will tunnel.</string>
|
||||
|
||||
Reference in New Issue
Block a user