You've already forked AstralRinth
forked from didirus/AstralRinth
Update master with new auth (#1236)
* Begin UI for threads and moderation overhaul * Hide close button on non-report threads * Fix review age coloring * Add project count * Remove action buttons from queue page and add queued date to project page * Hook up to actual data * Remove unused icon * Get up to 1000 projects in queue * prettier * more prettier * Changed all the things * lint * rebuild * Add omorphia * Workaround formatjs bug in ThreadSummary.vue * Fix notifications page on prod * Fix a few notifications and threads bugs * lockfile * Fix duplicate button styles * more fixes and polishing * More fixes * Remove legacy pages * More bugfixes * Add some error catching for reports and notifications * More error handling * fix lint * Add inbox links * Remove loading component and rename member header * Rely on threads always existing * Handle if project update notifs are not grouped * oops * Fix chips on notifications page * Import ModalModeration * finish threads * New authentication (#1234) * Initial new auth work * more auth pages * Finish most * more * fix on landing page * Finish everything but PATs + Sessions * fix threads merge bugs * fix cf pages ssr * fix most issues * Finish authentication * Fix merge --------- Co-authored-by: triphora <emma@modrinth.com> Co-authored-by: Jai A <jaiagr+gpg@pm.me> Co-authored-by: Geometrically <18202329+Geometrically@users.noreply.github.com>
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
<Meta name="og:description" :contcent="metaDescription" />
|
||||
</Head>
|
||||
<Modal
|
||||
v-if="$auth.user && currentMember"
|
||||
v-if="currentMember"
|
||||
ref="modal_edit_item"
|
||||
:header="editIndex === -1 ? 'Upload gallery image' : 'Edit gallery item'"
|
||||
>
|
||||
@@ -127,7 +127,7 @@
|
||||
</div>
|
||||
</Modal>
|
||||
<ModalConfirm
|
||||
v-if="$auth.user && currentMember"
|
||||
v-if="currentMember"
|
||||
ref="modal_confirm"
|
||||
title="Are you sure you want to delete this gallery image?"
|
||||
description="This will remove this gallery image forever (like really forever)."
|
||||
@@ -446,7 +446,6 @@ export default defineNuxtComponent({
|
||||
await useBaseFetch(url, {
|
||||
method: 'POST',
|
||||
body: this.editFile,
|
||||
...this.$defaultHeaders(),
|
||||
})
|
||||
await this.updateProject()
|
||||
|
||||
@@ -484,7 +483,6 @@ export default defineNuxtComponent({
|
||||
|
||||
await useBaseFetch(url, {
|
||||
method: 'PATCH',
|
||||
...this.$defaultHeaders(),
|
||||
})
|
||||
|
||||
await this.updateProject()
|
||||
@@ -511,7 +509,6 @@ export default defineNuxtComponent({
|
||||
)}`,
|
||||
{
|
||||
method: 'DELETE',
|
||||
...this.$defaultHeaders(),
|
||||
}
|
||||
)
|
||||
|
||||
@@ -528,7 +525,7 @@ export default defineNuxtComponent({
|
||||
stopLoading()
|
||||
},
|
||||
async updateProject() {
|
||||
const project = await useBaseFetch(`project/${this.project.id}`, this.$defaultHeaders())
|
||||
const project = await useBaseFetch(`project/${this.project.id}`)
|
||||
|
||||
project.actualProjectType = JSON.parse(JSON.stringify(project.project_type))
|
||||
|
||||
|
||||
@@ -68,6 +68,7 @@
|
||||
:project="project"
|
||||
:set-status="setStatus"
|
||||
:current-member="currentMember"
|
||||
:auth="auth"
|
||||
/>
|
||||
</section>
|
||||
</div>
|
||||
@@ -104,9 +105,10 @@ const props = defineProps({
|
||||
const emit = defineEmits(['update:project'])
|
||||
|
||||
const app = useNuxtApp()
|
||||
const auth = await useAuth()
|
||||
|
||||
const { data: thread } = await useAsyncData(`thread/${props.project.thread_id}`, () =>
|
||||
useBaseFetch(`thread/${props.project.thread_id}`, app.$defaultHeaders())
|
||||
useBaseFetch(`thread/${props.project.thread_id}`)
|
||||
)
|
||||
async function setStatus(status) {
|
||||
startLoading()
|
||||
@@ -117,12 +119,11 @@ async function setStatus(status) {
|
||||
await useBaseFetch(`project/${props.project.id}`, {
|
||||
method: 'PATCH',
|
||||
body: data,
|
||||
...app.$defaultHeaders(),
|
||||
})
|
||||
const project = props.project
|
||||
project.status = status
|
||||
emit('update:project', project)
|
||||
thread.value = await useBaseFetch(`thread/${thread.value.id}`, app.$defaultHeaders())
|
||||
thread.value = await useBaseFetch(`thread/${thread.value.id}`)
|
||||
} catch (err) {
|
||||
app.$notify({
|
||||
group: 'main',
|
||||
|
||||
@@ -191,7 +191,7 @@
|
||||
id="project-visibility"
|
||||
v-model="visibility"
|
||||
placeholder="Select one"
|
||||
:options="$tag.approvedStatuses"
|
||||
:options="tags.approvedStatuses"
|
||||
:custom-label="(value) => $formatProjectStatus(value)"
|
||||
:searchable="false"
|
||||
:close-on-select="true"
|
||||
@@ -315,6 +315,11 @@ export default defineNuxtComponent({
|
||||
},
|
||||
},
|
||||
},
|
||||
setup() {
|
||||
const tags = useTags()
|
||||
|
||||
return { tags }
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
name: this.project.title,
|
||||
@@ -325,7 +330,7 @@ export default defineNuxtComponent({
|
||||
clientSide: this.project.client_side,
|
||||
serverSide: this.project.server_side,
|
||||
deletedIcon: false,
|
||||
visibility: this.$tag.approvedStatuses.includes(this.project.status)
|
||||
visibility: this.tags.approvedStatuses.includes(this.project.status)
|
||||
? this.project.status
|
||||
: this.project.requested_status,
|
||||
}
|
||||
@@ -360,7 +365,7 @@ export default defineNuxtComponent({
|
||||
if (this.serverSide !== this.project.server_side) {
|
||||
data.server_side = this.serverSide
|
||||
}
|
||||
if (this.$tag.approvedStatuses.includes(this.project.status)) {
|
||||
if (this.tags.approvedStatuses.includes(this.project.status)) {
|
||||
if (this.visibility !== this.project.status) {
|
||||
data.status = this.visibility
|
||||
}
|
||||
@@ -376,7 +381,7 @@ export default defineNuxtComponent({
|
||||
},
|
||||
methods: {
|
||||
hasModifiedVisibility() {
|
||||
const originalVisibility = this.$tag.approvedStatuses.includes(this.project.status)
|
||||
const originalVisibility = this.tags.approvedStatuses.includes(this.project.status)
|
||||
? this.project.status
|
||||
: this.project.requested_status
|
||||
|
||||
@@ -407,7 +412,6 @@ export default defineNuxtComponent({
|
||||
async deleteProject() {
|
||||
await useBaseFetch(`project/${this.project.id}`, {
|
||||
method: 'DELETE',
|
||||
...this.$defaultHeaders(),
|
||||
})
|
||||
await initUserProjects()
|
||||
await this.$router.push('/dashboard/review')
|
||||
@@ -426,7 +430,6 @@ export default defineNuxtComponent({
|
||||
async deleteIcon() {
|
||||
await useBaseFetch(`project/${this.project.id}/icon`, {
|
||||
method: 'DELETE',
|
||||
...this.$defaultHeaders(),
|
||||
})
|
||||
await this.updateIcon()
|
||||
this.$notify({
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
<Multiselect
|
||||
v-model="donationLink.platform"
|
||||
placeholder="Select platform"
|
||||
:options="$tag.donationPlatforms.map((x) => x.name)"
|
||||
:options="tags.donationPlatforms.map((x) => x.name)"
|
||||
:searchable="false"
|
||||
:close-on-select="true"
|
||||
:show-labels="false"
|
||||
@@ -155,6 +155,11 @@ export default defineNuxtComponent({
|
||||
},
|
||||
},
|
||||
},
|
||||
setup() {
|
||||
const tags = useTags()
|
||||
|
||||
return { tags }
|
||||
},
|
||||
data() {
|
||||
const donationLinks = JSON.parse(JSON.stringify(this.project.donation_urls))
|
||||
donationLinks.push({
|
||||
@@ -195,7 +200,7 @@ export default defineNuxtComponent({
|
||||
|
||||
const donationLinks = this.donationLinks.filter((link) => link.url && link.platform)
|
||||
donationLinks.forEach((link) => {
|
||||
link.id = this.$tag.donationPlatforms.find(
|
||||
link.id = this.tags.donationPlatforms.find(
|
||||
(platform) => platform.name === link.platform
|
||||
).short
|
||||
})
|
||||
|
||||
@@ -323,7 +323,6 @@ export default defineNuxtComponent({
|
||||
await useBaseFetch(`team/${this.project.team}/members`, {
|
||||
method: 'POST',
|
||||
body: data,
|
||||
...this.$defaultHeaders(),
|
||||
})
|
||||
this.currentUsername = ''
|
||||
await this.updateMembers()
|
||||
@@ -346,7 +345,6 @@ export default defineNuxtComponent({
|
||||
`team/${this.project.team}/members/${this.allTeamMembers[index].user.id}`,
|
||||
{
|
||||
method: 'DELETE',
|
||||
...this.$defaultHeaders(),
|
||||
}
|
||||
)
|
||||
await this.updateMembers()
|
||||
@@ -381,7 +379,6 @@ export default defineNuxtComponent({
|
||||
{
|
||||
method: 'PATCH',
|
||||
body: data,
|
||||
...this.$defaultHeaders(),
|
||||
}
|
||||
)
|
||||
await this.updateMembers()
|
||||
@@ -411,7 +408,6 @@ export default defineNuxtComponent({
|
||||
body: {
|
||||
user_id: this.allTeamMembers[index].user.id,
|
||||
},
|
||||
...this.$defaultHeaders(),
|
||||
})
|
||||
await this.updateMembers()
|
||||
} catch (err) {
|
||||
@@ -426,9 +422,7 @@ export default defineNuxtComponent({
|
||||
stopLoading()
|
||||
},
|
||||
async updateMembers() {
|
||||
this.allTeamMembers = (
|
||||
await useBaseFetch(`team/${this.project.team}/members`, this.$defaultHeaders())
|
||||
).map((it) => ({
|
||||
this.allTeamMembers = (await useBaseFetch(`team/${this.project.team}/members`)).map((it) => ({
|
||||
avatar_url: it.user.avatar_url,
|
||||
name: it.user.username,
|
||||
oldRole: it.role,
|
||||
|
||||
@@ -152,13 +152,13 @@ export default defineNuxtComponent({
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
selectedTags: this.$sortedCategories.filter(
|
||||
selectedTags: this.$sortedCategories().filter(
|
||||
(x) =>
|
||||
x.project_type === this.project.actualProjectType &&
|
||||
(this.project.categories.includes(x.name) ||
|
||||
this.project.additional_categories.includes(x.name))
|
||||
),
|
||||
featuredTags: this.$sortedCategories.filter(
|
||||
featuredTags: this.$sortedCategories().filter(
|
||||
(x) =>
|
||||
x.project_type === this.project.actualProjectType &&
|
||||
this.project.categories.includes(x.name)
|
||||
@@ -168,7 +168,7 @@ export default defineNuxtComponent({
|
||||
computed: {
|
||||
categoryLists() {
|
||||
const lists = {}
|
||||
this.$sortedCategories.forEach((x) => {
|
||||
this.$sortedCategories().forEach((x) => {
|
||||
if (x.project_type === this.project.actualProjectType) {
|
||||
const header = x.header
|
||||
if (!lists[header]) {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<Meta name="og:description" :content="metaDescription" />
|
||||
</Head>
|
||||
<ModalConfirm
|
||||
v-if="$auth.user && currentMember"
|
||||
v-if="currentMember"
|
||||
ref="modal_confirm"
|
||||
title="Are you sure you want to delete this version?"
|
||||
description="This will remove this version forever (like really forever)."
|
||||
@@ -17,12 +17,12 @@
|
||||
@proceed="deleteVersion()"
|
||||
/>
|
||||
<ModalReport
|
||||
v-if="$auth.user"
|
||||
v-if="auth.user"
|
||||
ref="modal_version_report"
|
||||
:item-id="version.id"
|
||||
item-type="version"
|
||||
/>
|
||||
<Modal v-if="$auth.user && currentMember" ref="modal_package_mod" header="Package data pack">
|
||||
<Modal v-if="auth.user && currentMember" ref="modal_package_mod" header="Package data pack">
|
||||
<div class="modal-package-mod universal-labels">
|
||||
<div class="markdown-body">
|
||||
<p>
|
||||
@@ -116,7 +116,7 @@
|
||||
Create
|
||||
</button>
|
||||
<nuxt-link
|
||||
v-if="$auth.user"
|
||||
v-if="auth.user"
|
||||
:to="`/${project.project_type}/${project.slug ? project.slug : project.id}/versions`"
|
||||
class="iconified-button"
|
||||
>
|
||||
@@ -164,7 +164,7 @@
|
||||
<ReportIcon aria-hidden="true" />
|
||||
Report
|
||||
</button>
|
||||
<a v-if="!$auth.user" class="iconified-button" :href="getAuthUrl()" rel="noopener nofollow">
|
||||
<a v-if="!auth.user" class="iconified-button" :href="getAuthUrl()" rel="noopener nofollow">
|
||||
<ReportIcon aria-hidden="true" />
|
||||
Report
|
||||
</a>
|
||||
@@ -181,7 +181,7 @@
|
||||
<button
|
||||
v-if="
|
||||
currentMember &&
|
||||
version.loaders.some((x) => $tag.loaderData.dataPackLoaders.includes(x))
|
||||
version.loaders.some((x) => tags.loaderData.dataPackLoaders.includes(x))
|
||||
"
|
||||
class="iconified-button"
|
||||
@click="$refs.modal_package_mod.show()"
|
||||
@@ -390,7 +390,7 @@
|
||||
</span>
|
||||
<multiselect
|
||||
v-if="
|
||||
version.loaders.some((x) => $tag.loaderData.dataPackLoaders.includes(x)) &&
|
||||
version.loaders.some((x) => tags.loaderData.dataPackLoaders.includes(x)) &&
|
||||
isEditing &&
|
||||
primaryFile.hashes.sha1 !== file.hashes.sha1
|
||||
"
|
||||
@@ -457,7 +457,7 @@
|
||||
<span class="file-size">({{ $formatBytes(file.size) }})</span>
|
||||
</span>
|
||||
<multiselect
|
||||
v-if="version.loaders.some((x) => $tag.loaderData.dataPackLoaders.includes(x))"
|
||||
v-if="version.loaders.some((x) => tags.loaderData.dataPackLoaders.includes(x))"
|
||||
v-model="newFileTypes[index]"
|
||||
class="raised-multiselect"
|
||||
placeholder="Select file type"
|
||||
@@ -484,7 +484,7 @@
|
||||
</div>
|
||||
<div class="additional-files">
|
||||
<h4>Upload additional files</h4>
|
||||
<span v-if="version.loaders.some((x) => $tag.loaderData.dataPackLoaders.includes(x))">
|
||||
<span v-if="version.loaders.some((x) => tags.loaderData.dataPackLoaders.includes(x))">
|
||||
Used for additional files such as required/optional resource packs
|
||||
</span>
|
||||
<span v-else>Used for files such as sources or Javadocs.</span>
|
||||
@@ -566,14 +566,14 @@
|
||||
v-if="isEditing"
|
||||
v-model="version.loaders"
|
||||
:options="
|
||||
$tag.loaders
|
||||
tags.loaders
|
||||
.filter((x) =>
|
||||
x.supported_project_types.includes(project.actualProjectType.toLowerCase())
|
||||
)
|
||||
.map((it) => it.name)
|
||||
"
|
||||
:custom-label="(value) => $formatCategory(value)"
|
||||
:loading="$tag.loaders.length === 0"
|
||||
:loading="tags.loaders.length === 0"
|
||||
:multiple="true"
|
||||
:searchable="false"
|
||||
:show-no-results="false"
|
||||
@@ -593,12 +593,12 @@
|
||||
v-model="version.game_versions"
|
||||
:options="
|
||||
showSnapshots
|
||||
? $tag.gameVersions.map((x) => x.version)
|
||||
: $tag.gameVersions
|
||||
? tags.gameVersions.map((x) => x.version)
|
||||
: tags.gameVersions
|
||||
.filter((it) => it.version_type === 'release')
|
||||
.map((x) => x.version)
|
||||
"
|
||||
:loading="$tag.gameVersions.length === 0"
|
||||
:loading="tags.gameVersions.length === 0"
|
||||
:multiple="true"
|
||||
:searchable="true"
|
||||
:show-no-results="false"
|
||||
@@ -772,6 +772,9 @@ export default defineNuxtComponent({
|
||||
const data = useNuxtApp()
|
||||
const route = useRoute()
|
||||
|
||||
const auth = await useAuth()
|
||||
const tags = useTags()
|
||||
|
||||
const path = route.name.split('-')
|
||||
const mode = path[path.length - 1]
|
||||
|
||||
@@ -828,7 +831,7 @@ export default defineNuxtComponent({
|
||||
const inferredData = await inferVersionInfo(
|
||||
replaceFile,
|
||||
props.project,
|
||||
data.$tag.gameVersions
|
||||
tags.value.gameVersions
|
||||
)
|
||||
|
||||
version = {
|
||||
@@ -895,6 +898,8 @@ export default defineNuxtComponent({
|
||||
const order = ['required', 'optional', 'incompatible', 'embedded']
|
||||
|
||||
return {
|
||||
auth,
|
||||
tags,
|
||||
fileTypes: ref(fileTypes),
|
||||
oldFileTypes: ref(oldFileTypes),
|
||||
isCreating: ref(isCreating),
|
||||
@@ -1110,7 +1115,6 @@ export default defineNuxtComponent({
|
||||
body: formData,
|
||||
headers: {
|
||||
'Content-Disposition': formData,
|
||||
Authorization: this.$auth.token,
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -1135,13 +1139,11 @@ export default defineNuxtComponent({
|
||||
}
|
||||
}),
|
||||
},
|
||||
...this.$defaultHeaders(),
|
||||
})
|
||||
|
||||
for (const hash of this.deleteFiles) {
|
||||
await useBaseFetch(`version_file/${hash}?version_id=${this.version.id}`, {
|
||||
method: 'DELETE',
|
||||
...this.$defaultHeaders(),
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1246,7 +1248,6 @@ export default defineNuxtComponent({
|
||||
body: formData,
|
||||
headers: {
|
||||
'Content-Disposition': formData,
|
||||
Authorization: this.$auth.token,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -1263,7 +1264,6 @@ export default defineNuxtComponent({
|
||||
|
||||
await useBaseFetch(`version/${this.version.id}`, {
|
||||
method: 'DELETE',
|
||||
...this.$defaultHeaders(),
|
||||
})
|
||||
|
||||
await this.resetProjectVersions()
|
||||
@@ -1279,7 +1279,7 @@ export default defineNuxtComponent({
|
||||
this.version,
|
||||
this.primaryFile,
|
||||
this.members,
|
||||
this.$tag.gameVersions,
|
||||
this.tags.gameVersions,
|
||||
this.packageLoaders
|
||||
)
|
||||
|
||||
@@ -1324,12 +1324,9 @@ export default defineNuxtComponent({
|
||||
},
|
||||
async resetProjectVersions() {
|
||||
const [versions, featuredVersions, dependencies] = await Promise.all([
|
||||
useBaseFetch(`project/${this.version.project_id}/version`, this.$defaultHeaders()),
|
||||
useBaseFetch(
|
||||
`project/${this.version.project_id}/version?featured=true`,
|
||||
this.$defaultHeaders()
|
||||
),
|
||||
useBaseFetch(`project/${this.version.project_id}/dependencies`, this.$defaultHeaders()),
|
||||
useBaseFetch(`project/${this.version.project_id}/version`),
|
||||
useBaseFetch(`project/${this.version.project_id}/version?featured=true`),
|
||||
useBaseFetch(`project/${this.version.project_id}/dependencies`),
|
||||
])
|
||||
|
||||
const newCreatedVersions = this.$computeVersions(versions, this.members)
|
||||
|
||||
Reference in New Issue
Block a user