Make the UI use the new ShareURL option

This commit is contained in:
Caio Cotts
2024-09-15 14:45:00 -04:00
parent f0240280eb
commit 8ac133027d
7 changed files with 25 additions and 12 deletions
+15 -5
View File
@@ -7,24 +7,34 @@ export const baseUrl = (path) => {
return parts.join('/')
}
export const shareUrl = (id) => {
export const shareUrl = (path) => {
if (config.shareURL !== '') {
const base = config.shareURL || ''
const parts = [base]
parts.push(path.replace(/^\//, ''))
return parts.join('/')
}
return baseUrl(path)
}
export const sharePlayerUrl = (id) => {
const url = new URL(
baseUrl(config.publicBaseUrl + '/' + id),
shareUrl(config.publicBaseUrl + '/' + id),
window.location.href,
)
return url.href
}
export const shareStreamUrl = (id) => {
return baseUrl(config.publicBaseUrl + '/s/' + id)
return shareUrl(config.publicBaseUrl + '/s/' + id)
}
export const shareDownloadUrl = (id) => {
return baseUrl(config.publicBaseUrl + '/d/' + id)
return shareUrl(config.publicBaseUrl + '/d/' + id)
}
export const shareCoverUrl = (id) => {
return baseUrl(config.publicBaseUrl + '/img/' + id + '?size=300')
return shareUrl(config.publicBaseUrl + '/img/' + id + '?size=300')
}
export const docsUrl = (path) => `https://www.navidrome.org${path}`