Bug Fixes (#467)

* fixes #463

* fixes #465

* fixes #461

* fixes #458 key error

* Fixes #459

* Fixes comments shown when printing

* fix meal-image not return on API call

* return better status

* reorganize docs

Co-authored-by: hay-kot <hay-kot@pm.me>
This commit is contained in:
Hayden 2021-06-04 18:45:13 -08:00 committed by GitHub
parent d126f74d35
commit 59f8b74460
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 72 additions and 46 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -0,0 +1,2 @@
!!! info
This guide was submitted by a community member. Find something wrong? Submit a PR to get it fixed!

View File

@ -1,5 +1,5 @@
!!! info
This example was submitted by a user. Have an Example? Submit a PR!
This guide was submitted by a community member. Find something wrong? Submit a PR to get it fixed!
Recipes can be imported in bulk from a file containing a list of URLs. This can be done using the following bash or python scripts with the `list` file containing one URL per line.

View File

@ -1,3 +1,7 @@
!!! info
This guide was submitted by a community member. Find something wrong? Submit a PR to get it fixed!
In a lot of ways, Home Assistant is why this project exists! Since it Mealie has a robust API it makes it a great fit for interacting with Home Assistant and pulling information into your dashboard.
### Get Todays Meal in Lovelace

View File

@ -1,4 +1,9 @@
# Using iOS Shortcuts with Mealie
!!! info
This guide was submitted by a community member. Find something wrong? Submit a PR to get it fixed!
![](../assets/img/iphone-image.png){: align=right style="height:400px;width:400px"}

View File

@ -1,5 +1,10 @@
# Using SWAG as Reverse Proxy
!!! info
This guide was submitted by a community member. Find something wrong? Submit a PR to get it fixed!
To make the setup of a Reverse Proxy much easier, Linuxserver.io developed [SWAG](https://github.com/linuxserver/docker-swag)
SWAG - Secure Web Application Gateway (formerly known as letsencrypt, no relation to Let's Encrypt™) sets up an Nginx web server and reverse proxy with PHP support and a built-in certbot client that automates free SSL server certificate generation and renewal processes (Let's Encrypt and ZeroSSL). It also contains fail2ban for intrusion prevention.

View File

@ -47,13 +47,13 @@ New events can be created and viewed in admin Toolbox `/admin/toolbox?tab=event-
!!! tip
The feedback provided from the test feature is only an indicated of if the URL you provided is valid, not if the message was successfully sent. Be sure to check the notification feed for the test message.
![Add Notification Image](../../assets/img/add-notification.webp)
![Add Notification Image](../assets/img/add-notification.webp)
## Examples
### Discord
![Discord]()
![Discord](../assets/img/discord-notification-example.webp)
### Gotify
![Gotify]()
![Gotify](../assets/img/gotify-notification-example.webp)

View File

@ -19,7 +19,7 @@ Below are some general guidelines that were considered when creating the organiz
In the diagram below you will see what we came up with using the new custom pages feature. The large circles indicate pages, and the rectangles indicate categories. We've grouped several 'like' categories with each other as a way to quickly find similar items.
![Mealie Diagram](../../assets/img/mealie-diagram.webp)
![Mealie Diagram](../assets/img/mealie-diagram.webp)
## Toolbox
The toolbox gives you multiple options to clean-up and organize your recipes. You can acces it through the 'Settings' menu or through the [dashboard](../site-administration/dashboard.md).

File diff suppressed because one or more lines are too long

View File

@ -56,20 +56,20 @@ nav:
- Organizing Recipes: "getting-started/organizing-recipes.md"
- Planning Meals: "getting-started/meal-planner.md"
- External Notifications: "getting-started/notifications.md"
- iOS Shortcuts: "getting-started/ios.md"
- API Usage: "getting-started/api-usage.md"
- Site Administration:
- Dashboard: "site-administration/dashboard.md"
- User Settings: "site-administration/user-settings.md"
- Site Settings: "site-administration/site-settings.md"
- Building Pages: "site-administration/building-pages.md"
- User Management: "site-administration/user-management.md"
- Dashboard: "site-administration/dashboard.md"
- Backups and Restore: "site-administration/backups-and-exports.md"
- Recipe Migration: "site-administration/migration-imports.md"
- API Usage:
- Getting Started: "api-usage/getting-started.md"
- Home Assistant: "api-usage/home-assistant.md"
- Bulk Url Import: "api-usage/bulk-url-import.md"
- Community Guide: "community-guide/swag.md"
- Community Guides:
- iOS Shortcuts: "community-guide/ios.md"
- Reverse Proxy (SWAG): "community-guide/swag.md"
- Home Assistant: "community-guide/home-assistant.md"
- Bulk Url Import: "community-guide/bulk-url-import.md"
- API Reference: "api/redoc.md"
- Contributors Guide:
- Non-Code: "contributors/non-coders.md"

View File

@ -27,7 +27,7 @@
<div>
<v-text-field :label="$t('general.url')" class="pt-5" clearable v-model="url">
<template v-slot:append-outer>
<v-btn class="ml-2" color="primary" @click="getImageFromURL" :loading="loading">
<v-btn class="ml-2" color="primary" @click="getImageFromURL" :loading="loading" :disabled="slug">
{{ $t("general.get") }}
</v-btn>
</template>

View File

@ -21,7 +21,7 @@
{{ recipe.recipeYield }}
</v-btn>
</v-col>
<Rating :value="recipe.rating" :name="recipe.name" :slug="recipe.slug" />
<Rating :value="recipe.rating" :name="recipe.name" :slug="recipe.slug" :key="recipe.slug" />
</v-row>
<v-row>
<v-col cols="12" sm="12" md="4" lg="4">

View File

@ -14,7 +14,7 @@
<v-icon>mdi-account-plus-outline</v-icon>
</v-tab>
<v-tab href="#groups">
<v-tab href="#groups" @click="reqGroups">
{{ $t("group.groups") }}
<v-icon>{{ $globals.icons.group }}</v-icon>
</v-tab>
@ -55,7 +55,12 @@ export default {
},
},
mounted() {
this.$store.dispatch("requestAllGroups");
this.reqGroups();
},
methods: {
reqGroups() {
this.$store.dispatch("requestAllGroups");
},
},
};
</script>

View File

@ -45,7 +45,7 @@
<RecipeEditor v-else v-model="recipeDetails" ref="recipeEditor" @upload="getImageFile" />
</v-card>
<CommentsSection
class="mt-2"
class="mt-2 d-print-none"
:slug="recipeDetails.slug"
:comments="recipeDetails.comments"
@new-comment="getRecipeDetails"

View File

@ -45,6 +45,25 @@ def get_today(session: Session = Depends(generate_session), current_user: UserIn
return recipe
@router.get("/today/image", tags=["Meal Plan"])
def get_todays_image(session: Session = Depends(generate_session), group_name: str = "Home"):
"""
Returns the image for todays meal-plan.
"""
group_in_db: GroupInDB = db.groups.get(session, group_name, "name")
recipe = get_todays_meal(session, group_in_db)
if recipe:
recipe_image = recipe.image_dir.joinpath(image.ImageOptions.ORIGINAL_IMAGE)
else:
raise HTTPException(status.HTTP_404_NOT_FOUND)
if recipe_image:
return FileResponse(recipe_image)
else:
raise HTTPException(status.HTTP_404_NOT_FOUND)
@router.get("/{id}", response_model=MealPlanOut)
def get_meal_plan(
id,
@ -106,22 +125,3 @@ def delete_meal_plan(
)
except Exception:
raise HTTPException(status.HTTP_400_BAD_REQUEST)
@router.get("/today/image", tags=["Meal Plan"])
def get_todays_image(session: Session = Depends(generate_session), group_name: str = "Home"):
"""
Returns the image for todays meal-plan.
"""
group_in_db: GroupInDB = db.groups.get(session, group_name, "name")
recipe = get_todays_meal(session, group_in_db)
if recipe:
recipe_image = recipe.image_dir.joinpath(image.ImageOptions.ORIGINAL_IMAGE)
else:
raise HTTPException(status.HTTP_404_NOT_FOUND)
if recipe_image:
return FileResponse(recipe_image)
else:
raise HTTPException(status.HTTP_404_NOT_FOUND)

View File

@ -1,4 +1,4 @@
from fastapi import APIRouter, Depends
from fastapi import APIRouter, Depends, HTTPException, status
from mealie.db.database import db
from mealie.db.db_setup import generate_session
from mealie.routes.deps import get_current_user
@ -35,4 +35,7 @@ def test_webhooks(
""" Run the function to test your webhooks """
group_entry: GroupInDB = db.groups.get(session, current_user.group, "name")
return post_webhooks(group_entry.id, session)
try:
post_webhooks(group_entry.id, session)
except Exception:
return HTTPException(status.HTTP_500_INTERNAL_SERVER_ERROR)

View File

@ -12,9 +12,9 @@ logger = root_logger.get_logger()
@dataclass
class ImageOptions:
ORIGINAL_IMAGE: str = "original*"
MINIFIED_IMAGE: str = "min-original*"
TINY_IMAGE: str = "tiny-original*"
ORIGINAL_IMAGE: str = "original.webp"
MINIFIED_IMAGE: str = "min-original.webp"
TINY_IMAGE: str = "tiny-original.webp"
IMG_OPTIONS = ImageOptions()

View File

@ -33,7 +33,7 @@ class Cleaner:
recipe_data["recipeYield"] = Cleaner.yield_amount(recipe_data.get("recipeYield"))
recipe_data["recipeIngredient"] = Cleaner.ingredient(recipe_data.get("recipeIngredient"))
recipe_data["recipeInstructions"] = Cleaner.instructions(recipe_data["recipeInstructions"])
recipe_data["recipeInstructions"] = Cleaner.instructions(recipe_data.get("recipeInstructions"))
recipe_data["image"] = Cleaner.image(recipe_data.get("image"))
recipe_data["slug"] = slugify(recipe_data.get("name"))
recipe_data["orgURL"] = url

View File

@ -1,3 +1,5 @@
import json
import requests
from mealie.db.database import db
from mealie.db.db_setup import create_session
@ -7,11 +9,11 @@ from mealie.services.meal_services import get_todays_meal
from sqlalchemy.orm.session import Session
def post_webhooks(group: int, session: Session = None):
def post_webhooks(group: int, session: Session = None, force=True):
session = session or create_session()
group_settings: GroupInDB = db.groups.get(session, group)
if not group_settings.webhook_enable:
if not group_settings.webhook_enable and not force:
return
todays_recipe = get_todays_meal(session, group)
@ -20,7 +22,7 @@ def post_webhooks(group: int, session: Session = None):
return
for url in group_settings.webhook_urls:
requests.post(url, json=todays_recipe.json())
requests.post(url, json=json.loads(todays_recipe.json(by_alias=True)))
create_scheduled_event("Meal Plan Webhook", f"Meal plan webhook executed for group '{group}'")