aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2015-09-16 18:35:36 -0700
committerScott Jackson <daneren2005@gmail.com>2015-09-16 18:35:36 -0700
commita31942d823da4ff91b69baa68095a90ed78a0d02 (patch)
tree641f0622899fd70ae620c2383ce05f8fd60a584e /app
parent209781e63386332bb1c7f1ed84c6ea2be3879542 (diff)
downloaddsub-a31942d823da4ff91b69baa68095a90ed78a0d02.tar.gz
dsub-a31942d823da4ff91b69baa68095a90ed78a0d02.tar.bz2
dsub-a31942d823da4ff91b69baa68095a90ed78a0d02.zip
Madsonic 6 now uses rest2/ instead of rest/
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/github/daneren2005/dsub/domain/ServerInfo.java6
-rw-r--r--app/src/main/java/github/daneren2005/dsub/util/Util.java7
2 files changed, 12 insertions, 1 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/domain/ServerInfo.java b/app/src/main/java/github/daneren2005/dsub/domain/ServerInfo.java
index 6ee62efb..6281c086 100644
--- a/app/src/main/java/github/daneren2005/dsub/domain/ServerInfo.java
+++ b/app/src/main/java/github/daneren2005/dsub/domain/ServerInfo.java
@@ -183,6 +183,12 @@ public class ServerInfo implements Serializable {
public static boolean isMadsonic(Context context, int instance) {
return getServerType(context, instance) == TYPE_MADSONIC;
}
+ public static boolean isMadsonic6(Context context) {
+ return isMadsonic6(context, Util.getActiveServer(context));
+ }
+ public static boolean isMadsonic6(Context context, int instance) {
+ return getServerType(context, instance) == TYPE_MADSONIC && checkServerVersion(context, "2.0", instance);
+ }
private static String getCacheName(Context context, int instance) {
return "server-" + Util.getRestUrl(context, null, instance, false).hashCode() + ".ser";
diff --git a/app/src/main/java/github/daneren2005/dsub/util/Util.java b/app/src/main/java/github/daneren2005/dsub/util/Util.java
index c2ecdcee..e4e36b52 100644
--- a/app/src/main/java/github/daneren2005/dsub/util/Util.java
+++ b/app/src/main/java/github/daneren2005/dsub/util/Util.java
@@ -414,7 +414,12 @@ public final class Util {
if (builder.charAt(builder.length() - 1) != '/') {
builder.append("/");
}
- builder.append("rest/").append(method).append(".view");
+ if(method != null && ServerInfo.isMadsonic6(context, instance)) {
+ builder.append("rest2/");
+ } else {
+ builder.append("rest/");
+ }
+ builder.append(method).append(".view");
builder.append("?u=").append(username);
if(method != null && ServerInfo.canUseToken(context, instance)) {
int hash = (username + password).hashCode();