|
|
|
|
@ -30,7 +30,7 @@ public class Action implements Process { |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean isRequest(NanoHTTPD.IHTTPSession session, String path) { |
|
|
|
|
return session.getMethod() == NanoHTTPD.Method.POST && path.equals("/action"); |
|
|
|
|
return path.equals("/action"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@ -46,6 +46,9 @@ public class Action implements Process { |
|
|
|
|
case "api": |
|
|
|
|
onApi(params); |
|
|
|
|
break; |
|
|
|
|
case "refresh": |
|
|
|
|
onRefresh(params); |
|
|
|
|
break; |
|
|
|
|
case "cast": |
|
|
|
|
onCast(params); |
|
|
|
|
break; |
|
|
|
|
@ -72,6 +75,15 @@ public class Action implements Process { |
|
|
|
|
else if (url.length() > 0) ServerEvent.api(url); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void onRefresh(Map<String, String> params) { |
|
|
|
|
String type = params.get("type"); |
|
|
|
|
if ("detail".equals(type)) { |
|
|
|
|
RefreshEvent.detail(); |
|
|
|
|
} else if ("player".equals(type)) { |
|
|
|
|
RefreshEvent.player(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void onCast(Map<String, String> params) { |
|
|
|
|
Config config = Config.find(params.get("url"), 0); |
|
|
|
|
Device device = Device.objectFrom(params.get("device")); |
|
|
|
|
|