add download Jellyfin for Android Apk
This commit is contained in:
parent
56e55bab44
commit
ee089312f2
@ -1,13 +1,13 @@
|
||||
package com.yutou.nas.Controllers;
|
||||
|
||||
import com.yutou.nas.utils.AppTools;
|
||||
import com.yutou.nas.utils.JellyfinAPIManager;
|
||||
import com.yutou.nas.utils.QQBotManager;
|
||||
import com.yutou.nas.utils.StringUtils;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.yutou.nas.utils.*;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@Controller
|
||||
public class JellyfinController {
|
||||
@RequestMapping("/jellyfin/addItem")
|
||||
@ -28,4 +28,36 @@ public class JellyfinController {
|
||||
new JellyfinAPIManager().refresh();
|
||||
return "ok";
|
||||
}
|
||||
@ResponseBody
|
||||
@RequestMapping("/jellyfin/setAppVersion")
|
||||
public String setAppVersion(String version){
|
||||
RedisTools.set("jellyfin_app_version",version);
|
||||
return "";
|
||||
}
|
||||
@ResponseBody
|
||||
@RequestMapping("/jellyfin/updateApp.do")
|
||||
public JSONObject updateApp(String version){
|
||||
JSONObject json=new JSONObject();
|
||||
String appVersion=RedisTools.get("jellyfin_app_version");
|
||||
if(appVersion==null){
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return json;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user