You've already forked AstralRinth
forked from didirus/AstralRinth
@@ -1072,29 +1072,46 @@ export default {
|
|||||||
this.isEditing = true
|
this.isEditing = true
|
||||||
}
|
}
|
||||||
|
|
||||||
this.version = this.versions.find(
|
if (mode === 'latest') {
|
||||||
(x) => x.id === this.$route.params.version
|
let versionList = this.versions
|
||||||
)
|
if (this.$route.query.loader) {
|
||||||
|
versionList = versionList.filter((x) =>
|
||||||
if (!this.version)
|
x.loaders.includes(this.$route.query.loader)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
if (this.$route.query.version) {
|
||||||
|
versionList = versionList.filter((x) =>
|
||||||
|
x.game_versions.includes(this.$route.query.version)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
this.version = versionList.reduce((a, b) =>
|
||||||
|
a.date_published > b.date_published ? a : b
|
||||||
|
)
|
||||||
|
} else {
|
||||||
this.version = this.versions.find(
|
this.version = this.versions.find(
|
||||||
(x) => x.displayUrlEnding === this.$route.params.version
|
(x) => x.id === this.$route.params.version
|
||||||
)
|
)
|
||||||
|
|
||||||
// LEGACY- to support old duplicate version URLs
|
if (!this.version)
|
||||||
const dashIndex = this.$route.params.version.indexOf('-')
|
this.version = this.versions.find(
|
||||||
if (!this.version && dashIndex !== -1) {
|
(x) => x.displayUrlEnding === this.$route.params.version
|
||||||
const version = this.versions.find(
|
)
|
||||||
(x) =>
|
|
||||||
x.displayUrlEnding ===
|
|
||||||
this.$route.params.version.substring(0, dashIndex)
|
|
||||||
)
|
|
||||||
|
|
||||||
this.$nuxt.context.redirect(
|
// LEGACY- to support old duplicate version URLs
|
||||||
301,
|
const dashIndex = this.$route.params.version.indexOf('-')
|
||||||
`/${this.project.project_type}/${this.project.slug}/version/${version.version_number}`
|
if (!this.version && dashIndex !== -1) {
|
||||||
)
|
const version = this.versions.find(
|
||||||
return
|
(x) =>
|
||||||
|
x.displayUrlEnding ===
|
||||||
|
this.$route.params.version.substring(0, dashIndex)
|
||||||
|
)
|
||||||
|
|
||||||
|
this.$nuxt.context.redirect(
|
||||||
|
301,
|
||||||
|
`/${this.project.project_type}/${this.project.slug}/version/${version.version_number}`
|
||||||
|
)
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.version) {
|
if (!this.version) {
|
||||||
|
|||||||
10
pages/_type/_id/version/latest.vue
Normal file
10
pages/_type/_id/version/latest.vue
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<template>
|
||||||
|
<div></div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
auth: false,
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped></style>
|
||||||
Reference in New Issue
Block a user