update
This commit is contained in:
parent
2183444676
commit
1b61722446
@ -6,7 +6,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class ToolsApplication {
|
public class ToolsApplication {
|
||||||
public static final String version="1.4.9";
|
public static final String version="1.5.0";
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
System.out.println("当前版本号:" + version);
|
System.out.println("当前版本号:" + version);
|
||||||
|
@ -29,7 +29,7 @@ import java.util.UUID;
|
|||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
public class NasManager {
|
public class NasManager {
|
||||||
public static String NasUrl="http://yutou233.cn";
|
public static String NasUrl="https://nas.yutou233.cn";
|
||||||
static {
|
static {
|
||||||
if ("dev".equals(ConfigTools.load(ConfigTools.CONFIG, "model"))) {
|
if ("dev".equals(ConfigTools.load(ConfigTools.CONFIG, "model"))) {
|
||||||
NasUrl="http://192.168.31.88";
|
NasUrl="http://192.168.31.88";
|
||||||
@ -184,7 +184,7 @@ public class NasManager {
|
|||||||
json.put("data", NasUrl + ":8000");
|
json.put("data", NasUrl + ":8000");
|
||||||
} else {
|
} else {
|
||||||
if (UpdateIp.nas_ip == null) {
|
if (UpdateIp.nas_ip == null) {
|
||||||
json.put("data", "http://yutou233.cn:8001");
|
json.put("data", "http://nas.yutou233.cn:8001");
|
||||||
} else {
|
} else {
|
||||||
json.put("data", String.format("http://%s:8000", UpdateIp.nas_ip));
|
json.put("data", String.format("http://%s:8000", UpdateIp.nas_ip));
|
||||||
}
|
}
|
||||||
@ -282,7 +282,7 @@ public class NasManager {
|
|||||||
json.put("data", NasUrl + ":8000/nas/music/list.do?token=");
|
json.put("data", NasUrl + ":8000/nas/music/list.do?token=");
|
||||||
} else {
|
} else {
|
||||||
if (UpdateIp.nas_ip == null) {
|
if (UpdateIp.nas_ip == null) {
|
||||||
json.put("data", "http://yutou233.cn:8001/nas/music/list.do?token=");
|
json.put("data", "http://nas.yutou233.cn:8001/nas/music/list.do?token=");
|
||||||
} else {
|
} else {
|
||||||
json.put("data", String.format("http://%s:8000/nas/music/list.do?token=", UpdateIp.nas_ip));
|
json.put("data", String.format("http://%s:8000/nas/music/list.do?token=", UpdateIp.nas_ip));
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import com.yutou.tools.ToolsApplication;
|
|||||||
import com.yutou.tools.mybatis.dao.UKeyDao;
|
import com.yutou.tools.mybatis.dao.UKeyDao;
|
||||||
import com.yutou.tools.mybatis.model.UKey;
|
import com.yutou.tools.mybatis.model.UKey;
|
||||||
import com.yutou.tools.mybatis.model.UKeyExample;
|
import com.yutou.tools.mybatis.model.UKeyExample;
|
||||||
|
import com.yutou.tools.utils.ConfigTools;
|
||||||
import com.yutou.tools.utils.HttpTools;
|
import com.yutou.tools.utils.HttpTools;
|
||||||
import com.yutou.tools.utils.RedisTools;
|
import com.yutou.tools.utils.RedisTools;
|
||||||
import com.yutou.tools.utils.Tools;
|
import com.yutou.tools.utils.Tools;
|
||||||
@ -217,7 +218,11 @@ public class tools {
|
|||||||
}
|
}
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
@ResponseBody
|
||||||
|
@RequestMapping(value = "/tools/ssr/get.do", produces = "text/plain;charset=utf-8")
|
||||||
|
public String getSSRUrl(){
|
||||||
|
return (String) ConfigTools.load(ConfigTools.DATA,"ssr");
|
||||||
|
}
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@RequestMapping("/tools/clash/ssr.do")
|
@RequestMapping("/tools/clash/ssr.do")
|
||||||
public JSONObject setClashSSR(String url) {
|
public JSONObject setClashSSR(String url) {
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package com.yutou.tools.utils;
|
package com.yutou.tools.utils;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSON;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.aliyuncs.utils.StringUtils;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
|
||||||
@ -11,6 +13,8 @@ public class ConfigTools {
|
|||||||
public static final String CONFIG = "config.json";
|
public static final String CONFIG = "config.json";
|
||||||
public static final String DATA = "data.json";
|
public static final String DATA = "data.json";
|
||||||
public static final String SQLITE = "sqlite.json";
|
public static final String SQLITE = "sqlite.json";
|
||||||
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
try {
|
try {
|
||||||
File file = new File(CONFIG);
|
File file = new File(CONFIG);
|
||||||
@ -27,35 +31,64 @@ public class ConfigTools {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Object load(String type, String key) {
|
public static Object load(String type, String key) {
|
||||||
|
return load(type, key, Object.class, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> T load(String type, String key, Class<T> t) {
|
||||||
|
return load(type, key, t, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> T load(String type, String key, Class<T> t, T def) {
|
||||||
File file = new File(type);
|
File file = new File(type);
|
||||||
//System.out.println(type+"配置文件地址:"+file.getAbsolutePath());
|
//com.yutou.nas.utils.Log.i(type+"配置文件地址:"+file.getAbsolutePath());
|
||||||
String src = readFile(file);
|
String src = readFile(file);
|
||||||
if (src != null) {
|
if (src != null) {
|
||||||
try {
|
try {
|
||||||
JSONObject json=JSONObject.parseObject(src);
|
JSONObject json = JSONObject.parseObject(src, JSONObject.class);
|
||||||
if(json==null){
|
return json.getObject(key, t);
|
||||||
json=new JSONObject();
|
|
||||||
saveFile(file,json.toJSONString());
|
|
||||||
}
|
|
||||||
return json.getOrDefault(key, "");
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return "";
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "";
|
|
||||||
|
return def;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String loadIni(File file, String key) {
|
||||||
|
try {
|
||||||
|
BufferedReader reader = new BufferedReader(new FileReader(file));
|
||||||
|
String tmp, str = null;
|
||||||
|
while ((tmp = reader.readLine()) != null) {
|
||||||
|
if (tmp.startsWith(key + "=")) {
|
||||||
|
str = tmp.split("=")[1];
|
||||||
|
if (StringUtils.isEmpty(str)) {
|
||||||
|
str = null;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return str;
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean save(String type, String key, Object data) {
|
public static boolean save(String type, String key, Object data) {
|
||||||
File file = new File(type);
|
File file = new File(type);
|
||||||
String src = readFile(file);
|
String src = readFile(file);
|
||||||
if (src == null) {
|
if (src == null) {
|
||||||
src = "{}";
|
src = "{}";
|
||||||
}
|
}
|
||||||
JSONObject json=JSONObject.parseObject(src);
|
JSONObject json = JSON.parseObject(src);
|
||||||
json.put(key, data);
|
json.put(key, data);
|
||||||
saveFile(file, json.toJSONString());
|
saveFile(file, json.toJSONString());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean saveFile(File file, String data) {
|
public static boolean saveFile(File file, String data) {
|
||||||
try {
|
try {
|
||||||
FileWriter writer = new FileWriter(file);
|
FileWriter writer = new FileWriter(file);
|
||||||
@ -68,13 +101,14 @@ public class ConfigTools {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String readFile(File file) {
|
public static String readFile(File file) {
|
||||||
try {
|
try {
|
||||||
BufferedReader reader = new BufferedReader(new FileReader(file));
|
BufferedReader reader = new BufferedReader(new FileReader(file));
|
||||||
String tmp;
|
String tmp;
|
||||||
StringBuilder str = new StringBuilder();
|
StringBuilder str = new StringBuilder();
|
||||||
while ((tmp = reader.readLine()) != null) {
|
while ((tmp = reader.readLine()) != null) {
|
||||||
str.append(tmp);
|
str.append(tmp).append("\n");
|
||||||
}
|
}
|
||||||
reader.close();
|
reader.close();
|
||||||
return str.toString();
|
return str.toString();
|
||||||
@ -84,3 +118,4 @@ public class ConfigTools {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,13 +10,10 @@ public class CorsConfig implements WebMvcConfigurer {
|
|||||||
public void addCorsMappings(CorsRegistry registry) {
|
public void addCorsMappings(CorsRegistry registry) {
|
||||||
//设置允许跨域的路径
|
//设置允许跨域的路径
|
||||||
registry.addMapping("/**")
|
registry.addMapping("/**")
|
||||||
//设置允许跨域请求的域名
|
.allowedOrigins("https://tools.yutou233.cn") // 允许哪些域的请求
|
||||||
.allowedOrigins("Access-Control-Allow-Origin")
|
.allowedMethods("POST", "GET") // 允许的请求方法
|
||||||
//是否允许证书 不再默认开启
|
.allowedHeaders("*") // 允许的头部设置
|
||||||
.allowCredentials(true)
|
.allowCredentials(true) // 是否发送cookie
|
||||||
//设置允许的方法
|
.maxAge(168000); // 预检间隔时间
|
||||||
.allowedMethods("*")
|
|
||||||
//跨域允许时间
|
|
||||||
.maxAge(3600);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -459,7 +459,7 @@ public class Tools {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String getPinYin(String text) {
|
public static String getPinYin(String text) {
|
||||||
String pinyin = HttpTools.get("http://api.tianapi.com/pinyin/index?key=a1e0f7267037c4e0ea02fb1cb3912367&text=" + URLEncoder.encode(text, StandardCharsets.UTF_8));
|
String pinyin = HttpTools.get("https://apis.tianapi.com/pinyin/index?key=" + ConfigTools.load(ConfigTools.CONFIG, "tianapi.key", String.class) + "&text=" + URLEncoder.encode(text, StandardCharsets.UTF_8));
|
||||||
JSONObject json = JSONObject.parseObject(pinyin);
|
JSONObject json = JSONObject.parseObject(pinyin);
|
||||||
if (json.getInteger("code") == 200) {
|
if (json.getInteger("code") == 200) {
|
||||||
return json.getJSONArray("newslist").getJSONObject(0).getString("pinyin").trim().replace(" ", "");
|
return json.getJSONArray("newslist").getJSONObject(0).getString("pinyin").trim().replace(" ", "");
|
||||||
@ -474,6 +474,7 @@ public class Tools {
|
|||||||
calendar.setTime(new Date());
|
calendar.setTime(new Date());
|
||||||
return calendar.get(Calendar.DAY_OF_WEEK) - 1;
|
return calendar.get(Calendar.DAY_OF_WEEK) - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Date timeToDate(String date, String time) {
|
public static Date timeToDate(String date, String time) {
|
||||||
String form;
|
String form;
|
||||||
if (StringUtils.isEmpty(time)) {
|
if (StringUtils.isEmpty(time)) {
|
||||||
|
@ -101,7 +101,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
localhost = json.data;
|
localhost = json.data;
|
||||||
if (localhost === 'http://null:8000' || localhost === ":8000") {
|
if (localhost === 'https://null:8000' || localhost === ":8000") {
|
||||||
localhost = "https://" + window.location.host;
|
localhost = "https://" + window.location.host;
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -210,7 +210,7 @@
|
|||||||
}
|
}
|
||||||
$.post('/nas/music/share.do', {file: file, isDir: isDir}, function (json) {
|
$.post('/nas/music/share.do', {file: file, isDir: isDir}, function (json) {
|
||||||
if (json.code === 0) {
|
if (json.code === 0) {
|
||||||
var url = "http://" + window.location.host + "/html/body/nas/music.html?share=" + json.data.token
|
var url = "https://" + window.location.host + "/html/body/nas/music.html?share=" + json.data.token
|
||||||
layer.prompt({
|
layer.prompt({
|
||||||
title: "分享链接",
|
title: "分享链接",
|
||||||
value: url
|
value: url
|
||||||
@ -290,7 +290,7 @@
|
|||||||
$('#play_share').click(function () {
|
$('#play_share').click(function () {
|
||||||
$.post('/nas/music/share.do', {file: playNow}, function (json) {
|
$.post('/nas/music/share.do', {file: playNow}, function (json) {
|
||||||
if (json.code === 0) {
|
if (json.code === 0) {
|
||||||
let url = "http://" + window.location.host + "/html/body/nas/music.html?share=" + json.data.token
|
let url = "https://" + window.location.host + "/html/body/nas/music.html?share=" + json.data.token
|
||||||
layer.prompt({
|
layer.prompt({
|
||||||
title: "分享链接",
|
title: "分享链接",
|
||||||
value: url
|
value: url
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
©2022 by yutou
|
©2022 by yutou
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<a href="http://beian.miit.gov.cn/">湘ICP备16005656号1</a>
|
<a href="https://beian.miit.gov.cn/">湘ICP备16005656号1</a>
|
||||||
<!--<script type="text/javascript" src="https://s4.cnzz.com/z_stat.php?id=1279421741&web_id=1279421741"></script>-->
|
<!--<script type="text/javascript" src="https://s4.cnzz.com/z_stat.php?id=1279421741&web_id=1279421741"></script>-->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
<body>
|
<body>
|
||||||
<div class="layui-header">
|
<div class="layui-header">
|
||||||
<ul class="layui-nav" lay-filter="" style="background-color: #1772B4;">
|
<ul class="layui-nav" lay-filter="" style="background-color: #1772B4;">
|
||||||
<li class="layui-nav-item"><a href="http://blog.yutou233.cn">博客</a></li>
|
<li class="layui-nav-item"><a href="https://blog.yutou233.cn">博客</a></li>
|
||||||
<div id="admin" style="display: inline-block; font-size: 0px;">
|
<div id="admin" style="display: inline-block; font-size: 0px;">
|
||||||
<li class="layui-nav-item">
|
<li class="layui-nav-item">
|
||||||
<a href="javascript:;">NAS管理</a>
|
<a href="javascript:;">NAS管理</a>
|
||||||
@ -36,9 +36,9 @@
|
|||||||
<li class="layui-nav-item">
|
<li class="layui-nav-item">
|
||||||
<a href="javascript:;">页面集</a>
|
<a href="javascript:;">页面集</a>
|
||||||
<dl class="layui-nav-child">
|
<dl class="layui-nav-child">
|
||||||
<dd><a href="http://nas.yutou233.cn/" target="_blank">管理后台</a></dd>
|
<dd><a href="https://nas.yutou233.cn/" target="_blank">管理后台</a></dd>
|
||||||
<dd><a href="http://bt.yutou233.cn" target="_blank">BT下载</a></dd>
|
<dd><a href="https://bt.yutou233.cn" target="_blank">BT下载</a></dd>
|
||||||
<dd><a href="http://jellyfin.yutou233.cn:7800/" target="_blank">jellyfin</a></dd>
|
<dd><a href="https://jellyfin.yutou233.cn:7800/" target="_blank">jellyfin</a></dd>
|
||||||
<dd><a href="/html/body/nas/music.html">NAS音乐播放器</a></dd>
|
<dd><a href="/html/body/nas/music.html">NAS音乐播放器</a></dd>
|
||||||
<dd><a href="/html/body/tools/calendar.html">日历</a></dd>
|
<dd><a href="/html/body/tools/calendar.html">日历</a></dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
Loading…
Reference in New Issue
Block a user