@@ -204,6 +204,7 @@ export default defineComponent({
const form = reactive({
email: "changeme@email.com",
password: "MyPassword",
+ remember: false,
});
const loggingIn = ref(false);
@@ -215,15 +216,15 @@ export default defineComponent({
const formData = new FormData();
formData.append("username", form.email);
formData.append("password", form.password);
+ formData.append("remember_me", String(form.remember));
try {
await $auth.loginWith("local", { data: formData });
} catch (error) {
if (error.response.status === 401) {
alert.error("Invalid Credentials");
- }
- else {
- alert.error("Something Went Wrong!")
+ } else {
+ alert.error("Something Went Wrong!");
}
}
loggingIn.value = false;
diff --git a/frontend/plugins/dark-mode.client.ts b/frontend/plugins/dark-mode.client.ts
new file mode 100644
index 000000000..008d71c8d
--- /dev/null
+++ b/frontend/plugins/dark-mode.client.ts
@@ -0,0 +1,12 @@
+import { useDark } from "@vueuse/core";
+
+export default ({ $vuetify }: any) => {
+ const isDark = useDark();
+ console.log("isDark Plugin", isDark);
+
+ if (isDark.value) {
+ $vuetify.theme.dark = true;
+ } else {
+ $vuetify.theme.dark = false;
+ }
+};
diff --git a/mealie/db/data_initialization/init_units_foods.py b/mealie/db/data_initialization/init_units_foods.py
index be37c58a9..78b67ae54 100644
--- a/mealie/db/data_initialization/init_units_foods.py
+++ b/mealie/db/data_initialization/init_units_foods.py
@@ -3,6 +3,7 @@ from pathlib import Path
from mealie.core.root_logger import get_logger
from mealie.db.data_access_layer.access_model_factory import Database
+from mealie.schema.recipe import CreateIngredientFood, CreateIngredientUnit
CWD = Path(__file__).parent
logger = get_logger(__name__)
@@ -14,21 +15,26 @@ def get_default_foods():
return foods
-def get_default_units():
+def get_default_units() -> dict[str, str]:
with open(CWD.joinpath("resources", "units", "en-us.json"), "r") as f:
units = json.loads(f.read())
return units
def default_recipe_unit_init(db: Database) -> None:
- for unit in get_default_units():
+ for unit in get_default_units().values():
try:
- db.ingredient_units.create(unit)
+ db.ingredient_units.create(
+ CreateIngredientUnit(
+ name=unit["name"], description=unit["description"], abbreviation=unit["abbreviation"]
+ )
+ )
except Exception as e:
logger.error(e)
for food in get_default_foods():
try:
- db.ingredient_foods.create(food)
+
+ db.ingredient_foods.create(CreateIngredientFood(name=food, description=""))
except Exception as e:
logger.error(e)
diff --git a/mealie/db/data_initialization/resources/foods/en-us.json b/mealie/db/data_initialization/resources/foods/en-us.json
index ef89e2883..47b6f3f50 100644
--- a/mealie/db/data_initialization/resources/foods/en-us.json
+++ b/mealie/db/data_initialization/resources/foods/en-us.json
@@ -1,914 +1,224 @@
-[
- {
- "name": "acorn squash",
- "description": ""
- },
- {
- "name": "alfalfa sprouts",
- "description": ""
- },
- {
- "name": "anchovies",
- "description": ""
- },
- {
- "name": "apples",
- "description": ""
- },
- {
- "name": "artichoke",
- "description": ""
- },
- {
- "name": "arugula",
- "description": ""
- },
- {
- "name": "asparagus",
- "description": ""
- },
- {
- "name": "aubergine",
- "description": ""
- },
- {
- "name": "avocado",
- "description": ""
- },
- {
- "name": "bacon",
- "description": ""
- },
- {
- "name": "baking powder",
- "description": ""
- },
- {
- "name": "baking soda",
- "description": ""
- },
- {
- "name": "baking sugar",
- "description": ""
- },
- {
- "name": "bar sugar",
- "description": ""
- },
- {
- "name": "basil",
- "description": ""
- },
- {
- "name": "bell peppers",
- "description": ""
- },
- {
- "name": "blackberries",
- "description": ""
- },
- {
- "name": "brassicas ",
- "description": ""
- },
- {
- "name": "bok choy",
- "description": ""
- },
- {
- "name": "broccoflower",
- "description": ""
- },
- {
- "name": "broccoli",
- "description": ""
- },
- {
- "name": "broccolini",
- "description": ""
- },
- {
- "name": "broccoli rabe",
- "description": ""
- },
- {
- "name": "brussels sprouts",
- "description": ""
- },
- {
- "name": "cabbage",
- "description": ""
- },
- {
- "name": "cauliflower",
- "description": ""
- },
- {
- "name": "chinese leaves",
- "description": ""
- },
- {
- "name": "collard greens",
- "description": ""
- },
- {
- "name": "kohlrabi",
- "description": ""
- },
- {
- "name": "bread",
- "description": ""
- },
- {
- "name": "breadfruit",
- "description": ""
- },
- {
- "name": "broad beans",
- "description": ""
- },
- {
- "name": "brown sugar",
- "description": ""
- },
- {
- "name": "brussels sprouts",
- "description": ""
- },
- {
- "name": "butter",
- "description": ""
- },
- {
- "name": "butternut pumpkin",
- "description": ""
- },
- {
- "name": "butternut squash",
- "description": ""
- },
- {
- "name": "cactus, edible",
- "description": ""
- },
- {
- "name": "calabrese",
- "description": ""
- },
- {
- "name": "cannabis",
- "description": ""
- },
- {
- "name": "capsicum",
- "description": ""
- },
- {
- "name": "caraway",
- "description": ""
- },
- {
- "name": "carrot",
- "description": ""
- },
- {
- "name": "castor sugar",
- "description": ""
- },
- {
- "name": "cayenne pepper",
- "description": ""
- },
- {
- "name": "celeriac",
- "description": ""
- },
- {
- "name": "celery",
- "description": ""
- },
- {
- "name": "cereal grains",
- "description": ""
- },
- {
- "name": "rice",
- "description": ""
- },
- {
- "name": "chard",
- "description": ""
- },
- {
- "name": "cheese",
- "description": ""
- },
- {
- "name": "chicory",
- "description": ""
- },
- {
- "name": "chilli peppers",
- "description": ""
- },
- {
- "name": "chinese leaves",
- "description": ""
- },
- {
- "name": "chives",
- "description": ""
- },
- {
- "name": "chocolate",
- "description": ""
- },
- {
- "name": "cilantro",
- "description": ""
- },
- {
- "name": "cinnamon",
- "description": ""
- },
- {
- "name": "clarified butter",
- "description": ""
- },
- {
- "name": "coconut",
- "description": ""
- },
- {
- "name": "coconut milk",
- "description": ""
- },
- {
- "name": "coffee",
- "description": ""
- },
- {
- "name": "confectioners' sugar",
- "description": ""
- },
- {
- "name": "coriander",
- "description": ""
- },
- {
- "name": "corn",
- "description": ""
- },
- {
- "name": "corn syrup",
- "description": ""
- },
- {
- "name": "cottonseed oil",
- "description": ""
- },
- {
- "name": "courgette",
- "description": ""
- },
- {
- "name": "cream of tartar",
- "description": ""
- },
- {
- "name": "cucumber",
- "description": ""
- },
- {
- "name": "cumin",
- "description": ""
- },
- {
- "name": "daikon",
- "description": ""
- },
- {
- "name": "dairy products and dairy substitutes",
- "description": ""
- },
- {
- "name": "eggs",
- "description": ""
- },
- {
- "name": "ghee",
- "description": ""
- },
- {
- "name": "milk",
- "description": ""
- },
- {
- "name": "dandelion",
- "description": ""
- },
- {
- "name": "demerara sugar",
- "description": ""
- },
- {
- "name": "dough",
- "description": ""
- },
- {
- "name": "edible cactus",
- "description": ""
- },
- {
- "name": "eggplant",
- "description": ""
- },
- {
- "name": "endive",
- "description": ""
- },
- {
- "name": "fats",
- "description": ""
- },
- {
- "name": "spek",
- "description": ""
- },
- {
- "name": "fava beans",
- "description": ""
- },
- {
- "name": "fiddlehead",
- "description": ""
- },
- {
- "name": "fish",
- "description": ""
- },
- {
- "name": "catfish ",
- "description": ""
- },
- {
- "name": "cod",
- "description": ""
- },
- {
- "name": "salt cod",
- "description": ""
- },
- {
- "name": "salmon",
- "description": ""
- },
- {
- "name": "skate",
- "description": ""
- },
- {
- "name": "stockfish",
- "description": ""
- },
- {
- "name": "trout",
- "description": ""
- },
- {
- "name": "tuna",
- "description": ""
- },
- {
- "name": "five spice powder",
- "description": ""
- },
- {
- "name": "flour",
- "description": ""
- },
- {
- "name": "frisee",
- "description": ""
- },
- {
- "name": "fructose",
- "description": ""
- },
- {
- "name": "fruit",
- "description": ""
- },
- {
- "name": "apple",
- "description": ""
- },
- {
- "name": "oranges",
- "description": ""
- },
- {
- "name": "pear",
- "description": ""
- },
- {
- "name": "tomato",
- "description": ""
- },
- {
- "name": "fruit sugar",
- "description": ""
- },
- {
- "name": "garam masala",
- "description": ""
- },
- {
- "name": "garlic",
- "description": ""
- },
- {
- "name": "gem squash",
- "description": ""
- },
- {
- "name": "ginger",
- "description": ""
- },
- {
- "name": "giblets",
- "description": ""
- },
- {
- "name": "grains",
- "description": ""
- },
- {
- "name": "maize",
- "description": ""
- },
- {
- "name": "sweetcorn",
- "description": ""
- },
- {
- "name": "teff",
- "description": ""
- },
- {
- "name": "grape seed oil",
- "description": ""
- },
- {
- "name": "green onion",
- "description": ""
- },
- {
- "name": "heart of palm",
- "description": ""
- },
- {
- "name": "hemp",
- "description": ""
- },
- {
- "name": "herbs",
- "description": ""
- },
- {
- "name": "oregano",
- "description": ""
- },
- {
- "name": "parsley",
- "description": ""
- },
- {
- "name": "honey",
- "description": ""
- },
- {
- "name": "horse",
- "description": ""
- },
- {
- "name": "icing sugar",
- "description": ""
- },
- {
- "name": "isomalt",
- "description": ""
- },
- {
- "name": "jackfruit",
- "description": ""
- },
- {
- "name": "jaggery",
- "description": ""
- },
- {
- "name": "jams",
- "description": ""
- },
- {
- "name": "jellies",
- "description": ""
- },
- {
- "name": "jerusalem artichoke",
- "description": ""
- },
- {
- "name": "jicama",
- "description": ""
- },
- {
- "name": "kale",
- "description": ""
- },
- {
- "name": "kumara",
- "description": ""
- },
- {
- "name": "leavening agents",
- "description": ""
- },
- {
- "name": "leek",
- "description": ""
- },
- {
- "name": "legumes",
- "description": ""
- },
- {
- "name": "peas",
- "description": ""
- },
- {
- "name": "beans",
- "description": ""
- },
- {
- "name": "lentils",
- "description": ""
- },
- {
- "name": "lemongrass",
- "description": ""
- },
- {
- "name": "lettuce",
- "description": ""
- },
- {
- "name": "liver",
- "description": ""
- },
- {
- "name": "maple syrup",
- "description": ""
- },
- {
- "name": "meat",
- "description": ""
- },
- {
- "name": "mortadella",
- "description": ""
- },
- {
- "name": "mushroom",
- "description": ""
- },
- {
- "name": "white mushroom",
- "description": ""
- },
- {
- "name": "mussels",
- "description": ""
- },
- {
- "name": "nori",
- "description": ""
- },
- {
- "name": "nutmeg",
- "description": ""
- },
- {
- "name": "nutritional yeast flakes",
- "description": ""
- },
- {
- "name": "nuts",
- "description": ""
- },
- {
- "name": "nanaimo bar mix",
- "description": ""
- },
- {
- "name": "octopuses",
- "description": ""
- },
- {
- "name": "oils",
- "description": ""
- },
- {
- "name": "olive oil",
- "description": ""
- },
- {
- "name": "okra",
- "description": ""
- },
- {
- "name": "olive",
- "description": ""
- },
- {
- "name": "onion family",
- "description": ""
- },
- {
- "name": "onion",
- "description": ""
- },
- {
- "name": "scallion",
- "description": ""
- },
- {
- "name": "shallot",
- "description": ""
- },
- {
- "name": "spring onion",
- "description": ""
- },
- {
- "name": "orange blossom water",
- "description": ""
- },
- {
- "name": "oysters",
- "description": ""
- },
- {
- "name": "panch puran",
- "description": ""
- },
- {
- "name": "paprika",
- "description": ""
- },
- {
- "name": "parsnip",
- "description": ""
- },
- {
- "name": "pepper",
- "description": ""
- },
- {
- "name": "peppers",
- "description": ""
- },
- {
- "name": "plantain",
- "description": ""
- },
- {
- "name": "pineapple",
- "description": ""
- },
- {
- "name": "poppy seeds",
- "description": ""
- },
- {
- "name": "potatoes",
- "description": ""
- },
- {
- "name": "poultry",
- "description": ""
- },
- {
- "name": "powdered sugar",
- "description": ""
- },
- {
- "name": "pumpkin",
- "description": ""
- },
- {
- "name": "pumpkin seeds",
- "description": ""
- },
- {
- "name": "radish",
- "description": ""
- },
- {
- "name": "rape",
- "description": ""
- },
- {
- "name": "raw sugar",
- "description": ""
- },
- {
- "name": "refined sugar",
- "description": ""
- },
- {
- "name": "rice flour",
- "description": ""
- },
- {
- "name": "rock sugar",
- "description": ""
- },
- {
- "name": "rum",
- "description": ""
- },
- {
- "name": "salt",
- "description": ""
- },
- {
- "name": "seafood",
- "description": ""
- },
- {
- "name": "seeds",
- "description": ""
- },
- {
- "name": "sesame seeds",
- "description": ""
- },
- {
- "name": "sunflower seeds",
- "description": ""
- },
- {
- "name": "soda",
- "description": ""
- },
- {
- "name": "soda, baking",
- "description": ""
- },
- {
- "name": "soybean",
- "description": ""
- },
- {
- "name": "spaghetti squash",
- "description": ""
- },
- {
- "name": "spices",
- "description": ""
- },
- {
- "name": "five spice powder",
- "description": ""
- },
- {
- "name": "spinach",
- "description": ""
- },
- {
- "name": "squash family",
- "description": ""
- },
- {
- "name": "squash",
- "description": ""
- },
- {
- "name": "zucchini",
- "description": ""
- },
- {
- "name": "sugar",
- "description": ""
- },
- {
- "name": "caster sugar",
- "description": ""
- },
- {
- "name": "granulated sugar",
- "description": ""
- },
- {
- "name": "superfine sugar",
- "description": ""
- },
- {
- "name": "turbanado sugar",
- "description": ""
- },
- {
- "name": "unrefined sugar",
- "description": ""
- },
- {
- "name": "white sugar",
- "description": ""
- },
- {
- "name": "sweet potato",
- "description": ""
- },
- {
- "name": "sweeteners",
- "description": ""
- },
- {
- "name": "cane sugar",
- "description": ""
- },
- {
- "name": "tahini",
- "description": ""
- },
- {
- "name": "tubers",
- "description": ""
- },
- {
- "name": "potato",
- "description": ""
- },
- {
- "name": "sunchoke",
- "description": ""
- },
- {
- "name": "taro",
- "description": ""
- },
- {
- "name": "yam",
- "description": ""
- },
- {
- "name": "turnip",
- "description": ""
- },
- {
- "name": "vanilla",
- "description": ""
- },
- {
- "name": "vegetables",
- "description": ""
- },
- {
- "name": "brassicas",
- "description": ""
- },
- {
- "name": "fiddlehead fern",
- "description": ""
- },
- {
- "name": "ful",
- "description": ""
- },
- {
- "name": "legumes ",
- "description": ""
- },
- {
- "name": "tomato ",
- "description": ""
- },
- {
- "name": "watercress",
- "description": ""
- },
- {
- "name": "watermelon",
- "description": ""
- },
- {
- "name": "xanthan gum",
- "description": ""
- },
- {
- "name": "yeast",
- "description": ""
- }
-]
\ No newline at end of file
+{
+ "acorn-squash": "acorn squash",
+ "alfalfa-sprouts": "alfalfa sprouts",
+ "anchovies": "anchovies",
+ "apples": "apples",
+ "artichoke": "artichoke",
+ "arugula": "arugula",
+ "asparagus": "asparagus",
+ "aubergine": "aubergine",
+ "avocado": "avocado",
+ "bacon": "bacon",
+ "baking-powder": "baking powder",
+ "baking-soda": "baking soda",
+ "baking-sugar": "baking sugar",
+ "bar-sugar": "bar sugar",
+ "basil": "basil",
+ "bell-peppers": "bell peppers",
+ "blackberries": "blackberries",
+ "brassicas": "brassicas",
+ "bok-choy": "bok choy",
+ "broccoflower": "broccoflower",
+ "broccoli": "broccoli",
+ "broccolini": "broccolini",
+ "broccoli-rabe": "broccoli rabe",
+ "brussels-sprouts": "brussels sprouts",
+ "cabbage": "cabbage",
+ "cauliflower": "cauliflower",
+ "chinese-leaves": "chinese leaves",
+ "collard-greens": "collard greens",
+ "kohlrabi": "kohlrabi",
+ "bread": "bread",
+ "breadfruit": "breadfruit",
+ "broad-beans": "broad beans",
+ "brown-sugar": "brown sugar",
+ "butter": "butter",
+ "butternut-pumpkin": "butternut pumpkin",
+ "butternut-squash": "butternut squash",
+ "cactus-edible": "cactus, edible",
+ "calabrese": "calabrese",
+ "cannabis": "cannabis",
+ "capsicum": "capsicum",
+ "caraway": "caraway",
+ "carrot": "carrot",
+ "castor-sugar": "castor sugar",
+ "cayenne-pepper": "cayenne pepper",
+ "celeriac": "celeriac",
+ "celery": "celery",
+ "cereal-grains": "cereal grains",
+ "rice": "rice",
+ "chard": "chard",
+ "cheese": "cheese",
+ "chicory": "chicory",
+ "chilli-peppers": "chilli peppers",
+ "chives": "chives",
+ "chocolate": "chocolate",
+ "cilantro": "cilantro",
+ "cinnamon": "cinnamon",
+ "clarified-butter": "clarified butter",
+ "coconut": "coconut",
+ "coconut-milk": "coconut milk",
+ "coffee": "coffee",
+ "confectioners-sugar": "confectioners' sugar",
+ "coriander": "coriander",
+ "corn": "corn",
+ "corn-syrup": "corn syrup",
+ "cottonseed-oil": "cottonseed oil",
+ "courgette": "courgette",
+ "cream-of-tartar": "cream of tartar",
+ "cucumber": "cucumber",
+ "cumin": "cumin",
+ "daikon": "daikon",
+ "dairy-products-and-dairy-substitutes": "dairy products and dairy substitutes",
+ "eggs": "eggs",
+ "ghee": "ghee",
+ "milk": "milk",
+ "dandelion": "dandelion",
+ "demerara-sugar": "demerara sugar",
+ "dough": "dough",
+ "edible-cactus": "edible cactus",
+ "eggplant": "eggplant",
+ "endive": "endive",
+ "fats": "fats",
+ "spek": "spek",
+ "fava-beans": "fava beans",
+ "fiddlehead": "fiddlehead",
+ "fish": "fish",
+ "catfish": "catfish ",
+ "cod": "cod",
+ "salt-cod": "salt cod",
+ "salmon": "salmon",
+ "skate": "skate",
+ "stockfish": "stockfish",
+ "trout": "trout",
+ "tuna": "tuna",
+ "five-spice-powder": "five spice powder",
+ "flour": "flour",
+ "frisee": "frisee",
+ "fructose": "fructose",
+ "fruit": "fruit",
+ "apple": "apple",
+ "oranges": "oranges",
+ "pear": "pear",
+ "tomato": "tomato ",
+ "fruit-sugar": "fruit sugar",
+ "garam-masala": "garam masala",
+ "garlic": "garlic",
+ "gem-squash": "gem squash",
+ "ginger": "ginger",
+ "giblets": "giblets",
+ "grains": "grains",
+ "maize": "maize",
+ "sweetcorn": "sweetcorn",
+ "teff": "teff",
+ "grape-seed-oil": "grape seed oil",
+ "green-onion": "green onion",
+ "heart-of-palm": "heart of palm",
+ "hemp": "hemp",
+ "herbs": "herbs",
+ "oregano": "oregano",
+ "parsley": "parsley",
+ "honey": "honey",
+ "horse": "horse",
+ "icing-sugar": "icing sugar",
+ "isomalt": "isomalt",
+ "jackfruit": "jackfruit",
+ "jaggery": "jaggery",
+ "jams": "jams",
+ "jellies": "jellies",
+ "jerusalem-artichoke": "jerusalem artichoke",
+ "jicama": "jicama",
+ "kale": "kale",
+ "kumara": "kumara",
+ "leavening-agents": "leavening agents",
+ "leek": "leek",
+ "legumes": "legumes ",
+ "peas": "peas",
+ "beans": "beans",
+ "lentils": "lentils",
+ "lemongrass": "lemongrass",
+ "lettuce": "lettuce",
+ "liver": "liver",
+ "maple-syrup": "maple syrup",
+ "meat": "meat",
+ "mortadella": "mortadella",
+ "mushroom": "mushroom",
+ "white-mushroom": "white mushroom",
+ "mussels": "mussels",
+ "nori": "nori",
+ "nutmeg": "nutmeg",
+ "nutritional-yeast-flakes": "nutritional yeast flakes",
+ "nuts": "nuts",
+ "nanaimo-bar-mix": "nanaimo bar mix",
+ "octopuses": "octopuses",
+ "oils": "oils",
+ "olive-oil": "olive oil",
+ "okra": "okra",
+ "olive": "olive",
+ "onion-family": "onion family",
+ "onion": "onion",
+ "scallion": "scallion",
+ "shallot": "shallot",
+ "spring-onion": "spring onion",
+ "orange-blossom-water": "orange blossom water",
+ "oysters": "oysters",
+ "panch-puran": "panch puran",
+ "paprika": "paprika",
+ "parsnip": "parsnip",
+ "pepper": "pepper",
+ "peppers": "peppers",
+ "plantain": "plantain",
+ "pineapple": "pineapple",
+ "poppy-seeds": "poppy seeds",
+ "potatoes": "potatoes",
+ "poultry": "poultry",
+ "powdered-sugar": "powdered sugar",
+ "pumpkin": "pumpkin",
+ "pumpkin-seeds": "pumpkin seeds",
+ "radish": "radish",
+ "rape": "rape",
+ "raw-sugar": "raw sugar",
+ "refined-sugar": "refined sugar",
+ "rice-flour": "rice flour",
+ "rock-sugar": "rock sugar",
+ "rum": "rum",
+ "salt": "salt",
+ "seafood": "seafood",
+ "seeds": "seeds",
+ "sesame-seeds": "sesame seeds",
+ "sunflower-seeds": "sunflower seeds",
+ "soda": "soda",
+ "soda-baking": "soda, baking",
+ "soybean": "soybean",
+ "spaghetti-squash": "spaghetti squash",
+ "spices": "spices",
+ "spinach": "spinach",
+ "squash-family": "squash family",
+ "squash": "squash",
+ "zucchini": "zucchini",
+ "sugar": "sugar",
+ "caster-sugar": "caster sugar",
+ "granulated-sugar": "granulated sugar",
+ "superfine-sugar": "superfine sugar",
+ "turbanado-sugar": "turbanado sugar",
+ "unrefined-sugar": "unrefined sugar",
+ "white-sugar": "white sugar",
+ "sweet-potato": "sweet potato",
+ "sweeteners": "sweeteners",
+ "cane-sugar": "cane sugar",
+ "tahini": "tahini",
+ "tubers": "tubers",
+ "potato": "potato",
+ "sunchoke": "sunchoke",
+ "taro": "taro",
+ "yam": "yam",
+ "turnip": "turnip",
+ "vanilla": "vanilla",
+ "vegetables": "vegetables",
+ "fiddlehead-fern": "fiddlehead fern",
+ "ful": "ful",
+ "watercress": "watercress",
+ "watermelon": "watermelon",
+ "xanthan-gum": "xanthan gum",
+ "yeast": "yeast"
+}
\ No newline at end of file
diff --git a/mealie/db/data_initialization/resources/units/en-us.json b/mealie/db/data_initialization/resources/units/en-us.json
index 66d69e083..66444bb77 100644
--- a/mealie/db/data_initialization/resources/units/en-us.json
+++ b/mealie/db/data_initialization/resources/units/en-us.json
@@ -1,122 +1,102 @@
-[
- {
+{
+ "teaspoon": {
"name": "teaspoon",
"description": "",
- "fraction": true,
"abbreviation": "tsp"
},
- {
+ "tablespoon": {
"name": "tablespoon",
"description": "",
- "fraction": true,
"abbreviation": "tbsp"
},
- {
+ "cup": {
"name": "cup",
"description": "",
- "fraction": true,
"abbreviation": "cup"
},
- {
+ "fluid-ounce": {
"name": "fluid ounce",
"description": "",
- "fraction": true,
"abbreviation": "fl oz"
},
- {
+ "pint": {
"name": "pint",
"description": "",
- "fraction": true,
"abbreviation": "pt"
},
- {
+ "quart": {
"name": "quart",
"description": "",
- "fraction": true,
"abbreviation": "qt"
},
- {
+ "gallon": {
"name": "gallon",
"description": "",
- "fraction": true,
"abbreviation": "gal"
},
- {
+ "milliliter": {
"name": "milliliter",
"description": "",
- "fraction": true,
"abbreviation": "ml"
},
- {
+ "liter": {
"name": "liter",
"description": "",
- "fraction": true,
"abbreviation": "l"
},
- {
+ "pound": {
"name": "pound",
"description": "",
- "fraction": true,
"abbreviation": "lb"
},
- {
+ "ounce": {
"name": "ounce",
"description": "",
- "fraction": true,
"abbreviation": "oz"
},
- {
+ "gram": {
"name": "gram",
"description": "",
- "fraction": true,
"abbreviation": "g"
},
- {
+ "kilogram": {
"name": "kilogram",
"description": "",
- "fraction": true,
"abbreviation": "kg"
},
- {
+ "milligram": {
"name": "milligram",
"description": "",
- "fraction": true,
"abbreviation": "mg"
},
- {
+ "splash": {
"name": "splash",
"description": "",
- "fraction": true,
"abbreviation": ""
},
- {
+ "dash": {
"name": "dash",
"description": "",
- "fraction": true,
"abbreviation": ""
},
- {
+ "serving": {
"name": "serving",
"description": "",
- "fraction": true,
"abbreviation": ""
},
- {
+ "head": {
"name": "head",
"description": "",
- "fraction": true,
"abbreviation": ""
},
- {
+ "clove": {
"name": "clove",
"description": "",
- "fraction": true,
"abbreviation": ""
},
- {
+ "can": {
"name": "can",
"description": "",
- "fraction": true,
"abbreviation": ""
}
-]
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/mealie/routes/auth/auth.py b/mealie/routes/auth/auth.py
index bd07a91b2..d968ff3c5 100644
--- a/mealie/routes/auth/auth.py
+++ b/mealie/routes/auth/auth.py
@@ -1,4 +1,7 @@
-from fastapi import APIRouter, BackgroundTasks, Depends, Request, status
+from datetime import timedelta
+from typing import Optional
+
+from fastapi import APIRouter, BackgroundTasks, Depends, Form, Request, status
from fastapi.exceptions import HTTPException
from fastapi.security import OAuth2PasswordRequestForm
from sqlalchemy.orm.session import Session
@@ -15,12 +18,31 @@ public_router = APIRouter(tags=["Users: Authentication"])
user_router = UserAPIRouter(tags=["Users: Authentication"])
-@public_router.post("/token/long")
+class CustomOAuth2Form(OAuth2PasswordRequestForm):
+ def __init__(
+ self,
+ grant_type: str = Form(None, regex="password"),
+ username: str = Form(...),
+ password: str = Form(...),
+ remember_me: bool = Form(False),
+ scope: str = Form(""),
+ client_id: Optional[str] = Form(None),
+ client_secret: Optional[str] = Form(None),
+ ):
+ self.grant_type = grant_type
+ self.username = username
+ self.password = password
+ self.remember_me = remember_me
+ self.scopes = scope.split()
+ self.client_id = client_id
+ self.client_secret = client_secret
+
+
@public_router.post("/token")
def get_token(
background_tasks: BackgroundTasks,
request: Request,
- data: OAuth2PasswordRequestForm = Depends(),
+ data: CustomOAuth2Form = Depends(),
session: Session = Depends(generate_session),
):
email = data.username
@@ -37,7 +59,8 @@ def get_token(
headers={"WWW-Authenticate": "Bearer"},
)
- access_token = security.create_access_token(dict(sub=user.email))
+ duration = timedelta(days=14) if data.remember_me else None
+ access_token = security.create_access_token(dict(sub=user.email), duration)
return {"access_token": access_token, "token_type": "bearer"}
diff --git a/mealie/services/image/image.py b/mealie/services/image/image.py
index baab21ec6..94ccd6c91 100644
--- a/mealie/services/image/image.py
+++ b/mealie/services/image/image.py
@@ -55,6 +55,8 @@ def scrape_image(image_url: str, slug: str) -> Path:
all_image_requests = []
for url in image_url:
+ if isinstance(url, dict):
+ url = url.get("url", "")
try:
r = requests.get(url, stream=True, headers={"User-Agent": _FIREFOX_UA})
except Exception: