diff --git a/.gitignore b/.gitignore index a8af265..55b3c2e 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ package-lock.json yarn.lock *.db +__pycache__ .DS_Store node_modules/ diff --git a/cuizin/__pycache__/__init__.cpython-36.pyc b/cuizin/__pycache__/__init__.cpython-36.pyc deleted file mode 100644 index 99af6d0..0000000 Binary files a/cuizin/__pycache__/__init__.cpython-36.pyc and /dev/null differ diff --git a/cuizin/__pycache__/__main__.cpython-36.pyc b/cuizin/__pycache__/__main__.cpython-36.pyc deleted file mode 100644 index ad3accf..0000000 Binary files a/cuizin/__pycache__/__main__.cpython-36.pyc and /dev/null differ diff --git a/cuizin/__pycache__/db.cpython-36.pyc b/cuizin/__pycache__/db.cpython-36.pyc deleted file mode 100644 index 7858d23..0000000 Binary files a/cuizin/__pycache__/db.cpython-36.pyc and /dev/null differ diff --git a/cuizin/db.py b/cuizin/db.py index 804a870..e1bebea 100644 --- a/cuizin/db.py +++ b/cuizin/db.py @@ -1,6 +1,6 @@ import base64 -import mimetypes +import magic import requests from peewee import ( Model, SqliteDatabase, @@ -9,7 +9,7 @@ from peewee import ( from playhouse.shortcuts import model_to_dict -database = SqliteDatabase('recipes.db', threadlocals=True) +database = SqliteDatabase('recipes.db') database.connect() @@ -43,7 +43,8 @@ class Recipe(Model): def to_dict(self): serialized = model_to_dict(self) prepend_info = ( - 'data:%s;base64' % mimetypes.guess_type(serialized['picture'])[0] + 'data:%s;base64' % magic.from_buffer(serialized['picture'], + mime=True) ) serialized['picture'] = '%s,%s' % ( prepend_info, diff --git a/cuizin/js_src/components/New.vue b/cuizin/js_src/components/New.vue index 4b6482d..b51bc19 100644 --- a/cuizin/js_src/components/New.vue +++ b/cuizin/js_src/components/New.vue @@ -19,7 +19,7 @@ - +

Add manually

@@ -116,6 +116,7 @@ export default { } }, ], + featureAddManually: false, }; }, methods: { diff --git a/cuizin/js_src/components/Recipe.vue b/cuizin/js_src/components/Recipe.vue index a0e9ec5..04006a7 100644 --- a/cuizin/js_src/components/Recipe.vue +++ b/cuizin/js_src/components/Recipe.vue @@ -1,12 +1,28 @@