Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Authentication-Tokens towards Arcsi requests #273

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/components/HeaderBlock.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</template>

<script>
import { streamServer, rareShowsURL, customScheduleURL, arcsiShowsBaseURL } from '~/constants'
import { streamServer, rareShowsURL, customScheduleURL, arcsiShowsBaseURL, config } from '~/constants'

export default {
data () {
Expand Down Expand Up @@ -69,7 +69,7 @@ export default {
}
},
async refreshAllShows () {
await this.$axios.get(arcsiShowsBaseURL + '/all_without_items')
await this.$axios.get(arcsiShowsBaseURL + '/all_without_items', config)
.then((res) => {
this.$store.commit('refreshAllShowsList', res.data)
})
Expand Down
4 changes: 2 additions & 2 deletions app/components/arcsi/Latest.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
import resolveConfig from 'tailwindcss/resolveConfig'
import tailwindConfig from '~/tailwind.config.js'

import { arcsiItemBaseURL } from '~/constants'
import { arcsiItemBaseURL, config } from '~/constants'

const fullConfig = resolveConfig(tailwindConfig)
const tabletSize = fullConfig.theme.screens.md
Expand All @@ -67,7 +67,7 @@ export default {
}
},
async fetch () {
this.arcsiEpisodes = await this.$axios.get(`${arcsiItemBaseURL}/latest?size=${this.startNumberofEpisodes}&page=${this.startIndex}`)
this.arcsiEpisodes = await this.$axios.get(`${arcsiItemBaseURL}/latest?size=${this.startNumberofEpisodes}&page=${this.startIndex}`, config)
.then(res => res.data)
.catch((error) => {
this.$sentry.captureException(new Error('Arcsi latest not found ', error))
Expand Down
4 changes: 2 additions & 2 deletions app/components/schedule/Fullitem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
</template>

<script>
import { arcsiBaseURL } from '~/constants'
import { arcsiBaseURL, config } from '~/constants'

export default {
props: {
Expand Down Expand Up @@ -178,7 +178,7 @@ export default {
}
},
getShowInfos () {
this.$axios.get(arcsiBaseURL + '/show/' + this.show.archive_lahmastore_base_url + '/archive')
this.$axios.get(arcsiBaseURL + '/show/' + this.show.archive_lahmastore_base_url + '/archive', config)
.then((res) => {
this.latestEpisodeData = this.getLatestEpisode(res.data)
})
Expand Down
5 changes: 5 additions & 0 deletions app/constants/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ export const arcsiShowsBaseURL = arcsiBaseURL + '/show'
//arcsiServerURL is legacy, currently not in use as it returns all items along with the shows
export const arcsiServerURL = arcsiBaseURL + '/show/all'
export const arcsiItemBaseURL = arcsiBaseURL + '/item'
export const config = {
headers: {
'Authentication-Token': 'your-token'
}
};

// dev server 'https://devarcsi.lahmacun.hu' //
// prod server 'https://arcsi.lahmacun.hu' //
Expand Down
6 changes: 3 additions & 3 deletions app/pages/archive.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
</template>

<script>
import { arcsiItemBaseURL } from '~/constants'
import { arcsiItemBaseURL, config } from '~/constants'

export default {
data () {
Expand All @@ -52,7 +52,7 @@ export default {
}
},
async fetch () {
this.defaultEpisodes = await this.$axios.get(`${arcsiItemBaseURL}/latest?size=${this.startNumberofEpisodes}&page=${this.startIndex}`)
this.defaultEpisodes = await this.$axios.get(`${arcsiItemBaseURL}/latest?size=${this.startNumberofEpisodes}&page=${this.startIndex}`, config)
.then(res => res.data)
.catch((error) => {
this.$sentry.captureException(new Error('Arcsi is not available at the moment ', error))
Expand Down Expand Up @@ -111,7 +111,7 @@ export default {
methods: {
async loadMoreEpisodes () {
this.startIndex++
const newEpisodes = await this.$axios.get(`${arcsiItemBaseURL}/latest?size=${this.startNumberofEpisodes}&page=${this.startIndex}`)
const newEpisodes = await this.$axios.get(`${arcsiItemBaseURL}/latest?size=${this.startNumberofEpisodes}&page=${this.startIndex}`, config)
.then(res => res.data)
.catch((error) => {
this.$sentry.captureException(new Error('Arcsi is not available at the moment ', error))
Expand Down
8 changes: 4 additions & 4 deletions app/pages/shows/_slug/_id.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@

<script>
import { mapGetters } from 'vuex'
import { arcsiBaseURL, mediaServerURL } from '~/constants'
import { arcsiBaseURL, mediaServerURL, config } from '~/constants'

export default {
data () {
Expand Down Expand Up @@ -128,14 +128,14 @@ export default {
},
async fetch () {
//Fetch episode data
await this.$axios.get(`${arcsiBaseURL}/show/${this.slug}/item/${this.id}`)
await this.$axios.get(`${arcsiBaseURL}/show/${this.slug}/item/${this.id}`, config)
.then((res) => {
this.arcsiEpisode = res.data
})
.catch((error) => {
if (error.response.status === 404) {
//Use legacy API URL as fallback
this.$axios.get(`${arcsiBaseURL}/item/${this.id}`)
this.$axios.get(`${arcsiBaseURL}/item/${this.id}`, config)
.then((res) => {
this.arcsiEpisode = res.data
})
Expand All @@ -149,7 +149,7 @@ export default {
}
})
//Fetch show data
await this.$axios.get(arcsiBaseURL + '/show/' + this.slug + '/page')
await this.$axios.get(arcsiBaseURL + '/show/' + this.slug + '/page', config)
.then((res) => {
this.arcsiShow = res.data
})
Expand Down
4 changes: 2 additions & 2 deletions app/pages/shows/_slug/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
</template>

<script>
import { arcsiBaseURL, mediaServerURL } from '~/constants'
import { arcsiBaseURL, mediaServerURL, config } from '~/constants'

export default {
data () {
Expand All @@ -131,7 +131,7 @@ export default {
}
},
async fetch () {
this.showObject = await this.$axios.get(arcsiBaseURL + '/show/' + this.slug + '/page')
this.showObject = await this.$axios.get(arcsiBaseURL + '/show/' + this.slug + '/page', config)
.then(res => res.data)
.catch((error) => {
this.$nuxt.error({ statusCode: 404, message: 'Show page not found' + error })
Expand Down
4 changes: 2 additions & 2 deletions app/store/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { arcsiServerURL, arcsiShowsBaseURL, rareShowsURL, customScheduleURL } from '~/constants'
import { arcsiServerURL, arcsiShowsBaseURL, rareShowsURL, customScheduleURL, config } from '~/constants'

export const state = () => ({
arcsiShows: {},
Expand All @@ -19,7 +19,7 @@ export const actions = {
error({ statusCode: 404, message: 'Arcsi Shows not found' })
})
*/
await this.$axios.get(arcsiShowsBaseURL + '/all_without_items')
await this.$axios.get(arcsiShowsBaseURL + '/all_without_items', config)
.then((res) => {
state.allShowsList = res.data
})
Expand Down