mirror of
https://github.com/apognu/otter
synced 2025-02-17 11:20:34 +01:00
Add a checkbox to allow cleartext connections to a Funkwhale instance. Should close #6.
This commit is contained in:
parent
66c7915307
commit
1b98850a9c
@ -14,7 +14,8 @@
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
android:theme="@style/AppTheme"
|
||||
android:usesCleartextTraffic="true">
|
||||
|
||||
<!-- <meta-data
|
||||
android:name="com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME"
|
||||
|
@ -50,11 +50,23 @@ class LoginActivity : AppCompatActivity() {
|
||||
if (hostname.isEmpty()) throw Exception(getString(R.string.login_error_hostname))
|
||||
|
||||
Uri.parse(hostname).apply {
|
||||
if (scheme == "http") {
|
||||
if (!cleartext.isChecked && scheme == "http") {
|
||||
throw Exception(getString(R.string.login_error_hostname_https))
|
||||
}
|
||||
|
||||
if (scheme == null) hostname = "https://$hostname"
|
||||
if (scheme == null) {
|
||||
hostname = when (cleartext.isChecked) {
|
||||
true -> "http://$hostname"
|
||||
false -> "https://$hostname"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hostname_field.error = ""
|
||||
|
||||
when (anonymous.isChecked) {
|
||||
false -> authedLogin(hostname, username, password)
|
||||
true -> anonymousLogin(hostname)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
val message =
|
||||
@ -63,13 +75,6 @@ class LoginActivity : AppCompatActivity() {
|
||||
|
||||
hostname_field.error = message
|
||||
}
|
||||
|
||||
hostname_field.error = ""
|
||||
|
||||
when (anonymous.isChecked) {
|
||||
false -> authedLogin(hostname, username, password)
|
||||
true -> anonymousLogin(hostname)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,6 +50,14 @@
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.checkbox.MaterialCheckBox
|
||||
android:id="@+id/cleartext"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:buttonTint="@android:color/white"
|
||||
android:text="@string/login_cleartext"
|
||||
android:textColor="@android:color/white" />
|
||||
|
||||
<com.google.android.material.checkbox.MaterialCheckBox
|
||||
android:id="@+id/anonymous"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -2,6 +2,7 @@
|
||||
<resources>
|
||||
<string name="login_welcome">Veuillez saisir les détails de votre instance Funkwhale pour accéder à son contenu</string>
|
||||
<string name="login_hostname">Nom d\'hôte</string>
|
||||
<string name="login_cleartext">Autoriser les connexions non chiffrées (HTTP)</string>
|
||||
<string name="login_anonymous">Authentification anonyme</string>
|
||||
<string name="login_username">Nom d\'utilisateur</string>
|
||||
<string name="login_password">Mot de passe</string>
|
||||
|
@ -3,6 +3,7 @@
|
||||
<string name="app_name" translatable="false">Otter</string>
|
||||
<string name="login_welcome">Please enter the details of your Funkwhale instance to access its content</string>
|
||||
<string name="login_hostname">Host name</string>
|
||||
<string name="login_cleartext">Allow cleartext traffic (HTTP)</string>
|
||||
<string name="login_anonymous">Anonymous authentication</string>
|
||||
<string name="login_username">Username</string>
|
||||
<string name="login_password">Password</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user