Compare commits

..

9 Commits

Author SHA1 Message Date
Hayden
4967d24af9 New translations en-us.json (Swedish)
[ci skip]
2026-05-16 03:21:02 -05:00
Hayden
4e767b25d3 New translations en-us.json (Ukrainian)
[ci skip]
2026-05-14 13:26:20 -05:00
Hayden
ff783a766e New translations en-us.json (Polish)
[ci skip]
2026-05-14 13:26:19 -05:00
Hayden
3ff732439a New translations en-us.json (Polish)
[ci skip]
2026-05-14 13:26:17 -05:00
Hayden
5f72724d2d New translations en-us.json (Norwegian)
[ci skip]
2026-05-13 12:39:01 -05:00
Hayden
5dc98e8e7e New translations en-us.json (Norwegian)
[ci skip]
2026-05-13 12:38:59 -05:00
Hayden
eaf3a1b9bd New translations en-us.json (Slovenian)
[ci skip]
2026-05-13 00:32:09 -05:00
Hayden
f7e4d5ad99 New translations en-us.json (Norwegian)
[ci skip]
2026-05-13 00:32:07 -05:00
Hayden
04b975b779 New translations en-us.json (Norwegian)
[ci skip]
2026-05-13 00:32:06 -05:00
30 changed files with 105 additions and 295 deletions

View File

@@ -321,7 +321,7 @@ async function consolidateRecipesIntoSections(recipes: RecipeWithScale[]) {
const householdsWithFood = subIng.food?.householdsWithIngredientFood || []; const householdsWithFood = subIng.food?.householdsWithIngredientFood || [];
ownIngs.push({ ownIngs.push({
checked: !householdsWithFood.includes(currentHouseholdSlug.value), checked: !householdsWithFood.includes(currentHouseholdSlug.value),
ingredient: subIng, ingredient: { ...subIng, quantity: (ing.quantity || 1) * (subIng.quantity || 1) },
}); });
} }
} }

View File

