From 7300b5e3b792802dd00f5681c6aa8bf14c647996 Mon Sep 17 00:00:00 2001 From: yutou Date: Thu, 24 Dec 2020 18:36:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=9F=B3=E4=B9=90=E6=92=AD?= =?UTF-8?q?=E6=94=BE=E5=99=A8=E5=9B=BE=E7=89=87=E4=B8=8D=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98=20=E4=BF=AE=E5=A4=8D=E9=9F=B3?= =?UTF-8?q?=E4=B9=90=E6=92=AD=E6=94=BE=E5=99=A8=E6=92=AD=E6=94=BE=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=A4=B9=E4=B8=8D=E6=92=AD=E6=94=BE=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/yutou/tools/utils/APIFilter.java | 5 ++- web/html/body/nas/music.html | 35 +++++++++++++------ 2 files changed, 29 insertions(+), 11 deletions(-) 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); }