Compare commits

...

43 Commits
1.1.0 ... 1.1.2

Author SHA1 Message Date
vabene1111
edde8c8b8f Merge branch 'develop' 2022-03-04 15:54:16 +01:00
vabene1111
c950e6dabb Merge pull request #1625 from TandoorRecipes/dependabot/pip/recipe-scrapers-13.19.0
Bump recipe-scrapers from 13.18.0 to 13.19.0
2022-03-04 14:29:18 +01:00
vabene1111
e27a64f52c Merge pull request #1623 from gloriousDan/develop
Improve recipe import for non schema.org recipes
2022-03-04 14:28:34 +01:00
vabene1111
f02b6f29db Merge pull request #1620 from ratheile/ratheile-patch-boot-nonstandard-ports
Update boot.sh
2022-03-04 14:27:31 +01:00
dependabot[bot]
a3ba516587 Bump recipe-scrapers from 13.18.0 to 13.19.0
Bumps [recipe-scrapers](https://github.com/hhursev/recipe-scrapers) from 13.18.0 to 13.19.0.
- [Release notes](https://github.com/hhursev/recipe-scrapers/releases)
- [Commits](https://github.com/hhursev/recipe-scrapers/compare/13.18.0...13.19.0)

---
updated-dependencies:
- dependency-name: recipe-scrapers
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-04 13:27:30 +00:00
vabene1111
a15f5895f5 Merge pull request #1622 from MaxJa4/fix/ldap_dockerfile
Added ldap as runtime dependency to Dockerfile
2022-03-04 14:27:01 +01:00
vabene1111
c6e36b802c Merge pull request #1617 from smilerz/fix_sqlite_search
remove unaccent from sqlite search
2022-03-04 14:26:32 +01:00
vabene1111
f91ca28638 Merge pull request #1611 from smilerz/missing_preptime
missing prepTime assignment
2022-03-04 14:26:21 +01:00
Daniel Schulz
cfcf354d59 Improve recipe import for non schema.org recipes 2022-03-03 23:47:50 +01:00
MaxJa4
6813077113 Added ldap as runtime dependency to Dockerfile 2022-03-03 22:27:41 +01:00
Raffael Theiler
581ee762b6 Update boot.sh
Add port to pg_isready to allow non-standard ports.
2022-03-03 19:27:51 +01:00
smilerz
08c1a8f2ab fix loading children in treeselect 2022-03-02 14:56:33 -06:00
smilerz
ba25e463ad added uritemplate requirement back 2022-03-02 10:13:40 -06:00
smilerz
f2211da9bb remove unaccent from sqlite search 2022-03-02 09:42:10 -06:00
vabene1111
030d977a8c Merge branch 'develop' 2022-03-02 13:11:57 +01:00
vabene1111
8d3419952c movbed pg password check 2022-03-02 13:11:52 +01:00
vabene1111
8010ee3dca logical fix 2022-03-02 12:22:54 +01:00
vabene1111
0f3d82a5e6 fixing boot script 2022-03-02 12:22:12 +01:00
vabene1111
5e67e735db Merge branch 'beta' into develop 2022-03-02 12:17:40 +01:00
vabene1111
f9f6ca05a4 Merge pull request #1612 from smilerz/mealplan_modal_shopping
trigger shopping modal
2022-03-02 09:43:46 +01:00
vabene1111
d7379d8ab6 testing with setuptools_rust 2022-03-02 09:39:54 +01:00
vabene1111
51f44e4926 testing with py dev 2022-03-02 09:37:11 +01:00
vabene1111
447a16dcd5 re enabled disabled architectures 2022-03-02 09:28:28 +01:00
vabene1111
f15922ceb5 testing cryptography builds with rustc 2022-03-02 09:25:29 +01:00
vabene1111
a5cc218b56 Merge branch 'develop' into beta 2022-03-02 09:24:09 +01:00
vabene1111
640d7305c7 Merge branch 'master' into develop 2022-03-02 09:24:02 +01:00
vabene1111
fdf98932e2 exchanged deprecated vars 2022-03-02 09:20:35 +01:00
smilerz
2993c7e688 trigger shopping modal 2022-03-01 17:17:35 -06:00
smilerz
d6db3fe65b missing prepTime assignment 2022-03-01 16:31:18 -06:00
vabene1111
9a795a7f60 docker dont pip install cryptography
dont install cryptography wheel in alpine docker build as py-cryptography already takes care of this.
2022-03-01 19:50:17 +01:00
vabene1111
9ecb087cd6 Merge branch 'develop' into beta 2022-02-27 12:37:26 +01:00
vabene1111
559fee0ffe Merge branch 'develop' into beta 2022-01-23 12:51:07 +01:00
vabene1111
e15fec9845 Merge branch 'develop' into beta 2022-01-18 22:51:51 +01:00
vabene1111
2073158e1f Merge branch 'develop' into beta 2022-01-18 16:18:19 +01:00
vabene1111
7e2ee0300c Merge branch 'develop' into beta 2022-01-18 07:57:17 +01:00
vabene1111
79f6e27959 Merge branch 'develop' into beta 2022-01-17 17:00:16 +01:00
vabene1111
450923c0a4 Merge branch 'develop' into beta 2021-12-23 15:55:42 +01:00
vabene1111
7537c1a908 Merge branch 'develop' into beta 2021-11-15 08:41:15 +01:00
vabene1111
6cfd1a495e Merge branch 'develop' into beta 2021-10-29 14:56:41 +02:00
vabene1111
17d4619c31 Merge branch 'develop' into beta 2021-10-29 11:49:17 +02:00
vabene1111
2c05e7e282 Merge branch 'develop' into beta 2021-10-26 14:53:31 +02:00
vabene1111
928be086e4 Merge branch 'develop' into beta 2021-10-14 09:03:26 +02:00
vabene1111
e3c86e8685 Merge branch 'develop' into beta 2021-10-11 16:30:28 +02:00
9 changed files with 65 additions and 41 deletions

View File

@@ -35,8 +35,8 @@ jobs:
publish: true
imageName: vabene1111/recipes
tag: beta
dockerHubUser: ${{ secrets.DOCKER_USERNAME }}
dockerHubPassword: ${{ secrets.DOCKER_PASSWORD }}
dockerUser: ${{ secrets.DOCKER_USERNAME }}
dockerPassword: ${{ secrets.DOCKER_PASSWORD }}
# Send discord notification
- name: Discord notification
env:

View File

@@ -39,6 +39,5 @@ jobs:
publish: true
imageName: vabene1111/recipes
tag: latest
platform: linux/amd64,linux/arm64
dockerHubUser: ${{ secrets.DOCKER_USERNAME }}
dockerHubPassword: ${{ secrets.DOCKER_PASSWORD }}
dockerUser: ${{ secrets.DOCKER_USERNAME }}
dockerPassword: ${{ secrets.DOCKER_PASSWORD }}

View File

@@ -41,7 +41,6 @@ jobs:
publish: true
imageName: vabene1111/recipes
tag: ${{ steps.get_version.outputs.VERSION }}
platform: linux/amd64,linux/arm64
dockerUser: ${{ secrets.DOCKER_USERNAME }}
dockerPassword: ${{ secrets.DOCKER_PASSWORD }}
# Send discord notification

View File

@@ -1,7 +1,7 @@
FROM python:3.10-alpine3.15
#Install all dependencies.
RUN apk add --no-cache postgresql-libs postgresql-client gettext zlib libjpeg libwebp libxml2-dev libxslt-dev py-cryptography
RUN apk add --no-cache postgresql-libs postgresql-client gettext zlib libjpeg libwebp libxml2-dev libxslt-dev py-cryptography openldap
#Print all logs without buffering it.
ENV PYTHONUNBUFFERED 1
@@ -15,13 +15,12 @@ WORKDIR /opt/recipes
COPY requirements.txt ./
RUN sed -i '/cryptography==/d' ./requirements.txt
RUN apk add --no-cache --virtual .build-deps gcc musl-dev postgresql-dev zlib-dev jpeg-dev libwebp-dev libressl-dev python3-dev libffi-dev cargo openldap-dev && \
RUN apk add --no-cache --virtual .build-deps gcc musl-dev postgresql-dev zlib-dev jpeg-dev libwebp-dev libressl-dev libffi-dev cargo openssl-dev openldap-dev python3-dev && \
echo -n "INPUT ( libldap.so )" > /usr/lib/libldap_r.so && \
python -m venv venv && \
/opt/recipes/venv/bin/python -m pip install --upgrade pip && \
venv/bin/pip install wheel==0.37.1 && \
venv/bin/pip install setuptools_rust==1.1.2 && \
venv/bin/pip install -r requirements.txt --no-cache-dir &&\
apk --purge del .build-deps

21
boot.sh
View File

@@ -21,18 +21,23 @@ if [ -z "${SECRET_KEY}" ]; then
display_warning "The environment variable 'SECRET_KEY' is not set but REQUIRED for running Tandoor!"
fi
# POSTGRES_PASSWORD must be set in .env file
if [ -z "${POSTGRES_PASSWORD}" ]; then
display_warning "The environment variable 'POSTGRES_PASSWORD' is not set but REQUIRED for running Tandoor!"
fi
echo "Waiting for database to be ready..."
attempt=0
max_attempts=20
while pg_isready --host=${POSTGRES_HOST} -q; status=$?; attempt=$((attempt+1)); [ $status -ne 0 ] && [ $attempt -le $max_attempts ]; do
sleep 5
done
if [ "${DB_ENGINE}" != 'django.db.backends.sqlite3' ]; then
# POSTGRES_PASSWORD must be set in .env file
if [ -z "${POSTGRES_PASSWORD}" ]; then
display_warning "The environment variable 'POSTGRES_PASSWORD' is not set but REQUIRED for running Tandoor!"
fi
while pg_isready --host=${POSTGRES_HOST} --port=${POSTGRES_PORT} -q; status=$?; attempt=$((attempt+1)); [ $status -ne 0 ] && [ $attempt -le $max_attempts ]; do
sleep 5
done
fi
if [ $attempt -gt $max_attempts ]; then
echo -e "\nDatabase not reachable. Maximum attempts exceeded."
@@ -58,4 +63,4 @@ echo "Done"
chmod -R 755 /opt/recipes/mediafiles
exec gunicorn -b :$TANDOOR_PORT --access-logfile - --error-logfile - --log-level INFO recipes.wsgi
exec gunicorn -b :$TANDOOR_PORT --access-logfile - --error-logfile - --log-level INFO recipes.wsgi

View File

@@ -89,7 +89,10 @@ class RecipeSearch():
self._search_type = self._search_prefs.search or 'plain'
if self._string:
self._unaccent_include = self._search_prefs.unaccent.values_list('field', flat=True)
if self._postgres:
self._unaccent_include = self._search_prefs.unaccent.values_list('field', flat=True)
else:
self._unaccent_include = []
self._icontains_include = [x + '__unaccent' if x in self._unaccent_include else x for x in self._search_prefs.icontains.values_list('field', flat=True)]
self._istartswith_include = [x + '__unaccent' if x in self._unaccent_include else x for x in self._search_prefs.istartswith.values_list('field', flat=True)]
self._trigram_include = None
@@ -726,9 +729,8 @@ class RecipeFacet():
return self.get_facets()
def _recipe_count_queryset(self, field, depth=1, steplen=4):
return Recipe.objects.filter(**{f'{field}__path__startswith': OuterRef('path')}, id__in=self._recipe_list, space=self._request.space
).values(child=Substr(f'{field}__path', 1, steplen*depth)
).annotate(count=Count('pk', distinct=True)).values('count')
return Recipe.objects.filter(**{f'{field}__path__startswith': OuterRef('path'), f'{field}__depth__gte': depth}, id__in=self._recipe_list, space=self._request.space
).annotate(count=Coalesce(Func('pk', function='Count'), 0)).values('count')
def _keyword_queryset(self, queryset, keyword=None):
depth = getattr(keyword, 'depth', 0) + 1

View File

@@ -3,8 +3,8 @@ import re
from html import unescape
from unicodedata import decomposition
from django.utils.translation import gettext as _
from django.utils.dateparse import parse_duration
from django.utils.translation import gettext as _
from isodate import parse_duration as iso_parse_duration
from isodate.isoerror import ISO8601Error
from recipe_scrapers._utils import get_minutes
@@ -28,9 +28,14 @@ def get_from_scraper(scrape, request):
recipe_json['name'] = ''
try:
description = scrape.schema.data.get("description") or ''
description = scrape.description() or None
except Exception:
description = ''
description = None
if not description:
try:
description = scrape.schema.data.get("description") or ''
except Exception:
description = ''
recipe_json['description'] = parse_description(description)
@@ -51,20 +56,26 @@ def get_from_scraper(scrape, request):
recipe_json['servings'] = max(servings, 1)
try:
recipe_json['prepTime'] = get_minutes(scrape.schema.data.get("prepTime")) or 0
recipe_json['prepTime'] = get_minutes(scrape.prep_time()) or 0
except Exception:
recipe_json['prepTime'] = 0
try:
recipe_json['prepTime'] = get_minutes(scrape.schema.data.get("prepTime")) or 0
except Exception:
recipe_json['prepTime'] = 0
try:
recipe_json['cookTime'] = get_minutes(scrape.schema.data.get("cookTime")) or 0
recipe_json['cookTime'] = get_minutes(scrape.cook_time()) or 0
except Exception:
recipe_json['cookTime'] = 0
try:
recipe_json['cookTime'] = get_minutes(scrape.schema.data.get("cookTime")) or 0
except Exception:
recipe_json['cookTime'] = 0
if recipe_json['cookTime'] + recipe_json['prepTime'] == 0:
try:
recipe_json['prepTime'] = get_minutes(scrape.total_time()) or 0
except Exception:
try:
get_minutes(scrape.schema.data.get("totalTime")) or 0
recipe_json['prepTime'] = get_minutes(scrape.schema.data.get("totalTime")) or 0
except Exception:
pass
@@ -85,15 +96,23 @@ def get_from_scraper(scrape, request):
except Exception:
pass
try:
if scrape.schema.data.get('recipeCategory'):
keywords += listify_keywords(scrape.schema.data.get("recipeCategory"))
if scrape.category():
keywords += listify_keywords(scrape.category())
except Exception:
pass
try:
if scrape.schema.data.get('recipeCategory'):
keywords += listify_keywords(scrape.schema.data.get("recipeCategory"))
except Exception:
pass
try:
if scrape.schema.data.get('recipeCuisine'):
keywords += listify_keywords(scrape.schema.data.get("recipeCuisine"))
if scrape.cuisine():
keywords += listify_keywords(scrape.cuisine())
except Exception:
pass
try:
if scrape.schema.data.get('recipeCuisine'):
keywords += listify_keywords(scrape.schema.data.get("recipeCuisine"))
except Exception:
pass
try:
recipe_json['keywords'] = parse_keywords(list(set(map(str.casefold, keywords))), request.space)
except AttributeError:
@@ -146,9 +165,9 @@ def get_from_scraper(scrape, request):
except Exception:
recipe_json['recipeInstructions'] = ""
if scrape.url:
recipe_json['url'] = scrape.url
recipe_json['recipeInstructions'] += "\n\n" + _("Imported from") + ": " + scrape.url
if scrape.canonical_url():
recipe_json['url'] = scrape.canonical_url()
recipe_json['recipeInstructions'] += "\n\n" + _("Imported from") + ": " + scrape.canonical_url()
return recipe_json

View File

@@ -22,13 +22,14 @@ webdavclient3==3.14.6
whitenoise==5.3.0
icalendar==4.0.9
pyyaml==6.0
uritemplate==4.1.1
beautifulsoup4==4.10.0
microdata==0.8.0
Jinja2==3.0.3
django-webpack-loader==1.4.1
django-js-reverse==0.9.1
django-allauth==0.47.0
recipe-scrapers==13.18.0
recipe-scrapers==13.19.0
django-scopes==1.2.0
pytest==6.2.5
pytest-django==4.5.2

View File

@@ -206,7 +206,7 @@ export default {
}
if (!cancel) {
this.$bvModal.hide(`edit-modal`)
this.$emit("save-entry", { ...this.mealplan_settings, ...this.entryEditing, ...{ addshopping: this.entryEditing.addshopping && !this.autoMealPlan } })
this.$emit("save-entry", { ...this.mealplan_settings, ...this.entryEditing, ...{ addshopping: this.mealplan_settings.addshopping && !this.autoMealPlan } })
}
},
deleteEntry() {