Merge remote-tracking branch 'airsonic/pr/598'

master
Andrew DeMaria 7 years ago
commit c0c359a8f0
No known key found for this signature in database
GPG Key ID: 0A3F5E91F8364EDF
  1. 12
      airsonic-main/src/main/java/org/airsonic/player/ajax/NowPlayingService.java
  2. 12
      airsonic-main/src/main/java/org/airsonic/player/ajax/PlayQueueService.java
  3. 4
      airsonic-main/src/main/java/org/airsonic/player/controller/ExternalPlayerController.java
  4. 4
      airsonic-main/src/main/java/org/airsonic/player/controller/VideoPlayerController.java
  5. 4
      airsonic-main/src/main/java/org/airsonic/player/service/ShareService.java

@ -113,20 +113,20 @@ public class NowPlayingService {
String artist = mediaFile.getArtist(); String artist = mediaFile.getArtist();
String title = mediaFile.getTitle(); String title = mediaFile.getTitle();
String streamUrl = url + "/stream?player=" + player.getId() + "&id=" + mediaFile.getId(); String streamUrl = url + "stream?player=" + player.getId() + "&id=" + mediaFile.getId();
String albumUrl = url + "/main.view?id=" + mediaFile.getId(); String albumUrl = url + "main.view?id=" + mediaFile.getId();
String lyricsUrl = null; String lyricsUrl = null;
if (!mediaFile.isVideo()) { if (!mediaFile.isVideo()) {
lyricsUrl = url + "/lyrics.view?artistUtf8Hex=" + StringUtil.utf8HexEncode(artist) + lyricsUrl = url + "lyrics.view?artistUtf8Hex=" + StringUtil.utf8HexEncode(artist) +
"&songUtf8Hex=" + StringUtil.utf8HexEncode(title); "&songUtf8Hex=" + StringUtil.utf8HexEncode(title);
} }
String coverArtUrl = url + "/coverArt.view?size=60&id=" + mediaFile.getId(); String coverArtUrl = url + "coverArt.view?size=60&id=" + mediaFile.getId();
String avatarUrl = null; String avatarUrl = null;
if (userSettings.getAvatarScheme() == AvatarScheme.SYSTEM) { if (userSettings.getAvatarScheme() == AvatarScheme.SYSTEM) {
avatarUrl = url + "/avatar.view?id=" + userSettings.getSystemAvatarId(); avatarUrl = url + "avatar.view?id=" + userSettings.getSystemAvatarId();
} else if (userSettings.getAvatarScheme() == AvatarScheme.CUSTOM && settingsService.getCustomAvatar(username) != null) { } else if (userSettings.getAvatarScheme() == AvatarScheme.CUSTOM && settingsService.getCustomAvatar(username) != null) {
avatarUrl = url + "/avatar.view?usernameUtf8Hex=" + StringUtil.utf8HexEncode(username); avatarUrl = url + "avatar.view?usernameUtf8Hex=" + StringUtil.utf8HexEncode(username);
} }
String tooltip = StringUtil.toHtml(artist) + " – " + StringUtil.toHtml(title); String tooltip = StringUtil.toHtml(artist) + " – " + StringUtil.toHtml(title);

@ -647,7 +647,7 @@ public class PlayQueueService {
private PlayQueueInfo convert(HttpServletRequest request, Player player, boolean serverSidePlaylist, int offset) throws Exception { private PlayQueueInfo convert(HttpServletRequest request, Player player, boolean serverSidePlaylist, int offset) throws Exception {
String url = NetworkService.getBaseUrl(request); String url = NetworkService.getBaseUrl(request);
/* if (serverSidePlaylist && player.isJukebox()) { /* if (serverSidePlaylist && player.isJukebox()) {
updateJukebox(player, offset); updateJukebox(player, offset);
} */ } */
boolean isCurrentPlayer = player.getIpAddress() != null && player.getIpAddress().equals(request.getRemoteAddr()); boolean isCurrentPlayer = player.getIpAddress() != null && player.getIpAddress().equals(request.getRemoteAddr());
@ -661,12 +661,12 @@ public class PlayQueueService {
for (MediaFile file : playQueue.getFiles()) { for (MediaFile file : playQueue.getFiles()) {
String albumUrl = url + "/main.view?id=" + file.getId(); String albumUrl = url + "main.view?id=" + file.getId();
String streamUrl = url + "/stream?player=" + player.getId() + "&id=" + file.getId(); String streamUrl = url + "stream?player=" + player.getId() + "&id=" + file.getId();
String coverArtUrl = url + "/coverArt.view?id=" + file.getId(); String coverArtUrl = url + "coverArt.view?id=" + file.getId();
String remoteStreamUrl = jwtSecurityService.addJWTToken(url + "/ext/stream?player=" + player.getId() + "&id=" + file.getId()); String remoteStreamUrl = jwtSecurityService.addJWTToken(url + "ext/stream?player=" + player.getId() + "&id=" + file.getId());
String remoteCoverArtUrl = jwtSecurityService.addJWTToken(url + "/ext/coverArt.view?id=" + file.getId()); String remoteCoverArtUrl = jwtSecurityService.addJWTToken(url + "ext/coverArt.view?id=" + file.getId());
String format = formatFormat(player, file); String format = formatFormat(player, file);
String username = securityService.getCurrentUsername(request); String username = securityService.getCurrentUsername(request);

@ -128,7 +128,7 @@ public class ExternalPlayerController {
} }
public MediaFileWithUrlInfo addUrlInfo(HttpServletRequest request, Player player, MediaFile mediaFile, Date expires) { public MediaFileWithUrlInfo addUrlInfo(HttpServletRequest request, Player player, MediaFile mediaFile, Date expires) {
String prefix = "/ext"; String prefix = "ext";
String streamUrl = jwtSecurityService.addJWTToken( String streamUrl = jwtSecurityService.addJWTToken(
UriComponentsBuilder UriComponentsBuilder
.fromHttpUrl(NetworkService.getBaseUrl(request) + prefix + "/stream") .fromHttpUrl(NetworkService.getBaseUrl(request) + prefix + "/stream")
@ -149,4 +149,4 @@ public class ExternalPlayerController {
.toUriString(); .toUriString();
return new MediaFileWithUrlInfo(mediaFile, coverArtUrl, streamUrl); return new MediaFileWithUrlInfo(mediaFile, coverArtUrl, streamUrl);
} }
} }

@ -71,8 +71,8 @@ public class VideoPlayerController {
Integer duration = file.getDurationSeconds(); Integer duration = file.getDurationSeconds();
String playerId = playerService.getPlayer(request, response).getId(); String playerId = playerService.getPlayer(request, response).getId();
String url = NetworkService.getBaseUrl(request); String url = NetworkService.getBaseUrl(request);
String streamUrl = url + "/stream?id=" + file.getId() + "&player=" + playerId + "&format=mp4"; String streamUrl = url + "stream?id=" + file.getId() + "&player=" + playerId + "&format=mp4";
String coverArtUrl = url + "/coverArt.view?id=" + file.getId(); String coverArtUrl = url + "coverArt.view?id=" + file.getId();
map.put("video", file); map.put("video", file);
map.put("streamUrl", streamUrl); map.put("streamUrl", streamUrl);

@ -125,7 +125,7 @@ public class ShareService {
} }
public String getShareUrl(HttpServletRequest request, Share share) { public String getShareUrl(HttpServletRequest request, Share share) {
String shareUrl = NetworkService.getBaseUrl(request) + "/ext/share/" + share.getName(); String shareUrl = NetworkService.getBaseUrl(request) + "ext/share/" + share.getName();
return jwtSecurityService.addJWTToken(UriComponentsBuilder.fromUriString(shareUrl), share.getExpires()).build().toUriString(); return jwtSecurityService.addJWTToken(UriComponentsBuilder.fromUriString(shareUrl), share.getExpires()).build().toUriString();
} }
@ -144,4 +144,4 @@ public class ShareService {
public void setJwtSecurityService(JWTSecurityService jwtSecurityService) { public void setJwtSecurityService(JWTSecurityService jwtSecurityService) {
this.jwtSecurityService = jwtSecurityService; this.jwtSecurityService = jwtSecurityService;
} }
} }

Loading…
Cancel
Save