global variable apiUrl
This commit is contained in:
parent
cbcb7445c7
commit
415a672af3
@ -86,23 +86,7 @@ export default {
|
|||||||
this.tableData = []
|
this.tableData = []
|
||||||
const route = this.$route
|
const route = this.$route
|
||||||
this.$store.dispatch('setMenuState', route.name)
|
this.$store.dispatch('setMenuState', route.name)
|
||||||
switch (route.name) {
|
this.loadStations(route.name)
|
||||||
case 'TOP':
|
|
||||||
this.loadStations()
|
|
||||||
break
|
|
||||||
case 'RECENT':
|
|
||||||
this.loadStations()
|
|
||||||
break
|
|
||||||
case 'NEW':
|
|
||||||
this.loadStations()
|
|
||||||
break
|
|
||||||
case 'FAVORITES':
|
|
||||||
this.loadStations()
|
|
||||||
break
|
|
||||||
case 'CATEGORIES':
|
|
||||||
this.loadStations()
|
|
||||||
break
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Favor a new station by sending the information to the server
|
* Favor a new station by sending the information to the server
|
||||||
@ -131,7 +115,7 @@ export default {
|
|||||||
audioPlayer.fade(vm.player.volume, 0, 500)
|
audioPlayer.fade(vm.player.volume, 0, 500)
|
||||||
}
|
}
|
||||||
vm.$store.dispatch('setTitle', station.name)
|
vm.$store.dispatch('setTitle', station.name)
|
||||||
this.$jquery.get('http://de1.api.radio-browser.info/json/url/' + station.stationuuid,
|
this.$jquery.get(this.$apiUrl + '/json/url/' + station.stationuuid,
|
||||||
{
|
{
|
||||||
'User-Agent': 'Nextcloud Radio/1.0.0', // FIXME global version, doesnt seem to work
|
'User-Agent': 'Nextcloud Radio/1.0.0', // FIXME global version, doesnt seem to work
|
||||||
})
|
})
|
||||||
@ -168,16 +152,26 @@ export default {
|
|||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Fetching radio stations using Radio-Browser.info API
|
* Fetching radio stations using Radio-Browser.info API
|
||||||
|
* @param {String} menuState Entries to load
|
||||||
*/
|
*/
|
||||||
loadStations() {
|
loadStations(menuState = 'TOP') {
|
||||||
|
|
||||||
const vm = this
|
const vm = this
|
||||||
if (vm.offset === 0) {
|
if (vm.offset === 0) {
|
||||||
vm.pageLoading = true
|
vm.pageLoading = true
|
||||||
}
|
}
|
||||||
this.$jquery.getJSON('https://de1.api.radio-browser.info/json/stations',
|
|
||||||
|
let sortBy = 'clickcount'
|
||||||
|
if (menuState === 'TOP') {
|
||||||
|
sortBy = 'clickcount'
|
||||||
|
} else if (menuState === 'NEW') {
|
||||||
|
sortBy = 'lastchangetime'
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$jquery.getJSON(this.$apiUrl + '/json/stations',
|
||||||
{
|
{
|
||||||
limit: 20,
|
limit: 20,
|
||||||
order: 'clickcount',
|
order: sortBy,
|
||||||
reverse: true,
|
reverse: true,
|
||||||
offset: vm.offset,
|
offset: vm.offset,
|
||||||
'User-Agent': 'Nextcloud Radio/1.0.0', // FIXME global version, doesnt seem to work
|
'User-Agent': 'Nextcloud Radio/1.0.0', // FIXME global version, doesnt seem to work
|
||||||
|
@ -36,6 +36,8 @@ Vue.prototype.t = translate
|
|||||||
Vue.prototype.n = translatePlural
|
Vue.prototype.n = translatePlural
|
||||||
Vue.prototype.$jquery = jquery
|
Vue.prototype.$jquery = jquery
|
||||||
|
|
||||||
|
Vue.prototype.$apiUrl = 'https://de1.api.radio-browser.info'
|
||||||
|
|
||||||
Vue.use(VueBlurHash)
|
Vue.use(VueBlurHash)
|
||||||
|
|
||||||
export default new Vue({
|
export default new Vue({
|
||||||
|
Loading…
Reference in New Issue
Block a user