Use relative paths in web interface to ease reolcation or proxying

This commit is contained in:
Tucker Kern 2020-04-28 11:01:25 -06:00 committed by chme
parent f8257a1f55
commit 39b14ff8d4
8 changed files with 105 additions and 102 deletions

View File

@ -10,10 +10,10 @@
<!-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.1/css/bulma.min.css"> --> <!-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.1/css/bulma.min.css"> -->
<!-- Local libraries --> <!-- Local libraries -->
<link rel="stylesheet" href="/admin/vendor/fontawesome/css/all.min.css"> <link rel="stylesheet" href="admin/vendor/fontawesome/css/all.min.css">
<link rel="stylesheet" href="/admin/vendor/bulma/bulma.min.css"> <link rel="stylesheet" href="admin/vendor/bulma/bulma.min.css">
<link rel="stylesheet" href="/admin/css/forked-daapd.css"> <link rel="stylesheet" href="admin/css/forked-daapd.css">
</head> </head>
<body> <body>
@ -25,7 +25,7 @@
--> -->
<nav class="navbar"> <nav class="navbar">
<div class="navbar-brand"> <div class="navbar-brand">
<a class="navbar-item has-text-black" href="/">forked-daapd</a> <a class="navbar-item has-text-black" href="./">forked-daapd</a>
<a class="navbar-item" href="https://github.com/ejurgensen/forked-daapd" title="GitHub"><i class="fab fa-github"></i></a> <a class="navbar-item" href="https://github.com/ejurgensen/forked-daapd" title="GitHub"><i class="fab fa-github"></i></a>
</div> </div>
</nav> </nav>
@ -281,9 +281,9 @@
<!-- <script src="https://unpkg.com/axios@0.18.0/dist/axios.min.js"></script> --> <!-- <script src="https://unpkg.com/axios@0.18.0/dist/axios.min.js"></script> -->
<!-- Local libraries --> <!-- Local libraries -->
<script src="/admin/vendor/vue/vue.min.js"></script> <script src="admin/vendor/vue/vue.min.js"></script>
<script src="/admin/vendor/axios/axios.min.js"></script> <script src="admin/vendor/axios/axios.min.js"></script>
<script src="/admin/js/forked-daapd.js"></script> <script src="admin/js/forked-daapd.js"></script>
</body> </body>
</html> </html>

View File