@@ -13,10 +13,9 @@ describe("useStoreActions", () => {
const mockStore = ref([]); const mockStore = ref([]);
const mockLoading = ref(false); const mockLoading = ref(false);
const mockInitialized = ref(false);
test("deleteMany calls deleteOne for each ID and refreshes once", async () => { test("deleteMany calls deleteOne for each ID and refreshes once", async () => {
const actions = useStoreActions("test-store", mockApi, mockStore, mockLoading, mockInitialized); const actions = useStoreActions("test-store", mockApi, mockStore, mockLoading);
mockApi.deleteOne = vi.fn().mockResolvedValue({ response: { data: {} } }); mockApi.deleteOne = vi.fn().mockResolvedValue({ response: { data: {} } });
mockApi.getAll = vi.fn().mockResolvedValue({ data: { items: [] } }); mockApi.getAll = vi.fn().mockResolvedValue({ data: { items: [] } });
@@ -33,7 +32,7 @@ describe("useStoreActions", () => {
}); });
test("deleteMany handles empty array", async () => { test("deleteMany handles empty array", async () => {
const actions = useStoreActions("test-store", mockApi, mockStore, mockLoading, mockInitialized); const actions = useStoreActions("test-store", mockApi, mockStore, mockLoading);
mockApi.deleteOne = vi.fn(); mockApi.deleteOne = vi.fn();
mockApi.getAll = vi.fn().mockResolvedValue({ data: { items: [] } }); mockApi.getAll = vi.fn().mockResolvedValue({ data: { items: [] } });
@@ -45,7 +44,7 @@ describe("useStoreActions", () => {
}); });
test("deleteMany sets loading state", async () => { test("deleteMany sets loading state", async () => {
const actions = useStoreActions("test-store", mockApi, mockStore, mockLoading, mockInitialized); const actions = useStoreActions("test-store", mockApi, mockStore, mockLoading);
mockApi.deleteOne = vi.fn().mockResolvedValue({}); mockApi.deleteOne = vi.fn().mockResolvedValue({});
mockApi.getAll = vi.fn().mockResolvedValue({ data: { items: [] } }); mockApi.getAll = vi.fn().mockResolvedValue({ data: { items: [] } });
@@ -56,25 +55,4 @@ describe("useStoreActions", () => {
await promise; await promise;
expect(mockLoading.value).toBe(false); expect(mockLoading.value).toBe(false);
}); });
test("refresh sets initialized to true even when store returns empty results", async () => {
const localInitialized = ref(false);
const actions = useStoreActions("test-store", mockApi, mockStore, mockLoading, localInitialized);
mockApi.getAll = vi.fn().mockResolvedValue({ data: { items: [] } });
expect(localInitialized.value).toBe(false);
await actions.refresh();
expect(localInitialized.value).toBe(true);
});
test("refresh sets initialized to true when store returns items", async () => {
const localInitialized = ref(false);
const actions = useStoreActions("test-store", mockApi, mockStore, mockLoading, localInitialized);
mockApi.getAll = vi.fn().mockResolvedValue({ data: { items: [{ id: "1", name: "item" }] } });
await actions.refresh();
expect(localInitialized.value).toBe(true);
});
}); });

View File

@@ -26,7 +26,6 @@ export function useReadOnlyActions<T extends BoundT>(
api: BaseCRUDAPIReadOnly<T>, api: BaseCRUDAPIReadOnly<T>,
allRef: Ref<T[] | null> | null, allRef: Ref<T[] | null> | null,
loading: Ref<boolean>, loading: Ref<boolean>,
initialized: Ref<boolean>,
defaultQueryParams: Record<string, QueryValue> = {}, defaultQueryParams: Record<string, QueryValue> = {},
): ReadOnlyStoreActions<T> { ): ReadOnlyStoreActions<T> {
function getAll(page = 1, perPage = -1, params = {} as Record<string, QueryValue>) { function getAll(page = 1, perPage = -1, params = {} as Record<string, QueryValue>) {
@@ -70,7 +69,6 @@ export function useReadOnlyActions<T extends BoundT>(
allRef.value = data.items; allRef.value = data.items;
} }
initialized.value = true;
loading.value = false; loading.value = false;
} }
@@ -91,7 +89,6 @@ export function useStoreActions<T extends BoundT>(
api: BaseCRUDAPI<unknown, T, unknown>, api: BaseCRUDAPI<unknown, T, unknown>,
allRef: Ref<T[] | null> | null, allRef: Ref<T[] | null> | null,
loading: Ref<boolean>, loading: Ref<boolean>,
initialized: Ref<boolean>,
defaultQueryParams: Record<string, QueryValue> = {}, defaultQueryParams: Record<string, QueryValue> = {},
): StoreActions<T> { ): StoreActions<T> {
function getAll(page = 1, perPage = -1, params = {} as Record<string, QueryValue>) { function getAll(page = 1, perPage = -1, params = {} as Record<string, QueryValue>) {
@@ -135,7 +132,6 @@ export function useStoreActions<T extends BoundT>(
allRef.value = data.items; allRef.value = data.items;
} }
initialized.value = true;
loading.value = false; loading.value = false;
} }

View File

@@ -16,11 +16,10 @@ export const useReadOnlyStore = function <T extends BoundT>(
storeKey: string, storeKey: string,
store: Ref<T[]>, store: Ref<T[]>,
loading: Ref<boolean>, loading: Ref<boolean>,
initialized: Ref<boolean>,
api: BaseCRUDAPIReadOnly<T>, api: BaseCRUDAPIReadOnly<T>,
params = {} as Record<string, QueryValue>, params = {} as Record<string, QueryValue>,
) { ) {
const storeActions = useReadOnlyActions(`${storeKey}-store-readonly`, api, store, loading, initialized); const storeActions = useReadOnlyActions(`${storeKey}-store-readonly`, api, store, loading);
const actions = { const actions = {
...storeActions, ...storeActions,
async refresh() { async refresh() {
@@ -28,12 +27,11 @@ export const useReadOnlyStore = function <T extends BoundT>(
}, },
flushStore() { flushStore() {
store.value = []; store.value = [];
initialized.value = false;
}, },
}; };
// initial hydration // initial hydration
if (!loading.value && !initialized.value) { if (!loading.value && !store.value.length) {
actions.refresh(); actions.refresh();
} }
@@ -44,11 +42,10 @@ export const useStore = function <T extends BoundT>(
storeKey: string, storeKey: string,
store: Ref<T[]>, store: Ref<T[]>,
loading: Ref<boolean>, loading: Ref<boolean>,
initialized: Ref<boolean>,
api: BaseCRUDAPI<unknown, T, unknown>, api: BaseCRUDAPI<unknown, T, unknown>,
params = {} as Record<string, QueryValue>, params = {} as Record<string, QueryValue>,
) { ) {
const storeActions = useStoreActions(`${storeKey}-store`, api, store, loading, initialized); const storeActions = useStoreActions(`${storeKey}-store`, api, store, loading);
const actions = { const actions = {
...storeActions, ...storeActions,
async refresh() { async refresh() {
@@ -56,12 +53,11 @@ export const useStore = function <T extends BoundT>(
}, },
flushStore() { flushStore() {
store.value = []; store.value = [];
initialized.value = false;
}, },
}; };
// initial hydration // initial hydration
if (!loading.value && !initialized.value) { if (!loading.value && !store.value.length) {
actions.refresh(); actions.refresh();
} }

View File

@@ -5,16 +5,12 @@ import { usePublicExploreApi, useUserApi } from "~/composables/api";
const store: Ref<RecipeCategory[]> = ref([]); const store: Ref<RecipeCategory[]> = ref([]);
const loading = ref(false); const loading = ref(false);
const initialized = ref(false);
const publicLoading = ref(false); const publicLoading = ref(false);
const publicInitialized = ref(false);
export function resetCategoryStore() { export function resetCategoryStore() {
store.value = []; store.value = [];
loading.value = false; loading.value = false;
initialized.value = false;
publicLoading.value = false; publicLoading.value = false;
publicInitialized.value = false;
} }
export const useCategoryData = function () { export const useCategoryData = function () {
@@ -27,10 +23,10 @@ export const useCategoryData = function () {
export const useCategoryStore = function (i18n?: Composer) { export const useCategoryStore = function (i18n?: Composer) {
const api = useUserApi(i18n); const api = useUserApi(i18n);
return useStore<RecipeCategory>("category", store, loading, initialized, api.categories); return useStore<RecipeCategory>("category", store, loading, api.categories);
}; };
export const usePublicCategoryStore = function (groupSlug: string, i18n?: Composer) { export const usePublicCategoryStore = function (groupSlug: string, i18n?: Composer) {
const api = usePublicExploreApi(groupSlug, i18n).explore; const api = usePublicExploreApi(groupSlug, i18n).explore;
return useReadOnlyStore<RecipeCategory>("category", store, publicLoading, publicInitialized, api.categories); return useReadOnlyStore<RecipeCategory>("category", store, publicLoading, api.categories);
}; };

View File

@@ -5,21 +5,17 @@ import { usePublicExploreApi, useUserApi } from "~/composables/api";
const cookbooks: Ref<ReadCookBook[]> = ref([]); const cookbooks: Ref<ReadCookBook[]> = ref([]);
const loading = ref(false); const loading = ref(false);
const initialized = ref(false);
const publicLoading = ref(false); const publicLoading = ref(false);
const publicInitialized = ref(false);
export function resetCookbookStore() { export function resetCookbookStore() {
cookbooks.value = []; cookbooks.value = [];
loading.value = false; loading.value = false;
initialized.value = false;
publicLoading.value = false; publicLoading.value = false;
publicInitialized.value = false;
} }
export const useCookbookStore = function (i18n?: Composer) { export const useCookbookStore = function (i18n?: Composer) {
const api = useUserApi(i18n); const api = useUserApi(i18n);
const store = useStore<ReadCookBook>("cookbook", cookbooks, loading, initialized, api.cookbooks); const store = useStore<ReadCookBook>("cookbook", cookbooks, loading, api.cookbooks);
const updateAll = async function (updateData: UpdateCookBook[]) { const updateAll = async function (updateData: UpdateCookBook[]) {
loading.value = true; loading.value = true;
@@ -35,5 +31,5 @@ export const useCookbookStore = function (i18n?: Composer) {
export const usePublicCookbookStore = function (groupSlug: string, i18n?: Composer) { export const usePublicCookbookStore = function (groupSlug: string, i18n?: Composer) {
const api = usePublicExploreApi(groupSlug, i18n).explore; const api = usePublicExploreApi(groupSlug, i18n).explore;
return useReadOnlyStore<ReadCookBook>("cookbook", cookbooks, publicLoading, publicInitialized, api.cookbooks); return useReadOnlyStore<ReadCookBook>("cookbook", cookbooks, publicLoading, api.cookbooks);
}; };

View File

@@ -5,16 +5,12 @@ import { usePublicExploreApi, useUserApi } from "~/composables/api";
const store: Ref<IngredientFood[]> = ref([]); const store: Ref<IngredientFood[]> = ref([]);
const loading = ref(false); const loading = ref(false);
const initialized = ref(false);
const publicLoading = ref(false); const publicLoading = ref(false);
const publicInitialized = ref(false);
export function resetFoodStore() { export function resetFoodStore() {
store.value = []; store.value = [];
loading.value = false; loading.value = false;
initialized.value = false;
publicLoading.value = false; publicLoading.value = false;
publicInitialized.value = false;
} }
export const useFoodData = function () { export const useFoodData = function () {
@@ -28,10 +24,10 @@ export const useFoodData = function () {
export const useFoodStore = function (i18n?: Composer) { export const useFoodStore = function (i18n?: Composer) {
const api = useUserApi(i18n); const api = useUserApi(i18n);
return useStore<IngredientFood>("food", store, loading, initialized, api.foods); return useStore<IngredientFood>("food", store, loading, api.foods);
}; };
export const usePublicFoodStore = function (groupSlug: string, i18n?: Composer) { export const usePublicFoodStore = function (groupSlug: string, i18n?: Composer) {
const api = usePublicExploreApi(groupSlug, i18n).explore; const api = usePublicExploreApi(groupSlug, i18n).explore;
return useReadOnlyStore<IngredientFood>("food", store, publicLoading, publicInitialized, api.foods); return useReadOnlyStore<IngredientFood>("food", store, publicLoading, api.foods);
}; };

View File

@@ -5,24 +5,20 @@ import { usePublicExploreApi, useUserApi } from "~/composables/api";
const store: Ref<HouseholdSummary[]> = ref([]); const store: Ref<HouseholdSummary[]> = ref([]);
const loading = ref(false); const loading = ref(false);
const initialized = ref(false);
const publicLoading = ref(false); const publicLoading = ref(false);
const publicInitialized = ref(false);
export function resetHouseholdStore() { export function resetHouseholdStore() {
store.value = []; store.value = [];
loading.value = false; loading.value = false;
initialized.value = false;
publicLoading.value = false; publicLoading.value = false;
publicInitialized.value = false;
} }
export const useHouseholdStore = function (i18n?: Composer) { export const useHouseholdStore = function (i18n?: Composer) {
const api = useUserApi(i18n); const api = useUserApi(i18n);
return useReadOnlyStore<HouseholdSummary>("household", store, loading, initialized, api.households); return useReadOnlyStore<HouseholdSummary>("household", store, loading, api.households);
}; };
export const usePublicHouseholdStore = function (groupSlug: string, i18n?: Composer) { export const usePublicHouseholdStore = function (groupSlug: string, i18n?: Composer) {
const api = usePublicExploreApi(groupSlug, i18n).explore; const api = usePublicExploreApi(groupSlug, i18n).explore;
return useReadOnlyStore<HouseholdSummary>("household-public", store, publicLoading, publicInitialized, api.households); return useReadOnlyStore<HouseholdSummary>("household-public", store, publicLoading, api.households);
}; };

View File

@@ -5,12 +5,10 @@ import { useUserApi } from "~/composables/api";
const store: Ref<MultiPurposeLabelOut[]> = ref([]); const store: Ref<MultiPurposeLabelOut[]> = ref([]);
const loading = ref(false); const loading = ref(false);
const initialized = ref(false);
export function resetLabelStore() { export function resetLabelStore() {
store.value = []; store.value = [];
loading.value = false; loading.value = false;
initialized.value = false;
} }
export const useLabelData = function () { export const useLabelData = function () {
@@ -24,5 +22,5 @@ export const useLabelData = function () {
export const useLabelStore = function (i18n?: Composer) { export const useLabelStore = function (i18n?: Composer) {
const api = useUserApi(i18n); const api = useUserApi(i18n);
return useStore<MultiPurposeLabelOut>("label", store, loading, initialized, api.multiPurposeLabels); return useStore<MultiPurposeLabelOut>("label", store, loading, api.multiPurposeLabels);
}; };

View File

@@ -5,16 +5,12 @@ import { usePublicExploreApi, useUserApi } from "~/composables/api";
const store: Ref<RecipeTag[]> = ref([]); const store: Ref<RecipeTag[]> = ref([]);
const loading = ref(false); const loading = ref(false);
const initialized = ref(false);
const publicLoading = ref(false); const publicLoading = ref(false);
const publicInitialized = ref(false);
export function resetTagStore() { export function resetTagStore() {
store.value = []; store.value = [];
loading.value = false; loading.value = false;
initialized.value = false;
publicLoading.value = false; publicLoading.value = false;
publicInitialized.value = false;
} }
export const useTagData = function () { export const useTagData = function () {
@@ -27,10 +23,10 @@ export const useTagData = function () {
export const useTagStore = function (i18n?: Composer) { export const useTagStore = function (i18n?: Composer) {
const api = useUserApi(i18n); const api = useUserApi(i18n);
return useStore<RecipeTag>("tag", store, loading, initialized, api.tags); return useStore<RecipeTag>("tag", store, loading, api.tags);
}; };
export const usePublicTagStore = function (groupSlug: string, i18n?: Composer) { export const usePublicTagStore = function (groupSlug: string, i18n?: Composer) {
const api = usePublicExploreApi(groupSlug, i18n).explore; const api = usePublicExploreApi(groupSlug, i18n).explore;
return useReadOnlyStore<RecipeTag>("tag", store, publicLoading, publicInitialized, api.tags); return useReadOnlyStore<RecipeTag>("tag", store, publicLoading, api.tags);
}; };

View File

@@ -9,16 +9,12 @@ interface RecipeToolWithOnHand extends RecipeTool {
const store: Ref<RecipeTool[]> = ref([]); const store: Ref<RecipeTool[]> = ref([]);
const loading = ref(false); const loading = ref(false);
const initialized = ref(false);
const publicLoading = ref(false); const publicLoading = ref(false);
const publicInitialized = ref(false);
export function resetToolStore() { export function resetToolStore() {
store.value = []; store.value = [];
loading.value = false; loading.value = false;
initialized.value = false;
publicLoading.value = false; publicLoading.value = false;
publicInitialized.value = false;
} }
export const useToolData = function () { export const useToolData = function () {
@@ -33,10 +29,10 @@ export const useToolData = function () {
export const useToolStore = function (i18n?: Composer) { export const useToolStore = function (i18n?: Composer) {
const api = useUserApi(i18n); const api = useUserApi(i18n);
return useStore<RecipeTool>("tool", store, loading, initialized, api.tools); return useStore<RecipeTool>("tool", store, loading, api.tools);
}; };
export const usePublicToolStore = function (groupSlug: string, i18n?: Composer) { export const usePublicToolStore = function (groupSlug: string, i18n?: Composer) {
const api = usePublicExploreApi(groupSlug, i18n).explore; const api = usePublicExploreApi(groupSlug, i18n).explore;
return useReadOnlyStore<RecipeTool>("tool", store, publicLoading, publicInitialized, api.tools); return useReadOnlyStore<RecipeTool>("tool", store, publicLoading, api.tools);
}; };

View File

@@ -5,12 +5,10 @@ import { useUserApi } from "~/composables/api";
const store: Ref<IngredientUnit[]> = ref([]); const store: Ref<IngredientUnit[]> = ref([]);
const loading = ref(false); const loading = ref(false);
const initialized = ref(false);
export function resetUnitStore() { export function resetUnitStore() {
store.value = []; store.value = [];
loading.value = false; loading.value = false;
initialized.value = false;
} }
export const useUnitData = function () { export const useUnitData = function () {
@@ -25,5 +23,5 @@ export const useUnitData = function () {
export const useUnitStore = function (i18n?: Composer) { export const useUnitStore = function (i18n?: Composer) {
const api = useUserApi(i18n); const api = useUserApi(i18n);
return useStore<IngredientUnit>("unit", store, loading, initialized, api.units); return useStore<IngredientUnit>("unit", store, loading, api.units);
}; };

View File

@@ -6,12 +6,10 @@ import { BaseCRUDAPIReadOnly } from "~/lib/api/base/base-clients";
const store: Ref<UserSummary[]> = ref([]); const store: Ref<UserSummary[]> = ref([]);
const loading = ref(false); const loading = ref(false);
const initialized = ref(false);
export function resetUserStore() { export function resetUserStore() {
store.value = []; store.value = [];
loading.value = false; loading.value = false;
initialized.value = false;
} }
class GroupUserAPIReadOnly extends BaseCRUDAPIReadOnly<UserSummary> { class GroupUserAPIReadOnly extends BaseCRUDAPIReadOnly<UserSummary> {
@@ -23,5 +21,5 @@ export const useUserStore = function (i18n?: Composer) {
const requests = useRequests(i18n); const requests = useRequests(i18n);
const api = new GroupUserAPIReadOnly(requests); const api = new GroupUserAPIReadOnly(requests);
return useReadOnlyStore<UserSummary>("user", store, loading, initialized, api, { orderBy: "full_name" }); return useReadOnlyStore<UserSummary>("user", store, loading, api, { orderBy: "full_name" });
}; };

View File

@@ -98,7 +98,7 @@
"dashboard": "Kontrollpanel", "dashboard": "Kontrollpanel",
"delete": "Slett", "delete": "Slett",
"disabled": "Deaktivert", "disabled": "Deaktivert",
"done": "Done", "done": "Ferdig",
"download": "Last ned", "download": "Last ned",
"duplicate": "Dupliser", "duplicate": "Dupliser",
"edit": "Rediger", "edit": "Rediger",
@@ -169,7 +169,7 @@
"token": "Token", "token": "Token",
"tuesday": "Tirsdag", "tuesday": "Tirsdag",
"type": "Type", "type": "Type",
"undo": "Undo", "undo": "Angre",
"update": "Oppdater", "update": "Oppdater",
"updated": "Oppdatert", "updated": "Oppdatert",
"upload": "Last opp", "upload": "Last opp",
@@ -334,7 +334,7 @@
"no-meal-plan-defined-yet": "Ingen måltidsplan er definert ennå", "no-meal-plan-defined-yet": "Ingen måltidsplan er definert ennå",
"no-meal-planned-for-today": "Ingen måltid planlagt i dag", "no-meal-planned-for-today": "Ingen måltid planlagt i dag",
"numberOfDaysPast-hint": "Number of days in the past on page load", "numberOfDaysPast-hint": "Number of days in the past on page load",
"numberOfDaysPast-label": "Default Days in the Past", "numberOfDaysPast-label": "Standard antall dager tilbake",
"numberOfDays-hint": "Antall dager på sideinnlasting", "numberOfDays-hint": "Antall dager på sideinnlasting",
"numberOfDays-label": "Standard antall dager", "numberOfDays-label": "Standard antall dager",
"only-recipes-with-these-categories-will-be-used-in-meal-plans": "Kun oppskrifter med disse kategoriene vil bli brukt i måltidsplaner", "only-recipes-with-these-categories-will-be-used-in-meal-plans": "Kun oppskrifter med disse kategoriene vil bli brukt i måltidsplaner",
@@ -392,7 +392,7 @@
"nextcloud": { "nextcloud": {
"description": "Overfør data fra en Nextcloud Cookbook-instans", "description": "Overfør data fra en Nextcloud Cookbook-instans",
"description-long": "Oppskrifter fra Nextcloud kan importeres fra en zip-fil som inneholder dataene lagret i Nextcloud. Se eksempelet på mappestrukture nedenfor for å sikre at oppskriftene kan importeres.", "description-long": "Oppskrifter fra Nextcloud kan importeres fra en zip-fil som inneholder dataene lagret i Nextcloud. Se eksempelet på mappestrukture nedenfor for å sikre at oppskriftene kan importeres.",
"title": "Nextcloud Cookbook" "title": "Nextcloud kokebok"
}, },
"copymethat": { "copymethat": {
"description-long": "Mealie kan importere oppskrifter fra Copy Me That. Eksporter oppskrifter i HTML-format, last deretter opp .zip-filen under.", "description-long": "Mealie kan importere oppskrifter fra Copy Me That. Eksporter oppskrifter i HTML-format, last deretter opp .zip-filen under.",
@@ -917,7 +917,7 @@
"quantity": "Antall: {0}", "quantity": "Antall: {0}",
"shopping-list": "Handleliste", "shopping-list": "Handleliste",
"shopping-lists": "Handlelister", "shopping-lists": "Handlelister",
"add-item": "Add item", "add-item": "Legg til produkt",
"food": "Matvare", "food": "Matvare",
"note": "Notat", "note": "Notat",
"label": "Etikett", "label": "Etikett",
@@ -943,7 +943,7 @@
"are-you-sure-you-want-to-uncheck-all-items": "Er du sikker på at du vil fjerne valg av alle elementer?", "are-you-sure-you-want-to-uncheck-all-items": "Er du sikker på at du vil fjerne valg av alle elementer?",
"are-you-sure-you-want-to-delete-checked-items": "Er du sikker på at du vil slette alle valgte elementer?", "are-you-sure-you-want-to-delete-checked-items": "Er du sikker på at du vil slette alle valgte elementer?",
"no-shopping-lists-found": "Ingen handlelister funnet", "no-shopping-lists-found": "Ingen handlelister funnet",
"item-checked-off": "Checked off {item}" "item-checked-off": "Avkrysset av {item}"
}, },
"sidebar": { "sidebar": {
"all-recipes": "Alle oppskrifter", "all-recipes": "Alle oppskrifter",
@@ -1478,10 +1478,10 @@
"max-length": "Må være minst minst {max} tegn må bestå av maks {max} tegn" "max-length": "Må være minst minst {max} tegn må bestå av maks {max} tegn"
}, },
"announcements": { "announcements": {
"announcements": "Announcements", "announcements": "Kunngjøringer",
"all-announcements": "All announcements", "all-announcements": "Alle kunngjøringer",
"mark-all-as-read": "Mark All as Read", "mark-all-as-read": "Marker alle som lest",
"show-announcements-from-mealie": "Show announcements from Mealie", "show-announcements-from-mealie": "Vis kunngjøringer fra Mealie",
"show-announcements-setting-description": "Whether or not you want to allow users to see announcements from Mealie. When enabled users can still opt-out from seeing them in their user settings" "show-announcements-setting-description": "Whether or not you want to allow users to see announcements from Mealie. When enabled users can still opt-out from seeing them in their user settings"
} }
} }

View File

@@ -51,7 +51,7 @@
"category": "Kategoria" "category": "Kategoria"
}, },
"events": { "events": {
"apprise-url": "Apprise URL", "apprise-url": "URL Apprise",
"database": "Baza danych", "database": "Baza danych",
"delete-event": "Usuń wydarzenie", "delete-event": "Usuń wydarzenie",
"event-delete-confirmation": "Czy na pewno chcesz usunąć to zdarzenie?", "event-delete-confirmation": "Czy na pewno chcesz usunąć to zdarzenie?",
@@ -98,7 +98,7 @@
"dashboard": "Panel główny", "dashboard": "Panel główny",
"delete": "Usuń", "delete": "Usuń",
"disabled": "Wyłączone", "disabled": "Wyłączone",
"done": "Done", "done": "Gotowe",
"download": "Pobierz", "download": "Pobierz",
"duplicate": "Duplikuj", "duplicate": "Duplikuj",
"edit": "Edytuj", "edit": "Edytuj",
@@ -169,7 +169,7 @@
"token": "Token", "token": "Token",
"tuesday": "Wtorek", "tuesday": "Wtorek",
"type": "Typ", "type": "Typ",
"undo": "Undo", "undo": "Cofnij",
"update": "Zaktualizuj", "update": "Zaktualizuj",
"updated": "Zaktualizowano", "updated": "Zaktualizowano",
"upload": "Prześlij", "upload": "Prześlij",
@@ -917,7 +917,7 @@
"quantity": "Ilość: {0}", "quantity": "Ilość: {0}",
"shopping-list": "Lista zakupów", "shopping-list": "Lista zakupów",
"shopping-lists": "Listy zakupów", "shopping-lists": "Listy zakupów",
"add-item": "Add item", "add-item": "Dodaj element",
"food": "Jedzenie", "food": "Jedzenie",
"note": "Notatka", "note": "Notatka",
"label": "Etykieta", "label": "Etykieta",
@@ -943,7 +943,7 @@
"are-you-sure-you-want-to-uncheck-all-items": "Czy na pewno chcesz odznaczyć wszystkie elementy?", "are-you-sure-you-want-to-uncheck-all-items": "Czy na pewno chcesz odznaczyć wszystkie elementy?",
"are-you-sure-you-want-to-delete-checked-items": "Czy jesteś pewien, że chcesz usunąć wszystkie zaznaczone elementy?", "are-you-sure-you-want-to-delete-checked-items": "Czy jesteś pewien, że chcesz usunąć wszystkie zaznaczone elementy?",
"no-shopping-lists-found": "Nie znaleziono list zakupów", "no-shopping-lists-found": "Nie znaleziono list zakupów",
"item-checked-off": "Checked off {item}" "item-checked-off": "Zaznaczono {item}"
}, },
"sidebar": { "sidebar": {
"all-recipes": "Wszystkie", "all-recipes": "Wszystkie",
@@ -1478,10 +1478,10 @@
"max-length": "Może zawierać co najwyżej {max} znak|Może zawierać co najwyżej {max} znaki|Może zawierać co najwyżej {max} znaków" "max-length": "Może zawierać co najwyżej {max} znak|Może zawierać co najwyżej {max} znaki|Może zawierać co najwyżej {max} znaków"
}, },
"announcements": { "announcements": {
"announcements": "Announcements", "announcements": "Ogłoszenia",
"all-announcements": "All announcements", "all-announcements": "Wszystkie ogłoszenia",
"mark-all-as-read": "Mark All as Read", "mark-all-as-read": "Oznacz wszystkie jako przeczytane",
"show-announcements-from-mealie": "Show announcements from Mealie", "show-announcements-from-mealie": "Pokazuj ogłoszenia z Mealie",
"show-announcements-setting-description": "Whether or not you want to allow users to see announcements from Mealie. When enabled users can still opt-out from seeing them in their user settings" "show-announcements-setting-description": "Czy chcesz by użytkownicy widzieli ogłoszenia z Mealie? Użytkownicy będą w dalszym ciągu mogli wyłączyć ogłoszenia w swoich ustawieniach użytkownika"
} }
} }

View File

@@ -943,7 +943,7 @@
"are-you-sure-you-want-to-uncheck-all-items": "Ali res ne želite izbrati vseh elementov?", "are-you-sure-you-want-to-uncheck-all-items": "Ali res ne želite izbrati vseh elementov?",
"are-you-sure-you-want-to-delete-checked-items": "Ali ste prepričani, da želite izbrisati vse izbrane elemente?", "are-you-sure-you-want-to-delete-checked-items": "Ali ste prepričani, da želite izbrisati vse izbrane elemente?",
"no-shopping-lists-found": "Ni nakupovalnih seznamov", "no-shopping-lists-found": "Ni nakupovalnih seznamov",
"item-checked-off": "Checked off {item}" "item-checked-off": "Odkljukano {item}"
}, },
"sidebar": { "sidebar": {
"all-recipes": "Vsi recepti", "all-recipes": "Vsi recepti",

View File

@@ -169,7 +169,7 @@
"token": "Token", "token": "Token",
"tuesday": "Tisdag", "tuesday": "Tisdag",
"type": "Typ", "type": "Typ",
"undo": "Undo", "undo": "Ångra",
"update": "Uppdatera", "update": "Uppdatera",
"updated": "Uppdaterad", "updated": "Uppdaterad",
"upload": "Ladda upp", "upload": "Ladda upp",
@@ -333,8 +333,8 @@
"any-household": "Valfritt hushåll", "any-household": "Valfritt hushåll",
"no-meal-plan-defined-yet": "Ingen måltidsplan definierad ännu", "no-meal-plan-defined-yet": "Ingen måltidsplan definierad ännu",
"no-meal-planned-for-today": "Ingen måltidsplan för idag", "no-meal-planned-for-today": "Ingen måltidsplan för idag",
"numberOfDaysPast-hint": "Number of days in the past on page load", "numberOfDaysPast-hint": "Antal förflutna dagar vid sidhämtning",
"numberOfDaysPast-label": "Default Days in the Past", "numberOfDaysPast-label": "Förvalda förflutna dagar",
"numberOfDays-hint": "Antal dagar vid sidhämtning", "numberOfDays-hint": "Antal dagar vid sidhämtning",
"numberOfDays-label": "Förvalda dagar", "numberOfDays-label": "Förvalda dagar",
"only-recipes-with-these-categories-will-be-used-in-meal-plans": "Endast recept med dessa kategorier kommer att användas i måltidsplaner", "only-recipes-with-these-categories-will-be-used-in-meal-plans": "Endast recept med dessa kategorier kommer att användas i måltidsplaner",
@@ -812,7 +812,7 @@
"settings-updated": "Inställningar uppdaterade", "settings-updated": "Inställningar uppdaterade",
"site-settings": "Systeminställningar", "site-settings": "Systeminställningar",
"theme": { "theme": {
"accent": "Accent", "accent": "Accentfärg",
"dark": "Mörkt", "dark": "Mörkt",
"default-to-system": "Standard", "default-to-system": "Standard",
"error": "Fel", "error": "Fel",
@@ -893,17 +893,17 @@
"server-side-base-url-error-text": "`BASE_URL` är fortfarande standardvärdet på API-servern. Detta kommer att orsaka problem med meddelanden som genereras på servern för e-postmeddelanden, etc.", "server-side-base-url-error-text": "`BASE_URL` är fortfarande standardvärdet på API-servern. Detta kommer att orsaka problem med meddelanden som genereras på servern för e-postmeddelanden, etc.",
"server-side-base-url-success-text": "Serversidans URL matchar inte standard", "server-side-base-url-success-text": "Serversidans URL matchar inte standard",
"ldap-ready": "LDAP Redo", "ldap-ready": "LDAP Redo",
"ldap-not-ready": "LDAP Not Ready", "ldap-not-ready": "LDAP ej tillgängligt",
"ldap-ready-error-text": "Alla LDAP-värden är inte konfigurerade. Detta kan ignoreras om du inte använder LDAP-autentisering.", "ldap-ready-error-text": "Alla LDAP-värden är inte konfigurerade. Detta kan ignoreras om du inte använder LDAP-autentisering.",
"ldap-ready-success-text": "Alla obligatoriska LDAP-variabler är satta.", "ldap-ready-success-text": "Alla obligatoriska LDAP-variabler är satta.",
"build": "Bygge", "build": "Bygge",
"recipe-scraper-version": "Version av Recept-scraper", "recipe-scraper-version": "Version av Recept-scraper",
"oidc-ready": "OIDC Klar", "oidc-ready": "OIDC Klar",
"oidc-not-ready": "OIDC Not Ready", "oidc-not-ready": "OIDC ej tillgängligt",
"oidc-ready-error-text": "Alla OIDC-värden är inte konfigurerade. Detta kan ignoreras om du inte använder OIDC-autentisering.", "oidc-ready-error-text": "Alla OIDC-värden är inte konfigurerade. Detta kan ignoreras om du inte använder OIDC-autentisering.",
"oidc-ready-success-text": "Alla obligatoriska OIDC-variabler är satta.", "oidc-ready-success-text": "Alla obligatoriska OIDC-variabler är satta.",
"openai-ready": "OpenAI redo", "openai-ready": "OpenAI redo",
"openai-not-ready": "OpenAI Not Ready", "openai-not-ready": "OpenAI ej tillgängligt",
"openai-ready-error-text": "Alla OpenAI-värden är inte konfigurerade. Detta kan ignoreras om du inte använder OpenAI-funktioner.", "openai-ready-error-text": "Alla OpenAI-värden är inte konfigurerade. Detta kan ignoreras om du inte använder OpenAI-funktioner.",
"openai-ready-success-text": "Alla obligatoriska OpenAI-variabler är satta." "openai-ready-success-text": "Alla obligatoriska OpenAI-variabler är satta."
}, },
@@ -917,7 +917,7 @@
"quantity": "Antal {0}", "quantity": "Antal {0}",
"shopping-list": "Inköpslista", "shopping-list": "Inköpslista",
"shopping-lists": "Inköpslistor", "shopping-lists": "Inköpslistor",
"add-item": "Add item", "add-item": "Lägg till vara",
"food": "Mat", "food": "Mat",
"note": "Anteckning", "note": "Anteckning",
"label": "Etikett", "label": "Etikett",
@@ -943,7 +943,7 @@
"are-you-sure-you-want-to-uncheck-all-items": "Är du säker på att du vill avmarkera alla objekt?", "are-you-sure-you-want-to-uncheck-all-items": "Är du säker på att du vill avmarkera alla objekt?",
"are-you-sure-you-want-to-delete-checked-items": "Är du säker på att du vill ta bort alla markerade objekt?", "are-you-sure-you-want-to-delete-checked-items": "Är du säker på att du vill ta bort alla markerade objekt?",
"no-shopping-lists-found": "Inga inköpslistor hittades", "no-shopping-lists-found": "Inga inköpslistor hittades",
"item-checked-off": "Checked off {item}" "item-checked-off": "Kryssat av {item}"
}, },
"sidebar": { "sidebar": {
"all-recipes": "Recept", "all-recipes": "Recept",
@@ -1478,10 +1478,10 @@
"max-length": "Måste Vara Som Mest {max} Tecken|Måste Vara Som Mest {max} Tecken" "max-length": "Måste Vara Som Mest {max} Tecken|Måste Vara Som Mest {max} Tecken"
}, },
"announcements": { "announcements": {
"announcements": "Announcements", "announcements": "Meddelanden",
"all-announcements": "All announcements", "all-announcements": "Alla meddelanden",
"mark-all-as-read": "Mark All as Read", "mark-all-as-read": "Markera alla som lästa",
"show-announcements-from-mealie": "Show announcements from Mealie", "show-announcements-from-mealie": "Visa meddelanden från Mealie",
"show-announcements-setting-description": "Whether or not you want to allow users to see announcements from Mealie. When enabled users can still opt-out from seeing them in their user settings" "show-announcements-setting-description": "Om du vill tillåta användare att se meddelanden från Mealie eller inte. När funktionen är aktiverad kan användarna fortfarande välja att inte se dem i sina användarinställningar"
} }
} }

View File

@@ -911,7 +911,7 @@
"all-lists": "Всі списки", "all-lists": "Всі списки",
"create-shopping-list": "Сторити список покупок", "create-shopping-list": "Сторити список покупок",
"from-recipe": "З рецепту", "from-recipe": "З рецепту",
"ingredient-of-recipe": "Ingredient of {recipe}", "ingredient-of-recipe": "Інгредієнт з {recipe}",
"list-name": "Назва списку", "list-name": "Назва списку",
"new-list": "Новий список", "new-list": "Новий список",
"quantity": "Кількість: {0}", "quantity": "Кількість: {0}",

View File

@@ -35,7 +35,7 @@ class OpenIDProvider(AuthProvider[UserInfo]):
self._logger.debug("[OIDC] %s: %s", key, value) self._logger.debug("[OIDC] %s: %s", key, value)
if not self.required_claims.issubset(claims.keys()): if not self.required_claims.issubset(claims.keys()):
self._logger.debug( self._logger.error(
"[OIDC] Required claims not present. Expected: %s Actual: %s", "[OIDC] Required claims not present. Expected: %s Actual: %s",
self.required_claims, self.required_claims,
claims.keys(), claims.keys(),
@@ -45,7 +45,7 @@ class OpenIDProvider(AuthProvider[UserInfo]):
# Check for empty required claims # Check for empty required claims
for claim in self.required_claims: for claim in self.required_claims:
if not claims.get(claim): if not claims.get(claim):
self._logger.debug("[OIDC] Required claim '%s' is empty", claim) self._logger.error("[OIDC] Required claim '%s' is empty", claim)
raise MissingClaimException() raise MissingClaimException()
repos = get_repositories(self.session, group_id=None, household_id=None) repos = get_repositories(self.session, group_id=None, household_id=None)

View File

@@ -571,8 +571,8 @@
"delicata squash": { "delicata squash": {
"aliases": [], "aliases": [],
"description": "", "description": "",
"name": "delicata squash", "name": "delikat squash",
"plural_name": "delicata squashes" "plural_name": "delikate squasher"
}, },
"Frisée": { "Frisée": {
"aliases": [ "aliases": [
@@ -980,7 +980,7 @@
"aliases": [], "aliases": [],
"description": "", "description": "",
"name": "kastanjepuré", "name": "kastanjepuré",
"plural_name": "chestnut purée" "plural_name": "kastanjepuré"
}, },
"prickly pear": { "prickly pear": {
"aliases": [], "aliases": [],
@@ -1045,7 +1045,7 @@
"sweet lime": { "sweet lime": {
"aliases": [], "aliases": [],
"description": "", "description": "",
"name": "sweet lime", "name": "søt lime",
"plural_name": "sweet limes" "plural_name": "sweet limes"
}, },
"custard-apple": { "custard-apple": {
@@ -1873,8 +1873,8 @@
"melon seed": { "melon seed": {
"aliases": [], "aliases": [],
"description": "", "description": "",
"name": "melon seed", "name": "melonfrø",
"plural_name": "melon seeds" "plural_name": "melonfrø"
}, },
"lotus seed": { "lotus seed": {
"aliases": [], "aliases": [],
@@ -2003,48 +2003,48 @@
"parmesan cheese": { "parmesan cheese": {
"aliases": [], "aliases": [],
"description": "", "description": "",
"name": "parmesan cheese", "name": "parmesanost",
"plural_name": "parmesan cheese" "plural_name": "parmesanost"
}, },
"cheddar cheese": { "cheddar cheese": {
"aliases": [ "aliases": [
"cheddar cheese" "cheddarost"
], ],
"description": "", "description": "",
"name": "cheddar cheese", "name": "cheddarost",
"plural_name": "cheddar cheese" "plural_name": "cheddarost"
}, },
"cream cheese": { "cream cheese": {
"aliases": [], "aliases": [],
"description": "", "description": "",
"name": "cream cheese", "name": "kremost",
"plural_name": "cream cheese" "plural_name": "kremost"
}, },
"sharp cheddar cheese": { "sharp cheddar cheese": {
"aliases": [ "aliases": [
"sharp cheddar" "skarp cheddarost"
], ],
"description": "", "description": "",
"name": "sharp cheddar cheese", "name": "skarp cheddarost",
"plural_name": "sharp cheddar cheese" "plural_name": "skarp cheddarost"
}, },
"cheese": { "cheese": {
"aliases": [], "aliases": [],
"description": "", "description": "",
"name": "cheese", "name": "ost",
"plural_name": "cheese" "plural_name": "ost"
}, },
"mozzarella cheese": { "mozzarella cheese": {
"aliases": [], "aliases": [],
"description": "", "description": "",
"name": "mozzarella cheese", "name": "mozzarellaost",
"plural_name": "mozzarella cheese" "plural_name": "mozzarellaost"
}, },
"feta cheese": { "feta cheese": {
"aliases": [], "aliases": [],
"description": "", "description": "",
"name": "feta cheese", "name": "fetaost",
"plural_name": "feta cheese" "plural_name": "fetaost"
}, },
"ricotta cheese": { "ricotta cheese": {
"aliases": [], "aliases": [],
@@ -2073,14 +2073,14 @@
"goat cheese": { "goat cheese": {
"aliases": [], "aliases": [],
"description": "", "description": "",
"name": "goat cheese", "name": "geitost",
"plural_name": "goat cheese" "plural_name": "geitost"
}, },
"fresh mozzarella cheese": { "fresh mozzarella cheese": {
"aliases": [], "aliases": [],
"description": "", "description": "",
"name": "fresh mozzarella cheese", "name": "fersk mozzarellaost",
"plural_name": "fresh mozzarella cheese" "plural_name": "fersk mozzarellaost"
}, },
"swis cheese": { "swis cheese": {
"aliases": [], "aliases": [],

View File

@@ -919,7 +919,7 @@
"jackfruit": { "jackfruit": {
"aliases": [], "aliases": [],
"description": "", "description": "",
"name": "jackfruit", "name": "owoc chlebowca",
"plural_name": "jackfruity" "plural_name": "jackfruity"
}, },
"dragon fruit": { "dragon fruit": {

View File

@@ -134,7 +134,6 @@ async def oauth_callback(request: Request, session: Session = Depends(generate_s
auth_provider = OpenIDProvider(session, userinfo, use_default_groups=True) auth_provider = OpenIDProvider(session, userinfo, use_default_groups=True)
auth = auth_provider.authenticate() auth = auth_provider.authenticate()
except MissingClaimException: except MissingClaimException:
logger.error("[OIDC] Required claims not present in ID token or userinfo endpoint")
auth = None auth = None
if not auth: if not auth:

View File

@@ -58,6 +58,6 @@ async def get_recipe_asset(recipe_id: UUID4, file_name: str):
raise HTTPException(status.HTTP_400_BAD_REQUEST) raise HTTPException(status.HTTP_400_BAD_REQUEST)
if file.exists(): if file.exists():
return FileResponse(file, filename=file.name, content_disposition_type="attachment") return FileResponse(file)
else: else:
raise HTTPException(status.HTTP_404_NOT_FOUND) raise HTTPException(status.HTTP_404_NOT_FOUND)

View File

@@ -80,8 +80,6 @@ from mealie.services.scraper.scraper_strategies import (
from ._base import BaseRecipeController, JSONBytes from ._base import BaseRecipeController, JSONBytes
ASSET_ALLOWED_EXTENSIONS = {"pdf", "jpg", "jpeg", "png", "gif", "webp", "bmp", "avif", "txt", "md", "csv", "json"}
router = UserAPIRouter(prefix="/recipes", route_class=MealieCrudRoute) router = UserAPIRouter(prefix="/recipes", route_class=MealieCrudRoute)
@@ -662,10 +660,6 @@ class RecipeController(BaseRecipeController):
if "." in extension: if "." in extension:
extension = extension.split(".")[-1] extension = extension.split(".")[-1]
extension = extension.lower()
if extension not in ASSET_ALLOWED_EXTENSIONS:
raise HTTPException(status_code=400, detail="Unsupported file extension")
file_slug = slugify(name) file_slug = slugify(name)
if not extension or not file_slug: if not extension or not file_slug:
raise HTTPException(status_code=400, detail="Missing required fields") raise HTTPException(status_code=400, detail="Missing required fields")

View File

@@ -15,7 +15,6 @@ from mealie.schema.recipe.recipe_timeline_events import (
RecipeTimelineEventPagination, RecipeTimelineEventPagination,
RecipeTimelineEventUpdate, RecipeTimelineEventUpdate,
TimelineEventImage, TimelineEventImage,
TimelineEventType,
) )
from mealie.schema.recipe.request_helpers import UpdateImageResponse from mealie.schema.recipe.request_helpers import UpdateImageResponse
from mealie.schema.response.pagination import PaginationQuery from mealie.schema.response.pagination import PaginationQuery
@@ -51,10 +50,6 @@ class RecipeTimelineEventsController(BaseCrudController):
override=RecipeTimelineEventOut, override=RecipeTimelineEventOut,
) )
for event in response.items:
if event.event_type == TimelineEventType.system.value:
event.subject = self.t(event.subject)
response.set_pagination_guides(router.url_path_for("get_all"), q.model_dump()) response.set_pagination_guides(router.url_path_for("get_all"), q.model_dump())
return response return response
@@ -88,10 +83,7 @@ class RecipeTimelineEventsController(BaseCrudController):
@router.get("/{item_id}", response_model=RecipeTimelineEventOut) @router.get("/{item_id}", response_model=RecipeTimelineEventOut)
def get_one(self, item_id: UUID4): def get_one(self, item_id: UUID4):
event = self.mixins.get_one(item_id) return self.mixins.get_one(item_id)
if event.event_type == TimelineEventType.system.value:
event.subject = self.t(event.subject)
return event
@router.put("/{item_id}", response_model=RecipeTimelineEventOut) @router.put("/{item_id}", response_model=RecipeTimelineEventOut)
def update_one(self, item_id: UUID4, data: RecipeTimelineEventUpdate): def update_one(self, item_id: UUID4, data: RecipeTimelineEventUpdate):

View File

@@ -38,8 +38,6 @@ from mealie.services.scraper import cleaner
from .template_service import TemplateService from .template_service import TemplateService
RECIPE_CREATED_EVENT_SUBJECT = "recipe.recipe-created"
class RecipeServiceBase(BaseService): class RecipeServiceBase(BaseService):
def __init__(self, repos: AllRepositories, user: PrivateUser, household: HouseholdInDB, translator: Translator): def __init__(self, repos: AllRepositories, user: PrivateUser, household: HouseholdInDB, translator: Translator):
@@ -71,19 +69,8 @@ class RecipeService(RecipeServiceBase):
def can_delete(self, recipe_slugs: list[str]) -> bool: def can_delete(self, recipe_slugs: list[str]) -> bool:
if self.user.admin: if self.user.admin:
return True return True
else:
# Deletion requires ownership; collaborative editing rules (can_update) do not apply return self.can_update(recipe_slugs)
model = self.group_recipes.model
owned_count = self.group_recipes.session.scalar(
sa.select(sa.func.count())
.select_from(model)
.where(
model.slug.in_(recipe_slugs),
model.group_id == self.user.group_id,
model.user_id == self.user.id,
)
)
return owned_count == len(recipe_slugs)
def can_update(self, recipe_slugs: list[str]) -> bool: def can_update(self, recipe_slugs: list[str]) -> bool:
sql = dedent( sql = dedent(
@@ -237,7 +224,7 @@ class RecipeService(RecipeServiceBase):
timeline_event_data = RecipeTimelineEventCreate( timeline_event_data = RecipeTimelineEventCreate(
user_id=new_recipe.user_id, user_id=new_recipe.user_id,
recipe_id=new_recipe.id, recipe_id=new_recipe.id,
subject=RECIPE_CREATED_EVENT_SUBJECT, subject=self.t("recipe.recipe-created"),
event_type=TimelineEventType.system, event_type=TimelineEventType.system,
timestamp=new_recipe.created_at or datetime.now(UTC), timestamp=new_recipe.created_at or datetime.now(UTC),
) )

View File

@@ -201,12 +201,19 @@ def test_delete_recipes_from_other_households(
assert recipe_json["id"] == h2_recipe_id assert recipe_json["id"] == h2_recipe_id
response = api_client.delete(api_routes.recipes_slug(recipe_json["slug"]), headers=unique_user.token) response = api_client.delete(api_routes.recipes_slug(recipe_json["slug"]), headers=unique_user.token)
assert response.status_code == 403 if household_lock_recipe_edits:
assert response.status_code == 403
# confirm the recipe still exists # confirm the recipe still exists
response = api_client.get(api_routes.recipes_slug(h2_recipe_id), headers=unique_user.token) response = api_client.get(api_routes.recipes_slug(h2_recipe_id), headers=unique_user.token)
assert response.status_code == 200 assert response.status_code == 200
assert response.json()["id"] == h2_recipe_id assert response.json()["id"] == h2_recipe_id
else:
assert response.status_code == 200
# confirm the recipe was deleted
response = api_client.get(api_routes.recipes_slug(h2_recipe_id), headers=unique_user.token)
assert response.status_code == 404
@pytest.mark.parametrize("is_private_household", [True, False]) @pytest.mark.parametrize("is_private_household", [True, False])

View File

@@ -87,23 +87,6 @@ def test_recipe_asset_exploit(api_client: TestClient, unique_user: TestUser, rec
assert not (recipe.asset_dir / "test.txt").exists() assert not (recipe.asset_dir / "test.txt").exists()
def test_recipe_asset_dangerous_extension_blocked(
api_client: TestClient, unique_user: TestUser, recipe_ingredient_only: Recipe
):
"""Ensure scriptable extensions are rejected to prevent stored XSS (GHSA-gfwc-pjx4-mg9p)."""
recipe = recipe_ingredient_only
for ext in ("html", "svg", "js", "htm", "xhtml"):
payload = {"name": random_string(10), "icon": "mdi-file", "extension": ext}
file_payload = {"file": b"<script>alert(1)</script>"}
response = api_client.post(
f"/api/recipes/{recipe.slug}/assets",
data=payload,
files=file_payload,
headers=unique_user.token,
)
assert response.status_code == 400, f"expected 400 for extension={ext}, got {response.status_code}"
def test_recipe_image_upload(api_client: TestClient, unique_user: TestUser, recipe_ingredient_only: Recipe): def test_recipe_image_upload(api_client: TestClient, unique_user: TestUser, recipe_ingredient_only: Recipe):
data_payload = {"extension": "jpg"} data_payload = {"extension": "jpg"}
file_payload = {"image": data.images_test_image_1.read_bytes()} file_payload = {"image": data.images_test_image_1.read_bytes()}

View File

@@ -160,24 +160,6 @@ def test_other_user_cant_delete_recipe(api_client: TestClient, user_tuple: list[
assert response.status_code == 403 assert response.status_code == 403
def test_other_user_cant_delete_unlocked_recipe(api_client: TestClient, user_tuple: list[TestUser]):
"""Non-owner must not delete an unlocked recipe — BOLA regression (GHSA-x5v9-9jvh-7c7q)."""
slug = random_string(10)
unique_user, other_user = user_tuple
unique_user.repos.recipes.create(
Recipe(
user_id=unique_user.user_id,
group_id=unique_user.group_id,
name=slug,
settings=RecipeSettings(locked=False),
)
)
response = api_client.delete(api_routes.recipes_slug(slug), headers=other_user.token)
assert response.status_code == 403
def test_other_user_bulk_delete(api_client: TestClient, user_tuple: list[TestUser]): def test_other_user_bulk_delete(api_client: TestClient, user_tuple: list[TestUser]):
slug_locked = random_string(10) slug_locked = random_string(10)
slug_unlocked = random_string(10) slug_unlocked = random_string(10)
@@ -208,30 +190,6 @@ def test_other_user_bulk_delete(api_client: TestClient, user_tuple: list[TestUse
assert response.status_code == 403 assert response.status_code == 403
def test_other_user_cant_bulk_delete_unlocked_recipes(api_client: TestClient, user_tuple: list[TestUser]):
"""Non-owner must not bulk-delete unlocked recipes — BOLA regression (GHSA-x5v9-9jvh-7c7q)."""
slug_1 = random_string(10)
slug_2 = random_string(10)
unique_user, other_user = user_tuple
for slug in (slug_1, slug_2):
unique_user.repos.recipes.create(
Recipe(
user_id=unique_user.user_id,
group_id=unique_user.group_id,
name=slug,
settings=RecipeSettings(locked=False),
)
)
response = api_client.post(
api_routes.recipes_bulk_actions_delete,
json={"recipes": [slug_1, slug_2]},
headers=other_user.token,
)
assert response.status_code == 403
def test_admin_can_delete_locked_recipe_owned_by_another_user( def test_admin_can_delete_locked_recipe_owned_by_another_user(
api_client: TestClient, unfiltered_database: AllRepositories, unique_user: TestUser, admin_user: TestUser api_client: TestClient, unfiltered_database: AllRepositories, unique_user: TestUser, admin_user: TestUser
): ):

View File

@@ -3,24 +3,18 @@ from uuid import uuid4
import pytest import pytest
from fastapi.testclient import TestClient from fastapi.testclient import TestClient
from mealie.lang.providers import get_all_translations
from mealie.schema.recipe.recipe import Recipe from mealie.schema.recipe.recipe import Recipe
from mealie.schema.recipe.recipe_timeline_events import ( from mealie.schema.recipe.recipe_timeline_events import (
RecipeTimelineEventOut, RecipeTimelineEventOut,
RecipeTimelineEventPagination, RecipeTimelineEventPagination,
TimelineEventImage, TimelineEventImage,
TimelineEventType,
) )
from mealie.schema.recipe.request_helpers import UpdateImageResponse from mealie.schema.recipe.request_helpers import UpdateImageResponse
from mealie.services.recipe.recipe_service import RECIPE_CREATED_EVENT_SUBJECT
from tests.utils import api_routes from tests.utils import api_routes
from tests.utils.factories import random_string from tests.utils.factories import random_string
from tests.utils.fixture_schemas import TestUser from tests.utils.fixture_schemas import TestUser
PERSISTED_TRANSLATION_KEYS = [RECIPE_CREATED_EVENT_SUBJECT]
@pytest.fixture(scope="function") @pytest.fixture(scope="function")
def recipes(api_client: TestClient, unique_user: TestUser): def recipes(api_client: TestClient, unique_user: TestUser):
recipes = [] recipes = []
@@ -347,50 +341,6 @@ def test_create_recipe_with_timeline_event(
assert events_pagination.items assert events_pagination.items
@pytest.mark.parametrize("translation_key", PERSISTED_TRANSLATION_KEYS)
def test_persisted_translation_keys_have_translations(translation_key: str):
translations = get_all_translations(translation_key)
missing_translations = [locale for locale, translation in translations.items() if translation == translation_key]
assert missing_translations == []
def test_recipe_created_system_event_is_translated(
api_client: TestClient,
unique_user: TestUser,
recipes: list[Recipe],
):
recipe = recipes[0]
params = {"queryFilter": f"recipe_id={recipe.id}"}
# fetch events in French — the system "recipe created" event should be translated
fr_headers = {**unique_user.token, "Accept-Language": "fr-FR"}
events_response = api_client.get(api_routes.recipes_timeline_events, params=params, headers=fr_headers)
assert events_response.status_code == 200
events_pagination = RecipeTimelineEventPagination.model_validate(events_response.json())
system_events = [e for e in events_pagination.items if e.event_type == TimelineEventType.system.value]
assert system_events, "expected at least one system event for a newly created recipe"
for event in system_events:
assert event.subject == "Recette créée", f"expected French translation, got: {event.subject!r}"
# also verify the individual GET endpoint translates correctly
single_response = api_client.get(api_routes.recipes_timeline_events_item_id(event.id), headers=fr_headers)
assert single_response.status_code == 200
single_event = RecipeTimelineEventOut.model_validate(single_response.json())
assert single_event.subject == "Recette créée"
# fetch the same events in English — subject should be the English string
en_headers = {**unique_user.token, "Accept-Language": "en-US"}
events_response = api_client.get(api_routes.recipes_timeline_events, params=params, headers=en_headers)
events_pagination = RecipeTimelineEventPagination.model_validate(events_response.json())
system_events = [e for e in events_pagination.items if e.event_type == TimelineEventType.system.value]
for event in system_events:
assert event.subject == "Recipe Created", f"expected English string, got: {event.subject!r}"
@pytest.mark.parametrize("use_other_household_user", [True, False]) @pytest.mark.parametrize("use_other_household_user", [True, False])
def test_invalid_recipe_id( def test_invalid_recipe_id(
api_client: TestClient, unique_user: TestUser, h2_user: TestUser, use_other_household_user: bool api_client: TestClient, unique_user: TestUser, h2_user: TestUser, use_other_household_user: bool