parent
2d9293732b
commit
9f6b0e1018
@ -1072,29 +1072,46 @@ export default {
|
||||
this.isEditing = true
|
||||
}
|
||||
|
||||
this.version = this.versions.find(
|
||||
(x) => x.id === this.$route.params.version
|
||||
)
|
||||
|
||||
if (!this.version)
|
||||
if (mode === 'latest') {
|
||||
let versionList = this.versions
|
||||
if (this.$route.query.loader) {
|
||||
versionList = versionList.filter((x) =>
|
||||
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(
|
||||
(x) => x.displayUrlEnding === this.$route.params.version
|
||||
(x) => x.id === this.$route.params.version
|
||||
)
|
||||
|
||||
// LEGACY- to support old duplicate version URLs
|
||||
const dashIndex = this.$route.params.version.indexOf('-')
|
||||
if (!this.version && dashIndex !== -1) {
|
||||
const version = this.versions.find(
|
||||
(x) =>
|
||||
x.displayUrlEnding ===
|
||||
this.$route.params.version.substring(0, dashIndex)
|
||||
)
|
||||
if (!this.version)
|
||||
this.version = this.versions.find(
|
||||
(x) => x.displayUrlEnding === this.$route.params.version
|
||||
)
|
||||
|
||||
this.$nuxt.context.redirect(
|
||||
301,
|
||||
`/${this.project.project_type}/${this.project.slug}/version/${version.version_number}`
|
||||
)
|
||||
return
|
||||
// LEGACY- to support old duplicate version URLs
|
||||
const dashIndex = this.$route.params.version.indexOf('-')
|
||||
if (!this.version && dashIndex !== -1) {
|
||||
const version = this.versions.find(
|
||||
(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) {
|
||||
|
||||
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>
|
||||
Loading…
x
Reference in New Issue
Block a user