This commit is contained in:
Yutousama 2022-11-04 18:13:29 +08:00
parent 8fa1f81ff9
commit a39d99eeb6
2 changed files with 21 additions and 28 deletions

View File

@ -60,14 +60,14 @@
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>4.2.2</version>
<version>4.3.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.alibaba/fastjson -->
<dependency>
<groupId>com.alibaba.fastjson2</groupId>
<artifactId>fastjson2</artifactId>
<version>2.0.2</version>
<version>2.0.17</version>
</dependency>
<!-- <dependency>
<groupId>com.alibaba.fastjson2</groupId>

View File

@ -49,23 +49,28 @@ public class JellyfinController {
json.put("code",0);
}else{
File dir=new File("web"+File.separator+"apk"+File.separator+"jellyfin"+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;
}
}
}
buildDownloadJson(json, appVersion, dir);
}
return json;
}
private void buildDownloadJson(JSONObject json, String appVersion, File dir) {
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;
}
}
}
}
@ResponseBody
@RequestMapping("/jellyfin/updateTvApp.do")
public JSONObject updateTvApp(String version){
@ -75,19 +80,7 @@ public class JellyfinController {
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;
}
}
}
buildDownloadJson(json, appVersion, dir);
}
return json;