aboutsummaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java b/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java
index 913e30bf..1aa1d212 100644
--- a/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java
+++ b/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java
@@ -39,6 +39,7 @@ import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
+import android.util.Base64;
import android.util.Log;
import com.google.android.gms.security.ProviderInstaller;
@@ -1897,6 +1898,13 @@ public class RESTMusicService implements MusicService {
sslConnection.setHostnameVerifier(selfSignedHostnameVerifier);
}
+ SharedPreferences prefs = Util.getPreferences(context);
+ int instance = getInstance(context);
+ String username = prefs.getString(Constants.PREFERENCES_KEY_USERNAME + instance, null);
+ String password = prefs.getString(Constants.PREFERENCES_KEY_PASSWORD + instance, null);
+ String encoded = Base64.encodeToString((username + ":" + password).getBytes("UTF-8"), Base64.NO_WRAP);;
+ connection.setRequestProperty("Authorization", "Basic " + encoded);
+
// Force the connection to initiate
if(connection.getResponseCode() >= 500) {
throw new IOException("Error code: " + connection.getResponseCode());