Compare commits

...

12 Commits

Author SHA1 Message Date
bc9f82cc8d update 2024-10-26 01:43:19 +08:00
3f88a20557 更新拼音api的解析 2024-08-26 10:00:19 +08:00
1b61722446 update 2024-05-14 13:35:20 +08:00
2183444676 update 2023-12-27 10:43:20 +08:00
6c4fbc47ab update:nas ip
update:/public/request.do
add:/public/file/request.do
2023-03-17 17:37:04 +08:00
10c6967869 update 2023-03-06 15:25:41 +08:00
cf5e4f56e7 fix:新增过滤instrumental音乐 2022-11-14 14:59:26 +08:00
af8cf21705 fix:新增过滤instrumental音乐 2022-11-14 14:27:28 +08:00
8b1a2c86c6 add:新增过滤instrumental音乐 2022-11-14 14:11:18 +08:00
bad29d16f3 update:sakana set autoModel 2022-09-07 14:20:45 +08:00
c2195c287a update:holiday in Redis 2022-09-07 13:58:31 +08:00
b653c52669 fix:修复一出错误引入 2022-09-04 12:51:18 +08:00
22 changed files with 724 additions and 712 deletions

View File

@@ -6,7 +6,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ToolsApplication {
public static final String version="1.4.7";
public static final String version="1.5.2";
public static void main(String[] args) {
System.out.println("当前版本号:" + version);

View File

@@ -29,7 +29,7 @@ import java.util.UUID;
@Controller
public class NasManager {
public static String NasUrl="http://yutou233.cn";
public static String NasUrl="https://nas.yutou233.cn";
static {
if ("dev".equals(ConfigTools.load(ConfigTools.CONFIG, "model"))) {
NasUrl="http://192.168.31.88";
@@ -184,7 +184,7 @@ public class NasManager {
json.put("data", NasUrl + ":8000");
} else {
if (UpdateIp.nas_ip == null) {
json.put("data", "http://yutou233.cn:8001");
json.put("data", "http://nas.yutou233.cn:8001");
} else {
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=");
} else {
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 {
json.put("data", String.format("http://%s:8000/nas/music/list.do?token=", UpdateIp.nas_ip));
}

View File

@@ -21,7 +21,7 @@ import java.util.regex.Pattern;
@Controller
public class UpdateIp {
private static List<String> keys = new ArrayList<>();
public static String nas_ip=null;
public static String nas_ip="nas.yutou233.cn";
static {
if ("dev".equals(ConfigTools.load(ConfigTools.CONFIG, "model"))) {
nas_ip="192.168.31.88";

View File

@@ -10,13 +10,15 @@ import com.yutou.tools.utils.ConfigTools;
import com.yutou.tools.utils.HttpTools;
import com.yutou.tools.utils.RedisTools;
import com.yutou.tools.utils.Tools;
import lombok.SneakyThrows;
import org.springframework.core.io.FileSystemResource;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.Cookie;
@@ -25,8 +27,11 @@ import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Enumeration;
import java.util.List;
import java.util.Locale;
@Controller
public class tools {
@@ -66,9 +71,16 @@ public class tools {
return ToolsApplication.version;
}
@SneakyThrows
@ResponseBody
@RequestMapping("/public/request.do")
public String testRequest(HttpServletRequest request) {
return testRequest(request, null);
}
@ResponseBody
@RequestMapping("/public/file/request.do")
public String testRequest(HttpServletRequest request, @RequestParam("file")MultipartFile file) {
JSONObject params = new JSONObject();
JSONArray cookies = new JSONArray();
JSONObject header = new JSONObject();
@@ -81,11 +93,26 @@ public class tools {
cookies.add(ck);
}
}
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
try {
BufferedInputStream stream = new BufferedInputStream(request.getInputStream());
byte[] bytes = new byte[1024];
int len = 0, size;
while ((len = stream.read(bytes)) != -1) {
outputStream.write(bytes, 0, len);
outputStream.flush();
}
}catch (Exception e){
e.printStackTrace();
}
Enumeration<String> enumeration = request.getHeaderNames();
while (enumeration != null && enumeration.hasMoreElements()) {
String tmp = enumeration.nextElement();
header.put(tmp, request.getHeader(tmp));
}
String str = outputStream.toString(StandardCharsets.UTF_8);
System.out.println("str = " + str);
JSONObject json = new JSONObject();
json.put("code", 0);
json.put("method", request.getMethod());
@@ -95,6 +122,15 @@ public class tools {
json.put("params", params);
json.put("cookie", cookies);
json.put("header", header);
System.out.println("json = " + json);
// Tools.sendServer("打印请求", json.toJSONString());
if(file!=null){
try {
Tools.createFile("tmp",file,new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.CHINA).format(new Date())+".zip");
} catch (Exception e) {
e.printStackTrace();
}
}
Tools.sendServer("打印请求", json.toJSONString());
try {
switch (RedisTools.get("request")) {
@@ -148,30 +184,34 @@ public class tools {
Tools.sendServer(title, msg);
return "ok";
}
@ResponseBody
@RequestMapping(value="/tools/clash/get.do",produces ="text/plain;charset=utf-8")
public String getClash(){
StringBuilder builder=new StringBuilder();
String ssrUrl=RedisTools.get("ssr");
String url="http://127.0.0.1:25500/sub?target=clash&new_name=true&url="+URLEncoder.encode(ssrUrl, StandardCharsets.UTF_8) +"&insert=false&config=https%3A%2F%2Fgit.yutou233.cn%2Fyutou%2FACL4SSR%2Fraw%2Fmaster%2FClash%2Fconfig%2FACL4SSR.ini";
String text= HttpTools.get(url);
if(text==null){
@RequestMapping(value = "/tools/clash/get.do", produces = "text/plain;charset=utf-8")
public String getClash(String ssr) {
StringBuilder builder = new StringBuilder();
String ssrUrl = RedisTools.get("ssr");
if (!StringUtils.isEmpty(ssr)) {
ssrUrl = ssr;
}
String url = "http://127.0.0.1:25500/sub?target=clash&new_name=true&url=" + URLEncoder.encode(ssrUrl, StandardCharsets.UTF_8) + "&insert=false&config=https%3A%2F%2Fgit.yutou233.cn%2Fyutou%2FACL4SSR%2Fraw%2Fbranch%2Fmaster%2FClash%2Fconfig%2FACL4SSR_Online_Full.ini";
String text = HttpTools.get(url);
if (text == null) {
System.out.println("ssr is Null = " + url);
return "";
}
String[] tmp=text.split("\n");
text=RedisTools.get("clash");
String[] tmp = text.split("\n");
text = RedisTools.get("clash");
builder.append("mixed-port: 7890").append("\n");
for (String s : tmp) {
if("port: 7890".equals(s)||"socks-port: 7891".equals(s)){
if ("port: 7890".equals(s) || "socks-port: 7891".equals(s)) {
continue;
}
builder.append(s).append("\n");
if("rules:".equals(s.trim())){
if(text!=null){
JSONArray array=JSONArray.parseArray(text);
if ("rules:".equals(s.trim())) {
if (text != null) {
JSONArray array = JSONArray.parseArray(text);
for (Object o : array) {
builder.append(" ").append(((JSONObject)o).getString("url").trim()).append("\n");
builder.append(" ").append(((JSONObject) o).getString("url").trim()).append("\n");
}
}
}
@@ -179,83 +219,106 @@ public class tools {
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
@RequestMapping("/tools/clash/ssr.do")
public JSONObject setClashSSR(String url){
RedisTools.set("ssr",url);
JSONObject json=new JSONObject();
json.put("msg","OK~");
public JSONObject setClashSSR(String url) {
RedisTools.set("ssr", url);
JSONObject json = new JSONObject();
json.put("msg", "OK~");
return json;
}
@ResponseBody
@RequestMapping("/tools/clash/getssr.do")
public JSONObject getClashSSR(){
JSONObject json=new JSONObject();
json.put("code",0);
json.put("data",RedisTools.get("ssr"));
public JSONObject getClashSSR() {
JSONObject json = new JSONObject();
json.put("code", 0);
json.put("data", RedisTools.get("ssr"));
return json;
}
@ResponseBody
@RequestMapping("/tools/clash/list.do")
public JSONObject clashList(){
String text=RedisTools.get("clash");
public JSONObject clashList() {
String text = RedisTools.get("clash");
JSONArray array;
if(text!=null){
array=JSONArray.parseArray(text);
}else{
array=new JSONArray();
if (text != null) {
array = JSONArray.parseArray(text);
} else {
array = new JSONArray();
}
RedisTools.set("clash",array.toJSONString());
JSONObject json=new JSONObject();
json.put("code",0);
json.put("msg","ok~");
json.put("data",array);
return json;
RedisTools.set("clash", array.toJSONString());
JSONObject json = new JSONObject();
json.put("code", 0);
json.put("msg", "ok~");
json.put("data", array);
return json;
}
@ResponseBody
@RequestMapping("/tools/clash/add.do")
public JSONObject clashAddUrl(String url){
String text=RedisTools.get("clash");
public JSONObject clashAddUrl(String url) {
String text = RedisTools.get("clash");
JSONArray array;
if(text!=null){
array=JSONArray.parseArray(text);
}else{
array=new JSONArray();
if (text != null) {
array = JSONArray.parseArray(text);
} else {
array = new JSONArray();
}
JSONObject data=new JSONObject();
data.put("url",url);
JSONObject data = new JSONObject();
data.put("url", url);
array.add(data);
RedisTools.set("clash",array.toJSONString());
JSONObject json=new JSONObject();
json.put("code",0);
json.put("msg","ok~");
return json;
RedisTools.set("clash", array.toJSONString());
JSONObject json = new JSONObject();
json.put("code", 0);
json.put("msg", "ok~");
return json;
}
@ResponseBody
@RequestMapping("/tools/clash/del.do")
public JSONObject clashDelUrl(String url){
String text=RedisTools.get("clash");
public JSONObject clashDelUrl(String url) {
String text = RedisTools.get("clash");
JSONArray array;
if(text!=null){
array=JSONArray.parseArray(text);
}else{
array=new JSONArray();
if (text != null) {
array = JSONArray.parseArray(text);
} else {
array = new JSONArray();
}
int delIndex=-1;
int delIndex = -1;
for (int i = 0; i < array.size(); i++) {
JSONObject item=array.getJSONObject(i);
if(item.getString("url").trim().equals(url.trim())){
delIndex=i;
JSONObject item = array.getJSONObject(i);
if (item.getString("url").trim().equals(url.trim())) {
delIndex = i;
break;
}
}
if(delIndex!=-1){
array.remove(delIndex);
}
RedisTools.set("clash",array.toJSONString());
JSONObject json=new JSONObject();
json.put("code",0);
json.put("msg","ok~");
return json;
if (delIndex != -1) {
array.remove(delIndex);
}
RedisTools.set("clash", array.toJSONString());
JSONObject json = new JSONObject();
json.put("code", 0);
json.put("msg", "ok~");
return json;
}
@ResponseBody
@RequestMapping("/public/tools/setu.do")
public ResponseEntity<FileSystemResource> getSetu(String model){
String url="https://api.lolicon.app/setu/v2?r18=0&size=regular";
String body=HttpTools.get(url);
JSONObject json=JSONObject.parseObject(body);
if (json.getJSONArray("data").isEmpty()) {
return Tools.getFile(new File("def_setu.png"));
}
JSONObject item = json.getJSONArray("data").getJSONObject(0);
File file = HttpTools.syncDownload(item.getJSONObject("urls").getString("regular"),
System.currentTimeMillis() + "_setu.jpg");
return Tools.getFile(file);
}
public int getUid(HttpServletRequest request) {
String token = request.getParameter("token");

View File

@@ -1,9 +1,12 @@
package com.yutou.tools.utils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Timer;
@@ -14,9 +17,12 @@ import java.util.TimerTask;
*/
@Component
public class ApplicationInit implements ApplicationRunner {
@Resource
private Environment environment;
@Override
public void run(ApplicationArguments args) throws Exception {
RedisTools.initConfig(environment.getProperty("redis.port",Integer.class,6379),
environment.getProperty("redis.auth"));
new Timer().schedule(new TimerTask() {
@Override
public void run() {

View File

@@ -3,7 +3,6 @@ package com.yutou.tools.utils;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.yutou.tools.bean.CalendarTask;
import com.yutou.tools.interfaces.ITimerTask;
import lombok.SneakyThrows;
import java.text.DateFormat;
@@ -13,6 +12,7 @@ import java.util.*;
@SuppressWarnings("MagicConstant")
public class CalendarTools {
public static final String REDIS_TAG = "Calendar";
public static final String REDIS_HOLIDAY = "holiday";
public static JSONObject getHoliday() {
int year = Calendar.getInstance(DateFormat.getDateInstance().getTimeZone(), Locale.CHINA).get(Calendar.YEAR);
@@ -21,7 +21,13 @@ public class CalendarTools {
@SneakyThrows
public static JSONObject getHoliday(String year) {
String get = HttpTools.get(String.format("https://timor.tech/api/holiday/year/%s", year));
String get;
if(RedisTools.exists(REDIS_HOLIDAY)){
get=RedisTools.get(REDIS_HOLIDAY);
}else {
get = HttpTools.get(String.format("https://timor.tech/api/holiday/year/%s", year));
RedisTools.set(REDIS_HOLIDAY,get);
}
JSONObject json = JSONObject.parseObject(get);
JSONObject date = new JSONObject();
JSONArray dateHoliday = new JSONArray();

View File

@@ -1,6 +1,8 @@
package com.yutou.tools.utils;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.aliyuncs.utils.StringUtils;
import java.io.*;
@@ -8,57 +10,88 @@ import java.io.*;
* 配置和参数
*/
public class ConfigTools {
public static final String CONFIG="config.json";
public static final String DATA="data.json";
public static final String SQLITE="sqlite.json";
public static final String CONFIG = "config.json";
public static final String DATA = "data.json";
public static final String SQLITE = "sqlite.json";
static {
try {
File file=new File(CONFIG);
if(!file.exists()){
File file = new File(CONFIG);
if (!file.exists()) {
file.createNewFile();
}
file=new File(DATA);
if(!file.exists()){
file = new File(DATA);
if (!file.exists()) {
file.createNewFile();
}
file=null;
}catch (Exception e){
file = null;
} catch (Exception e) {
e.printStackTrace();
}
}
public static Object load(String type,String key){
File file=new File(type);
//System.out.println(type+"配置文件地址:"+file.getAbsolutePath());
String src=readFile(file);
if(src!=null){
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);
//com.yutou.nas.utils.Log.i(type+"配置文件地址:"+file.getAbsolutePath());
String src = readFile(file);
if (src != null) {
try {
JSONObject json=JSONObject.parseObject(src);
if(json==null){
json=new JSONObject();
saveFile(file,json.toJSONString());
}
return json.getOrDefault(key, "");
}catch (Exception e){
return "";
JSONObject json = JSONObject.parseObject(src, JSONObject.class);
return json.getObject(key, t);
} catch (Exception e) {
e.printStackTrace();
}
}
return "";
return def;
}
public static boolean save(String type,String key,Object data){
File file=new File(type);
String src=readFile(file);
if(src==null){
src="{}";
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();
}
JSONObject json=JSONObject.parseObject(src);
json.put(key,data);
saveFile(file,json.toJSONString());
return null;
}
public static boolean save(String type, String key, Object data) {
File file = new File(type);
String src = readFile(file);
if (src == null) {
src = "{}";
}
JSONObject json = JSON.parseObject(src);
json.put(key, data);
saveFile(file, json.toJSONString());
return false;
}
public static boolean saveFile(File file,String data){
public static boolean saveFile(File file, String data) {
try {
FileWriter writer=new FileWriter(file);
FileWriter writer = new FileWriter(file);
writer.write(data);
writer.flush();
writer.close();
@@ -68,13 +101,14 @@ public class ConfigTools {
return false;
}
}
public static String readFile(File file){
public static String readFile(File file) {
try {
BufferedReader reader=new BufferedReader(new FileReader(file));
BufferedReader reader = new BufferedReader(new FileReader(file));
String tmp;
StringBuilder str= new StringBuilder();
while ((tmp=reader.readLine())!=null){
str.append(tmp);
StringBuilder str = new StringBuilder();
while ((tmp = reader.readLine()) != null) {
str.append(tmp).append("\n");
}
reader.close();
return str.toString();
@@ -84,3 +118,4 @@ public class ConfigTools {
return null;
}
}

View File

@@ -10,13 +10,10 @@ public class CorsConfig implements WebMvcConfigurer {
public void addCorsMappings(CorsRegistry registry) {
//设置允许跨域的路径
registry.addMapping("/**")
//设置允许跨域请求的域名
.allowedOrigins("Access-Control-Allow-Origin")
//是否允许证书 不再默认开启
.allowCredentials(true)
//设置允许的方法
.allowedMethods("*")
//跨域允许时间
.maxAge(3600);
.allowedOrigins("https://tools.yutou233.cn") // 允许哪些域的请求
.allowedMethods("POST", "GET") // 允许的请求方法
.allowedHeaders("*") // 允许的头部设置
.allowCredentials(true) // 是否发送cookie
.maxAge(168000); // 预检间隔时间
}
}

View File

@@ -18,9 +18,19 @@ public class HttpTools {
private static final int HttpRequestIndex = 3;
public static String get(String url) {
return https_get(url, null);
if(url.startsWith("http:")){
return https_get(HttpURLConnection.class, url, null);
}else {
return https_get(HttpsURLConnection.class,url, null);
}
}
public static <T extends URLConnection> String https_get(String url, Map<String, String> header) {
if(url.startsWith("http:")){
return https_get(HttpURLConnection.class, url, header);
}else {
return https_get(HttpsURLConnection.class,url, header);
}
}
public static String post(final String url, final byte[] body) {
return http_post(url, body, 0, null);
}
@@ -29,10 +39,9 @@ public class HttpTools {
return new HttpTools().http_syncDownload(url, saveName);
}
public static String https_get(String url, Map<String, String> header) {
public static <T extends URLConnection> String https_get(Class<T> c, String url, Map<String, String> header) {
try {
URLConnection connection;
connection = new URL(url).openConnection();
T connection = (T) new URL(url).openConnection();
connection.setConnectTimeout(60*1000);
connection.setReadTimeout(60*1000);
connection.setRequestProperty("User-Agent", getExtUa());

View File

@@ -9,6 +9,8 @@ import java.util.Properties;
import java.util.Set;
import com.alibaba.fastjson2.JSONObject;
import org.apache.ibatis.mapping.Environment;
import org.springframework.beans.factory.annotation.Autowired;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;
@@ -19,6 +21,7 @@ public class RedisTools {
private static boolean isNotInstallRedis = false;
private static String host;
private static int port;
private static String auth;
public static int TOKEN_TIMEOUT_DEFAULT = 360;
private RedisTools() {
@@ -26,12 +29,11 @@ public class RedisTools {
}
// 写成静态代码块形式,只加载一次,节省资源
static {
//Properties properties = PropertyUtil.loadProperties("jedis.properties");
//host = properties.getProperty("redis.host");
//port = Integer.valueOf(properties.getProperty("redis.port"));
public static void initConfig(int port, String auth) {
host = "127.0.0.1";
port = 6379;
RedisTools.port = port;
RedisTools.auth = auth;
}
@@ -136,8 +138,20 @@ public class RedisTools {
return flag;
}
public static boolean exists(String key) {
if (isNotInstallRedis) {
return false;
}
Jedis jedis = getRedis();
boolean flag = jedis.exists(key);
jedis.close();
return flag;
}
public static Jedis getRedis() {
return new Jedis(host, port);
Jedis jedis = new Jedis(host, port);
jedis.auth(auth);
return jedis;
}
public static boolean remove(String key, int index) {
@@ -186,6 +200,7 @@ public class RedisTools {
return flag;
}
private static class PropertyUtil {
// 加载property文件到io流里面

View File

@@ -3,6 +3,9 @@ package com.yutou.tools.utils;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.yutou.tools.interfaces.DownloadInterface;
import com.yutou.tools.mybatis.dao.ToolsPasswordDao;
import com.yutou.tools.mybatis.model.ToolsPassword;
import com.yutou.tools.mybatis.model.ToolsPasswordExample;
import com.yutou.tools.nas.UpdateIp;
import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.beans.factory.config.BeanDefinition;
@@ -435,7 +438,7 @@ public class Tools {
}
public static String getLoginUser() {
if("dev".equals(ConfigTools.load(ConfigTools.CONFIG, "model"))) {
if ("dev".equals(ConfigTools.load(ConfigTools.CONFIG, "model"))) {
return "admin";
}
Object user = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
@@ -459,10 +462,10 @@ public class Tools {
}
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);
if (json.getInteger("code") == 200) {
return json.getJSONArray("newslist").getJSONObject(0).getString("pinyin").trim().replace(" ", "");
return json.getJSONObject("result").getString("pinyin").trim().replace(" ", "");
}
return "";
}
@@ -472,19 +475,24 @@ public class Tools {
calendar.setTimeZone(TimeZone.getTimeZone("GMT+8:00"));
calendar.setFirstDayOfWeek(Calendar.MONDAY);
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;
if(StringUtils.isEmpty(time)){
form="yyyy-MM-dd";
}else{
form="yyyy-MM-dd HH:mm:ss";
if (StringUtils.isEmpty(time)) {
form = "yyyy-MM-dd";
} else {
form = "yyyy-MM-dd HH:mm:ss";
}
try {
return new SimpleDateFormat(form).parse(date+" "+time);
return new SimpleDateFormat(form).parse(date + " " + time);
} catch (ParseException e) {
return null;
}
}
public static void main(String[] args) {
System.out.println(getPinYin("webdav"));
}
}

View File

@@ -7,4 +7,6 @@ mybatis.mapper-locations=classpath:mapper/*.xml
mybatis.type-aliases-package=com.yutou.tools.mybatis
#<23><>ӡmybatis<69><73>־
#logging.level.com.yutou.tools=debug
#server.servlet.session.timeout=10s
#server.servlet.session.timeout=10s
redis.auth=ADVbdzPbF1jwThtb
redis.port=21120

View File

@@ -26,10 +26,28 @@
<div id="artist">艺术家:</div>
<div id="album">专辑:</div>
<div id="composer">作曲家</div>
<a class="layui-btn layui-btn-normal" id="download">下载</a>
<a class="layui-btn layui-btn-normal" id="next">下一首</a>
<a class="layui-btn layui-btn-normal" id="play_share">分享</a>
<a class="layui-btn layui-btn-normal" id="showLrc">显示歌词</a>
<form class="layui-form" lay-filter="calendarForm">
<div class="layui-row layui-col-space12">
<div class="layui-col-xs3 ">
<a class="layui-btn layui-btn-normal" id="download">下载</a>
</div>
<div class="layui-col-xs3 ">
<a class="layui-btn layui-btn-normal" id="next">下一首</a>
</div>
<div class="layui-col-xs3 ">
<a class="layui-btn layui-btn-normal" id="play_share">分享</a>
</div>
<div class="layui-col-xs3 ">
<a class="layui-btn layui-btn-normal" id="showLrc">显示歌词</a>
</div>
</div>
<div class="layui-row layui-col-space5">
<div class="layui-col-xs2 ">
<input type="checkbox" name="" title="过滤instrumental" checked id="filter_instrumental">
</div>
</div>
</form>
</div>
<div id="audioWrap"></div>
@@ -83,7 +101,7 @@
return;
}
localhost = json.data;
if (localhost === 'http://null:8000' || localhost === ":8000") {
if (localhost === 'https://null:8000' || localhost === ":8000") {
localhost = "https://" + window.location.host;
}
} catch (e) {
@@ -131,7 +149,8 @@
}
listTable.reload({
where: {
path: path
path: path,
filter:$('#filter_instrumental')[0].checked
}
, page: {
curr: 1
@@ -161,7 +180,7 @@
type: "POST",
url: localhost + "/nas/music/list.do",
contentType: "application/json; charset=utf-8",
data: JSON.stringify({type: true, path: data.file}),
data: JSON.stringify({type: true, path: data.file,filter:$('#filter_instrumental')[0].checked}),
dataType: "json",
success: function (json) {
try {
@@ -191,7 +210,7 @@
}
$.post('/nas/music/share.do', {file: file, isDir: isDir}, function (json) {
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({
title: "分享链接",
value: url
@@ -271,7 +290,7 @@
$('#play_share').click(function () {
$.post('/nas/music/share.do', {file: playNow}, function (json) {
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({
title: "分享链接",
value: url
@@ -341,7 +360,7 @@
}
function random() {
$.post(localhost + "/nas/music/random.do", function (data) {
$.post(localhost + "/nas/music/random.do",{filter:$('#filter_instrumental')[0].checked}, function (data) {
let json = JSON.parse(data)
if (json.code === 0) {
playNow = json.data

View File

@@ -11,7 +11,7 @@
©2022 by yutou
</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>-->
</div>
@@ -20,9 +20,10 @@
<script type="text/javascript" src="/js/sakana.min.js"></script>
<script>
function initSakanaWidget() {
new SakanaWidget({
let widget=new SakanaWidget({
audoFit:true
}).mount('#sakana-widget');
widget.triggetAutoMode();
}
initSakanaWidget()
</script>

View File

@@ -12,7 +12,7 @@
<body>
<div class="layui-header">
<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;">
<li class="layui-nav-item">
<a href="javascript:;">NAS管理</a>
@@ -36,9 +36,9 @@
<li class="layui-nav-item">
<a href="javascript:;">页面集</a>
<dl class="layui-nav-child">
<dd><a href="http://nas.yutou233.cn/" target="_blank">管理后台</a></dd>
<dd><a href="http://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://nas.yutou233.cn/" target="_blank">管理后台</a></dd>
<dd><a href="https://bt.yutou233.cn" target="_blank">BT下载</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/tools/calendar.html">日历</a></dd>
</dl>

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 299 KiB

After

Width:  |  Height:  |  Size: 321 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long