diff --git a/src/main/java/com/yutou/tools/utils/APIFilter.java b/src/main/java/com/yutou/tools/utils/APIFilter.java index 34d3090..3903ca4 100644 --- a/src/main/java/com/yutou/tools/utils/APIFilter.java +++ b/src/main/java/com/yutou/tools/utils/APIFilter.java @@ -54,7 +54,10 @@ public class APIFilter implements Filter { String tmp = request.getRequestURI(); try { url = tmp.split(tmp.split("/")[tmp.split("/").length - 1])[0]; - } catch (Exception ignored) { + } catch (Exception e) { + e.printStackTrace(); + System.out.println("无权限请求:"+tmp); + return; } UKey key = list.get(0); diff --git a/web/html/body/nas/music.html b/web/html/body/nas/music.html index d165704..9d31081 100644 --- a/web/html/body/nas/music.html +++ b/web/html/body/nas/music.html @@ -73,7 +73,7 @@ } catch (e) { localhost = "" } - //localhost = "http://192.168.31.88:8000"; + // localhost = "http://113.109.23.240:8000"; layui.use(['table', 'element'], function () { let table = layui.table; let element = layui.element; @@ -126,15 +126,30 @@ window.open(localhost + "/nas/music/play.do?token=PlVodzYhvxRQbOHKakpKs2dvnoc43Cnk&random=false&filePath=" + new Base64().encode(data.file)) } } else if (obj.event === 'play') { - $.post(localhost + "/nas/music/list.do", {type: false, path: data.file}, function (obj) { - let json = JSON.parse(obj); - if (json.code === 0) { - playIndex = 0; - musicLib = json.data; - isRandom = false; - playNext() - } + $.ajax({ + type: "POST", + url:localhost + "/nas/music/list.do", + contentType: "application/json; charset=utf-8", + data:JSON.stringify({type: true, path: data.file}), + dataType: "json", + success:function (json){ + try { + if (json.code === 0) { + playIndex = 0; + musicLib=[] + for (let datum of json.data) { + if(datum.isdir===0){ + musicLib.push(datum) + } + } + isRandom = false; + playNext() + } + }catch (e){ + } + + } }) } }); @@ -263,7 +278,7 @@ }); } }) - $('#img').attr("src",'/nas/music/web/image.do?fileName='+fileName); + $('#img').attr("src",localhost+'/nas/music/web/image.do?fileName='+fileName); }