Stop airsonic from creating double slashes in urls.

Signed-off-by: Jim Hribar <me@jimhribar.com>
master
Jim Hribar 7 years ago
parent 6fc6d90351
commit e554bc8ec6
  1. 12
      airsonic-main/src/main/java/org/airsonic/player/ajax/NowPlayingService.java
  2. 10
      airsonic-main/src/main/java/org/airsonic/player/ajax/PlayQueueService.java
  3. 2
      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. 2
      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) + " &ndash; " + StringUtil.toHtml(title); String tooltip = StringUtil.toHtml(artist) + " &ndash; " + StringUtil.toHtml(title);

@ -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")

@ -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();
} }

Loading…
Cancel
Save