Merge pull request #136 from sschueller/develop

v1.0.29
This commit is contained in:
Stefan Schüller 2019-03-03 22:00:47 +01:00 committed by GitHub
commit 6c4a44a911
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 6 deletions

View File

@ -1,3 +1,6 @@
### Version 1.0.29 Tag: v1.0.29 (2019-03-03)
* Prevent entry of bad URL
### Version 1.0.28 Tag: v1.0.28 (2019-03-03) ### Version 1.0.28 Tag: v1.0.28 (2019-03-03)
* Server selection * Server selection
* Lots of translations * Lots of translations

View File

@ -6,8 +6,8 @@
<a href="https://github.com/sschueller/peertube-android/releases/latest" alt="GitHub release"><img src="https://img.shields.io/github/release/sschueller/peertube-android.svg" ></a> <a href="https://github.com/sschueller/peertube-android/releases/latest" alt="GitHub release"><img src="https://img.shields.io/github/release/sschueller/peertube-android.svg" ></a>
<a href="https://www.gnu.org/licenses/gpl-3.0" alt="License: GPLv3"><img src="https://img.shields.io/badge/License-GPL%20v3-blue.svg"></a> <a href="https://www.gnu.org/licenses/gpl-3.0" alt="License: GPLv3"><img src="https://img.shields.io/badge/License-GPL%20v3-blue.svg"></a>
<a href="https://f-droid.org/de/packages/net.schueller.peertube/" alt="F-Droid release"><img src="https://img.shields.io/f-droid/v/net.schueller.peertube.svg"></a> <a href="https://f-droid.org/de/packages/net.schueller.peertube/" alt="F-Droid release"><img src="https://img.shields.io/f-droid/v/net.schueller.peertube.svg"></a>
<a href="https://hosted.weblate.org/projects/peertube/" alt="Translation Status"><img src="https://hosted.weblate.org/widgets/NewPipe/-/svg-badge.svg"></a> <a href="https://hosted.weblate.org/projects/peertube/" alt="Translation Status"><img src="https://hosted.weblate.org/widgets/peertube/-/svg-badge.svg"></a>
<a href="https://www.bountysource.com/people/65848-sschueller" alt="Bountysource bounties"><img src="https://img.shields.io/bountysource/team/newpipe/activity.svg?colorB=cd201f"></a> <a href="https://www.bountysource.com/teams/peertube-android" alt="Bountysource bounties"><img src="https://img.shields.io/bountysource/team/peertube-android/activity.svg?colorB=cd201f"></a>
<a href="https://liberapay.com/sschueller/donate" alt="Donate Link"><img src="http://img.shields.io/liberapay/patrons/sschueller.svg?logo=liberapay"></a> <a href="https://liberapay.com/sschueller/donate" alt="Donate Link"><img src="http://img.shields.io/liberapay/patrons/sschueller.svg?logo=liberapay"></a>
</p> </p>
@ -63,5 +63,4 @@ Whether you have ideas, translations, design changes, code cleaning, or real hea
## Donate ## Donate
<script src="https://liberapay.com/sschueller/widgets/button.js"></script>
<noscript><a href="https://liberapay.com/sschueller/donate"><img alt="Donate using Liberapay" src="https://liberapay.com/assets/widgets/donate.svg"></a></noscript> <noscript><a href="https://liberapay.com/sschueller/donate"><img alt="Donate using Liberapay" src="https://liberapay.com/assets/widgets/donate.svg"></a></noscript>

View File

@ -13,6 +13,7 @@ import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.util.Log; import android.util.Log;
import android.util.Patterns;
import android.view.View; import android.view.View;
import android.widget.Button; import android.widget.Button;
import android.widget.TextView; import android.widget.TextView;
@ -65,10 +66,14 @@ public class SelectServerActivity extends AppCompatActivity {
String serverUrl = APIUrlHelper.cleanServerUrl(selectedUrl.getText().toString()); String serverUrl = APIUrlHelper.cleanServerUrl(selectedUrl.getText().toString());
editor.putString("pref_api_base", serverUrl); if (!Patterns.WEB_URL.matcher(serverUrl).matches()) {
editor.apply(); Toast.makeText(this, R.string.invalid_url, Toast.LENGTH_LONG).show();
} else {
editor.putString("pref_api_base", serverUrl);
editor.apply();
this.finish();
}
this.finish();
}); });
} }

View File

@ -20,7 +20,9 @@ package net.schueller.peertube.helper;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.util.Patterns;
import android.webkit.URLUtil; import android.webkit.URLUtil;
import android.widget.Toast;
import net.schueller.peertube.R; import net.schueller.peertube.R;
@ -53,6 +55,8 @@ public class APIUrlHelper{
String cleanUrl = url.toLowerCase(); String cleanUrl = url.toLowerCase();
cleanUrl = cleanUrl.replace(" ", "");
if (!cleanUrl.startsWith("http")) { if (!cleanUrl.startsWith("http")) {
cleanUrl = "https://" + cleanUrl; cleanUrl = "https://" + cleanUrl;
} }