Added path field
This commit is contained in:
@@ -5,4 +5,5 @@ class Regexps {
|
|||||||
RegExp(r'[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)');
|
RegExp(r'[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)');
|
||||||
static final ipAddress = RegExp(r'^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}$');
|
static final ipAddress = RegExp(r'^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)(\.(?!$)|$)){4}$');
|
||||||
static final domain = RegExp(r'^(([a-z0-9|-]+\.)*[a-z0-9|-]+\.[a-z]+)$');
|
static final domain = RegExp(r'^(([a-z0-9|-]+\.)*[a-z0-9|-]+\.[a-z]+)$');
|
||||||
|
static final path = RegExp(r'^\/\b([A-Za-z0-9_\-~/]*)[^\/|\.|\:]$');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,9 +4,9 @@
|
|||||||
/// To regenerate, run: `dart run slang`
|
/// To regenerate, run: `dart run slang`
|
||||||
///
|
///
|
||||||
/// Locales: 2
|
/// Locales: 2
|
||||||
/// Strings: 280 (140 per locale)
|
/// Strings: 284 (142 per locale)
|
||||||
///
|
///
|
||||||
/// Built on 2024-02-26 at 09:50 UTC
|
/// Built on 2024-02-26 at 14:46 UTC
|
||||||
|
|
||||||
// coverage:ignore-file
|
// coverage:ignore-file
|
||||||
// ignore_for_file: type=lint
|
// ignore_for_file: type=lint
|
||||||
@@ -194,6 +194,8 @@ class _StringsOnboardingEn {
|
|||||||
String get createConnectionSubtitle => 'Enter all the required details to create a connection to your server.';
|
String get createConnectionSubtitle => 'Enter all the required details to create a connection to your server.';
|
||||||
String get ipAddressOrDomain => 'IP address or domain';
|
String get ipAddressOrDomain => 'IP address or domain';
|
||||||
String get port => 'Port';
|
String get port => 'Port';
|
||||||
|
String get path => 'Path';
|
||||||
|
String get invalidPath => 'Invalid path';
|
||||||
String get token => 'Token';
|
String get token => 'Token';
|
||||||
String get required => 'Required';
|
String get required => 'Required';
|
||||||
String get serverDetails => 'Server details';
|
String get serverDetails => 'Server details';
|
||||||
@@ -520,6 +522,8 @@ class _StringsOnboardingEs implements _StringsOnboardingEn {
|
|||||||
@override String get createConnectionSubtitle => 'Introduce todos los detalles requeridos para crear una conexión con el servidor';
|
@override String get createConnectionSubtitle => 'Introduce todos los detalles requeridos para crear una conexión con el servidor';
|
||||||
@override String get ipAddressOrDomain => 'Dirección IP o dominio';
|
@override String get ipAddressOrDomain => 'Dirección IP o dominio';
|
||||||
@override String get port => 'Puerto';
|
@override String get port => 'Puerto';
|
||||||
|
@override String get path => 'Ruta';
|
||||||
|
@override String get invalidPath => 'Ruta no válida';
|
||||||
@override String get token => 'Token';
|
@override String get token => 'Token';
|
||||||
@override String get required => 'Requerido';
|
@override String get required => 'Requerido';
|
||||||
@override String get serverDetails => 'Detalles del servidor';
|
@override String get serverDetails => 'Detalles del servidor';
|
||||||
@@ -803,6 +807,8 @@ extension on Translations {
|
|||||||
case 'onboarding.createConnectionSubtitle': return 'Enter all the required details to create a connection to your server.';
|
case 'onboarding.createConnectionSubtitle': return 'Enter all the required details to create a connection to your server.';
|
||||||
case 'onboarding.ipAddressOrDomain': return 'IP address or domain';
|
case 'onboarding.ipAddressOrDomain': return 'IP address or domain';
|
||||||
case 'onboarding.port': return 'Port';
|
case 'onboarding.port': return 'Port';
|
||||||
|
case 'onboarding.path': return 'Path';
|
||||||
|
case 'onboarding.invalidPath': return 'Invalid path';
|
||||||
case 'onboarding.token': return 'Token';
|
case 'onboarding.token': return 'Token';
|
||||||
case 'onboarding.required': return 'Required';
|
case 'onboarding.required': return 'Required';
|
||||||
case 'onboarding.serverDetails': return 'Server details';
|
case 'onboarding.serverDetails': return 'Server details';
|
||||||
@@ -951,6 +957,8 @@ extension on _StringsEs {
|
|||||||
case 'onboarding.createConnectionSubtitle': return 'Introduce todos los detalles requeridos para crear una conexión con el servidor';
|
case 'onboarding.createConnectionSubtitle': return 'Introduce todos los detalles requeridos para crear una conexión con el servidor';
|
||||||
case 'onboarding.ipAddressOrDomain': return 'Dirección IP o dominio';
|
case 'onboarding.ipAddressOrDomain': return 'Dirección IP o dominio';
|
||||||
case 'onboarding.port': return 'Puerto';
|
case 'onboarding.port': return 'Puerto';
|
||||||
|
case 'onboarding.path': return 'Ruta';
|
||||||
|
case 'onboarding.invalidPath': return 'Ruta no válida';
|
||||||
case 'onboarding.token': return 'Token';
|
case 'onboarding.token': return 'Token';
|
||||||
case 'onboarding.required': return 'Requerido';
|
case 'onboarding.required': return 'Requerido';
|
||||||
case 'onboarding.serverDetails': return 'Detalles del servidor';
|
case 'onboarding.serverDetails': return 'Detalles del servidor';
|
||||||
|
|||||||
@@ -23,6 +23,8 @@
|
|||||||
"createConnectionSubtitle": "Enter all the required details to create a connection to your server.",
|
"createConnectionSubtitle": "Enter all the required details to create a connection to your server.",
|
||||||
"ipAddressOrDomain": "IP address or domain",
|
"ipAddressOrDomain": "IP address or domain",
|
||||||
"port": "Port",
|
"port": "Port",
|
||||||
|
"path": "Path",
|
||||||
|
"invalidPath": "Invalid path",
|
||||||
"token": "Token",
|
"token": "Token",
|
||||||
"required": "Required",
|
"required": "Required",
|
||||||
"serverDetails": "Server details",
|
"serverDetails": "Server details",
|
||||||
|
|||||||
@@ -23,6 +23,8 @@
|
|||||||
"createConnectionSubtitle": "Introduce todos los detalles requeridos para crear una conexión con el servidor",
|
"createConnectionSubtitle": "Introduce todos los detalles requeridos para crear una conexión con el servidor",
|
||||||
"ipAddressOrDomain": "Dirección IP o dominio",
|
"ipAddressOrDomain": "Dirección IP o dominio",
|
||||||
"port": "Puerto",
|
"port": "Puerto",
|
||||||
|
"path": "Ruta",
|
||||||
|
"invalidPath": "Ruta no válida",
|
||||||
"token": "Token",
|
"token": "Token",
|
||||||
"required": "Requerido",
|
"required": "Requerido",
|
||||||
"serverDetails": "Detalles del servidor",
|
"serverDetails": "Detalles del servidor",
|
||||||
|
|||||||
@@ -53,8 +53,8 @@ class Connect extends _$Connect {
|
|||||||
ref.notifyListeners();
|
ref.notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
void validatePort(value) {
|
void validatePort(String value) {
|
||||||
if (value != null && value != '') {
|
if (value != '') {
|
||||||
if (int.tryParse(value) != null && int.parse(value) <= 65535) {
|
if (int.tryParse(value) != null && int.parse(value) <= 65535) {
|
||||||
state.portError = null;
|
state.portError = null;
|
||||||
} else {
|
} else {
|
||||||
@@ -65,6 +65,20 @@ class Connect extends _$Connect {
|
|||||||
ref.notifyListeners();
|
ref.notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void validatePath(String value) {
|
||||||
|
if (value == "") {
|
||||||
|
state.pathError = null;
|
||||||
|
} else {
|
||||||
|
if (Regexps.path.hasMatch(value) == true) {
|
||||||
|
state.pathError = null;
|
||||||
|
} else {
|
||||||
|
state.pathError = t.onboarding.invalidPath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
state.validValues = validValues();
|
||||||
|
ref.notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
void validateToken(String value) {
|
void validateToken(String value) {
|
||||||
if (value != "") {
|
if (value != "") {
|
||||||
state.tokenError = null;
|
state.tokenError = null;
|
||||||
@@ -79,7 +93,9 @@ class Connect extends _$Connect {
|
|||||||
return state.tokenController.text != "" &&
|
return state.tokenController.text != "" &&
|
||||||
state.tokenError == null &&
|
state.tokenError == null &&
|
||||||
state.ipDomainController.text != "" &&
|
state.ipDomainController.text != "" &&
|
||||||
state.ipDomainError == null;
|
state.ipDomainError == null &&
|
||||||
|
state.pathError == null &&
|
||||||
|
state.portError == null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ final connectToServerProvider = AutoDisposeFutureProvider<bool>.internal(
|
|||||||
);
|
);
|
||||||
|
|
||||||
typedef ConnectToServerRef = AutoDisposeFutureProviderRef<bool>;
|
typedef ConnectToServerRef = AutoDisposeFutureProviderRef<bool>;
|
||||||
String _$connectHash() => r'946ac6cce15a0ac9b3a7f8c1b606b3782e64f5e7';
|
String _$connectHash() => r'576283d8c543cdb4b1ae22c99cc63a23e4ff2981';
|
||||||
|
|
||||||
/// See also [Connect].
|
/// See also [Connect].
|
||||||
@ProviderFor(Connect)
|
@ProviderFor(Connect)
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ class _ConnectForm extends ConsumerWidget {
|
|||||||
final connectionMethod = ConnectionMethod.values[provider.method];
|
final connectionMethod = ConnectionMethod.values[provider.method];
|
||||||
|
|
||||||
final connectionString =
|
final connectionString =
|
||||||
"${connectionMethod.name}://${provider.ipDomainController.text}${provider.portController.text != '' ? ':${provider.portController.text}' : ""}";
|
"${connectionMethod.name}://${provider.ipDomainController.text}${provider.portController.text != '' ? ':${provider.portController.text}' : ""}${provider.pathController.text}";
|
||||||
|
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
@@ -167,6 +167,22 @@ class _ConnectForm extends ConsumerWidget {
|
|||||||
labelText: t.onboarding.port,
|
labelText: t.onboarding.port,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
const SizedBox(height: 24),
|
||||||
|
TextFormField(
|
||||||
|
controller: provider.pathController,
|
||||||
|
onChanged: ref.read(connectProvider.notifier).validatePath,
|
||||||
|
autocorrect: false,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
prefixIcon: const Icon(Icons.route_rounded),
|
||||||
|
border: const OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.all(
|
||||||
|
Radius.circular(10),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
errorText: provider.pathError,
|
||||||
|
labelText: t.onboarding.path,
|
||||||
|
),
|
||||||
|
),
|
||||||
SectionLabel(
|
SectionLabel(
|
||||||
label: t.onboarding.authentication,
|
label: t.onboarding.authentication,
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 0, vertical: 24),
|
padding: const EdgeInsets.symmetric(horizontal: 0, vertical: 24),
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import 'package:linkdy/models/server_instance.dart';
|
import 'package:linkdy/models/server_instance.dart';
|
||||||
|
|
||||||
String apiBaseUrl(ServerInstance server) {
|
String apiBaseUrl(ServerInstance server) {
|
||||||
return "${server.method}://${server.ipDomain}${server.port != null ? ':${server.port}' : ""}/api";
|
return "${server.method}://${server.ipDomain}${server.port != null ? ':${server.port}' : ""}${server.path}/api";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user