diff --git a/src/components/ChannelPage.vue b/src/components/ChannelPage.vue index a176c315..3755f54d 100644 --- a/src/components/ChannelPage.vue +++ b/src/components/ChannelPage.vue @@ -70,7 +70,7 @@ export default { methods: { async fetchSubscribedStatus() { this.fetchJson( - this.apiUrl() + "/subscribed", + this.authApiUrl() + "/subscribed", { channelId: this.channel.id, }, @@ -113,7 +113,7 @@ export default { } }, subscribeHandler() { - this.fetchJson(this.apiUrl() + (this.subscribed ? "/unsubscribe" : "/subscribe"), null, { + this.fetchJson(this.authApiUrl() + (this.subscribed ? "/unsubscribe" : "/subscribe"), null, { method: "POST", body: JSON.stringify({ channelId: this.channel.id, diff --git a/src/components/FeedPage.vue b/src/components/FeedPage.vue index fcf4f0f0..66c8b6d6 100644 --- a/src/components/FeedPage.vue +++ b/src/components/FeedPage.vue @@ -41,7 +41,7 @@ export default { }, computed: { getRssUrl(_this) { - return _this.apiUrl() + "/feed/rss?authToken=" + _this.getAuthToken(); + return _this.authApiUrl() + "/feed/rss?authToken=" + _this.getAuthToken(); }, }, mounted() { @@ -66,7 +66,7 @@ export default { }, methods: { async fetchFeed() { - return await this.fetchJson(this.apiUrl() + "/feed", { + return await this.fetchJson(this.authApiUrl() + "/feed", { authToken: this.getAuthToken(), }); }, diff --git a/src/components/ImportPage.vue b/src/components/ImportPage.vue index c54bb481..dcc354b0 100644 --- a/src/components/ImportPage.vue +++ b/src/components/ImportPage.vue @@ -133,7 +133,7 @@ export default { }, handleImport() { this.fetchJson( - this.apiUrl() + "/import", + this.authApiUrl() + "/import", { override: this.override, }, diff --git a/src/components/LoginPage.vue b/src/components/LoginPage.vue index 9bb303b3..549a7b95 100644 --- a/src/components/LoginPage.vue +++ b/src/components/LoginPage.vue @@ -49,7 +49,7 @@ export default { }, methods: { login() { - this.fetchJson(this.apiUrl() + "/login", null, { + this.fetchJson(this.authApiUrl() + "/login", null, { method: "POST", body: JSON.stringify({ username: this.username, @@ -57,7 +57,7 @@ export default { }), }).then(resp => { if (resp.token) { - this.setPreference("authToken" + this.hashCode(this.apiUrl()), resp.token); + this.setPreference("authToken" + this.hashCode(this.authApiUrl()), resp.token); window.location = "/"; // done to bypass cache } else alert(resp.error); }); diff --git a/src/components/PlaylistAddModal.vue b/src/components/PlaylistAddModal.vue index f61511b0..aeb20921 100644 --- a/src/components/PlaylistAddModal.vue +++ b/src/components/PlaylistAddModal.vue @@ -56,7 +56,7 @@ export default { }, mounted() { this.fetchPlaylists(); - this.selectedPlaylist = this.getPreferenceString("selectedPlaylist" + this.hashCode(this.apiUrl())); + this.selectedPlaylist = this.getPreferenceString("selectedPlaylist" + this.hashCode(this.authApiUrl())); window.addEventListener("keydown", this.handleKeyDown); window.blur(); }, @@ -83,7 +83,7 @@ export default { this.$refs.addButton.disabled = true; this.processing = true; - this.fetchJson(this.apiUrl() + "/user/playlists/add", null, { + this.fetchJson(this.authApiUrl() + "/user/playlists/add", null, { method: "POST", body: JSON.stringify({ playlistId: playlistId, @@ -94,13 +94,13 @@ export default { "Content-Type": "application/json", }, }).then(json => { - this.setPreference("selectedPlaylist" + this.hashCode(this.apiUrl()), playlistId); + this.setPreference("selectedPlaylist" + this.hashCode(this.authApiUrl()), playlistId); this.$emit("close"); if (json.error) alert(json.error); }); }, async fetchPlaylists() { - this.fetchJson(this.apiUrl() + "/user/playlists", null, { + this.fetchJson(this.authApiUrl() + "/user/playlists", null, { headers: { Authorization: this.getAuthToken(), }, diff --git a/src/components/PlaylistPage.vue b/src/components/PlaylistPage.vue index d2f97513..d54d63da 100644 --- a/src/components/PlaylistPage.vue +++ b/src/components/PlaylistPage.vue @@ -57,14 +57,14 @@ export default { }, computed: { getRssUrl: _this => { - return _this.apiUrl() + "/rss/playlists/" + _this.$route.query.list; + return _this.authApiUrl() + "/rss/playlists/" + _this.$route.query.list; }, }, mounted() { this.getPlaylistData(); const playlistId = this.$route.query.list; if (this.authenticated && playlistId?.length == 36) - this.fetchJson(this.apiUrl() + "/user/playlists", null, { + this.fetchJson(this.authApiUrl() + "/user/playlists", null, { headers: { Authorization: this.getAuthToken(), }, @@ -82,7 +82,7 @@ export default { }, methods: { async fetchPlaylist() { - return await await this.fetchJson(this.apiUrl() + "/playlists/" + this.$route.query.list); + return await await this.fetchJson(this.authApiUrl() + "/playlists/" + this.$route.query.list); }, async getPlaylistData() { this.fetchPlaylist() @@ -96,7 +96,7 @@ export default { if (this.loading || !this.playlist || !this.playlist.nextpage) return; if (window.innerHeight + window.scrollY >= document.body.offsetHeight - window.innerHeight) { this.loading = true; - this.fetchJson(this.apiUrl() + "/nextpage/playlists/" + this.$route.query.list, { + this.fetchJson(this.authApiUrl() + "/nextpage/playlists/" + this.$route.query.list, { nextpage: this.playlist.nextpage, }).then(json => { this.playlist.relatedStreams.concat(json.relatedStreams); diff --git a/src/components/PlaylistsPage.vue b/src/components/PlaylistsPage.vue index daae9eaa..3b048a64 100644 --- a/src/components/PlaylistsPage.vue +++ b/src/components/PlaylistsPage.vue @@ -38,7 +38,7 @@ export default { }, methods: { fetchPlaylists() { - this.fetchJson(this.apiUrl() + "/user/playlists", null, { + this.fetchJson(this.authApiUrl() + "/user/playlists", null, { headers: { Authorization: this.getAuthToken(), }, @@ -48,7 +48,7 @@ export default { }, deletePlaylist(id) { if (confirm(this.$t("actions.delete_playlist_confirm"))) - this.fetchJson(this.apiUrl() + "/user/playlists/delete", null, { + this.fetchJson(this.authApiUrl() + "/user/playlists/delete", null, { method: "POST", body: JSON.stringify({ playlistId: id, @@ -65,7 +65,7 @@ export default { createPlaylist() { const name = prompt(this.$t("actions.create_playlist")); if (name) - this.fetchJson(this.apiUrl() + "/user/playlists/create", null, { + this.fetchJson(this.authApiUrl() + "/user/playlists/create", null, { method: "POST", body: JSON.stringify({ name: name, diff --git a/src/components/PreferencesPage.vue b/src/components/PreferencesPage.vue index a2dd8649..7dc68ae8 100644 --- a/src/components/PreferencesPage.vue +++ b/src/components/PreferencesPage.vue @@ -203,11 +203,33 @@
-