优化jellyfin搜刮器
This commit is contained in:
@@ -152,13 +152,18 @@ public class MusicController {
|
||||
fileName = Tools.base64ToString(fileName);
|
||||
}
|
||||
List<MusicData> list = null;
|
||||
if (body.getString("type").equals("album")) {
|
||||
if ("album".equals(body.getString("type"))) {
|
||||
list = musicTools.selectAlbum(fileName);
|
||||
}
|
||||
File file;
|
||||
if (list != null && !list.isEmpty()) {
|
||||
fileName = list.get(0).getFile();
|
||||
}
|
||||
if(!fileName.startsWith("/media/yutou/disk_lvm/public/音乐/")
|
||||
||fileName.endsWith("..")
|
||||
||fileName.endsWith("../")){
|
||||
return null;
|
||||
}
|
||||
file = new File(fileName);
|
||||
if (file.exists()) {
|
||||
try {
|
||||
@@ -194,13 +199,18 @@ public class MusicController {
|
||||
public ResponseEntity<FileSystemResource> play(String filePath, String random) {
|
||||
String _filePath;
|
||||
boolean _random;
|
||||
_random = !StringUtils.isEmpty(random) && random.equals("true");
|
||||
_random = !StringUtils.isEmpty(random) && "true".equals(random);
|
||||
_filePath = Tools.base64ToString(filePath);
|
||||
if (_random) {
|
||||
List<MusicData> list = musicTools.getMusicList();
|
||||
MusicData data = list.get(Tools.randomCommon(0, list.size() - 1, 1)[0]);
|
||||
_filePath = data.getFile();
|
||||
}
|
||||
if(!_filePath.startsWith("/media/yutou/disk_lvm/public/音乐/")
|
||||
||_filePath.endsWith("..")
|
||||
||_filePath.endsWith("../")){
|
||||
return null;
|
||||
}
|
||||
File file = new File(_filePath);
|
||||
if (file.exists()) {
|
||||
return Tools.getFile(file);
|
||||
|
||||
Reference in New Issue
Block a user