fix: #6263 remove reserved prefix (#7033)

This commit is contained in:
Zachary Schaffter
2026-02-14 13:05:42 -08:00
committed by GitHub
parent 5aafb56c4f
commit 904e6b7d82
55 changed files with 158 additions and 158 deletions

View File

@@ -163,9 +163,9 @@ export default defineNuxtComponent({
});
const i18n = useI18n();
const $auth = useMealieAuth();
const auth = useMealieAuth();
const route = useRoute();
const groupSlug = computed(() => route.params.groupSlug || $auth.user.value?.groupSlug || "");
const groupSlug = computed(() => route.params.groupSlug || auth.user.value?.groupSlug || "");
const adminApi = useAdminApi();
const selected = ref("");

View File

@@ -112,9 +112,9 @@ export default defineNuxtComponent({
const api = useAdminApi();
const refUserDialog = ref();
const inviteDialog = ref();
const $auth = useMealieAuth();
const auth = useMealieAuth();
const user = computed(() => $auth.user.value);
const user = computed(() => auth.user.value);
const i18n = useI18n();
const { $globals } = useNuxtApp();
@@ -149,7 +149,7 @@ export default defineNuxtComponent({
deleteUserMixin(id);
if (isUserOwnAccount.value) {
$auth.refresh();
auth.refresh();
}
}

View File

@@ -262,11 +262,11 @@ definePageMeta({
// ================================================================
// Setup
const i18n = useI18n();
const $auth = useMealieAuth();
const auth = useMealieAuth();
const userApi = useUserApi();
const adminApi = useAdminApi();
const groupSlug = computed(() => $auth.user.value?.groupSlug);
const groupSlug = computed(() => auth.user.value?.groupSlug);
const { locale } = useLocales();
const router = useRouter();
const isSubmitting = ref(false);
@@ -347,9 +347,9 @@ const currentPage = ref(Pages.LANDING);
// Page Submission
async function updateUser() {
// Note: $auth.user is now a ref
const { response } = await userApi.users.updateOne($auth.user.value!.id, {
...$auth.user.value,
// Note: auth.user is now a ref
const { response } = await userApi.users.updateOne(auth.user.value!.id, {
...auth.user.value,
email: accountDetails.email.value,
username: accountDetails.username.value,
fullName: accountDetails.fullName.value,
@@ -360,7 +360,7 @@ async function updateUser() {
alert.error(i18n.t("events.something-went-wrong"));
}
else {
$auth.refresh();
auth.refresh();
}
}
@@ -381,8 +381,8 @@ async function submitRegistration() {
}
async function updateGroup() {
// Note: $auth.user is now a ref
const { data } = await userApi.groups.getOne($auth.user.value!.groupId);
// Note: auth.user is now a ref
const { data } = await userApi.groups.getOne(auth.user.value!.groupId);
if (!data || !data.preferences) {
alert.error(i18n.t("events.something-went-wrong"));
return;
@@ -398,16 +398,16 @@ async function updateGroup() {
preferences,
};
// Note: $auth.user is now a ref
const { response } = await userApi.groups.updateOne($auth.user.value!.groupId, payload);
// Note: auth.user is now a ref
const { response } = await userApi.groups.updateOne(auth.user.value!.groupId, payload);
if (!response || response.status !== 200) {
alert.error(i18n.t("events.something-went-wrong"));
}
}
async function updateHousehold() {
// Note: $auth.user is now a ref
const { data } = await adminApi.households.getOne($auth.user.value!.householdId);
// Note: auth.user is now a ref
const { data } = await adminApi.households.getOne(auth.user.value!.householdId);
if (!data || !data.preferences) {
alert.error(i18n.t("events.something-went-wrong"));
return;
@@ -424,8 +424,8 @@ async function updateHousehold() {
preferences,
};
// Note: $auth.user is now a ref
const { response } = await adminApi.households.updateOne($auth.user.value!.householdId, payload);
// Note: auth.user is now a ref
const { response } = await adminApi.households.updateOne(auth.user.value!.householdId, payload);
if (!response || response.status !== 200) {
alert.error(i18n.t("events.something-went-wrong"));
}

View File

@@ -159,7 +159,7 @@ export default defineNuxtComponent({
title: i18n.t("cookbook.cookbooks"),
});
const $auth = useMealieAuth();
const auth = useMealieAuth();
const { store: allCookbooks, actions, updateAll } = useCookbookStore();
// Make a local reactive copy of myCookbooks
@@ -169,7 +169,7 @@ export default defineNuxtComponent({
(cookbooks) => {
myCookbooks.value
= cookbooks?.filter(
cookbook => cookbook.householdId === $auth.user.value?.householdId,
cookbook => cookbook.householdId === auth.user.value?.householdId,
).sort((a, b) => a.position > b.position) ?? [];
},
{ immediate: true },

View File

@@ -16,7 +16,7 @@ import { usePublicExploreApi } from "~/composables/api/api-client";
import { useRecipe } from "~/composables/recipes";
import type { Recipe } from "~/lib/api/types/recipe";
const $auth = useMealieAuth();
const auth = useMealieAuth();
const { isOwnGroup } = useLoggedInState();
const route = useRoute();
const title = ref(route.meta?.title as string || "");
@@ -34,7 +34,7 @@ function loadRecipe() {
}
async function loadPublicRecipe() {
const groupSlug = computed(() => route.params.groupSlug as string || $auth.user.value?.groupSlug || "");
const groupSlug = computed(() => route.params.groupSlug as string || auth.user.value?.groupSlug || "");
const api = usePublicExploreApi(groupSlug.value);
const { data } = await useAsyncData(useAsyncKey(), async () => {
const { data, error } = await api.explore.recipes.getOne(slug);

View File

@@ -51,7 +51,7 @@ export default defineNuxtComponent({
middleware: ["group-only"],
setup() {
const i18n = useI18n();
const $auth = useMealieAuth();
const auth = useMealieAuth();
const { $appInfo, $globals } = useNuxtApp();
useSeoMeta({
@@ -99,7 +99,7 @@ export default defineNuxtComponent({
const route = useRoute();
const router = useRouter();
const groupSlug = computed(() => route.params.groupSlug || $auth.user.value?.groupSlug || "");
const groupSlug = computed(() => route.params.groupSlug || auth.user.value?.groupSlug || "");
const subpage = computed({
set(subpage: string) {

View File

@@ -112,9 +112,9 @@ export default defineNuxtComponent({
loading: false,
isEditJSON: false,
});
const $auth = useMealieAuth();
const auth = useMealieAuth();
const route = useRoute();
const groupSlug = computed(() => route.params.groupSlug as string || $auth.user.value?.groupSlug || "");
const groupSlug = computed(() => route.params.groupSlug as string || auth.user.value?.groupSlug || "");
const domUrlForm = ref<VForm | null>(null);
const api = useUserApi();

View File

@@ -53,9 +53,9 @@ export default defineNuxtComponent({
error: false,
loading: false,
});
const $auth = useMealieAuth();
const auth = useMealieAuth();
const route = useRoute();
const groupSlug = computed(() => route.params.groupSlug as string || $auth.user.value?.groupSlug || "");
const groupSlug = computed(() => route.params.groupSlug as string || auth.user.value?.groupSlug || "");
const api = useUserApi();
const router = useRouter();

View File

@@ -144,10 +144,10 @@ export default defineNuxtComponent({
loading: false,
});
const $auth = useMealieAuth();
const auth = useMealieAuth();
const api = useUserApi();
const route = useRoute();
const groupSlug = computed(() => route.params.groupSlug as string || $auth.user.value?.groupSlug || "");
const groupSlug = computed(() => route.params.groupSlug as string || auth.user.value?.groupSlug || "");
const router = useRouter();
const tags = useTagStore();

View File

@@ -47,9 +47,9 @@ export default defineNuxtComponent({
const state = reactive({
loading: false,
});
const $auth = useMealieAuth();
const auth = useMealieAuth();
const route = useRoute();
const groupSlug = computed(() => route.params.groupSlug as string || $auth.user.value?.groupSlug || "");
const groupSlug = computed(() => route.params.groupSlug as string || auth.user.value?.groupSlug || "");
const api = useUserApi();
const router = useRouter();

View File

@@ -436,7 +436,7 @@ export default defineNuxtComponent({
setup() {
const display = useDisplay();
const i18n = useI18n();
const $auth = useMealieAuth();
const auth = useMealieAuth();
const route = useRoute();
useSeoMeta({
@@ -445,7 +445,7 @@ export default defineNuxtComponent({
const useMobile = computed(() => display.smAndDown.value);
const groupSlug = computed(() => route.params.groupSlug as string || $auth.user.value?.groupSlug || "");
const groupSlug = computed(() => route.params.groupSlug as string || auth.user.value?.groupSlug || "");
const { isOwnGroup } = useLoggedInState();
const api = isOwnGroup.value ? useUserApi() : usePublicExploreApi(groupSlug.value).explore;

View File

@@ -30,7 +30,7 @@ export default defineNuxtComponent({
},
middleware: ["group-only"],
setup() {
const $auth = useMealieAuth();
const auth = useMealieAuth();
const toolStore = useToolStore();
const dialog = ref(false);
const i18n = useI18n();
@@ -39,7 +39,7 @@ export default defineNuxtComponent({
title: i18n.t("tool.tools"),
});
const userHousehold = computed(() => $auth.user.value?.householdSlug || "");
const userHousehold = computed(() => auth.user.value?.householdSlug || "");
const tools = computed(() => toolStore.store.value.map(tool => (
{
...tool,

View File

@@ -17,9 +17,9 @@ definePageMeta({
layout: "basic",
});
const $auth = useMealieAuth();
const auth = useMealieAuth();
const route = useRoute();
const groupSlug = computed(() => route.params.groupSlug as string || $auth.user.value?.groupSlug || "");
const groupSlug = computed(() => route.params.groupSlug as string || auth.user.value?.groupSlug || "");
const router = useRouter();
const recipeId = route.params.id as string;

View File

@@ -371,7 +371,7 @@ export default defineNuxtComponent({
setup() {
const userApi = useUserApi();
const i18n = useI18n();
const $auth = useMealieAuth();
const auth = useMealieAuth();
const tableConfig = {
hideColumns: true,
canExport: true,
@@ -424,7 +424,7 @@ export default defineNuxtComponent({
},
];
const userHousehold = computed(() => $auth.user.value?.householdSlug || "");
const userHousehold = computed(() => auth.user.value?.householdSlug || "");
const foodStore = useFoodStore();
const foods = computed(() => foodStore.store.value.map((food) => {
const onHand = food.householdsWithIngredientFood?.includes(userHousehold.value) || false;

View File

@@ -254,14 +254,14 @@ export default defineNuxtComponent({
scrollToTop: true,
setup() {
const i18n = useI18n();
const $auth = useMealieAuth();
const auth = useMealieAuth();
const { $globals } = useNuxtApp();
useSeoMeta({
title: i18n.t("data-pages.recipes.recipe-data"),
});
const { getAllRecipes, refreshRecipes } = useRecipes(true, true, false, `householdId=${$auth.user.value?.householdId || ""}`);
const { getAllRecipes, refreshRecipes } = useRecipes(true, true, false, `householdId=${auth.user.value?.householdId || ""}`);
const selected = ref<Recipe[]>([]);
function resetAll() {

View File

@@ -143,7 +143,7 @@ interface RecipeToolWithOnHand extends RecipeTool {
export default defineNuxtComponent({
setup() {
const i18n = useI18n();
const $auth = useMealieAuth();
const auth = useMealieAuth();
const tableConfig = {
hideColumns: true,
canExport: true,
@@ -175,7 +175,7 @@ export default defineNuxtComponent({
bulkDeleteDialog: false,
});
const userHousehold = computed(() => $auth.user.value?.householdSlug || "");
const userHousehold = computed(() => auth.user.value?.householdSlug || "");
const toolData = useToolData();
const toolStore = useToolStore();
const tools = computed(() => toolStore.store.value.map((tools) => {

View File

@@ -263,7 +263,7 @@ export default defineNuxtComponent({
},
setup(props) {
const api = useUserApi();
const $auth = useMealieAuth();
const auth = useMealieAuth();
const { household } = useHouseholdSelf();
const requiredRule = (value: any) => !!value || "Required.";
@@ -343,7 +343,7 @@ export default defineNuxtComponent({
existing: false,
id: 0,
groupId: "",
userId: $auth.user.value?.id || "",
userId: auth.user.value?.id || "",
});
const newMealDateString = computed(() => {
@@ -375,7 +375,7 @@ export default defineNuxtComponent({
newMeal.existing = true;
newMeal.id = id;
newMeal.groupId = groupId;
newMeal.userId = userId || $auth.user.value?.id || "";
newMeal.userId = userId || auth.user.value?.id || "";
state.value.dialog = true;
dialog.note = !recipeId;

View File

@@ -125,7 +125,7 @@ export default defineNuxtComponent({
UserAvatar,
},
setup() {
const $auth = useMealieAuth();
const auth = useMealieAuth();
const api = useUserApi();
const i18n = useI18n();
@@ -169,7 +169,7 @@ export default defineNuxtComponent({
await refreshMembers();
});
return { members, headers, setPermissions, sessionUser: $auth.user };
return { members, headers, setPermissions, sessionUser: auth.user };
},
});
</script>

View File

@@ -14,12 +14,12 @@ export default defineNuxtComponent({
layout: "blank",
});
const $auth = useMealieAuth();
const auth = useMealieAuth();
const { $axios } = useNuxtApp();
const router = useRouter();
const activityPreferences = useUserActivityPreferences();
const { getDefaultActivityRoute } = useDefaultActivity();
const groupSlug = computed(() => $auth.user.value?.groupSlug);
const groupSlug = computed(() => auth.user.value?.groupSlug);
async function redirectPublicUserToDefaultGroup() {
const { data } = await $axios.get<AppInfo>("/api/app/about");
@@ -40,7 +40,7 @@ export default defineNuxtComponent({
activityPreferences.value.defaultActivity,
groupSlug.value,
);
if (!isDemo && isFirstLogin && $auth.user.value?.admin) {
if (!isDemo && isFirstLogin && auth.user.value?.admin) {
router.push("/admin/setup");
}
else if (defaultActivityRoute) {

View File

@@ -228,10 +228,10 @@ export default defineNuxtComponent({
const router = useRouter();
const i18n = useI18n();
const $auth = useMealieAuth();
const auth = useMealieAuth();
const { $appInfo, $axios } = useNuxtApp();
const { loggedIn } = useLoggedInState();
const groupSlug = computed(() => $auth.user.value?.groupSlug);
const groupSlug = computed(() => auth.user.value?.groupSlug);
const isDemo = ref(false);
const isFirstLogin = ref(false);
const activityPreferences = useUserActivityPreferences();
@@ -265,7 +265,7 @@ export default defineNuxtComponent({
activityPreferences.value.defaultActivity,
groupSlug.value,
);
if (!isDemo.value && isFirstLogin.value && $auth.user.value?.admin) {
if (!isDemo.value && isFirstLogin.value && auth.user.value?.admin) {
router.push("/admin/setup");
}
else if (defaultActivityRoute) {
@@ -284,7 +284,7 @@ export default defineNuxtComponent({
const { passwordIcon, inputType, togglePasswordShow } = usePasswordField();
whenever(
() => $appInfo.enableOidc && $appInfo.oidcRedirect && !isCallback() && !isDirectLogin() /* && !$auth.check().valid */,
() => $appInfo.enableOidc && $appInfo.oidcRedirect && !isCallback() && !isDirectLogin() /* && !auth.check().valid */,
() => oidcAuthenticate(),
{ immediate: true },
);
@@ -309,7 +309,7 @@ export default defineNuxtComponent({
if (callback) {
oidcLoggingIn.value = true;
try {
await $auth.oauthSignIn();
await auth.oauthSignIn();
}
catch (error) {
await router.replace("/login?direct=1");
@@ -335,7 +335,7 @@ export default defineNuxtComponent({
formData.append("remember_me", String(form.remember));
try {
await $auth.signIn(formData);
await auth.signIn(formData);
}
catch (error) {
console.log(error);

View File

@@ -353,7 +353,7 @@ export default defineNuxtComponent({
setup() {
const { mdAndUp } = useDisplay();
const i18n = useI18n();
const $auth = useMealieAuth();
const auth = useMealieAuth();
const preferences = useShoppingListPreferences();
useSeoMeta({
@@ -361,7 +361,7 @@ export default defineNuxtComponent({
});
const route = useRoute();
const groupSlug = computed(() => route.params.groupSlug as string || $auth.user.value?.groupSlug || "");
const groupSlug = computed(() => route.params.groupSlug as string || auth.user.value?.groupSlug || "");
const id = route.params.id as string;
const shoppingListPage = useShoppingListPage(id);

View File

@@ -132,7 +132,7 @@ import type { UserOut } from "~/lib/api/types/user";
export default defineNuxtComponent({
setup() {
const $auth = useMealieAuth();
const auth = useMealieAuth();
const i18n = useI18n();
const ready = ref(false);
const userApi = useUserApi();
@@ -142,7 +142,7 @@ export default defineNuxtComponent({
title: i18n.t("shopping-list.shopping-list"),
});
const groupSlug = computed(() => route.params.groupSlug || $auth.user.value?.groupSlug || "");
const groupSlug = computed(() => route.params.groupSlug || auth.user.value?.groupSlug || "");
const overrideDisableRedirect = ref(false);
const disableRedirect = computed(() => route.query.disableRedirect === "true" || overrideDisableRedirect.value);
const preferences = useShoppingListPreferences();
@@ -165,7 +165,7 @@ export default defineNuxtComponent({
return [];
}
return shoppingLists.value.filter(list => preferences.value.viewAllLists || list.userId === $auth.user.value?.id);
return shoppingLists.value.filter(list => preferences.value.viewAllLists || list.userId === auth.user.value?.id);
});
// This has to appear before the shoppingListChoices watcher, otherwise that runs first and the redirect is not disabled

View File

@@ -114,14 +114,14 @@ export default defineNuxtComponent({
middleware: ["advanced-only"],
setup() {
const i18n = useI18n();
const $auth = useMealieAuth();
const auth = useMealieAuth();
useSeoMeta({
title: i18n.t("settings.token.api-tokens"),
});
const user = computed(() => {
return $auth.user.value;
return auth.user.value;
});
const api = useUserApi();
@@ -136,7 +136,7 @@ export default defineNuxtComponent({
createdToken.value = "";
loading.value = false;
name.value = "";
$auth.refresh();
auth.refresh();
}
async function createToken(name: string) {
@@ -161,7 +161,7 @@ export default defineNuxtComponent({
async function deleteToken(id: number) {
const { data } = await api.users.deleteAPIToken(id);
$auth.refresh();
auth.refresh();
return data;
}

View File

@@ -13,7 +13,7 @@
file-name="profile"
accept="image/*"
:url="`/api/users/${userCopy.id}/image`"
@uploaded="$auth.refresh()"
@uploaded="auth.refresh()"
/>
</div>
</template>
@@ -231,9 +231,9 @@ export default defineNuxtComponent({
},
setup() {
const i18n = useI18n();
const $auth = useMealieAuth();
const auth = useMealieAuth();
const { getDefaultActivityLabels, getActivityLabel, getActivityKey } = useDefaultActivity();
const user = computed(() => $auth.user.value);
const user = computed(() => auth.user.value);
useSeoMeta({
title: i18n.t("settings.profile"),
@@ -267,7 +267,7 @@ export default defineNuxtComponent({
if (!userCopy.value?.id) return;
const { response } = await api.users.updateOne(userCopy.value.id, userCopy.value);
if (response?.status === 200) {
$auth.refresh();
auth.refresh();
}
}
@@ -303,7 +303,7 @@ export default defineNuxtComponent({
domUpdatePassword,
passwordsMatch,
validators,
$auth,
auth,
};
},
});

View File

@@ -294,17 +294,17 @@ export default defineNuxtComponent({
scrollToTop: true,
async setup() {
const i18n = useI18n();
const $auth = useMealieAuth();
const auth = useMealieAuth();
const { $appInfo } = useNuxtApp();
const route = useRoute();
const groupSlug = computed(() => route.params.groupSlug || $auth.user.value?.groupSlug || "");
const groupSlug = computed(() => route.params.groupSlug || auth.user.value?.groupSlug || "");
useSeoMeta({
title: i18n.t("settings.profile"),
});
const user = computed<UserOut | null>(() => {
const authUser = $auth.user.value;
const authUser = auth.user.value;
if (!authUser) return null;
// Override canInvite if password login is disabled