diff --git a/mvnw b/mvnw old mode 100644 new mode 100755 diff --git a/src/main/java/com/yutou/nas/Controllers/DoorController.java b/src/main/java/com/yutou/nas/Controllers/DoorController.java index 8aec74d..ab3c6e8 100644 --- a/src/main/java/com/yutou/nas/Controllers/DoorController.java +++ b/src/main/java/com/yutou/nas/Controllers/DoorController.java @@ -1,6 +1,7 @@ package com.yutou.nas.Controllers; import com.alibaba.fastjson2.JSONObject; +import com.yutou.nas.utils.ConfigTools; import com.yutou.nas.utils.RedisTools; import com.yutou.nas.utils.StringUtils; import com.yutou.nas.utils.Tools; @@ -31,7 +32,7 @@ public class DoorController { if(file.exists()&& Objects.requireNonNull(file.listFiles()).length!=0){ JSONObject update=new JSONObject(); update.put("versionName", Objects.requireNonNull(file.listFiles())[0].getName().replace("app-release-","").replace(".apk","")); - update.put("url","http://192.168.31.88:803/apk/door/"+ Objects.requireNonNull(file.listFiles())[0].getName()); + update.put("url","http://"+ ConfigTools.load(ConfigTools.CONFIG,"nas_ip",String.class)+":803/apk/door/"+ Objects.requireNonNull(file.listFiles())[0].getName()); json.put("update",update); } RedisTools.remove("door_audio"); @@ -57,7 +58,7 @@ public class DoorController { System.out.println("收到音频"); try { String path=Tools.createFile("audio",audio,System.currentTimeMillis()+".mp3"); - RedisTools.set("door_audio","http://192.168.31.88:801/"+path); + RedisTools.set("door_audio","http://"+ConfigTools.load(ConfigTools.CONFIG,"nas_ip",String.class)+":801/"+path); } catch (Exception e) { e.printStackTrace(); } diff --git a/src/main/java/com/yutou/nas/utils/JellyfinAPIManager.java b/src/main/java/com/yutou/nas/utils/JellyfinAPIManager.java index b6a54a4..a3d55e7 100644 --- a/src/main/java/com/yutou/nas/utils/JellyfinAPIManager.java +++ b/src/main/java/com/yutou/nas/utils/JellyfinAPIManager.java @@ -28,7 +28,7 @@ public class JellyfinAPIManager { public LibsItem getLibs(String key) { HashMap header = getHeader(); - String httpText = HttpTools.https_get("http://192.168.31.88:8096/Users/"+userId+"/Items", header); + String httpText = HttpTools.https_get("http://"+ConfigTools.load(ConfigTools.CONFIG,"nas_ip",String.class)+":8096/Users/"+userId+"/Items", header); JSONObject json = JSON.parseObject(httpText); if (key == null) { return null; @@ -44,12 +44,12 @@ public class JellyfinAPIManager { } public ItemInfo getInfo(String id) { - String http = HttpTools.https_get("http://192.168.31.88:8096/Users/"+userId+"/Items/" + id, getHeader()); + String http = HttpTools.https_get("http://"+ConfigTools.load(ConfigTools.CONFIG,"nas_ip",String.class)+":8096/Users/"+userId+"/Items/" + id, getHeader()); return JSON.parseObject(http).toJavaObject(ItemInfo.class); } public List getAllItem() { - String http = HttpTools.https_get("http://192.168.31.88:8096/Users/"+userId+"/Items?SortBy=SortName&SortOrder=Ascending&IncludeItemTypes=Series&Recursive=true&Fields=PrimaryImageAspectRatio%2CBasicSyncInfo&ImageTypeLimit=1&EnableImageTypes=Primary%2CBackdrop%2CBanner%2CThumb&ParentId=28e774baf8f2fd279e7d58da9890a7d2", getHeader()); + String http = HttpTools.https_get("http://"+ConfigTools.load(ConfigTools.CONFIG,"nas_ip",String.class)+":8096/Users/"+userId+"/Items?SortBy=SortName&SortOrder=Ascending&IncludeItemTypes=Series&Recursive=true&Fields=PrimaryImageAspectRatio%2CBasicSyncInfo&ImageTypeLimit=1&EnableImageTypes=Primary%2CBackdrop%2CBanner%2CThumb&ParentId=28e774baf8f2fd279e7d58da9890a7d2", getHeader()); JSONObject json = JSON.parseObject(http); JSONArray items = json.getJSONArray("Items"); @@ -61,21 +61,21 @@ public class JellyfinAPIManager { } public List getLibsItems(String id) { - String httpText = HttpTools.https_get("http://192.168.31.88:8096/Users/"+userId+"/Items?ParentId=" + id, getHeader()); + String httpText = HttpTools.https_get("http://"+ConfigTools.load(ConfigTools.CONFIG,"nas_ip",String.class)+":8096/Users/"+userId+"/Items?ParentId=" + id, getHeader()); JSONObject json = JSON.parseObject(httpText); JSONArray items = json.getJSONArray("Items"); return items.toJavaList(LibsItem.class); } public JSONObject getItemShows(String id) { - String data = HttpTools.https_get(String.format("http://192.168.31.88:8096/Shows/%s/Seasons?userId="+userId+"", + String data = HttpTools.https_get(String.format("http://"+ConfigTools.load(ConfigTools.CONFIG,"nas_ip",String.class)+":8096/Shows/%s/Seasons?userId="+userId+"", id ), getHeader()); return JSON.parseObject(data); } public JSONObject getEpisodesForJson(String parentID, String id) { - String data = HttpTools.https_get(String.format("http://192.168.31.88:8096/Shows/%s/Episodes?seasonId=%s&userId="+userId+"", + String data = HttpTools.https_get(String.format("http://"+ConfigTools.load(ConfigTools.CONFIG,"nas_ip",String.class)+":8096/Shows/%s/Episodes?seasonId=%s&userId="+userId+"", parentID, id ), getHeader()); @@ -89,7 +89,7 @@ public class JellyfinAPIManager { } public JSONObject getEpisodesDataForJson(String id) { - String data = HttpTools.https_get(String.format("http://192.168.31.88:8096/Users/"+userId+"/Items/%s", + String data = HttpTools.https_get(String.format("http://"+ConfigTools.load(ConfigTools.CONFIG,"nas_ip",String.class)+":8096/Users/"+userId+"/Items/%s", id ), getHeader()); return JSON.parseObject(data); @@ -112,7 +112,7 @@ public class JellyfinAPIManager { try { HashMap header = getHeader(); header.put("Content-Type", "image/jpeg"); - String url = String.format("http://192.168.31.88:8096/Items/%s/Images/%s", + String url = String.format("http://"+ConfigTools.load(ConfigTools.CONFIG,"nas_ip",String.class)+":8096/Items/%s/Images/%s", id, model ); @@ -178,7 +178,7 @@ public class JellyfinAPIManager { metadata.put("Taglines", new JSONArray()); HashMap headers = getHeader(); headers.put("Content-Type", "application/json"); - String ret = HttpTools.http_post("http://192.168.31.88:8096/Items/" + item.getId() + String ret = HttpTools.http_post("http://"+ConfigTools.load(ConfigTools.CONFIG,"nas_ip",String.class)+":8096/Items/" + item.getId() , metadata.toString().replace("\"null\"", "null").getBytes(StandardCharsets.UTF_8) , 4 , headers); @@ -280,7 +280,7 @@ public class JellyfinAPIManager { return array; } public void refresh(){ - String url="http://192.168.31.88:8096/Items/28e774baf8f2fd279e7d58da9890a7d2/Refresh?Recursive=true&ImageRefreshMode=Default&MetadataRefreshMode=Default&ReplaceAllImages=false&ReplaceAllMetadata=false"; + String url="http://"+ConfigTools.load(ConfigTools.CONFIG,"nas_ip",String.class)+":8096/Items/28e774baf8f2fd279e7d58da9890a7d2/Refresh?Recursive=true&ImageRefreshMode=Default&MetadataRefreshMode=Default&ReplaceAllImages=false&ReplaceAllMetadata=false"; String tmp=HttpTools.http_post(url,null,1,getHeader()); System.out.println(tmp); } @@ -334,7 +334,7 @@ public class JellyfinAPIManager { public static String mainPath = "Z:\\download\\anim\\"; public void login(){ - String url="http://192.168.31.88:8096/Users/authenticatebyname"; + String url="http://"+ConfigTools.load(ConfigTools.CONFIG,"nas_ip",String.class)+":8096/Users/authenticatebyname"; HashMap header=getHttpHeader(); JSONObject json=new JSONObject(); json.put("Pw","34864394"); @@ -350,7 +350,7 @@ public class JellyfinAPIManager { header.put("accept", "application/json"); header.put("Connection", "keep-alive"); header.put("User-Agent", HttpTools.getUa()); - header.put("Origin", "http://192.168.31.88:8096"); + header.put("Origin", "http://"+ConfigTools.load(ConfigTools.CONFIG,"nas_ip",String.class)+":8096"); header.put("X-Emby-Authorization", "MediaBrowser Client=\"Jellyfin Web\", Device=\"Chrome\", DeviceId=\"TW96aWxsYS81LjAgKFdpbmRvd3MgTlQgMTAuMDsgV2luNjQ7IHg2NCkgQXBwbGVXZWJLaXQvNTM3LjM2IChLSFRNTCwgbGlrZSBHZWNrbykgQ2hyb21lLzg2LjAuNDI0MC43NSBTYWZhcmkvNTM3LjM2fDE2MDI4NDYzMDc5NjE1\", Version=\"10.8.1\""); return header; } diff --git a/src/main/java/com/yutou/nas/utils/QQBotManager.java b/src/main/java/com/yutou/nas/utils/QQBotManager.java index 4c2d756..a2dffa0 100644 --- a/src/main/java/com/yutou/nas/utils/QQBotManager.java +++ b/src/main/java/com/yutou/nas/utils/QQBotManager.java @@ -35,7 +35,7 @@ public class QQBotManager { json.put("message",text); Map header = new HashMap<>(); header.put("content-type", "application/json"); - return HttpTools.http_post("http://192.168.31.88:802/qq/send.do", json.toString().getBytes(StandardCharsets.UTF_8), 1, header); + return HttpTools.http_post("http://"+ConfigTools.load(ConfigTools.CONFIG,"nas_ip",String.class)+":802/qq/send.do", json.toString().getBytes(StandardCharsets.UTF_8), 1, header); } public String sendMessage(long qq,String text) { @@ -44,7 +44,7 @@ public class QQBotManager { json.put("message",text); Map header = new HashMap<>(); header.put("content-type", "application/json"); - return HttpTools.http_post("http://192.168.31.88:802/qq/send.do", json.toString().getBytes(StandardCharsets.UTF_8), 1, header); + return HttpTools.http_post("http://"+ConfigTools.load(ConfigTools.CONFIG,"nas_ip",String.class)+":802/qq/send.do", json.toString().getBytes(StandardCharsets.UTF_8), 1, header); } public String sendMessage(String imageUrl, String message) { @@ -57,7 +57,7 @@ public class QQBotManager { json.put("image", imageUrl); Map header = new HashMap<>(); header.put("content-type", "application/json"); - return HttpTools.http_post("http://192.168.31.88:802/qq/send.do", json.toString().getBytes(StandardCharsets.UTF_8), 1, header); + return HttpTools.http_post("http://"+ConfigTools.load(ConfigTools.CONFIG,"nas_ip",String.class)+":802/qq/send.do", json.toString().getBytes(StandardCharsets.UTF_8), 1, header); }