@ -35,43 +35,43 @@ var app = new Vue({
methods: { methods: {
loadConfig: function() { loadConfig: function() {
axios.get('/api/config').then(response => { axios.get('./api/config').then(response => {
this.config = response.data; this.config = response.data;
this.connect()}); this.connect()});
}, },
loadLibrary: function() { loadLibrary: function() {
axios.get('/api/library').then(response => this.library = response.data); axios.get('./api/library').then(response => this.library = response.data);
}, },
loadOutputs: function() { loadOutputs: function() {
axios.get('/api/outputs').then(response => this.outputs = response.data.outputs); axios.get('./api/outputs').then(response => this.outputs = response.data.outputs);
}, },
loadSpotify: function() { loadSpotify: function() {
axios.get('/api/spotify').then(response => this.spotify = response.data); axios.get('./api/spotify').then(response => this.spotify = response.data);
}, },
loadPairing: function() { loadPairing: function() {
axios.get('/api/pairing').then(response => this.pairing = response.data); axios.get('./api/pairing').then(response => this.pairing = response.data);
}, },
loadLastfm: function() { loadLastfm: function() {
axios.get('/api/lastfm').then(response => this.lastfm = response.data); axios.get('./api/lastfm').then(response => this.lastfm = response.data);
}, },
update: function() { update: function() {
this.library.updating = true; this.library.updating = true;
axios.put('/api/update').then(console.log('Library is updating')); axios.put('./api/update').then(console.log('Library is updating'));
}, },
update_meta: function() { update_meta: function() {
this.library.updating = true; this.library.updating = true;
axios.put('/api/rescan').then(console.log('Library is rescanning meta')); axios.put('./api/rescan').then(console.log('Library is rescanning meta'));
}, },
kickoffPairing: function() { kickoffPairing: function() {
axios.post('/api/pairing', this.pairing_req).then(response => { axios.post('./api/pairing', this.pairing_req).then(response => {
console.log('Kicked off pairing'); console.log('Kicked off pairing');
if (!this.config.websocket_port) { if (!this.config.websocket_port) {
this.pairing = {}; this.pairing = {};
@ -80,7 +80,7 @@ var app = new Vue({
}, },
kickoffVerification: function() { kickoffVerification: function() {
axios.post('/api/verification', this.verification_req).then(response => { axios.post('./api/verification', this.verification_req).then(response => {
console.log('Kicked off verification'); console.log('Kicked off verification');
this.verification_req.pin = ''; this.verification_req.pin = '';
}); });
@ -94,7 +94,7 @@ var app = new Vue({
} }
} }
axios.put('/api/outputs/set', { outputs: selected_outputs }).then(response => { axios.put('./api/outputs/set', { outputs: selected_outputs }).then(response => {
if (!this.config.websocket_port) { if (!this.config.websocket_port) {
this.loadOutputs(); this.loadOutputs();
} }
@ -102,7 +102,7 @@ var app = new Vue({
}, },
loginLibspotify: function() { loginLibspotify: function() {
axios.post('/api/spotify-login', this.libspotify).then(response => { axios.post('./api/spotify-login', this.libspotify).then(response => {
this.libspotify.user = ''; this.libspotify.user = '';
this.libspotify.password = ''; this.libspotify.password = '';
this.libspotify.errors.user = ''; this.libspotify.errors.user = '';
@ -117,7 +117,7 @@ var app = new Vue({
}, },
loginLastfm: function() { loginLastfm: function() {
axios.post('/api/lastfm-login', this.lastfm_login).then(response => { axios.post('./api/lastfm-login', this.lastfm_login).then(response => {
this.lastfm_login.user = ''; this.lastfm_login.user = '';
this.lastfm_login.password = ''; this.lastfm_login.password = '';
this.lastfm_login.errors.user = ''; this.lastfm_login.errors.user = '';
@ -132,7 +132,7 @@ var app = new Vue({
}, },
logoutLastfm: function() { logoutLastfm: function() {
axios.get('/api/lastfm-logout', this.lastfm_login).then(response => { axios.get('./api/lastfm-logout', this.lastfm_login).then(response => {
if (!this.config.websocket_port) { if (!this.config.websocket_port) {
this.loadLastfm(); this.loadLastfm();
} }

View File

@ -1 +1 @@
<!DOCTYPE html><html class="has-navbar-fixed-top has-navbar-fixed-bottom"><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><title>forked-daapd-web 2</title><link rel=apple-touch-icon sizes=120x120 href=/apple-touch-icon.png?ver1.1><link rel=icon type=image/png sizes=32x32 href=/favicon-32x32.png><link rel=icon type=image/png sizes=16x16 href=/favicon-16x16.png><link rel=manifest href=/site.webmanifest><link rel=mask-icon href=/safari-pinned-tab.svg color=#5bbad5><meta name=msapplication-TileColor content=#da532c><meta name=theme-color content=#ffffff><link href=/player/css/app.css rel=preload as=style><link href=/player/css/chunk-vendors.css rel=preload as=style><link href=/player/js/app.js rel=modulepreload as=script><link href=/player/js/chunk-vendors.js rel=modulepreload as=script><link href=/player/css/chunk-vendors.css rel=stylesheet><link href=/player/css/app.css rel=stylesheet></head><body><div id=app></div><script type=module src=/player/js/chunk-vendors.js></script><script type=module src=/player/js/app.js></script><script>!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script src=/player/js/chunk-vendors-legacy.js nomodule></script><script src=/player/js/app-legacy.js nomodule></script></body></html> <!DOCTYPE html><html class="has-navbar-fixed-top has-navbar-fixed-bottom"><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><title>forked-daapd-web 2</title><link rel=apple-touch-icon sizes=120x120 href=apple-touch-icon.png?ver1.1><link rel=icon type=image/png sizes=32x32 href=favicon-32x32.png><link rel=icon type=image/png sizes=16x16 href=favicon-16x16.png><link rel=manifest href=site.webmanifest><link rel=mask-icon href=safari-pinned-tab.svg color=#5bbad5><meta name=msapplication-TileColor content=#da532c><meta name=theme-color content=#ffffff><link href=player/css/app.css rel=preload as=style><link href=player/css/chunk-vendors.css rel=preload as=style><link href=player/js/app.js rel=modulepreload as=script><link href=player/js/chunk-vendors.js rel=modulepreload as=script><link href=player/css/chunk-vendors.css rel=stylesheet><link href=player/css/app.css rel=stylesheet></head><body><div id=app></div><script type=module src=player/js/chunk-vendors.js></script><script type=module src=player/js/app.js></script><script>!function(){var e=document,t=e.createElement("script");if(!("noModule"in t)&&"onbeforeload"in t){var n=!1;e.addEventListener("beforeload",function(e){if(e.target===t)n=!0;else if(!e.target.hasAttribute("nomodule")||!n)return;e.preventDefault()},!0),t.type="module",t.src=".",e.head.appendChild(t),t.remove()}}();</script><script src=player/js/chunk-vendors-legacy.js nomodule></script><script src=player/js/app-legacy.js nomodule></script></body></html>

View File

@ -213,7 +213,7 @@ artist_to_json(struct db_group_info *dbgri)
if (ret < sizeof(uri)) if (ret < sizeof(uri))
json_object_object_add(item, "uri", json_object_new_string(uri)); json_object_object_add(item, "uri", json_object_new_string(uri));
ret = snprintf(artwork_url, sizeof(artwork_url), "/artwork/group/%s", dbgri->id); ret = snprintf(artwork_url, sizeof(artwork_url), "./artwork/group/%s", dbgri->id);
if (ret < sizeof(artwork_url)) if (ret < sizeof(artwork_url))
json_object_object_add(item, "artwork_url", json_object_new_string(artwork_url)); json_object_object_add(item, "artwork_url", json_object_new_string(artwork_url));
@ -261,7 +261,7 @@ album_to_json(struct db_group_info *dbgri)
if (ret < sizeof(uri)) if (ret < sizeof(uri))
json_object_object_add(item, "uri", json_object_new_string(uri)); json_object_object_add(item, "uri", json_object_new_string(uri));
ret = snprintf(artwork_url, sizeof(artwork_url), "/artwork/group/%s", dbgri->id); ret = snprintf(artwork_url, sizeof(artwork_url), "./artwork/group/%s", dbgri->id);
if (ret < sizeof(artwork_url)) if (ret < sizeof(artwork_url))
json_object_object_add(item, "artwork_url", json_object_new_string(artwork_url)); json_object_object_add(item, "artwork_url", json_object_new_string(artwork_url));
@ -2099,7 +2099,7 @@ jsonapi_reply_player(struct httpd_request *hreq)
json_object_object_add(reply, "item_id", json_object_new_int(status.item_id)); json_object_object_add(reply, "item_id", json_object_new_int(status.item_id));
json_object_object_add(reply, "item_length_ms", json_object_new_int(status.len_ms)); json_object_object_add(reply, "item_length_ms", json_object_new_int(status.len_ms));
json_object_object_add(reply, "item_progress_ms", json_object_new_int(status.pos_ms)); json_object_object_add(reply, "item_progress_ms", json_object_new_int(status.pos_ms));
json_object_object_add(reply, "artwork_url", json_object_new_string("/artwork/nowplaying")); json_object_object_add(reply, "artwork_url", json_object_new_string("./artwork/nowplaying"));
} }
else else
{ {
@ -2194,7 +2194,7 @@ queue_item_to_json(struct db_queue_item *queue_item, char shuffle)
{ {
// Queue item does not have a valid artwork url, construct artwork url to // Queue item does not have a valid artwork url, construct artwork url to
// get the image through the httpd_artworkapi (uses the artwork handlers). // get the image through the httpd_artworkapi (uses the artwork handlers).
ret = snprintf(artwork_url, sizeof(artwork_url), "/artwork/item/%d", queue_item->file_id); ret = snprintf(artwork_url, sizeof(artwork_url), "./artwork/item/%d", queue_item->file_id);
if (ret < sizeof(artwork_url)) if (ret < sizeof(artwork_url))
json_object_object_add(item, "artwork_url", json_object_new_string(artwork_url)); json_object_object_add(item, "artwork_url", json_object_new_string(artwork_url));
} }
@ -2203,7 +2203,7 @@ queue_item_to_json(struct db_queue_item *queue_item, char shuffle)
// Pipe and stream metadata can change if the queue version changes. Construct artwork url // Pipe and stream metadata can change if the queue version changes. Construct artwork url
// similar to non-pipe items, but append the queue version to the url to force // similar to non-pipe items, but append the queue version to the url to force
// clients to reload image if the queue version changes (additional metadata was found). // clients to reload image if the queue version changes (additional metadata was found).
ret = snprintf(artwork_url, sizeof(artwork_url), "/artwork/item/%d?v=%d", queue_item->file_id, queue_item->queue_version); ret = snprintf(artwork_url, sizeof(artwork_url), "./artwork/item/%d?v=%d", queue_item->file_id, queue_item->queue_version);
if (ret < sizeof(artwork_url)) if (ret < sizeof(artwork_url))
json_object_object_add(item, "artwork_url", json_object_new_string(artwork_url)); json_object_object_add(item, "artwork_url", json_object_new_string(artwork_url));
} }

View File

@ -4,11 +4,11 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0"> <meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>forked-daapd-web 2</title> <title>forked-daapd-web 2</title>
<link rel="apple-touch-icon" sizes="120x120" href="/apple-touch-icon.png?ver1.1"> <link rel="apple-touch-icon" sizes="120x120" href="apple-touch-icon.png?ver1.1">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"> <link rel="icon" type="image/png" sizes="32x32" href="favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"> <link rel="icon" type="image/png" sizes="16x16" href="favicon-16x16.png">
<link rel="manifest" href="/site.webmanifest"> <link rel="manifest" href="site.webmanifest">
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5"> <link rel="mask-icon" href="safari-pinned-tab.svg" color="#5bbad5">
<meta name="msapplication-TileColor" content="#da532c"> <meta name="msapplication-TileColor" content="#da532c">
<meta name="theme-color" content="#ffffff"> <meta name="theme-color" content="#ffffff">
</head> </head>

View File

@ -81,7 +81,7 @@
</div> </div>
<div class="level-item fd-expanded"> <div class="level-item fd-expanded">
<div class="fd-expanded"> <div class="fd-expanded">
<p class="heading" :class="{ 'has-text-grey-light': !playing }">HTTP stream <a href="/stream.mp3"><span class="is-lowercase">(stream.mp3)</span></a></p> <p class="heading" :class="{ 'has-text-grey-light': !playing }">HTTP stream <a href="stream.mp3"><span class="is-lowercase">(stream.mp3)</span></a></p>
<range-slider <range-slider
class="slider fd-has-action" class="slider fd-has-action"
min="0" min="0"
@ -174,7 +174,7 @@
</div> </div>
<div class="level-item fd-expanded"> <div class="level-item fd-expanded">
<div class="fd-expanded"> <div class="fd-expanded">
<p class="heading" :class="{ 'has-text-grey-light': !playing }">HTTP stream <a href="/stream.mp3"><span class="is-lowercase">(stream.mp3)</span></a></p> <p class="heading" :class="{ 'has-text-grey-light': !playing }">HTTP stream <a href="stream.mp3"><span class="is-lowercase">(stream.mp3)</span></a></p>
<range-slider <range-slider
class="slider fd-has-action" class="slider fd-has-action"
min="0" min="0"

View File

@ -12,51 +12,51 @@ axios.interceptors.response.use(function (response) {
export default { export default {
config () { config () {
return axios.get('/api/config') return axios.get('./api/config')
}, },
settings () { settings () {
return axios.get('/api/settings') return axios.get('./api/settings')
}, },
settings_update (categoryName, option) { settings_update (categoryName, option) {
return axios.put('/api/settings/' + categoryName + '/' + option.name, option) return axios.put('./api/settings/' + categoryName + '/' + option.name, option)
}, },
library_stats () { library_stats () {
return axios.get('/api/library') return axios.get('./api/library')
}, },
library_update () { library_update () {
return axios.put('/api/update') return axios.put('./api/update')
}, },
library_rescan () { library_rescan () {
return axios.put('/api/rescan') return axios.put('./api/rescan')
}, },
library_count (expression) { library_count (expression) {
return axios.get('/api/library/count?expression=' + expression) return axios.get('./api/library/count?expression=' + expression)
}, },
queue () { queue () {
return axios.get('/api/queue') return axios.get('./api/queue')
}, },
queue_clear () { queue_clear () {
return axios.put('/api/queue/clear') return axios.put('./api/queue/clear')
}, },
queue_remove (itemId) { queue_remove (itemId) {
return axios.delete('/api/queue/items/' + itemId) return axios.delete('./api/queue/items/' + itemId)
}, },
queue_move (itemId, newPosition) { queue_move (itemId, newPosition) {
return axios.put('/api/queue/items/' + itemId + '?new_position=' + newPosition) return axios.put('./api/queue/items/' + itemId + '?new_position=' + newPosition)
}, },
queue_add (uri) { queue_add (uri) {
return axios.post('/api/queue/items/add?uris=' + uri).then((response) => { return axios.post('./api/queue/items/add?uris=' + uri).then((response) => {
store.dispatch('add_notification', { text: response.data.count + ' tracks appended to queue', type: 'info', timeout: 2000 }) store.dispatch('add_notification', { text: response.data.count + ' tracks appended to queue', type: 'info', timeout: 2000 })
return Promise.resolve(response) return Promise.resolve(response)
}) })
@ -67,7 +67,7 @@ export default {
if (store.getters.now_playing && store.getters.now_playing.id) { if (store.getters.now_playing && store.getters.now_playing.id) {
position = store.getters.now_playing.position + 1 position = store.getters.now_playing.position + 1
} }
return axios.post('/api/queue/items/add?uris=' + uri + '&position=' + position).then((response) => { return axios.post('./api/queue/items/add?uris=' + uri + '&position=' + position).then((response) => {
store.dispatch('add_notification', { text: response.data.count + ' tracks appended to queue', type: 'info', timeout: 2000 }) store.dispatch('add_notification', { text: response.data.count + ' tracks appended to queue', type: 'info', timeout: 2000 })
return Promise.resolve(response) return Promise.resolve(response)
}) })
@ -77,7 +77,7 @@ export default {
var options = {} var options = {}
options.expression = expression options.expression = expression
return axios.post('/api/queue/items/add', undefined, { params: options }).then((response) => { return axios.post('./api/queue/items/add', undefined, { params: options }).then((response) => {
store.dispatch('add_notification', { text: response.data.count + ' tracks appended to queue', type: 'info', timeout: 2000 }) store.dispatch('add_notification', { text: response.data.count + ' tracks appended to queue', type: 'info', timeout: 2000 })
return Promise.resolve(response) return Promise.resolve(response)
}) })
@ -91,21 +91,21 @@ export default {
options.position = store.getters.now_playing.position + 1 options.position = store.getters.now_playing.position + 1
} }
return axios.post('/api/queue/items/add', undefined, { params: options }).then((response) => { return axios.post('./api/queue/items/add', undefined, { params: options }).then((response) => {
store.dispatch('add_notification', { text: response.data.count + ' tracks appended to queue', type: 'info', timeout: 2000 }) store.dispatch('add_notification', { text: response.data.count + ' tracks appended to queue', type: 'info', timeout: 2000 })
return Promise.resolve(response) return Promise.resolve(response)
}) })
}, },
queue_save_playlist (name) { queue_save_playlist (name) {
return axios.post('/api/queue/save', undefined, { params: { name: name } }).then((response) => { return axios.post('./api/queue/save', undefined, { params: { name: name } }).then((response) => {
store.dispatch('add_notification', { text: 'Queue saved to playlist "' + name + '"', type: 'info', timeout: 2000 }) store.dispatch('add_notification', { text: 'Queue saved to playlist "' + name + '"', type: 'info', timeout: 2000 })
return Promise.resolve(response) return Promise.resolve(response)
}) })
}, },
player_status () { player_status () {
return axios.get('/api/player') return axios.get('./api/player')
}, },
player_play_uri (uris, shuffle, position = undefined) { player_play_uri (uris, shuffle, position = undefined) {
@ -116,7 +116,7 @@ export default {
options.playback = 'start' options.playback = 'start'
options.playback_from_position = position options.playback_from_position = position
return axios.post('/api/queue/items/add', undefined, { params: options }) return axios.post('./api/queue/items/add', undefined, { params: options })
}, },
player_play_expression (expression, shuffle, position = undefined) { player_play_expression (expression, shuffle, position = undefined) {
@ -127,111 +127,111 @@ export default {
options.playback = 'start' options.playback = 'start'
options.playback_from_position = position options.playback_from_position = position
return axios.post('/api/queue/items/add', undefined, { params: options }) return axios.post('./api/queue/items/add', undefined, { params: options })
}, },
player_play (options = {}) { player_play (options = {}) {
return axios.put('/api/player/play', undefined, { params: options }) return axios.put('./api/player/play', undefined, { params: options })
}, },
player_playpos (position) { player_playpos (position) {
return axios.put('/api/player/play?position=' + position) return axios.put('./api/player/play?position=' + position)
}, },
player_playid (itemId) { player_playid (itemId) {
return axios.put('/api/player/play?item_id=' + itemId) return axios.put('./api/player/play?item_id=' + itemId)
}, },
player_pause () { player_pause () {
return axios.put('/api/player/pause') return axios.put('./api/player/pause')
}, },
player_stop () { player_stop () {
return axios.put('/api/player/stop') return axios.put('./api/player/stop')
}, },
player_next () { player_next () {
return axios.put('/api/player/next') return axios.put('./api/player/next')
}, },
player_previous () { player_previous () {
return axios.put('/api/player/previous') return axios.put('./api/player/previous')
}, },
player_shuffle (newState) { player_shuffle (newState) {
var shuffle = newState ? 'true' : 'false' var shuffle = newState ? 'true' : 'false'
return axios.put('/api/player/shuffle?state=' + shuffle) return axios.put('./api/player/shuffle?state=' + shuffle)
}, },
player_consume (newState) { player_consume (newState) {
var consume = newState ? 'true' : 'false' var consume = newState ? 'true' : 'false'
return axios.put('/api/player/consume?state=' + consume) return axios.put('./api/player/consume?state=' + consume)
}, },
player_repeat (newRepeatMode) { player_repeat (newRepeatMode) {
return axios.put('/api/player/repeat?state=' + newRepeatMode) return axios.put('./api/player/repeat?state=' + newRepeatMode)
}, },
player_volume (volume) { player_volume (volume) {
return axios.put('/api/player/volume?volume=' + volume) return axios.put('./api/player/volume?volume=' + volume)
}, },
player_output_volume (outputId, outputVolume) { player_output_volume (outputId, outputVolume) {
return axios.put('/api/player/volume?volume=' + outputVolume + '&output_id=' + outputId) return axios.put('./api/player/volume?volume=' + outputVolume + '&output_id=' + outputId)
}, },
player_seek_to_pos (newPosition) { player_seek_to_pos (newPosition) {
return axios.put('/api/player/seek?position_ms=' + newPosition) return axios.put('./api/player/seek?position_ms=' + newPosition)
}, },
player_seek (seekMs) { player_seek (seekMs) {
return axios.put('/api/player/seek?seek_ms=' + seekMs) return axios.put('./api/player/seek?seek_ms=' + seekMs)
}, },
outputs () { outputs () {
return axios.get('/api/outputs') return axios.get('./api/outputs')
}, },
output_update (outputId, output) { output_update (outputId, output) {
return axios.put('/api/outputs/' + outputId, output) return axios.put('./api/outputs/' + outputId, output)
}, },
output_toggle (outputId) { output_toggle (outputId) {
return axios.put('/api/outputs/' + outputId + '/toggle') return axios.put('./api/outputs/' + outputId + '/toggle')
}, },
library_artists (media_kind = undefined) { library_artists (media_kind = undefined) {
return axios.get('/api/library/artists', { params: { media_kind: media_kind } }) return axios.get('./api/library/artists', { params: { media_kind: media_kind } })
}, },
library_artist (artistId) { library_artist (artistId) {
return axios.get('/api/library/artists/' + artistId) return axios.get('./api/library/artists/' + artistId)
}, },
library_artist_albums (artistId) { library_artist_albums (artistId) {
return axios.get('/api/library/artists/' + artistId + '/albums') return axios.get('./api/library/artists/' + artistId + '/albums')
}, },
library_albums (media_kind = undefined) { library_albums (media_kind = undefined) {
return axios.get('/api/library/albums', { params: { media_kind: media_kind } }) return axios.get('./api/library/albums', { params: { media_kind: media_kind } })
}, },
library_album (albumId) { library_album (albumId) {
return axios.get('/api/library/albums/' + albumId) return axios.get('./api/library/albums/' + albumId)
}, },
library_album_tracks (albumId, filter = { limit: -1, offset: 0 }) { library_album_tracks (albumId, filter = { limit: -1, offset: 0 }) {
return axios.get('/api/library/albums/' + albumId + '/tracks', { return axios.get('./api/library/albums/' + albumId + '/tracks', {
params: filter params: filter
}) })
}, },
library_album_track_update (albumId, attributes) { library_album_track_update (albumId, attributes) {
return axios.put('/api/library/albums/' + albumId + '/tracks', undefined, { params: attributes }) return axios.put('./api/library/albums/' + albumId + '/tracks', undefined, { params: attributes })
}, },
library_genres () { library_genres () {
return axios.get('/api/library/genres') return axios.get('./api/library/genres')
}, },
library_genre (genre) { library_genre (genre) {
@ -240,7 +240,7 @@ export default {
media_kind: 'music', media_kind: 'music',
expression: 'genre is "' + genre + '"' expression: 'genre is "' + genre + '"'
} }
return axios.get('/api/search', { return axios.get('./api/search', {
params: genreParams params: genreParams
}) })
}, },
@ -251,7 +251,7 @@ export default {
media_kind: 'music', media_kind: 'music',
expression: 'genre is "' + genre + '"' expression: 'genre is "' + genre + '"'
} }
return axios.get('/api/search', { return axios.get('./api/search', {
params: genreParams params: genreParams
}) })
}, },
@ -262,7 +262,7 @@ export default {
media_kind: 'music', media_kind: 'music',
expression: 'data_kind is url and song_length = 0' expression: 'data_kind is url and song_length = 0'
} }
return axios.get('/api/search', { return axios.get('./api/search', {
params: params params: params
}) })
}, },
@ -273,7 +273,7 @@ export default {
type: 'tracks', type: 'tracks',
expression: 'songartistid is "' + artist + '"' expression: 'songartistid is "' + artist + '"'
} }
return axios.get('/api/search', { return axios.get('./api/search', {
params: artistParams params: artistParams
}) })
} }
@ -284,7 +284,7 @@ export default {
type: 'tracks', type: 'tracks',
expression: 'media_kind is podcast and play_count = 0 ORDER BY time_added DESC' expression: 'media_kind is podcast and play_count = 0 ORDER BY time_added DESC'
} }
return axios.get('/api/search', { return axios.get('./api/search', {
params: episodesParams params: episodesParams
}) })
}, },
@ -294,86 +294,86 @@ export default {
type: 'tracks', type: 'tracks',
expression: 'media_kind is podcast and songalbumid is "' + albumId + '" ORDER BY date_released DESC' expression: 'media_kind is podcast and songalbumid is "' + albumId + '" ORDER BY date_released DESC'
} }
return axios.get('/api/search', { return axios.get('./api/search', {
params: episodesParams params: episodesParams
}) })
}, },
library_add (url) { library_add (url) {
return axios.post('/api/library/add', undefined, { params: { url: url } }) return axios.post('./api/library/add', undefined, { params: { url: url } })
}, },
library_playlist_delete (playlistId) { library_playlist_delete (playlistId) {
return axios.delete('/api/library/playlists/' + playlistId, undefined) return axios.delete('./api/library/playlists/' + playlistId, undefined)
}, },
library_playlists () { library_playlists () {
return axios.get('/api/library/playlists') return axios.get('./api/library/playlists')
}, },
library_playlist_folder (playlistId = 0) { library_playlist_folder (playlistId = 0) {
return axios.get('/api/library/playlists/' + playlistId + '/playlists') return axios.get('./api/library/playlists/' + playlistId + '/playlists')
}, },
library_playlist (playlistId) { library_playlist (playlistId) {
return axios.get('/api/library/playlists/' + playlistId) return axios.get('./api/library/playlists/' + playlistId)
}, },
library_playlist_tracks (playlistId) { library_playlist_tracks (playlistId) {
return axios.get('/api/library/playlists/' + playlistId + '/tracks') return axios.get('./api/library/playlists/' + playlistId + '/tracks')
}, },
library_track (trackId) { library_track (trackId) {
return axios.get('/api/library/tracks/' + trackId) return axios.get('./api/library/tracks/' + trackId)
}, },
library_track_playlists (trackId) { library_track_playlists (trackId) {
return axios.get('/api/library/tracks/' + trackId + '/playlists') return axios.get('./api/library/tracks/' + trackId + '/playlists')
}, },
library_track_update (trackId, attributes = {}) { library_track_update (trackId, attributes = {}) {
return axios.put('/api/library/tracks/' + trackId, undefined, { params: attributes }) return axios.put('./api/library/tracks/' + trackId, undefined, { params: attributes })
}, },
library_files (directory = undefined) { library_files (directory = undefined) {
var filesParams = { directory: directory } var filesParams = { directory: directory }
return axios.get('/api/library/files', { return axios.get('./api/library/files', {
params: filesParams params: filesParams
}) })
}, },
search (searchParams) { search (searchParams) {
return axios.get('/api/search', { return axios.get('./api/search', {
params: searchParams params: searchParams
}) })
}, },
spotify () { spotify () {
return axios.get('/api/spotify') return axios.get('./api/spotify')
}, },
spotify_login (credentials) { spotify_login (credentials) {
return axios.post('/api/spotify-login', credentials) return axios.post('./api/spotify-login', credentials)
}, },
lastfm () { lastfm () {
return axios.get('/api/lastfm') return axios.get('./api/lastfm')
}, },
lastfm_login (credentials) { lastfm_login (credentials) {
return axios.post('/api/lastfm-login', credentials) return axios.post('./api/lastfm-login', credentials)
}, },
lastfm_logout (credentials) { lastfm_logout (credentials) {
return axios.get('/api/lastfm-logout') return axios.get('./api/lastfm-logout')
}, },
pairing () { pairing () {
return axios.get('/api/pairing') return axios.get('./api/pairing')
}, },
pairing_kickoff (pairingReq) { pairing_kickoff (pairingReq) {
return axios.post('/api/pairing', pairingReq) return axios.post('./api/pairing', pairingReq)
}, },
artwork_url_append_size_params (artworkUrl, maxwidth = 600, maxheight = 600) { artwork_url_append_size_params (artworkUrl, maxwidth = 600, maxheight = 600) {

View File

@ -10,6 +10,9 @@ module.exports = {
assetsDir: 'player', assetsDir: 'player',
// Relative public path
publicPath: './',
// Do not add hashes to the generated js/css filenames, would otherwise // Do not add hashes to the generated js/css filenames, would otherwise
// require to adjust the Makefile in htdocs each time the web interface is // require to adjust the Makefile in htdocs each time the web interface is
// build // build