See #327: Cleaned now unused backend.absoluteUrl and config module
This commit is contained in:
parent
f3e2193782
commit
2e3a2cd6dd
|
@ -1,4 +1,3 @@
|
|||
module.exports = {
|
||||
NODE_ENV: '"production"',
|
||||
BACKEND_URL: '"/"'
|
||||
NODE_ENV: '"production"'
|
||||
}
|
||||
|
|
|
@ -39,7 +39,13 @@
|
|||
<template v-else>{{ $t('Source code') }}</template>
|
||||
</a>
|
||||
<a href="https://code.eliotberriot.com/funkwhale/funkwhale/issues" class="item" target="_blank">{{ $t('Issue tracker') }}</a>
|
||||
<a @click="switchInstance" class="item" target="_blank">{{ $t('Use another instance') }}</a>
|
||||
<a @click="switchInstance" class="item" >
|
||||
{{ $t('Use another instance') }}
|
||||
<template v-if="$store.state.instance.instanceUrl !== '/'">
|
||||
<br>
|
||||
({{ $store.state.instance.instanceUrl }})
|
||||
</template>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ten wide column">
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import config from '@/config'
|
||||
|
||||
var Album = {
|
||||
clean (album) {
|
||||
// we manually rebind the album and artist to each child track
|
||||
|
@ -21,21 +19,6 @@ var Artist = {
|
|||
}
|
||||
}
|
||||
export default {
|
||||
absoluteUrl (url) {
|
||||
if (url.startsWith('http')) {
|
||||
return url
|
||||
}
|
||||
if (url.startsWith('/')) {
|
||||
let rootUrl = (
|
||||
window.location.protocol + '//' + window.location.hostname +
|
||||
(window.location.port ? ':' + window.location.port : '')
|
||||
)
|
||||
return rootUrl + url
|
||||
} else {
|
||||
return config.BACKEND_URL + url
|
||||
}
|
||||
},
|
||||
Artist: Artist,
|
||||
Album: Album
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
import backend from './backend'
|
||||
|
||||
export default {
|
||||
getCover (track) {
|
||||
return backend.absoluteUrl(track.album.cover)
|
||||
}
|
||||
}
|
|
@ -125,7 +125,7 @@
|
|||
<tr @click="$store.dispatch('queue/currentIndex', index)" v-for="(track, index) in queue.tracks" :key="index" :class="[{'active': index === queue.currentIndex}]">
|
||||
<td class="right aligned">{{ index + 1}}</td>
|
||||
<td class="center aligned">
|
||||
<img class="ui mini image" v-if="track.album.cover" :src="backend.absoluteUrl(track.album.cover)">
|
||||
<img class="ui mini image" v-if="track.album.cover" :src="$store.getters['instance/absoluteUrl'](track.album.cover)">
|
||||
<img class="ui mini image" v-else src="../assets/audio/default-cover.png">
|
||||
</td>
|
||||
<td colspan="4">
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<div v-if="currentTrack" class="track-area ui unstackable items">
|
||||
<div class="ui inverted item">
|
||||
<div class="ui tiny image">
|
||||
<img ref="cover" @load="updateBackground" v-if="currentTrack.album.cover" :src="Track.getCover(currentTrack)">
|
||||
<img ref="cover" @load="updateBackground" v-if="currentTrack.album.cover" :src="$store.getters['instance/absoluteUrl'](currentTrack.album.cover)">
|
||||
<img v-else src="../../assets/audio/default-cover.png">
|
||||
</div>
|
||||
<div class="middle aligned content">
|
||||
|
@ -143,7 +143,6 @@ import {mapState, mapGetters, mapActions} from 'vuex'
|
|||
import GlobalEvents from '@/components/utils/global-events'
|
||||
import ColorThief from '@/vendor/color-thief'
|
||||
|
||||
import Track from '@/audio/track'
|
||||
import AudioTrack from '@/components/audio/Track'
|
||||
import TrackFavoriteIcon from '@/components/favorites/TrackFavoriteIcon'
|
||||
import TrackPlaylistIcon from '@/components/playlists/TrackPlaylistIcon'
|
||||
|
@ -162,7 +161,6 @@ export default {
|
|||
isShuffling: false,
|
||||
renderAudio: true,
|
||||
sliderVolume: this.volume,
|
||||
Track: Track,
|
||||
defaultAmbiantColors: defaultAmbiantColors,
|
||||
ambiantColors: defaultAmbiantColors
|
||||
}
|
||||
|
|
|
@ -11,11 +11,8 @@
|
|||
|
||||
<script>
|
||||
import jQuery from 'jquery'
|
||||
import config from '@/config'
|
||||
import router from '@/router'
|
||||
|
||||
const SEARCH_URL = config.API_URL + 'search?query={query}'
|
||||
|
||||
export default {
|
||||
mounted () {
|
||||
let self = this
|
||||
|
@ -94,7 +91,7 @@ export default {
|
|||
})
|
||||
return {results: results}
|
||||
},
|
||||
url: SEARCH_URL
|
||||
url: this.$store.getters['instance/absoluteUrl']('search?query={query}')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ export default {
|
|||
return []
|
||||
}
|
||||
let sources = [
|
||||
{type: file.mimetype, url: file.path}
|
||||
{type: file.mimetype, url: this.$store.getters['instance/absoluteUrl'](file.path)}
|
||||
]
|
||||
if (this.$store.state.auth.authenticated) {
|
||||
// we need to send the token directly in url
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<div class="ui card">
|
||||
<div class="content">
|
||||
<div class="right floated tiny ui image">
|
||||
<img v-if="album.cover" v-lazy="backend.absoluteUrl(album.cover)">
|
||||
<img v-if="album.cover" v-lazy="$store.getters['instance/absoluteUrl'](album.cover)">
|
||||
<img v-else src="../../../assets/audio/default-cover.png">
|
||||
</div>
|
||||
<div class="header">
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<tbody>
|
||||
<tr v-for="album in albums">
|
||||
<td>
|
||||
<img class="ui mini image" v-if="album.cover" :src="backend.absoluteUrl(album.cover)">
|
||||
<img class="ui mini image" v-if="album.cover" :src="$store.getters['instance/absoluteUrl'](album.cover)">
|
||||
<img class="ui mini image" v-else src="../../../assets/audio/default-cover.png">
|
||||
</td>
|
||||
<td colspan="4">
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<play-button class="basic icon" :discrete="true" :track="track"></play-button>
|
||||
</td>
|
||||
<td>
|
||||
<img class="ui mini image" v-if="track.album.cover" v-lazy="backend.absoluteUrl(track.album.cover)">
|
||||
<img class="ui mini image" v-if="track.album.cover" v-lazy="$store.getters['instance/absoluteUrl'](track.album.cover)">
|
||||
<img class="ui mini image" v-else src="../../..//assets/audio/default-cover.png">
|
||||
</td>
|
||||
<td colspan="6">
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
<pre>
|
||||
export PRIVATE_TOKEN="{{ $store.state.auth.token }}"
|
||||
<template v-for="track in tracks"><template v-if="track.files.length > 0">
|
||||
curl -G -o "{{ track.files[0].filename }}" <template v-if="$store.state.auth.authenticated">--header "Authorization: JWT $PRIVATE_TOKEN"</template> "{{ backend.absoluteUrl(track.files[0].path) }}"</template></template>
|
||||
curl -G -o "{{ track.files[0].filename }}" <template v-if="$store.state.auth.authenticated">--header "Authorization: JWT $PRIVATE_TOKEN"</template> "{{ $store.getters['instance/absoluteUrl'](track.files[0].path) }}"</template></template>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -87,7 +87,7 @@ export default {
|
|||
if (!this.album.cover) {
|
||||
return ''
|
||||
}
|
||||
return 'background-image: url(' + backend.absoluteUrl(this.album.cover) + ')'
|
||||
return 'background-image: url(' + this.$store.getters['instance/absoluteUrl'](this.album.cover) + ')'
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
|
|
@ -127,7 +127,7 @@ export default {
|
|||
if (!this.cover) {
|
||||
return ''
|
||||
}
|
||||
return 'background-image: url(' + backend.absoluteUrl(this.cover) + ')'
|
||||
return 'background-image: url(' + this.$store.getters['instance/absoluteUrl'](this.cover) + ')'
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
|
|
@ -108,7 +108,6 @@ import time from '@/utils/time'
|
|||
import axios from 'axios'
|
||||
import url from '@/utils/url'
|
||||
import logger from '@/logging'
|
||||
import backend from '@/audio/backend'
|
||||
import PlayButton from '@/components/audio/PlayButton'
|
||||
import TrackFavoriteIcon from '@/components/favorites/TrackFavoriteIcon'
|
||||
import TrackPlaylistIcon from '@/components/playlists/TrackPlaylistIcon'
|
||||
|
@ -169,7 +168,7 @@ export default {
|
|||
},
|
||||
downloadUrl () {
|
||||
if (this.track.files.length > 0) {
|
||||
let u = backend.absoluteUrl(this.track.files[0].path)
|
||||
let u = this.$store.getters['instance/absoluteUrl'](this.track.files[0].path)
|
||||
if (this.$store.state.auth.authenticated) {
|
||||
u = url.updateQueryString(u, 'jwt', this.$store.state.auth.token)
|
||||
}
|
||||
|
@ -191,7 +190,7 @@ export default {
|
|||
if (!this.cover) {
|
||||
return ''
|
||||
}
|
||||
return 'background-image: url(' + backend.absoluteUrl(this.cover) + ')'
|
||||
return 'background-image: url(' + this.$store.getters['instance/absoluteUrl'](this.cover) + ')'
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
|
|
@ -63,7 +63,6 @@
|
|||
</template>
|
||||
<script>
|
||||
import axios from 'axios'
|
||||
import config from '@/config'
|
||||
import $ from 'jquery'
|
||||
import _ from 'lodash'
|
||||
|
||||
|
@ -86,7 +85,7 @@ export default {
|
|||
return {
|
||||
checkResult: null,
|
||||
showCandidadesModal: false,
|
||||
exclude: config.not
|
||||
exclude: this.config.not
|
||||
}
|
||||
},
|
||||
mounted: function () {
|
||||
|
|
|
@ -43,8 +43,6 @@
|
|||
<script>
|
||||
import axios from 'axios'
|
||||
|
||||
import backend from '@/audio/backend'
|
||||
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
|
@ -72,7 +70,7 @@ export default {
|
|||
})
|
||||
},
|
||||
getUrl (code) {
|
||||
return backend.absoluteUrl(this.$router.resolve({name: 'signup', query: {invitation: code.toUpperCase()}}).href)
|
||||
return this.$store.getters['instance/absoluteUrl'](this.$router.resolve({name: 'signup', query: {invitation: code.toUpperCase()}}).href)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
|
||||
<script>
|
||||
import jQuery from 'jquery'
|
||||
import config from '@/config'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
|
@ -117,7 +116,7 @@ export default {
|
|||
})[0]
|
||||
},
|
||||
searchUrl: function () {
|
||||
return config.API_URL + 'providers/musicbrainz/search/' + this.currentTypeObject.value + 's/?query={query}'
|
||||
return this.$store.getters['instance/absoluteUrl']('providers/musicbrainz/search/' + this.currentTypeObject.value + 's/?query={query}')
|
||||
},
|
||||
types: function () {
|
||||
return [
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
class Config {
|
||||
constructor () {
|
||||
this.BACKEND_URL = process.env.BACKEND_URL
|
||||
this.API_URL = this.BACKEND_URL + 'api/v1/'
|
||||
}
|
||||
}
|
||||
|
||||
export default new Config()
|
|
@ -6,7 +6,7 @@ export default {
|
|||
namespaced: true,
|
||||
state: {
|
||||
maxEvents: 200,
|
||||
instanceUrl: process.env.INSTANCE_URL,
|
||||
instanceUrl: '/',
|
||||
events: [],
|
||||
settings: {
|
||||
instance: {
|
||||
|
|
Loading…
Reference in New Issue