diff --git a/.vscode/settings.json b/.vscode/settings.json index 7522198819..af3d483835 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -9,7 +9,7 @@ "files.insertFinalNewline": true, "editor.codeActionsOnSave": { "source.fixAll.eslint": "explicit", - "source.organizeImports": "always" + "source.organizeImports": "never" }, "editor.defaultFormatter": "esbenp.prettier-vscode", "[vue]": { diff --git a/Cargo.toml b/Cargo.toml index 529fc9cb66..91008f355d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -241,6 +241,7 @@ bool_to_int_with_if = "warn" borrow_as_ptr = "warn" cfg_not_test = "warn" clear_with_drain = "warn" +type_complexity = "allow" cloned_instead_of_copied = "warn" collection_is_never_read = "warn" dbg_macro = "warn" diff --git a/apps/app-frontend/src/pages/hosting/manage/Access.vue b/apps/app-frontend/src/pages/hosting/manage/Access.vue new file mode 100644 index 0000000000..59a3b82e36 --- /dev/null +++ b/apps/app-frontend/src/pages/hosting/manage/Access.vue @@ -0,0 +1,33 @@ + + + diff --git a/apps/app-frontend/src/pages/hosting/manage/index.js b/apps/app-frontend/src/pages/hosting/manage/index.js index 50052e3f9e..0c10b07133 100644 --- a/apps/app-frontend/src/pages/hosting/manage/index.js +++ b/apps/app-frontend/src/pages/hosting/manage/index.js @@ -1,7 +1,8 @@ +import Access from './Access.vue' import Backups from './Backups.vue' import Content from './Content.vue' import Files from './Files.vue' import Index from './Index.vue' import Overview from './Overview.vue' -export { Backups, Content, Files, Index, Overview } +export { Access, Backups, Content, Files, Index, Overview } diff --git a/apps/app-frontend/src/routes.js b/apps/app-frontend/src/routes.js index f01df0670c..da93b48e85 100644 --- a/apps/app-frontend/src/routes.js +++ b/apps/app-frontend/src/routes.js @@ -73,6 +73,14 @@ export default new createRouter({ breadcrumb: [{ name: '?Server' }], }, }, + { + path: 'access', + name: 'ServerManageAccess', + component: Hosting.Access, + meta: { + breadcrumb: [{ name: '?Server' }], + }, + }, ], }, { diff --git a/apps/frontend/CLAUDE.md b/apps/frontend/CLAUDE.md index 9d0d05c4df..03515cbb31 100644 --- a/apps/frontend/CLAUDE.md +++ b/apps/frontend/CLAUDE.md @@ -40,4 +40,3 @@ These composables are deprecated and should not be used in new code: - **`useAsyncData`** - we use tanstack, not nuxt's built in async data utility. - **`useBaseFetch`** (`src/composables/fetch.js`) — legacy Labrinth fetch wrapper. Use `client.labrinth.*` modules instead. -- **`useServersFetch`** (`src/composables/servers/servers-fetch.ts`) — legacy Archon fetch wrapper with manual retry/circuit-breaker. Use `client.archon.*` modules instead — refer to the `packages/api-client/CLAUDE.md` for more information. diff --git a/apps/frontend/nuxt.config.ts b/apps/frontend/nuxt.config.ts index 45f1526eb4..f7f8a5296b 100644 --- a/apps/frontend/nuxt.config.ts +++ b/apps/frontend/nuxt.config.ts @@ -224,6 +224,7 @@ export default defineNuxtConfig({ globalThis.INTERCOM_APP_ID || 'ykeritl9', production: isProduction(), + cookieSecure: isProduction(), buildEnv: process.env.BUILD_ENV, preview: process.env.PREVIEW === 'true', featureFlagOverrides: getFeatureFlagOverrides(), diff --git a/apps/frontend/package.json b/apps/frontend/package.json index e835e9cfc9..fa2e751f4c 100644 --- a/apps/frontend/package.json +++ b/apps/frontend/package.json @@ -26,7 +26,7 @@ "@types/semver": "^7.7.1", "autoprefixer": "^10.4.19", "glob": "^10.2.7", - "nuxt": "^3.20.2", + "nuxt": "=3.20.2", "postcss": "^8.4.39", "prettier-plugin-tailwindcss": "^0.6.5", "sass": "^1.58.0", diff --git a/apps/frontend/src/components/ui/NotificationItem.vue b/apps/frontend/src/components/ui/NotificationItem.vue index 420e852424..4b27e5be76 100644 --- a/apps/frontend/src/components/ui/NotificationItem.vue +++ b/apps/frontend/src/components/ui/NotificationItem.vue @@ -1,52 +1,123 @@ + @@ -328,6 +400,7 @@ import { markAsRead } from '~/helpers/platform-notifications' import { getProjectLink, getVersionLink } from '~/helpers/projects' import { acceptTeamInvite, removeSelfFromTeam } from '~/helpers/teams' +import ModrinthServersIcon from '../brand/ModrinthServersIcon.vue' import ThreadSummary from './thread/ThreadSummary.vue' const client = injectModrinthClient() @@ -415,9 +488,25 @@ async function performAction(notification, actionIndex) { await read() if (actionIndex !== null) { - await useBaseFetch(`${notification.actions[actionIndex].action_route[1]}`, { - method: notification.actions[actionIndex].action_route[0].toUpperCase(), - }) + const [method, route] = notification.actions[actionIndex].action_route + + // TODO: fix all this jank shit + if (route.startsWith('hosting/') || route.startsWith('/hosting/')) { + const archonRoute = route + .replace(/^\/?hosting/, '') + .replace('/invite/accept', '/invites/accept') + .replace('/invite/deny', '/invites/decline') + + await client.request(archonRoute, { + api: 'archon', + version: 1, + method: method.toUpperCase(), + }) + } else { + await useBaseFetch(route, { + method: method.toUpperCase(), + }) + } } } catch (err) { addNotification({ @@ -429,6 +518,20 @@ async function performAction(notification, actionIndex) { stopLoading() } +function performActionByTitle(notification, title) { + const actionIndex = notification.actions.findIndex((action) => action.title === title) + if (actionIndex === -1) { + addNotification({ + title: 'An error occurred', + text: `Missing ${title.toLowerCase()} action for notification.`, + type: 'error', + }) + return + } + + return performAction(notification, actionIndex) +} + function getMessages() { const messages = [] if (props.notification.body.message_id) { diff --git a/apps/frontend/src/components/ui/admin/AssignNoticeModal.vue b/apps/frontend/src/components/ui/admin/AssignNoticeModal.vue index 4a303112a0..a52bb5c01e 100644 --- a/apps/frontend/src/components/ui/admin/AssignNoticeModal.vue +++ b/apps/frontend/src/components/ui/admin/AssignNoticeModal.vue @@ -1,20 +1,22 @@