More secure custom authentication solution (#126)

* Remove Nuxt Auth from the project, and switch to a custom solution

* Replace old testing code

* Remove warnings

* Add comments to hard to understand function calls in middleware

* Use arrow functions
This commit is contained in:
Geometrically
2021-03-29 09:43:00 -07:00
committed by GitHub
parent 8911bdf966
commit 24c8e29691
23 changed files with 271 additions and 614 deletions

View File

@@ -38,7 +38,7 @@
</div> </div>
<div class="buttons"> <div class="buttons">
<nuxt-link <nuxt-link
v-if="this.$auth.loggedIn" v-if="this.$auth.user"
:to="`/report/create?id=${mod.id}&t=mod`" :to="`/report/create?id=${mod.id}&t=mod`"
class="iconified-button" class="iconified-button"
> >
@@ -458,34 +458,18 @@ export default {
elem.click() elem.click()
}, },
async followMod() { async followMod() {
const config = {
headers: {
Authorization: this.$auth.getToken('local')
? this.$auth.getToken('local')
: '',
},
}
await axios.post( await axios.post(
`https://api.modrinth.com/api/v1/mod/${this.mod.id}/follow`, `https://api.modrinth.com/api/v1/mod/${this.mod.id}/follow`,
{}, {},
config this.$auth.headers
) )
this.userFollows.push(this.mod.id) this.userFollows.push(this.mod.id)
}, },
async unfollowMod() { async unfollowMod() {
const config = {
headers: {
Authorization: this.$auth.getToken('local')
? this.$auth.getToken('local')
: '',
},
}
await axios.delete( await axios.delete(
`https://api.modrinth.com/api/v1/mod/${this.mod.id}/follow`, `https://api.modrinth.com/api/v1/mod/${this.mod.id}/follow`,
config this.$auth.headers
) )
this.userFollows.splice(this.userFollows.indexOf(this.mod.id), 1) this.userFollows.splice(this.userFollows.indexOf(this.mod.id), 1)

View File

@@ -18,7 +18,7 @@
<span>Mods</span> <span>Mods</span>
</NuxtLink> </NuxtLink>
<client-only> <client-only>
<div v-if="this.$auth.loggedIn" class="section"> <div v-if="this.$auth.user" class="section">
<NuxtLink to="/dashboard/projects" class="tab"> <NuxtLink to="/dashboard/projects" class="tab">
<span>Dashboard</span> <span>Dashboard</span>
</NuxtLink> </NuxtLink>
@@ -28,7 +28,7 @@
</section> </section>
<section class="column-grow"> <section class="column-grow">
<client-only> <client-only>
<template v-if="this.$auth.loggedIn"> <template v-if="this.$auth.user">
<section class="user-controls"> <section class="user-controls">
<div <div
v-click-outside="hideDropdown" v-click-outside="hideDropdown"
@@ -139,11 +139,6 @@ export default {
directives: { directives: {
ClickOutside, ClickOutside,
}, },
async fetch() {
if (this.$route.query.code) {
await this.$auth.setUserToken(this.$route.query.code)
}
},
data() { data() {
return { return {
isDropdownOpen: false, isDropdownOpen: false,
@@ -151,7 +146,7 @@ export default {
}, },
computed: { computed: {
authUrl() { authUrl() {
return `https://api.modrinth.com/api/v1/auth/init?url=http://modrinth.com${this.$route.path}` return `https://api.modrinth.com/api/v1/auth/init?url=https://modrinth.com${this.$route.fullPath}`
}, },
userUrl() { userUrl() {
return `/user/${this.$auth.user.id}` return `/user/${this.$auth.user.id}`
@@ -168,7 +163,7 @@ export default {
this.isDropdownOpen = false this.isDropdownOpen = false
}, },
logout() { logout() {
this.$auth.setToken('local', false) this.$cookies.remove('auth-token')
this.$router.go(null) this.$router.go(null)
}, },
changeTheme() { changeTheme() {
@@ -389,9 +384,6 @@ export default {
@media (min-width: 1024px) { @media (min-width: 1024px) {
.layout { .layout {
header {
}
main { main {
.alpha-alert { .alpha-alert {
margin: 1rem; margin: 1rem;
@@ -403,11 +395,4 @@ export default {
} }
} }
} }
@media (min-width: 1280px) {
.layout {
header {
}
}
}
</style> </style>

63
middleware/auth.js Normal file
View File

@@ -0,0 +1,63 @@
export default async function (context) {
if (!context.from) {
if (context.route.query.code) {
context.app.$cookies.set('auth-token', context.route.query.code, {
secure: true,
sameSite: 'Strict',
httpOnly: true,
})
return context.redirect(context.route.path)
}
if (context.app.$cookies.get('auth-token')) {
const cookie = context.app.$cookies.get('auth-token')
await context.store.dispatch('auth/fetchUser', { token: cookie })
}
}
// Disable middleware if options: { auth: false } is set on the route
if (routeOption(context.route, 'auth', false)) return
// Disable middleware if no route was matched to allow 404/error page
if (!getMatchedComponents(context.route, []).length) {
return
}
if (!context.$auth.user) {
return context.redirect(
`https://api.modrinth.com/api/v1/auth/init?url=https://modrinth.com${context.route.fullPath}`
)
}
}
function routeOption(route, key, value) {
return route.matched.some((m) => {
if (process.client) {
// Client
return Object.values(m.components).some(
(component) => component.options && component.options[key] === value
)
} else {
// SSR
return Object.values(m.components).some((component) =>
Object.values(component._Ctor).some(
(ctor) => ctor.options && ctor.options[key] === value
)
)
}
})
}
function getMatchedComponents(route, matches) {
return [].concat(
...[],
...route.matched.map((m, index) => {
return Object.keys(m.components).map((key) => {
matches.push(index)
return m.components[key]
})
})
)
}

View File

@@ -77,9 +77,8 @@ export default {
devtools: true, devtools: true,
}, },
}, },
router: { router: {
middleware: ['auth'], middleware: 'auth',
}, },
/* /*
** Global CSS ** Global CSS
@@ -94,6 +93,7 @@ export default {
'~/plugins/vue-notification.js', '~/plugins/vue-notification.js',
'~/plugins/compiled-markdown-directive.js', '~/plugins/compiled-markdown-directive.js',
'~/plugins/vue-syntax.js', '~/plugins/vue-syntax.js',
'~/plugins/auth.js',
], ],
/* /*
** Auto import components ** Auto import components
@@ -116,12 +116,11 @@ export default {
// Doc: https://axios.nuxtjs.org/usage // Doc: https://axios.nuxtjs.org/usage
'@nuxtjs/dayjs', '@nuxtjs/dayjs',
'@nuxtjs/axios', '@nuxtjs/axios',
'@nuxtjs/auth',
'@nuxtjs/robots', '@nuxtjs/robots',
'@nuxtjs/sitemap', '@nuxtjs/sitemap',
'nuxt-clipboard2',
'@nuxtjs/style-resources', '@nuxtjs/style-resources',
'@nuxtjs/google-adsense', '@nuxtjs/google-adsense',
'cookie-universal-nuxt',
], ],
robots: { robots: {
Sitemap: 'https://modrinth.com/sitemap.xml', Sitemap: 'https://modrinth.com/sitemap.xml',
@@ -129,20 +128,6 @@ export default {
sitemap: { sitemap: {
exclude: ['/dashboard/**', '/dashboard', '/mod/create'], exclude: ['/dashboard/**', '/dashboard', '/mod/create'],
}, },
auth: {
strategies: {
local: {
endpoints: {
user: {
url: 'https://api.modrinth.com/api/v1/user',
method: 'get',
propertyName: false,
},
},
tokenType: false,
},
},
},
/* /*
** Axios module configuration ** Axios module configuration
** See https://axios.nuxtjs.org/options ** See https://axios.nuxtjs.org/options

355
package-lock.json generated
View File

@@ -8,17 +8,16 @@
"name": "knossos", "name": "knossos",
"version": "1.0.0", "version": "1.0.0",
"dependencies": { "dependencies": {
"@nuxtjs/auth": "^4.9.1",
"@nuxtjs/axios": "^5.12.5", "@nuxtjs/axios": "^5.12.5",
"@nuxtjs/dayjs": "^1.2.0", "@nuxtjs/dayjs": "^1.2.0",
"@nuxtjs/google-adsense": "^1.3.0", "@nuxtjs/google-adsense": "^1.3.0",
"@nuxtjs/robots": "^2.4.2", "@nuxtjs/robots": "^2.4.2",
"@nuxtjs/sitemap": "^2.4.0", "@nuxtjs/sitemap": "^2.4.0",
"@nuxtjs/style-resources": "^1.0.0", "@nuxtjs/style-resources": "^1.0.0",
"cookie-universal-nuxt": "^2.1.4",
"highlight.js": "^10.3.2", "highlight.js": "^10.3.2",
"marked": "^2.0.0", "marked": "^2.0.0",
"nuxt": "^2.14.7", "nuxt": "^2.14.7",
"nuxt-clipboard2": "^0.2.1",
"v-tooltip": "^2.0.3", "v-tooltip": "^2.0.3",
"vue-click-outside": "^1.1.0", "vue-click-outside": "^1.1.0",
"vue-highlightjs": "^1.3.3", "vue-highlightjs": "^1.3.3",
@@ -1630,11 +1629,6 @@
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
}, },
"node_modules/@nuxt/builder/node_modules/consola": {
"version": "2.15.0",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.15.0.tgz",
"integrity": "sha512-vlcSGgdYS26mPf7qNi+dCisbhiyDnrN1zaRbw3CSuc2wGOMEGGPsp46PdRG5gqXwgtJfjxDkxRNAgRPr1B77vQ=="
},
"node_modules/@nuxt/builder/node_modules/has-flag": { "node_modules/@nuxt/builder/node_modules/has-flag": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
@@ -1739,11 +1733,6 @@
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
}, },
"node_modules/@nuxt/cli/node_modules/consola": {
"version": "2.15.0",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.15.0.tgz",
"integrity": "sha512-vlcSGgdYS26mPf7qNi+dCisbhiyDnrN1zaRbw3CSuc2wGOMEGGPsp46PdRG5gqXwgtJfjxDkxRNAgRPr1B77vQ=="
},
"node_modules/@nuxt/cli/node_modules/has-flag": { "node_modules/@nuxt/cli/node_modules/has-flag": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
@@ -1793,11 +1782,6 @@
"std-env": "^2.2.1" "std-env": "^2.2.1"
} }
}, },
"node_modules/@nuxt/config/node_modules/consola": {
"version": "2.15.0",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.15.0.tgz",
"integrity": "sha512-vlcSGgdYS26mPf7qNi+dCisbhiyDnrN1zaRbw3CSuc2wGOMEGGPsp46PdRG5gqXwgtJfjxDkxRNAgRPr1B77vQ=="
},
"node_modules/@nuxt/config/node_modules/defu": { "node_modules/@nuxt/config/node_modules/defu": {
"version": "2.0.4", "version": "2.0.4",
"resolved": "https://registry.npmjs.org/defu/-/defu-2.0.4.tgz", "resolved": "https://registry.npmjs.org/defu/-/defu-2.0.4.tgz",
@@ -1822,11 +1806,6 @@
"std-env": "^2.2.1" "std-env": "^2.2.1"
} }
}, },
"node_modules/@nuxt/core/node_modules/consola": {
"version": "2.15.0",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.15.0.tgz",
"integrity": "sha512-vlcSGgdYS26mPf7qNi+dCisbhiyDnrN1zaRbw3CSuc2wGOMEGGPsp46PdRG5gqXwgtJfjxDkxRNAgRPr1B77vQ=="
},
"node_modules/@nuxt/core/node_modules/debug": { "node_modules/@nuxt/core/node_modules/debug": {
"version": "4.2.0", "version": "4.2.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz", "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz",
@@ -1931,11 +1910,6 @@
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
}, },
"node_modules/@nuxt/generator/node_modules/consola": {
"version": "2.15.0",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.15.0.tgz",
"integrity": "sha512-vlcSGgdYS26mPf7qNi+dCisbhiyDnrN1zaRbw3CSuc2wGOMEGGPsp46PdRG5gqXwgtJfjxDkxRNAgRPr1B77vQ=="
},
"node_modules/@nuxt/generator/node_modules/has-flag": { "node_modules/@nuxt/generator/node_modules/has-flag": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
@@ -1989,11 +1963,6 @@
"npm": ">=5.0.0" "npm": ">=5.0.0"
} }
}, },
"node_modules/@nuxt/opencollective/node_modules/consola": {
"version": "2.15.0",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.15.0.tgz",
"integrity": "sha512-vlcSGgdYS26mPf7qNi+dCisbhiyDnrN1zaRbw3CSuc2wGOMEGGPsp46PdRG5gqXwgtJfjxDkxRNAgRPr1B77vQ=="
},
"node_modules/@nuxt/server": { "node_modules/@nuxt/server": {
"version": "2.14.7", "version": "2.14.7",
"resolved": "https://registry.npmjs.org/@nuxt/server/-/server-2.14.7.tgz", "resolved": "https://registry.npmjs.org/@nuxt/server/-/server-2.14.7.tgz",
@@ -2058,11 +2027,6 @@
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
}, },
"node_modules/@nuxt/server/node_modules/consola": {
"version": "2.15.0",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.15.0.tgz",
"integrity": "sha512-vlcSGgdYS26mPf7qNi+dCisbhiyDnrN1zaRbw3CSuc2wGOMEGGPsp46PdRG5gqXwgtJfjxDkxRNAgRPr1B77vQ=="
},
"node_modules/@nuxt/server/node_modules/has-flag": { "node_modules/@nuxt/server/node_modules/has-flag": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
@@ -2157,11 +2121,6 @@
"ua-parser-js": "^0.7.22" "ua-parser-js": "^0.7.22"
} }
}, },
"node_modules/@nuxt/utils/node_modules/consola": {
"version": "2.15.0",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.15.0.tgz",
"integrity": "sha512-vlcSGgdYS26mPf7qNi+dCisbhiyDnrN1zaRbw3CSuc2wGOMEGGPsp46PdRG5gqXwgtJfjxDkxRNAgRPr1B77vQ=="
},
"node_modules/@nuxt/vue-app": { "node_modules/@nuxt/vue-app": {
"version": "2.14.7", "version": "2.14.7",
"resolved": "https://registry.npmjs.org/@nuxt/vue-app/-/vue-app-2.14.7.tgz", "resolved": "https://registry.npmjs.org/@nuxt/vue-app/-/vue-app-2.14.7.tgz",
@@ -2193,11 +2152,6 @@
"vue-server-renderer": "^2.6.12" "vue-server-renderer": "^2.6.12"
} }
}, },
"node_modules/@nuxt/vue-renderer/node_modules/consola": {
"version": "2.15.0",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.15.0.tgz",
"integrity": "sha512-vlcSGgdYS26mPf7qNi+dCisbhiyDnrN1zaRbw3CSuc2wGOMEGGPsp46PdRG5gqXwgtJfjxDkxRNAgRPr1B77vQ=="
},
"node_modules/@nuxt/webpack": { "node_modules/@nuxt/webpack": {
"version": "2.14.7", "version": "2.14.7",
"resolved": "https://registry.npmjs.org/@nuxt/webpack/-/webpack-2.14.7.tgz", "resolved": "https://registry.npmjs.org/@nuxt/webpack/-/webpack-2.14.7.tgz",
@@ -2289,11 +2243,6 @@
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
}, },
"node_modules/@nuxt/webpack/node_modules/consola": {
"version": "2.15.0",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.15.0.tgz",
"integrity": "sha512-vlcSGgdYS26mPf7qNi+dCisbhiyDnrN1zaRbw3CSuc2wGOMEGGPsp46PdRG5gqXwgtJfjxDkxRNAgRPr1B77vQ=="
},
"node_modules/@nuxt/webpack/node_modules/has-flag": { "node_modules/@nuxt/webpack/node_modules/has-flag": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
@@ -2321,43 +2270,18 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/@nuxtjs/auth": {
"version": "4.9.1",
"resolved": "https://registry.npmjs.org/@nuxtjs/auth/-/auth-4.9.1.tgz",
"integrity": "sha512-h5VZanq2+P47jq3t0EnsZv800cg/ufOPC6JqvcyeDFJM99p58jHSODAjDuePo3PrZxd8hovMk7zusU5lOHgjvQ==",
"dependencies": {
"@nuxtjs/axios": "^5.9.5",
"body-parser": "^1.19.0",
"consola": "^2.11.3",
"cookie": "^0.4.0",
"is-https": "^1.0.0",
"js-cookie": "^2.2.1",
"lodash": "^4.17.15",
"nanoid": "^2.1.11"
}
},
"node_modules/@nuxtjs/auth/node_modules/nanoid": {
"version": "2.1.11",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-2.1.11.tgz",
"integrity": "sha512-s/snB+WGm6uwi0WjsZdaVcuf3KJXlfGl2LcxgwkEwJF0D/BWzVWAZW/XY4bFaiR7s0Jk3FPvlnepg1H1b1UwlA=="
},
"node_modules/@nuxtjs/axios": { "node_modules/@nuxtjs/axios": {
"version": "5.12.5", "version": "5.13.1",
"resolved": "https://registry.npmjs.org/@nuxtjs/axios/-/axios-5.12.5.tgz", "resolved": "https://registry.npmjs.org/@nuxtjs/axios/-/axios-5.13.1.tgz",
"integrity": "sha512-KCZMLRZFYOKcGt9mKxJMH6UJMB6H6g+BF/YxXEYz3Urrf2U2XiNkj6rmBqgw0XLRY5XD9Wm8knTGp6955512fQ==", "integrity": "sha512-vZpXV2AAkQ5Duejubt1k3ZgUnYowYnPvmcUt0hskd+OebmQ+jF6Wk6rOG0/9EeknOxm7mtTGgKSwdlE1jDo+xA==",
"dependencies": { "dependencies": {
"@nuxtjs/proxy": "^2.1.0", "@nuxtjs/proxy": "^2.1.0",
"axios": "^0.21.1", "axios": "^0.21.1",
"axios-retry": "^3.1.9", "axios-retry": "^3.1.9",
"consola": "^2.15.0", "consola": "^2.15.3",
"defu": "^3.2.2" "defu": "^3.2.2"
} }
}, },
"node_modules/@nuxtjs/axios/node_modules/consola": {
"version": "2.15.0",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.15.0.tgz",
"integrity": "sha512-vlcSGgdYS26mPf7qNi+dCisbhiyDnrN1zaRbw3CSuc2wGOMEGGPsp46PdRG5gqXwgtJfjxDkxRNAgRPr1B77vQ=="
},
"node_modules/@nuxtjs/color-mode": { "node_modules/@nuxtjs/color-mode": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/@nuxtjs/color-mode/-/color-mode-1.1.1.tgz", "resolved": "https://registry.npmjs.org/@nuxtjs/color-mode/-/color-mode-1.1.1.tgz",
@@ -2580,6 +2504,11 @@
"resolved": "https://registry.npmjs.org/@types/anymatch/-/anymatch-1.3.1.tgz", "resolved": "https://registry.npmjs.org/@types/anymatch/-/anymatch-1.3.1.tgz",
"integrity": "sha512-/+CRPXpBDpo2RK9C68N3b2cOvO0Cf5B9aPijHsoDQTHivnGSObdOF2BRQOYjojWTDy6nQvMjmqRXIxH55VjxxA==" "integrity": "sha512-/+CRPXpBDpo2RK9C68N3b2cOvO0Cf5B9aPijHsoDQTHivnGSObdOF2BRQOYjojWTDy6nQvMjmqRXIxH55VjxxA=="
}, },
"node_modules/@types/cookie": {
"version": "0.3.3",
"resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.3.3.tgz",
"integrity": "sha512-LKVP3cgXBT9RYj+t+9FDKwS5tdI+rPBXaNSkma7hvqy35lc7mAokC2zsqWJH0LaqIt3B962nuYI77hsJoT1gow=="
},
"node_modules/@types/html-minifier-terser": { "node_modules/@types/html-minifier-terser": {
"version": "5.1.1", "version": "5.1.1",
"resolved": "https://registry.npmjs.org/@types/html-minifier-terser/-/html-minifier-terser-5.1.1.tgz", "resolved": "https://registry.npmjs.org/@types/html-minifier-terser/-/html-minifier-terser-5.1.1.tgz",
@@ -4528,16 +4457,6 @@
"node": ">= 10" "node": ">= 10"
} }
}, },
"node_modules/clipboard": {
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/clipboard/-/clipboard-2.0.6.tgz",
"integrity": "sha512-g5zbiixBRk/wyKakSwCKd7vQXDjFnAMGHoEyBogG/bw9kTD9GvdAvaoRR1ALcEzt3pVKxZR0pViekPMIS0QyGg==",
"dependencies": {
"good-listener": "^1.2.2",
"select": "^1.1.2",
"tiny-emitter": "^2.0.0"
}
},
"node_modules/cliui": { "node_modules/cliui": {
"version": "5.0.0", "version": "5.0.0",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz",
@@ -4819,9 +4738,9 @@
} }
}, },
"node_modules/consola": { "node_modules/consola": {
"version": "2.14.0", "version": "2.15.3",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.14.0.tgz", "resolved": "https://registry.npmjs.org/consola/-/consola-2.15.3.tgz",
"integrity": "sha512-A2j1x4u8d6SIVikhZROfpFJxQZie+cZOfQMyI/tu2+hWXe8iAv7R6FW6s6x04/7zBCst94lPddztot/d6GJiuQ==" "integrity": "sha512-9vAdYbHj6x2fLKC4+oPH0kFzY/orMZyG2Aj+kNylHxKGJ/Ed4dpNyAQYwJOdqO4zdM7XpVHmyejQDcQHrnuXbw=="
}, },
"node_modules/console-browserify": { "node_modules/console-browserify": {
"version": "1.2.0", "version": "1.2.0",
@@ -4909,6 +4828,24 @@
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
"integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw="
}, },
"node_modules/cookie-universal": {
"version": "2.1.4",
"resolved": "https://registry.npmjs.org/cookie-universal/-/cookie-universal-2.1.4.tgz",
"integrity": "sha512-dwWXs7NGBzaBYDypu3jWH5M3NJW+zu5QdyJkFMHJvhLuyL4/eXG4105fwtTDwfIqyTunwVvQX4PHdtfPDS7URQ==",
"dependencies": {
"@types/cookie": "^0.3.3",
"cookie": "^0.4.0"
}
},
"node_modules/cookie-universal-nuxt": {
"version": "2.1.4",
"resolved": "https://registry.npmjs.org/cookie-universal-nuxt/-/cookie-universal-nuxt-2.1.4.tgz",
"integrity": "sha512-xbn4Ozs9S0u2+0mQTZRwGlBL9MGNq8N4H6iGfprR5ufZFCS2hGef++3DBHSmHXZi30Wu3Q7RI/GkNMhz3cecmg==",
"dependencies": {
"@types/cookie": "^0.3.3",
"cookie-universal": "^2.1.4"
}
},
"node_modules/copy-concurrently": { "node_modules/copy-concurrently": {
"version": "1.0.5", "version": "1.0.5",
"resolved": "https://registry.npmjs.org/copy-concurrently/-/copy-concurrently-1.0.5.tgz", "resolved": "https://registry.npmjs.org/copy-concurrently/-/copy-concurrently-1.0.5.tgz",
@@ -5560,11 +5497,6 @@
"node": ">=0.4.0" "node": ">=0.4.0"
} }
}, },
"node_modules/delegate": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/delegate/-/delegate-3.2.0.tgz",
"integrity": "sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw=="
},
"node_modules/delegates": { "node_modules/delegates": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz",
@@ -7939,14 +7871,6 @@
"node": ">= 0.10" "node": ">= 0.10"
} }
}, },
"node_modules/good-listener": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/good-listener/-/good-listener-1.2.2.tgz",
"integrity": "sha1-1TswzfkxPf+33JoNR3CWqm0UXFA=",
"dependencies": {
"delegate": "^3.1.2"
}
},
"node_modules/graceful-fs": { "node_modules/graceful-fs": {
"version": "4.2.4", "version": "4.2.4",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz",
@@ -8910,11 +8834,6 @@
"node": ">=0.10.0" "node": ">=0.10.0"
} }
}, },
"node_modules/is-https": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-https/-/is-https-1.0.0.tgz",
"integrity": "sha512-1adLLwZT9XEXjzhQhZxd75uxf0l+xI9uTSFaZeSESjL3E1eXSPpO+u5RcgqtzeZ1KCaNvtEwZSTO2P4U5erVqQ=="
},
"node_modules/is-nan": { "node_modules/is-nan": {
"version": "1.3.0", "version": "1.3.0",
"resolved": "https://registry.npmjs.org/is-nan/-/is-nan-1.3.0.tgz", "resolved": "https://registry.npmjs.org/is-nan/-/is-nan-1.3.0.tgz",
@@ -9153,11 +9072,6 @@
"integrity": "sha512-fiUvdfCaAXoQTHdKMgTvg6IkecXDcVz6V5rlftUTclF9IKBjMizvSdQaCl/z/6TApDeby5NL+axYou3i0mu1Pg==", "integrity": "sha512-fiUvdfCaAXoQTHdKMgTvg6IkecXDcVz6V5rlftUTclF9IKBjMizvSdQaCl/z/6TApDeby5NL+axYou3i0mu1Pg==",
"dev": true "dev": true
}, },
"node_modules/js-cookie": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/js-cookie/-/js-cookie-2.2.1.tgz",
"integrity": "sha512-HvdH2LzI/EAZcUwA8+0nKNtWHqS+ZmijLA30RwZA0bo7ToCckjK5MkGhjED9KoRcXO6BaGI3I9UIzSA1FKFPOQ=="
},
"node_modules/js-tokens": { "node_modules/js-tokens": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
@@ -10568,14 +10482,6 @@
"npm": ">=5.0.0" "npm": ">=5.0.0"
} }
}, },
"node_modules/nuxt-clipboard2": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/nuxt-clipboard2/-/nuxt-clipboard2-0.2.1.tgz",
"integrity": "sha512-NZl9UpcLjePt3CRhYSmJiv7af5IiI1DRrmesGawapjImmWZ2cO+UqflimIlBqIXjJSnz3ZsaPxX4639UgkxYTA==",
"dependencies": {
"vue-clipboard2": "0.2.1"
}
},
"node_modules/oauth-sign": { "node_modules/oauth-sign": {
"version": "0.9.0", "version": "0.9.0",
"resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz",
@@ -13450,11 +13356,6 @@
"node": ">=0.8.0" "node": ">=0.8.0"
} }
}, },
"node_modules/select": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/select/-/select-1.1.2.tgz",
"integrity": "sha1-DnNQrN7ICxEIUoeG7B1EGNEbOW0="
},
"node_modules/semver": { "node_modules/semver": {
"version": "7.3.2", "version": "7.3.2",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz",
@@ -14656,11 +14557,6 @@
"resolved": "https://registry.npmjs.org/timsort/-/timsort-0.3.0.tgz", "resolved": "https://registry.npmjs.org/timsort/-/timsort-0.3.0.tgz",
"integrity": "sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q=" "integrity": "sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q="
}, },
"node_modules/tiny-emitter": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.1.0.tgz",
"integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q=="
},
"node_modules/tmp": { "node_modules/tmp": {
"version": "0.0.33", "version": "0.0.33",
"resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz",
@@ -15235,14 +15131,6 @@
"resolved": "https://registry.npmjs.org/vue-client-only/-/vue-client-only-2.0.0.tgz", "resolved": "https://registry.npmjs.org/vue-client-only/-/vue-client-only-2.0.0.tgz",
"integrity": "sha512-arhk1wtWAfLsJyxGMoEYhoBowM87/i6HLSG2LH/03Yog6i2d9JEN1peMP0Ceis+/n9DxdenGYZZTxbPPJyHciA==" "integrity": "sha512-arhk1wtWAfLsJyxGMoEYhoBowM87/i6HLSG2LH/03Yog6i2d9JEN1peMP0Ceis+/n9DxdenGYZZTxbPPJyHciA=="
}, },
"node_modules/vue-clipboard2": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/vue-clipboard2/-/vue-clipboard2-0.2.1.tgz",
"integrity": "sha512-n6ie/0g0bKohmLlC/5ja1esq2Q0jQ5hWmhNSZcvCsWfDeDnVARjl6cBB9p72XV1nlVfuqsZcfV8HTjjZAIlLBA==",
"dependencies": {
"clipboard": "^2.0.0"
}
},
"node_modules/vue-eslint-parser": { "node_modules/vue-eslint-parser": {
"version": "7.1.0", "version": "7.1.0",
"resolved": "https://registry.npmjs.org/vue-eslint-parser/-/vue-eslint-parser-7.1.0.tgz", "resolved": "https://registry.npmjs.org/vue-eslint-parser/-/vue-eslint-parser-7.1.0.tgz",
@@ -18144,11 +18032,6 @@
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
}, },
"consola": {
"version": "2.15.0",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.15.0.tgz",
"integrity": "sha512-vlcSGgdYS26mPf7qNi+dCisbhiyDnrN1zaRbw3CSuc2wGOMEGGPsp46PdRG5gqXwgtJfjxDkxRNAgRPr1B77vQ=="
},
"has-flag": { "has-flag": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
@@ -18234,11 +18117,6 @@
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
}, },
"consola": {
"version": "2.15.0",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.15.0.tgz",
"integrity": "sha512-vlcSGgdYS26mPf7qNi+dCisbhiyDnrN1zaRbw3CSuc2wGOMEGGPsp46PdRG5gqXwgtJfjxDkxRNAgRPr1B77vQ=="
},
"has-flag": { "has-flag": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
@@ -18284,11 +18162,6 @@
"std-env": "^2.2.1" "std-env": "^2.2.1"
}, },
"dependencies": { "dependencies": {
"consola": {
"version": "2.15.0",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.15.0.tgz",
"integrity": "sha512-vlcSGgdYS26mPf7qNi+dCisbhiyDnrN1zaRbw3CSuc2wGOMEGGPsp46PdRG5gqXwgtJfjxDkxRNAgRPr1B77vQ=="
},
"defu": { "defu": {
"version": "2.0.4", "version": "2.0.4",
"resolved": "https://registry.npmjs.org/defu/-/defu-2.0.4.tgz", "resolved": "https://registry.npmjs.org/defu/-/defu-2.0.4.tgz",
@@ -18315,11 +18188,6 @@
"std-env": "^2.2.1" "std-env": "^2.2.1"
}, },
"dependencies": { "dependencies": {
"consola": {
"version": "2.15.0",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.15.0.tgz",
"integrity": "sha512-vlcSGgdYS26mPf7qNi+dCisbhiyDnrN1zaRbw3CSuc2wGOMEGGPsp46PdRG5gqXwgtJfjxDkxRNAgRPr1B77vQ=="
},
"debug": { "debug": {
"version": "4.2.0", "version": "4.2.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz", "resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz",
@@ -18409,11 +18277,6 @@
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
}, },
"consola": {
"version": "2.15.0",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.15.0.tgz",
"integrity": "sha512-vlcSGgdYS26mPf7qNi+dCisbhiyDnrN1zaRbw3CSuc2wGOMEGGPsp46PdRG5gqXwgtJfjxDkxRNAgRPr1B77vQ=="
},
"has-flag": { "has-flag": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
@@ -18456,13 +18319,6 @@
"chalk": "^4.1.0", "chalk": "^4.1.0",
"consola": "^2.15.0", "consola": "^2.15.0",
"node-fetch": "^2.6.1" "node-fetch": "^2.6.1"
},
"dependencies": {
"consola": {
"version": "2.15.0",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.15.0.tgz",
"integrity": "sha512-vlcSGgdYS26mPf7qNi+dCisbhiyDnrN1zaRbw3CSuc2wGOMEGGPsp46PdRG5gqXwgtJfjxDkxRNAgRPr1B77vQ=="
}
} }
}, },
"@nuxt/server": { "@nuxt/server": {
@@ -18520,11 +18376,6 @@
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
}, },
"consola": {
"version": "2.15.0",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.15.0.tgz",
"integrity": "sha512-vlcSGgdYS26mPf7qNi+dCisbhiyDnrN1zaRbw3CSuc2wGOMEGGPsp46PdRG5gqXwgtJfjxDkxRNAgRPr1B77vQ=="
},
"has-flag": { "has-flag": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
@@ -18608,13 +18459,6 @@
"serialize-javascript": "^5.0.1", "serialize-javascript": "^5.0.1",
"signal-exit": "^3.0.3", "signal-exit": "^3.0.3",
"ua-parser-js": "^0.7.22" "ua-parser-js": "^0.7.22"
},
"dependencies": {
"consola": {
"version": "2.15.0",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.15.0.tgz",
"integrity": "sha512-vlcSGgdYS26mPf7qNi+dCisbhiyDnrN1zaRbw3CSuc2wGOMEGGPsp46PdRG5gqXwgtJfjxDkxRNAgRPr1B77vQ=="
}
} }
}, },
"@nuxt/vue-app": { "@nuxt/vue-app": {
@@ -18646,13 +18490,6 @@
"vue": "^2.6.12", "vue": "^2.6.12",
"vue-meta": "^2.4.0", "vue-meta": "^2.4.0",
"vue-server-renderer": "^2.6.12" "vue-server-renderer": "^2.6.12"
},
"dependencies": {
"consola": {
"version": "2.15.0",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.15.0.tgz",
"integrity": "sha512-vlcSGgdYS26mPf7qNi+dCisbhiyDnrN1zaRbw3CSuc2wGOMEGGPsp46PdRG5gqXwgtJfjxDkxRNAgRPr1B77vQ=="
}
} }
}, },
"@nuxt/webpack": { "@nuxt/webpack": {
@@ -18734,11 +18571,6 @@
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
}, },
"consola": {
"version": "2.15.0",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.15.0.tgz",
"integrity": "sha512-vlcSGgdYS26mPf7qNi+dCisbhiyDnrN1zaRbw3CSuc2wGOMEGGPsp46PdRG5gqXwgtJfjxDkxRNAgRPr1B77vQ=="
},
"has-flag": { "has-flag": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
@@ -18759,45 +18591,16 @@
} }
} }
}, },
"@nuxtjs/auth": {
"version": "4.9.1",
"resolved": "https://registry.npmjs.org/@nuxtjs/auth/-/auth-4.9.1.tgz",
"integrity": "sha512-h5VZanq2+P47jq3t0EnsZv800cg/ufOPC6JqvcyeDFJM99p58jHSODAjDuePo3PrZxd8hovMk7zusU5lOHgjvQ==",
"requires": {
"@nuxtjs/axios": "^5.9.5",
"body-parser": "^1.19.0",
"consola": "^2.11.3",
"cookie": "^0.4.0",
"is-https": "^1.0.0",
"js-cookie": "^2.2.1",
"lodash": "^4.17.15",
"nanoid": "^2.1.11"
},
"dependencies": {
"nanoid": {
"version": "2.1.11",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-2.1.11.tgz",
"integrity": "sha512-s/snB+WGm6uwi0WjsZdaVcuf3KJXlfGl2LcxgwkEwJF0D/BWzVWAZW/XY4bFaiR7s0Jk3FPvlnepg1H1b1UwlA=="
}
}
},
"@nuxtjs/axios": { "@nuxtjs/axios": {
"version": "5.12.5", "version": "5.13.1",
"resolved": "https://registry.npmjs.org/@nuxtjs/axios/-/axios-5.12.5.tgz", "resolved": "https://registry.npmjs.org/@nuxtjs/axios/-/axios-5.13.1.tgz",
"integrity": "sha512-KCZMLRZFYOKcGt9mKxJMH6UJMB6H6g+BF/YxXEYz3Urrf2U2XiNkj6rmBqgw0XLRY5XD9Wm8knTGp6955512fQ==", "integrity": "sha512-vZpXV2AAkQ5Duejubt1k3ZgUnYowYnPvmcUt0hskd+OebmQ+jF6Wk6rOG0/9EeknOxm7mtTGgKSwdlE1jDo+xA==",
"requires": { "requires": {
"@nuxtjs/proxy": "^2.1.0", "@nuxtjs/proxy": "^2.1.0",
"axios": "^0.21.1", "axios": "^0.21.1",
"axios-retry": "^3.1.9", "axios-retry": "^3.1.9",
"consola": "^2.15.0", "consola": "^2.15.3",
"defu": "^3.2.2" "defu": "^3.2.2"
},
"dependencies": {
"consola": {
"version": "2.15.0",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.15.0.tgz",
"integrity": "sha512-vlcSGgdYS26mPf7qNi+dCisbhiyDnrN1zaRbw3CSuc2wGOMEGGPsp46PdRG5gqXwgtJfjxDkxRNAgRPr1B77vQ=="
}
} }
}, },
"@nuxtjs/color-mode": { "@nuxtjs/color-mode": {
@@ -19007,6 +18810,11 @@
"resolved": "https://registry.npmjs.org/@types/anymatch/-/anymatch-1.3.1.tgz", "resolved": "https://registry.npmjs.org/@types/anymatch/-/anymatch-1.3.1.tgz",
"integrity": "sha512-/+CRPXpBDpo2RK9C68N3b2cOvO0Cf5B9aPijHsoDQTHivnGSObdOF2BRQOYjojWTDy6nQvMjmqRXIxH55VjxxA==" "integrity": "sha512-/+CRPXpBDpo2RK9C68N3b2cOvO0Cf5B9aPijHsoDQTHivnGSObdOF2BRQOYjojWTDy6nQvMjmqRXIxH55VjxxA=="
}, },
"@types/cookie": {
"version": "0.3.3",
"resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.3.3.tgz",
"integrity": "sha512-LKVP3cgXBT9RYj+t+9FDKwS5tdI+rPBXaNSkma7hvqy35lc7mAokC2zsqWJH0LaqIt3B962nuYI77hsJoT1gow=="
},
"@types/html-minifier-terser": { "@types/html-minifier-terser": {
"version": "5.1.1", "version": "5.1.1",
"resolved": "https://registry.npmjs.org/@types/html-minifier-terser/-/html-minifier-terser-5.1.1.tgz", "resolved": "https://registry.npmjs.org/@types/html-minifier-terser/-/html-minifier-terser-5.1.1.tgz",
@@ -20682,16 +20490,6 @@
"resolved": "https://registry.npmjs.org/cli-width/-/cli-width-3.0.0.tgz", "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-3.0.0.tgz",
"integrity": "sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw==" "integrity": "sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw=="
}, },
"clipboard": {
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/clipboard/-/clipboard-2.0.6.tgz",
"integrity": "sha512-g5zbiixBRk/wyKakSwCKd7vQXDjFnAMGHoEyBogG/bw9kTD9GvdAvaoRR1ALcEzt3pVKxZR0pViekPMIS0QyGg==",
"requires": {
"good-listener": "^1.2.2",
"select": "^1.1.2",
"tiny-emitter": "^2.0.0"
}
},
"cliui": { "cliui": {
"version": "5.0.0", "version": "5.0.0",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz",
@@ -20936,9 +20734,9 @@
} }
}, },
"consola": { "consola": {
"version": "2.14.0", "version": "2.15.3",
"resolved": "https://registry.npmjs.org/consola/-/consola-2.14.0.tgz", "resolved": "https://registry.npmjs.org/consola/-/consola-2.15.3.tgz",
"integrity": "sha512-A2j1x4u8d6SIVikhZROfpFJxQZie+cZOfQMyI/tu2+hWXe8iAv7R6FW6s6x04/7zBCst94lPddztot/d6GJiuQ==" "integrity": "sha512-9vAdYbHj6x2fLKC4+oPH0kFzY/orMZyG2Aj+kNylHxKGJ/Ed4dpNyAQYwJOdqO4zdM7XpVHmyejQDcQHrnuXbw=="
}, },
"console-browserify": { "console-browserify": {
"version": "1.2.0", "version": "1.2.0",
@@ -21015,6 +20813,24 @@
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
"integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw="
}, },
"cookie-universal": {
"version": "2.1.4",
"resolved": "https://registry.npmjs.org/cookie-universal/-/cookie-universal-2.1.4.tgz",
"integrity": "sha512-dwWXs7NGBzaBYDypu3jWH5M3NJW+zu5QdyJkFMHJvhLuyL4/eXG4105fwtTDwfIqyTunwVvQX4PHdtfPDS7URQ==",
"requires": {
"@types/cookie": "^0.3.3",
"cookie": "^0.4.0"
}
},
"cookie-universal-nuxt": {
"version": "2.1.4",
"resolved": "https://registry.npmjs.org/cookie-universal-nuxt/-/cookie-universal-nuxt-2.1.4.tgz",
"integrity": "sha512-xbn4Ozs9S0u2+0mQTZRwGlBL9MGNq8N4H6iGfprR5ufZFCS2hGef++3DBHSmHXZi30Wu3Q7RI/GkNMhz3cecmg==",
"requires": {
"@types/cookie": "^0.3.3",
"cookie-universal": "^2.1.4"
}
},
"copy-concurrently": { "copy-concurrently": {
"version": "1.0.5", "version": "1.0.5",
"resolved": "https://registry.npmjs.org/copy-concurrently/-/copy-concurrently-1.0.5.tgz", "resolved": "https://registry.npmjs.org/copy-concurrently/-/copy-concurrently-1.0.5.tgz",
@@ -21546,11 +21362,6 @@
"integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=",
"dev": true "dev": true
}, },
"delegate": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/delegate/-/delegate-3.2.0.tgz",
"integrity": "sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw=="
},
"delegates": { "delegates": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz",
@@ -23523,14 +23334,6 @@
"minimatch": "~3.0.2" "minimatch": "~3.0.2"
} }
}, },
"good-listener": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/good-listener/-/good-listener-1.2.2.tgz",
"integrity": "sha1-1TswzfkxPf+33JoNR3CWqm0UXFA=",
"requires": {
"delegate": "^3.1.2"
}
},
"graceful-fs": { "graceful-fs": {
"version": "4.2.4", "version": "4.2.4",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz",
@@ -24307,11 +24110,6 @@
"is-extglob": "^2.1.1" "is-extglob": "^2.1.1"
} }
}, },
"is-https": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-https/-/is-https-1.0.0.tgz",
"integrity": "sha512-1adLLwZT9XEXjzhQhZxd75uxf0l+xI9uTSFaZeSESjL3E1eXSPpO+u5RcgqtzeZ1KCaNvtEwZSTO2P4U5erVqQ=="
},
"is-nan": { "is-nan": {
"version": "1.3.0", "version": "1.3.0",
"resolved": "https://registry.npmjs.org/is-nan/-/is-nan-1.3.0.tgz", "resolved": "https://registry.npmjs.org/is-nan/-/is-nan-1.3.0.tgz",
@@ -24495,11 +24293,6 @@
"integrity": "sha512-fiUvdfCaAXoQTHdKMgTvg6IkecXDcVz6V5rlftUTclF9IKBjMizvSdQaCl/z/6TApDeby5NL+axYou3i0mu1Pg==", "integrity": "sha512-fiUvdfCaAXoQTHdKMgTvg6IkecXDcVz6V5rlftUTclF9IKBjMizvSdQaCl/z/6TApDeby5NL+axYou3i0mu1Pg==",
"dev": true "dev": true
}, },
"js-cookie": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/js-cookie/-/js-cookie-2.2.1.tgz",
"integrity": "sha512-HvdH2LzI/EAZcUwA8+0nKNtWHqS+ZmijLA30RwZA0bo7ToCckjK5MkGhjED9KoRcXO6BaGI3I9UIzSA1FKFPOQ=="
},
"js-tokens": { "js-tokens": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
@@ -25683,14 +25476,6 @@
"@nuxt/webpack": "2.14.7" "@nuxt/webpack": "2.14.7"
} }
}, },
"nuxt-clipboard2": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/nuxt-clipboard2/-/nuxt-clipboard2-0.2.1.tgz",
"integrity": "sha512-NZl9UpcLjePt3CRhYSmJiv7af5IiI1DRrmesGawapjImmWZ2cO+UqflimIlBqIXjJSnz3ZsaPxX4639UgkxYTA==",
"requires": {
"vue-clipboard2": "0.2.1"
}
},
"oauth-sign": { "oauth-sign": {
"version": "0.9.0", "version": "0.9.0",
"resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz",
@@ -28077,11 +27862,6 @@
} }
} }
}, },
"select": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/select/-/select-1.1.2.tgz",
"integrity": "sha1-DnNQrN7ICxEIUoeG7B1EGNEbOW0="
},
"semver": { "semver": {
"version": "7.3.2", "version": "7.3.2",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz",
@@ -29103,11 +28883,6 @@
"resolved": "https://registry.npmjs.org/timsort/-/timsort-0.3.0.tgz", "resolved": "https://registry.npmjs.org/timsort/-/timsort-0.3.0.tgz",
"integrity": "sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q=" "integrity": "sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q="
}, },
"tiny-emitter": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.1.0.tgz",
"integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q=="
},
"tmp": { "tmp": {
"version": "0.0.33", "version": "0.0.33",
"resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz",
@@ -29585,14 +29360,6 @@
"resolved": "https://registry.npmjs.org/vue-client-only/-/vue-client-only-2.0.0.tgz", "resolved": "https://registry.npmjs.org/vue-client-only/-/vue-client-only-2.0.0.tgz",
"integrity": "sha512-arhk1wtWAfLsJyxGMoEYhoBowM87/i6HLSG2LH/03Yog6i2d9JEN1peMP0Ceis+/n9DxdenGYZZTxbPPJyHciA==" "integrity": "sha512-arhk1wtWAfLsJyxGMoEYhoBowM87/i6HLSG2LH/03Yog6i2d9JEN1peMP0Ceis+/n9DxdenGYZZTxbPPJyHciA=="
}, },
"vue-clipboard2": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/vue-clipboard2/-/vue-clipboard2-0.2.1.tgz",
"integrity": "sha512-n6ie/0g0bKohmLlC/5ja1esq2Q0jQ5hWmhNSZcvCsWfDeDnVARjl6cBB9p72XV1nlVfuqsZcfV8HTjjZAIlLBA==",
"requires": {
"clipboard": "^2.0.0"
}
},
"vue-eslint-parser": { "vue-eslint-parser": {
"version": "7.1.0", "version": "7.1.0",
"resolved": "https://registry.npmjs.org/vue-eslint-parser/-/vue-eslint-parser-7.1.0.tgz", "resolved": "https://registry.npmjs.org/vue-eslint-parser/-/vue-eslint-parser-7.1.0.tgz",

View File

@@ -12,17 +12,16 @@
"lint": "npm run lint:js" "lint": "npm run lint:js"
}, },
"dependencies": { "dependencies": {
"@nuxtjs/auth": "^4.9.1",
"@nuxtjs/axios": "^5.12.5", "@nuxtjs/axios": "^5.12.5",
"@nuxtjs/dayjs": "^1.2.0", "@nuxtjs/dayjs": "^1.2.0",
"@nuxtjs/google-adsense": "^1.3.0", "@nuxtjs/google-adsense": "^1.3.0",
"@nuxtjs/robots": "^2.4.2", "@nuxtjs/robots": "^2.4.2",
"@nuxtjs/sitemap": "^2.4.0", "@nuxtjs/sitemap": "^2.4.0",
"@nuxtjs/style-resources": "^1.0.0", "@nuxtjs/style-resources": "^1.0.0",
"cookie-universal-nuxt": "^2.1.4",
"highlight.js": "^10.3.2", "highlight.js": "^10.3.2",
"marked": "^2.0.0", "marked": "^2.0.0",
"nuxt": "^2.14.7", "nuxt": "^2.14.7",
"nuxt-clipboard2": "^0.2.1",
"v-tooltip": "^2.0.3", "v-tooltip": "^2.0.3",
"vue-click-outside": "^1.1.0", "vue-click-outside": "^1.1.0",
"vue-highlightjs": "^1.3.3", "vue-highlightjs": "^1.3.3",

View File

@@ -54,7 +54,7 @@ export default {
}, },
methods: { methods: {
async logout() { async logout() {
await this.$auth.setToken('local', false) this.$cookies.remove('auth-token')
await this.$router.replace( await this.$router.replace(
'https://api.modrinth.com/api/v1/auth/init?url=https://modrinth.com/' 'https://api.modrinth.com/api/v1/auth/init?url=https://modrinth.com/'
) )

View File

@@ -84,20 +84,18 @@ export default {
ModCard, ModCard,
}, },
async asyncData(data) { async asyncData(data) {
const config = {
headers: {
Authorization: data.$auth.getToken('local')
? data.$auth.getToken('local')
: '',
},
}
const mods = ( const mods = (
await axios.get(`https://api.modrinth.com/api/v1/moderation/mods`, config) await axios.get(
`https://api.modrinth.com/api/v1/moderation/mods`,
data.$auth.headers
)
).data ).data
const reports = ( const reports = (
await axios.get(`https://api.modrinth.com/api/v1/report`, config) await axios.get(
`https://api.modrinth.com/api/v1/report`,
data.$auth.headers
)
).data ).data
return { return {
@@ -107,36 +105,20 @@ export default {
}, },
methods: { methods: {
async changeModStatus(id, status, index) { async changeModStatus(id, status, index) {
const config = {
headers: {
Authorization: this.$auth.getToken('local')
? this.$auth.getToken('local')
: '',
},
}
await axios.patch( await axios.patch(
`https://api.modrinth.com/api/v1/mod/${id}`, `https://api.modrinth.com/api/v1/mod/${id}`,
{ {
status, status,
}, },
config this.$auth.headers
) )
this.mods.splice(index, 1) this.mods.splice(index, 1)
}, },
async deleteReport(index) { async deleteReport(index) {
const config = {
headers: {
Authorization: this.$auth.getToken('local')
? this.$auth.getToken('local')
: '',
},
}
await axios.delete( await axios.delete(
`https://api.modrinth.com/api/v1/report/${this.reports[index].id}`, `https://api.modrinth.com/api/v1/report/${this.reports[index].id}`,
config this.$auth.headers
) )
this.reports.splice(index, 1) this.reports.splice(index, 1)

View File

@@ -53,18 +53,10 @@ export default {
DashboardPage, DashboardPage,
}, },
async asyncData(data) { async asyncData(data) {
const config = {
headers: {
Authorization: data.$auth.getToken('local')
? data.$auth.getToken('local')
: '',
},
}
const notifications = ( const notifications = (
await axios.get( await axios.get(
`https://api.modrinth.com/api/v1/user/${data.$auth.user.id}/notifications`, `https://api.modrinth.com/api/v1/user/${data.$auth.user.id}/notifications`,
config data.$auth.headers
) )
).data ).data
@@ -82,25 +74,19 @@ export default {
method: notification.actions[index].action_route[0].toLowerCase(), method: notification.actions[index].action_route[0].toLowerCase(),
url: `https://api.modrinth.com/api/v1/${notification.actions[index].action_route[1]}`, url: `https://api.modrinth.com/api/v1/${notification.actions[index].action_route[1]}`,
headers: { headers: {
Authorization: this.$auth.getToken('local'), Authorization: this.$auth.token,
}, },
} }
await axios(config) await axios(config)
} }
const config = {
headers: {
Authorization: this.$auth.getToken('local')
? this.$auth.getToken('local')
: '',
},
}
await axios.delete( await axios.delete(
`https://api.modrinth.com/api/v1/notification/${notification.id}`, `https://api.modrinth.com/api/v1/notification/${notification.id}`,
config this.$auth.headers
) )
this.notifications.splice(index, 1)
} catch (err) { } catch (err) {
this.$notify({ this.$notify({
group: 'main', group: 'main',

View File

@@ -46,22 +46,14 @@ export default {
ModCard, ModCard,
}, },
async asyncData(data) { async asyncData(data) {
const config = {
headers: {
Authorization: data.$auth.getToken('local')
? data.$auth.getToken('local')
: '',
},
}
let res = await axios.get( let res = await axios.get(
`https://api.modrinth.com/api/v1/user/${data.$auth.user.id}/mods`, `https://api.modrinth.com/api/v1/user/${data.$auth.user.id}/mods`,
config data.$auth.headers
) )
res = await axios.get( res = await axios.get(
`https://api.modrinth.com/api/v1/mods?ids=${JSON.stringify(res.data)}`, `https://api.modrinth.com/api/v1/mods?ids=${JSON.stringify(res.data)}`,
config data.$auth.headers
) )
return { return {

View File

@@ -114,7 +114,7 @@ export default {
this.name = this.$auth.user.name this.name = this.$auth.user.name
this.email = this.$auth.user.email this.email = this.$auth.user.email
this.bio = this.$auth.user.bio this.bio = this.$auth.user.bio
this.token = this.$auth.getToken('local') this.token = this.$auth.token
}, },
data() { data() {
return { return {
@@ -134,7 +134,7 @@ export default {
this.$router.replace('/dashboard/misc/revoke-token') this.$router.replace('/dashboard/misc/revoke-token')
}, },
async copyToken() { async copyToken() {
await this.$copyText(this.token) await navigator.clipboard.writeText(this.token)
this.$notify({ this.$notify({
group: 'main', group: 'main',
title: 'Copied to clipboard.', title: 'Copied to clipboard.',
@@ -143,12 +143,6 @@ export default {
}) })
}, },
async editProfile() { async editProfile() {
const config = {
headers: {
Authorization: this.$auth.getToken('local'),
},
}
this.$nuxt.$loading.start() this.$nuxt.$loading.start()
try { try {
@@ -162,10 +156,12 @@ export default {
await axios.patch( await axios.patch(
`https://api.modrinth.com/api/v1/user/${this.$auth.user.id}`, `https://api.modrinth.com/api/v1/user/${this.$auth.user.id}`,
data, data,
config this.$auth.headers
) )
await this.$auth.fetchUser() await this.$store.dispatch('auth/fetchUser', {
token: this.$auth.token,
})
} catch (err) { } catch (err) {
this.$notify({ this.$notify({
group: 'main', group: 'main',
@@ -178,18 +174,12 @@ export default {
this.$nuxt.$loading.finish() this.$nuxt.$loading.finish()
}, },
async deleteAccount() { async deleteAccount() {
const config = {
headers: {
Authorization: this.$auth.getToken('local'),
},
}
this.$nuxt.$loading.start() this.$nuxt.$loading.start()
try { try {
await axios.delete( await axios.delete(
`https://api.modrinth.com/api/v1/user/${this.$auth.user.id}`, `https://api.modrinth.com/api/v1/user/${this.$auth.user.id}`,
config this.$auth.headers
) )
} catch (err) { } catch (err) {
this.$notify({ this.$notify({

View File

@@ -314,14 +314,6 @@ export default {
Multiselect, Multiselect,
}, },
async asyncData(data) { async asyncData(data) {
const config = {
headers: {
Authorization: data.$auth.getToken('local')
? data.$auth.getToken('local')
: '',
},
}
try { try {
const [ const [
mod, mod,
@@ -334,7 +326,7 @@ export default {
await Promise.all([ await Promise.all([
axios.get( axios.get(
`https://api.modrinth.com/api/v1/mod/${data.params.id}`, `https://api.modrinth.com/api/v1/mod/${data.params.id}`,
config data.$auth.headers
), ),
axios.get(`https://api.modrinth.com/api/v1/tag/category`), axios.get(`https://api.modrinth.com/api/v1/tag/category`),
axios.get(`https://api.modrinth.com/api/v1/tag/loader`), axios.get(`https://api.modrinth.com/api/v1/tag/loader`),
@@ -425,12 +417,6 @@ export default {
await this.saveMod() await this.saveMod()
}, },
async saveMod() { async saveMod() {
const config = {
headers: {
Authorization: this.$auth.getToken('local'),
},
}
this.$nuxt.$loading.start() this.$nuxt.$loading.start()
try { try {
@@ -465,7 +451,7 @@ export default {
await axios.patch( await axios.patch(
`https://api.modrinth.com/api/v1/mod/${this.mod.id}`, `https://api.modrinth.com/api/v1/mod/${this.mod.id}`,
data, data,
config this.$auth.headers
) )
if (this.iconChanged) { if (this.iconChanged) {
@@ -474,7 +460,7 @@ export default {
this.icon.type.split('/')[this.icon.type.split('/').length - 1] this.icon.type.split('/')[this.icon.type.split('/').length - 1]
}`, }`,
this.icon, this.icon,
config this.$auth.headers
) )
} }

View File

@@ -23,19 +23,11 @@ export default {
components: { ModPage }, components: { ModPage },
auth: false, auth: false,
async asyncData(data) { async asyncData(data) {
const config = {
headers: {
Authorization: data.$auth.getToken('local')
? data.$auth.getToken('local')
: '',
},
}
try { try {
const mod = ( const mod = (
await axios.get( await axios.get(
`https://api.modrinth.com/api/v1/mod/${data.params.id}`, `https://api.modrinth.com/api/v1/mod/${data.params.id}`,
config data.$auth.headers
) )
).data ).data
@@ -50,10 +42,10 @@ export default {
`https://api.modrinth.com/api/v1/mod/${mod.id}/version?featured=true` `https://api.modrinth.com/api/v1/mod/${mod.id}/version?featured=true`
), ),
axios.get( axios.get(
data.$auth.loggedIn data.$auth.user
? `https://api.modrinth.com/api/v1/user/${data.$auth.user.id}/follows` ? `https://api.modrinth.com/api/v1/user/${data.$auth.user.id}/follows`
: `https://api.modrinth.com`, : `https://api.modrinth.com`,
config data.$auth.headers
), ),
]) ])
).map((it) => it.data) ).map((it) => it.data)
@@ -63,7 +55,7 @@ export default {
`https://api.modrinth.com/api/v1/users?ids=${JSON.stringify( `https://api.modrinth.com/api/v1/users?ids=${JSON.stringify(
members.map((it) => it.user_id) members.map((it) => it.user_id)
)}`, )}`,
config data.$auth.headers
) )
).data ).data
@@ -73,7 +65,7 @@ export default {
members[index].name = it.username members[index].name = it.username
}) })
const currentMember = data.$auth.loggedIn const currentMember = data.$auth.user
? members.find((x) => x.user_id === data.$auth.user.id) ? members.find((x) => x.user_id === data.$auth.user.id)
: null : null

View File

@@ -137,19 +137,11 @@ export default {
Multiselect, Multiselect,
}, },
async asyncData(data) { async asyncData(data) {
const config = {
headers: {
Authorization: data.$auth.getToken('local')
? data.$auth.getToken('local')
: '',
},
}
try { try {
const mod = ( const mod = (
await axios.get( await axios.get(
`https://api.modrinth.com/api/v1/mod/${data.params.id}`, `https://api.modrinth.com/api/v1/mod/${data.params.id}`,
config data.$auth.headers
) )
).data ).data
@@ -168,10 +160,10 @@ export default {
axios.get(`https://api.modrinth.com/api/v1/tag/loader`), axios.get(`https://api.modrinth.com/api/v1/tag/loader`),
axios.get(`https://api.modrinth.com/api/v1/tag/game_version`), axios.get(`https://api.modrinth.com/api/v1/tag/game_version`),
axios.get( axios.get(
data.$auth.loggedIn data.$auth.user
? `https://api.modrinth.com/api/v1/user/${data.$auth.user.id}/follows` ? `https://api.modrinth.com/api/v1/user/${data.$auth.user.id}/follows`
: `https://api.modrinth.com`, : `https://api.modrinth.com`,
config data.$auth.headers
), ),
]) ])
).map((it) => it.data) ).map((it) => it.data)
@@ -181,7 +173,7 @@ export default {
`https://api.modrinth.com/api/v1/users?ids=${JSON.stringify( `https://api.modrinth.com/api/v1/users?ids=${JSON.stringify(
members.map((it) => it.user_id) members.map((it) => it.user_id)
)}`, )}`,
config data.$auth.headers
) )
).data ).data
@@ -191,7 +183,7 @@ export default {
members[index].name = it.username members[index].name = it.username
}) })
const currentMember = data.$auth.loggedIn const currentMember = data.$auth.user
? members.find((x) => x.user_id === data.$auth.user.id) ? members.find((x) => x.user_id === data.$auth.user.id)
: null : null
@@ -244,7 +236,7 @@ export default {
data: formData, data: formData,
headers: { headers: {
'Content-Type': 'multipart/form-data', 'Content-Type': 'multipart/form-data',
Authorization: this.$auth.getToken('local'), Authorization: this.$auth.token,
}, },
}) })
await this.$router.go(null) await this.$router.go(null)

View File

@@ -246,19 +246,11 @@ import DropdownIcon from '~/assets/images/utils/dropdown.svg?inline'
export default { export default {
components: { ModPage, DropdownIcon }, components: { ModPage, DropdownIcon },
async asyncData(data) { async asyncData(data) {
const config = {
headers: {
Authorization: data.$auth.getToken('local')
? data.$auth.getToken('local')
: '',
},
}
try { try {
const mod = ( const mod = (
await axios.get( await axios.get(
`https://api.modrinth.com/api/v1/mod/${data.params.id}`, `https://api.modrinth.com/api/v1/mod/${data.params.id}`,
config data.$auth.headers
) )
).data ).data
@@ -266,16 +258,16 @@ export default {
await Promise.all([ await Promise.all([
axios.get( axios.get(
`https://api.modrinth.com/api/v1/team/${mod.team}/members`, `https://api.modrinth.com/api/v1/team/${mod.team}/members`,
config data.$auth.headers
), ),
axios.get( axios.get(
`https://api.modrinth.com/api/v1/mod/${mod.id}/version?featured=true` `https://api.modrinth.com/api/v1/mod/${mod.id}/version?featured=true`
), ),
axios.get( axios.get(
data.$auth.loggedIn data.$auth.user
? `https://api.modrinth.com/api/v1/user/${data.$auth.user.id}/follows` ? `https://api.modrinth.com/api/v1/user/${data.$auth.user.id}/follows`
: `https://api.modrinth.com`, : `https://api.modrinth.com`,
config data.$auth.headers
), ),
]) ])
).map((it) => it.data) ).map((it) => it.data)
@@ -286,7 +278,7 @@ export default {
`https://api.modrinth.com/api/v1/users?ids=${JSON.stringify( `https://api.modrinth.com/api/v1/users?ids=${JSON.stringify(
members.map((it) => it.user_id) members.map((it) => it.user_id)
)}`, )}`,
config data.$auth.headers
), ),
]) ])
).map((it) => it.data) ).map((it) => it.data)
@@ -297,7 +289,7 @@ export default {
members[index].name = it.username members[index].name = it.username
}) })
const currentMember = data.$auth.loggedIn const currentMember = data.$auth.user
? members.find((x) => x.user_id === data.$auth.user.id) ? members.find((x) => x.user_id === data.$auth.user.id)
: null : null
@@ -333,12 +325,6 @@ export default {
}, },
methods: { methods: {
async inviteTeamMember() { async inviteTeamMember() {
const config = {
headers: {
Authorization: this.$auth.getToken('local'),
},
}
this.$nuxt.$loading.start() this.$nuxt.$loading.start()
try { try {
@@ -355,7 +341,7 @@ export default {
await axios.post( await axios.post(
`https://api.modrinth.com/api/v1/team/${this.mod.team}/members`, `https://api.modrinth.com/api/v1/team/${this.mod.team}/members`,
data, data,
config this.auth.headers
) )
await this.$router.go(null) await this.$router.go(null)
} catch (err) { } catch (err) {
@@ -370,18 +356,12 @@ export default {
this.$nuxt.$loading.finish() this.$nuxt.$loading.finish()
}, },
async removeTeamMember(index) { async removeTeamMember(index) {
const config = {
headers: {
Authorization: this.$auth.getToken('local'),
},
}
this.$nuxt.$loading.start() this.$nuxt.$loading.start()
try { try {
await axios.delete( await axios.delete(
`https://api.modrinth.com/api/v1/team/${this.mod.team}/members/${this.members[index].user_id}`, `https://api.modrinth.com/api/v1/team/${this.mod.team}/members/${this.members[index].user_id}`,
config this.$auth.headers
) )
await this.$router.go(null) await this.$router.go(null)
} catch (err) { } catch (err) {
@@ -396,12 +376,6 @@ export default {
this.$nuxt.$loading.finish() this.$nuxt.$loading.finish()
}, },
async updateTeamMember(index) { async updateTeamMember(index) {
const config = {
headers: {
Authorization: this.$auth.getToken('local'),
},
}
this.$nuxt.$loading.start() this.$nuxt.$loading.start()
try { try {
@@ -413,7 +387,7 @@ export default {
await axios.patch( await axios.patch(
`https://api.modrinth.com/api/v1/team/${this.mod.team}/members/${this.members[index].user_id}`, `https://api.modrinth.com/api/v1/team/${this.mod.team}/members/${this.members[index].user_id}`,
data, data,
config this.$auth.headers
) )
await this.$router.go(null) await this.$router.go(null)
} catch (err) { } catch (err) {
@@ -428,15 +402,9 @@ export default {
this.$nuxt.$loading.finish() this.$nuxt.$loading.finish()
}, },
async deleteMod() { async deleteMod() {
const config = {
headers: {
Authorization: this.$auth.getToken('local'),
},
}
await axios.delete( await axios.delete(
`https://api.modrinth.com/api/v1/mod/${this.mod.id}`, `https://api.modrinth.com/api/v1/mod/${this.mod.id}`,
config this.$auth.headers
) )
}, },
}, },

View File

@@ -126,19 +126,11 @@ export default {
}, },
auth: false, auth: false,
async asyncData(data) { async asyncData(data) {
const config = {
headers: {
Authorization: data.$auth.getToken('local')
? data.$auth.getToken('local')
: '',
},
}
try { try {
const mod = ( const mod = (
await axios.get( await axios.get(
`https://api.modrinth.com/api/v1/mod/${data.params.id}`, `https://api.modrinth.com/api/v1/mod/${data.params.id}`,
config data.$auth.headers
) )
).data ).data
@@ -159,10 +151,10 @@ export default {
axios.get(`https://api.modrinth.com/api/v1/tag/loader`), axios.get(`https://api.modrinth.com/api/v1/tag/loader`),
axios.get(`https://api.modrinth.com/api/v1/tag/game_version`), axios.get(`https://api.modrinth.com/api/v1/tag/game_version`),
axios.get( axios.get(
data.$auth.loggedIn data.$auth.user
? `https://api.modrinth.com/api/v1/user/${data.$auth.user.id}/follows` ? `https://api.modrinth.com/api/v1/user/${data.$auth.user.id}/follows`
: `https://api.modrinth.com`, : `https://api.modrinth.com`,
config data.$auth.headers
), ),
]) ])
).map((it) => it.data) ).map((it) => it.data)
@@ -172,7 +164,7 @@ export default {
`https://api.modrinth.com/api/v1/users?ids=${JSON.stringify( `https://api.modrinth.com/api/v1/users?ids=${JSON.stringify(
members.map((it) => it.user_id) members.map((it) => it.user_id)
)}`, )}`,
config data.$auth.headers
) )
).data ).data
@@ -192,7 +184,7 @@ export default {
primaryFile = version.files[0] primaryFile = version.files[0]
} }
const currentMember = data.$auth.loggedIn const currentMember = data.$auth.user
? members.find((x) => x.user_id === data.$auth.user.id) ? members.find((x) => x.user_id === data.$auth.user.id)
: null : null
@@ -221,21 +213,13 @@ export default {
}, },
methods: { methods: {
async saveVersion() { async saveVersion() {
const config = {
headers: {
Authorization: this.$auth.getToken('local')
? this.$auth.getToken('local')
: '',
},
}
this.$nuxt.$loading.start() this.$nuxt.$loading.start()
try { try {
await axios.patch( await axios.patch(
`https://api.modrinth.com/api/v1/version/${this.version.id}`, `https://api.modrinth.com/api/v1/version/${this.version.id}`,
this.version, this.version,
config this.$auth.headers
) )
await this.$router.replace( await this.$router.replace(
`/mod/${this.mod.id}/version/${this.version.id}` `/mod/${this.mod.id}/version/${this.version.id}`

View File

@@ -29,7 +29,7 @@
<Categories :categories="version.loaders" /> <Categories :categories="version.loaders" />
<div class="buttons"> <div class="buttons">
<nuxt-link <nuxt-link
v-if="this.$auth.loggedIn" v-if="this.$auth.user"
:to="`/report/create?id=${version.id}&t=version`" :to="`/report/create?id=${version.id}&t=version`"
class="action iconified-button" class="action iconified-button"
> >
@@ -154,19 +154,11 @@ export default {
}, },
auth: false, auth: false,
async asyncData(data) { async asyncData(data) {
const config = {
headers: {
Authorization: data.$auth.getToken('local')
? data.$auth.getToken('local')
: '',
},
}
try { try {
const mod = ( const mod = (
await axios.get( await axios.get(
`https://api.modrinth.com/api/v1/mod/${data.params.id}`, `https://api.modrinth.com/api/v1/mod/${data.params.id}`,
config data.$auth.headers
) )
).data ).data
@@ -178,10 +170,10 @@ export default {
`https://api.modrinth.com/api/v1/mod/${mod.id}/version?featured=true` `https://api.modrinth.com/api/v1/mod/${mod.id}/version?featured=true`
), ),
axios.get( axios.get(
data.$auth.loggedIn data.$auth.user
? `https://api.modrinth.com/api/v1/user/${data.$auth.user.id}/follows` ? `https://api.modrinth.com/api/v1/user/${data.$auth.user.id}/follows`
: `https://api.modrinth.com`, : `https://api.modrinth.com`,
config data.$auth.headers
), ),
]) ])
).map((it) => it.data) ).map((it) => it.data)
@@ -191,7 +183,7 @@ export default {
`https://api.modrinth.com/api/v1/users?ids=${JSON.stringify( `https://api.modrinth.com/api/v1/users?ids=${JSON.stringify(
members.map((it) => it.user_id) members.map((it) => it.user_id)
)}`, )}`,
config data.$auth.headers
) )
).data ).data
@@ -211,7 +203,7 @@ export default {
primaryFile = version.files[0] primaryFile = version.files[0]
} }
const currentMember = data.$auth.loggedIn const currentMember = data.$auth.user
? members.find((x) => x.user_id === data.$auth.user.id) ? members.find((x) => x.user_id === data.$auth.user.id)
: null : null
@@ -255,15 +247,9 @@ export default {
async deleteFile(hash) { async deleteFile(hash) {
this.$nuxt.$loading.start() this.$nuxt.$loading.start()
const config = {
headers: {
Authorization: this.$auth.getToken('local'),
},
}
await axios.delete( await axios.delete(
`https://api.modrinth.com/api/v1/version_file/${hash}`, `https://api.modrinth.com/api/v1/version_file/${hash}`,
config this.$auth.headers
) )
await this.$router.go(null) await this.$router.go(null)
@@ -272,18 +258,12 @@ export default {
async makePrimary(hash) { async makePrimary(hash) {
this.$nuxt.$loading.start() this.$nuxt.$loading.start()
const config = {
headers: {
Authorization: this.$auth.getToken('local'),
},
}
await axios.patch( await axios.patch(
`https://api.modrinth.com/api/v1/version/${this.version.id}`, `https://api.modrinth.com/api/v1/version/${this.version.id}`,
{ {
primary_file: ['sha1', hash], primary_file: ['sha1', hash],
}, },
config this.$auth.headers
) )
await this.$router.go(null) await this.$router.go(null)
@@ -317,7 +297,7 @@ export default {
data: formData, data: formData,
headers: { headers: {
'Content-Type': 'multipart/form-data', 'Content-Type': 'multipart/form-data',
Authorization: this.$auth.getToken('local'), Authorization: this.$auth.token,
}, },
}) })
@@ -337,15 +317,9 @@ export default {
async deleteVersion() { async deleteVersion() {
this.$nuxt.$loading.start() this.$nuxt.$loading.start()
const config = {
headers: {
Authorization: this.$auth.getToken('local'),
},
}
await axios.delete( await axios.delete(
`https://api.modrinth.com/api/v1/version/${this.version.id}`, `https://api.modrinth.com/api/v1/version/${this.version.id}`,
config this.$auth.headers
) )
await this.$router.replace(`/mod/${this.mod.id}`) await this.$router.replace(`/mod/${this.mod.id}`)

View File

@@ -107,19 +107,11 @@ export default {
}, },
auth: false, auth: false,
async asyncData(data) { async asyncData(data) {
const config = {
headers: {
Authorization: data.$auth.getToken('local')
? data.$auth.getToken('local')
: '',
},
}
try { try {
const mod = ( const mod = (
await axios.get( await axios.get(
`https://api.modrinth.com/api/v1/mod/${data.params.id}`, `https://api.modrinth.com/api/v1/mod/${data.params.id}`,
config data.$auth.headers
) )
).data ).data
@@ -131,10 +123,10 @@ export default {
`https://api.modrinth.com/api/v1/mod/${mod.id}/version?featured=true` `https://api.modrinth.com/api/v1/mod/${mod.id}/version?featured=true`
), ),
axios.get( axios.get(
data.$auth.loggedIn data.$auth.user
? `https://api.modrinth.com/api/v1/user/${data.$auth.user.id}/follows` ? `https://api.modrinth.com/api/v1/user/${data.$auth.user.id}/follows`
: `https://api.modrinth.com`, : `https://api.modrinth.com`,
config data.$auth.headers
), ),
]) ])
).map((it) => it.data) ).map((it) => it.data)
@@ -144,7 +136,7 @@ export default {
`https://api.modrinth.com/api/v1/users?ids=${JSON.stringify( `https://api.modrinth.com/api/v1/users?ids=${JSON.stringify(
members.map((it) => it.user_id) members.map((it) => it.user_id)
)}`, )}`,
config data.$auth.headers
) )
).data ).data
@@ -154,7 +146,7 @@ export default {
members[index].name = it.username members[index].name = it.username
}) })
const currentMember = data.$auth.loggedIn const currentMember = data.$auth.user
? members.find((x) => x.user_id === data.$auth.user.id) ? members.find((x) => x.user_id === data.$auth.user.id)
: null : null

View File

@@ -660,7 +660,7 @@ export default {
data: formData, data: formData,
headers: { headers: {
'Content-Type': 'multipart/form-data', 'Content-Type': 'multipart/form-data',
Authorization: this.$auth.getToken('local'), Authorization: this.$auth.token,
}, },
}) })

View File

@@ -119,14 +119,6 @@ export default {
this.$nuxt.$loading.start() this.$nuxt.$loading.start()
try { try {
const config = {
headers: {
Authorization: this.$auth.getToken('local')
? this.$auth.getToken('local')
: '',
},
}
const data = { const data = {
report_type: this.reportType, report_type: this.reportType,
item_id: this.itemId, item_id: this.itemId,
@@ -134,7 +126,11 @@ export default {
body: this.body, body: this.body,
} }
await axios.post('https://api.modrinth.com/api/v1/report', data, config) await axios.post(
'https://api.modrinth.com/api/v1/report',
data,
this.$auth.headers
)
await this.$router.replace(`/${this.itemType}/${this.itemId}`) await this.$router.replace(`/${this.itemType}/${this.itemId}`)
} catch (err) { } catch (err) {

View File

@@ -19,7 +19,7 @@
<p v-if="user.bio" class="bio">{{ user.bio }}</p> <p v-if="user.bio" class="bio">{{ user.bio }}</p>
<div class="buttons"> <div class="buttons">
<nuxt-link <nuxt-link
v-if="this.$auth.loggedIn" v-if="this.$auth.user"
:to="`/report/create?id=${user.id}&t=user`" :to="`/report/create?id=${user.id}&t=user`"
class="iconified-button" class="iconified-button"
> >
@@ -102,32 +102,19 @@ export default {
ReportIcon, ReportIcon,
}, },
async asyncData(data) { async asyncData(data) {
const config = {
headers: {
Authorization: data.$auth.getToken('local')
? data.$auth.getToken('local')
: '',
},
}
try { try {
let res = await axios.get( let res = await axios.get(
`https://api.modrinth.com/api/v1/user/${data.params.id}`, `https://api.modrinth.com/api/v1/user/${data.params.id}`
config
) )
const user = res.data const user = res.data
let mods = [] let mods = []
res = await axios.get( res = await axios.get(
`https://api.modrinth.com/api/v1/user/${user.id}/mods`, `https://api.modrinth.com/api/v1/user/${user.id}/mods`
config
) )
if (res.data) { if (res.data) {
res = await axios.get( res = await axios.get(
`https://api.modrinth.com/api/v1/mods?ids=${JSON.stringify( `https://api.modrinth.com/api/v1/mods?ids=${JSON.stringify(res.data)}`
res.data
)}`,
config
) )
mods = res.data mods = res.data
} }
@@ -250,7 +237,4 @@ export default {
} }
} }
} }
.mods {
}
</style> </style>

3
plugins/auth.js Normal file
View File

@@ -0,0 +1,3 @@
export default ({ store }, inject) => {
inject('auth', store.state.auth)
}

53
store/auth.js Normal file
View File

@@ -0,0 +1,53 @@
export const state = () => ({
user: {},
userFollows: [],
token: '',
headers: {},
})
export const mutations = {
SET_USER(state, user) {
state.user = user
},
SET_USER_FOLLOWS(state, follows) {
state.userFollows = follows
},
SET_TOKEN(state, token) {
state.token = token
},
SET_HEADERS(state, headers) {
state.headers = headers
},
}
export const actions = {
async fetchUser({ commit }, { token }) {
const user = (
await this.$axios.get(`https://api.modrinth.com/api/v1/user`, {
headers: {
Authorization: token,
},
})
).data
commit('SET_USER', user)
commit('SET_TOKEN', token)
commit('SET_HEADERS', {
headers: {
Authorization: token,
},
})
},
async fetchUserFollows({ commit }, { userId, token }) {
const follows = await this.$axios.get(
`https://api.modrinth.com/api/v1/user/${userId}/follows`,
{
headers: {
Authorization: token,
},
}
)
commit('SET_USER_FOLLOWS', follows)
},
}