mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-22 14:33:33 -07:00
add url param
This commit is contained in:
parent
74fc10cf1c
commit
34fd57d576
2 changed files with 6 additions and 3 deletions
|
@ -95,6 +95,7 @@ def determine_sqlite_path(path=False, suffix=DB_VERSION) -> str:
|
|||
class AppSettings(BaseSettings):
|
||||
global DATA_DIR
|
||||
PRODUCTION: bool = Field(True, env="PRODUCTION")
|
||||
BASE_URL: str = "http://localhost:8080"
|
||||
IS_DEMO: bool = False
|
||||
API_PORT: int = 9000
|
||||
API_DOCS: bool = True
|
||||
|
|
|
@ -2,11 +2,13 @@ from shutil import copyfileobj
|
|||
|
||||
from fastapi import APIRouter, BackgroundTasks, Depends, File, Form, HTTPException, status
|
||||
from fastapi.datastructures import UploadFile
|
||||
from mealie.core.config import settings
|
||||
from mealie.core.root_logger import get_logger
|
||||
from mealie.db.database import db
|
||||
from mealie.db.db_setup import generate_session
|
||||
from mealie.routes.deps import get_current_user
|
||||
from mealie.schema.recipe import Recipe, RecipeAsset, RecipeURLIn
|
||||
from mealie.schema.user import UserInDB
|
||||
from mealie.services.events import create_recipe_event
|
||||
from mealie.services.image.image import scrape_image, write_image
|
||||
from mealie.services.recipe.media import check_assets, delete_assets
|
||||
|
@ -31,7 +33,7 @@ def create_from_json(
|
|||
background_tasks.add_task(
|
||||
create_recipe_event,
|
||||
"Recipe Created (URL)",
|
||||
f"'{recipe.name}' by {current_user.full_name}",
|
||||
f"'{recipe.name}' by {current_user.full_name} \n {settings.BASE_URL}/recipe/{recipe.slug}",
|
||||
session=session,
|
||||
attachment=recipe.image_dir.joinpath("min-original.webp"),
|
||||
)
|
||||
|
@ -44,7 +46,7 @@ def parse_recipe_url(
|
|||
background_tasks: BackgroundTasks,
|
||||
url: RecipeURLIn,
|
||||
session: Session = Depends(generate_session),
|
||||
current_user=Depends(get_current_user),
|
||||
current_user: UserInDB = Depends(get_current_user),
|
||||
):
|
||||
""" Takes in a URL and attempts to scrape data and load it into the database """
|
||||
|
||||
|
@ -54,7 +56,7 @@ def parse_recipe_url(
|
|||
background_tasks.add_task(
|
||||
create_recipe_event,
|
||||
"Recipe Created (URL)",
|
||||
f"'{recipe.name}' by {current_user.full_name}",
|
||||
f"'{recipe.name}' by {current_user.full_name} \n {settings.BASE_URL}/recipe/{recipe.slug}",
|
||||
session=session,
|
||||
attachment=recipe.image_dir.joinpath("min-original.webp"),
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue