aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
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();