add JellyfinTv update Apk

This commit is contained in:
Yutousama 2022-11-04 17:17:38 +08:00
parent ee089312f2
commit 8fa1f81ff9

View File

@ -35,6 +35,12 @@ public class JellyfinController {
return "";
}
@ResponseBody
@RequestMapping("/jellyfin/setTvAppVersion")
public String setTvAppVersion(String version){
RedisTools.set("jellyfin_tv_version",version);
return "";
}
@ResponseBody
@RequestMapping("/jellyfin/updateApp.do")
public JSONObject updateApp(String version){
JSONObject json=new JSONObject();
@ -60,4 +66,30 @@ public class JellyfinController {
}
return json;
}
@ResponseBody
@RequestMapping("/jellyfin/updateTvApp.do")
public JSONObject updateTvApp(String version){
JSONObject json=new JSONObject();
String appVersion=RedisTools.get("jellyfin_tv_version");
if(appVersion==null){
json.put("code",0);
}else{
File dir=new File("web"+File.separator+"apk"+File.separator+"jellyfinTv"+File.separator);
json.put("code",0);
if(dir.exists()){
for (File file : dir.listFiles()) {
if(file.getName().endsWith(".apk")){
json.put("code",1);
JSONObject data=new JSONObject();
data.put("version",appVersion);
data.put("url","http://nas.cnmglz.com:9999/apk"+file.getAbsolutePath().replace(new File("web"+File.separator+"apk"+File.separator).getAbsolutePath(),""));
json.put("data",data);
break;
}
}
}
}
return json;
}
}