diff --git a/packages/backend/src/server/api/endpoints/i.ts b/packages/backend/src/server/api/endpoints/i.ts index ac7675a81..a3df7d498 100644 --- a/packages/backend/src/server/api/endpoints/i.ts +++ b/packages/backend/src/server/api/endpoints/i.ts @@ -41,7 +41,7 @@ export default define(meta, paramDef, async (ps, user, token) => { userProfile.loggedInDates = [...userProfile.loggedInDates, today]; } - return await Users.pack(userProfile.user!, userProfile.user!, { + return await Users.pack(user.id, user, { detail: true, includeSecrets: isSecure, userProfile, diff --git a/packages/backend/src/server/api/endpoints/latest-version.ts b/packages/backend/src/server/api/endpoints/latest-version.ts index 163b63b26..2883772d7 100644 --- a/packages/backend/src/server/api/endpoints/latest-version.ts +++ b/packages/backend/src/server/api/endpoints/latest-version.ts @@ -21,9 +21,13 @@ export default define(meta, paramDef, async () => { ) .then((response) => response.json()) .then((data) => { - tag_name = data[0].tag_name; + if (data.length > 0) + tag_name = data[0].tag_name ?? undefined; }); + if (!tag_name) + throw new Error('Could not fetch latest release information. Please check manually if your release of TrashPoss is up to date.'); + return { tag_name, }; diff --git a/packages/client/src/ui/_common_/navbar.vue b/packages/client/src/ui/_common_/navbar.vue index bfa28474d..5a87ec85a 100644 --- a/packages/client/src/ui/_common_/navbar.vue +++ b/packages/client/src/ui/_common_/navbar.vue @@ -83,8 +83,7 @@ v-if=" thereIsUnresolvedAbuseReport || noMaintainerInformation || - noBotProtection || - updateAvailable + noBotProtection " class="indicator" > @@ -148,7 +147,6 @@ import { defaultStore } from "@/store"; import { i18n } from "@/i18n"; import { instance } from "@/instance"; import { version } from "@/config"; -import { isUpdateAvailable } from "@/scripts/is-update-available.js"; const isEmpty = (x: string | null) => x == null || x === ""; @@ -184,7 +182,6 @@ let noBotProtection = !instance.enableHcaptcha && !instance.enableRecaptcha; let thereIsUnresolvedAbuseReport = $ref(false); -let updateAvailable = $ref(false); if ($i?.isAdmin) { os.api("admin/abuse-user-reports", { @@ -193,12 +190,6 @@ if ($i?.isAdmin) { }).then((reports) => { if (reports?.length > 0) thereIsUnresolvedAbuseReport = true; }); - - if (defaultStore.state.showAdminUpdates) { - isUpdateAvailable().then(res => { - updateAvailable = res; - }); - } } function openAccountMenu(ev: MouseEvent) {