From 0f5a564ff34b2fefa56ddbf64fe93a38bd003682 Mon Sep 17 00:00:00 2001 From: Hayden <64056131+hay-kot@users.noreply.github.com> Date: Sat, 17 Apr 2021 12:57:47 -0800 Subject: [PATCH] v0.4.2 (#310) * fix links * actually fix #238 * Feature/mkdocs version bump (#240) * fix links (#239) Co-authored-by: hay-kot * fix #238 * bump mkdocs version * light/dark toggle * light/dark mode css * API_DOCS defaults to True * disable build on push for master Co-authored-by: hay-kot * Feature/recipe viewer (#244) * fix dialog placement * markdown support in ingredients * fix line render issue * fix tag rendering bug * change ingredients to text area * no slug error * add tag pages * remove console.logs Co-authored-by: hay-kot * changelog v0.4.1 * bug/backup-download (#245) * fix blocked download * + download blocked Co-authored-by: hay-kot * Feature/meal planner (#246) * fixes duplicate recipes in meal-plan #221 * add quick week option * scope css * add mealplanner info Co-authored-by: hay-kot * Nextcloud Import Bugs - #248 (#250) * parses datetime properly + clean category - #248 * add default credentials to docs Co-authored-by: hay-kot * Add bulk import examples to docs. (#252) * Add bulk import examples to docs. * Update api-usage.md * Add Python example for bulk import. * Change IP address in API example. * Refactor/app settings (#251) * fix env setup bugs * remove unused import * fix layout issues * changelog Co-authored-by: hay-kot * env setup fixes * Feature/about api (#253) * fix settings * app info cleanup Co-authored-by: hay-kot * Feature/image minify (#256) * fix settings * app info cleanup * bottom-bar experiment * remove dup key * type hints * add dependency * updated image with query parameters * read image options * add image minification * add image minification step * alt image routes * add image minification * set mobile bar to top Co-authored-by: hay-kot * Feature/additional endpoints (#257) * new recipe summary route * add categories to cards * add pillow * show tags instead of categories * additional debug info * add todays meal image url * about page * fix reactive tag * changelog + docs * bump version Co-authored-by: hay-kot * add pillow dependencies (#258) Co-authored-by: hay-kot * Feature/search page (#259) * add pillow dependencies * advanced search page * advanced search apge * remove extra dependencies * add pre-run script Co-authored-by: hay-kot * no image assignment * advanced search * fix docker dev build * Do not force theme settings on login form (#260) * Fix docker dev db persistence (#264) * Fix docker dev db persistence * Make run.sh the only startup script for prod + dev Credits to @hay-kot for run.sh script logic * Restore dev backend initialization in non-docker setup * Make run.sh POSIX-friendly * Allow dev backend to auto-reload in Docker * Frontend Refactor + Bug Fixes * merge category and tag selector * unifiy category selector * add hint * spacing * fix nextcloud migration * simplify email validator #261 * formatting * cleanup * auto-gen * format * update run script * unified category/tag selector * rename component * Add advanced search link * remove old code * convert keywords to tags * add proper behavior on rename * proper image name association on rename * fix test cleanup * changelog * set docker comppand * minify on migration Co-authored-by: hay-kot * bug-fixes/category-tag-creator (#266) * fix category labels * set loader for migration * v0.4.1 Co-authored-by: hay-kot * Hot Fix (#269) * fix category labels * set loader for migration * v0.4.1 * reorganize API docs Co-authored-by: hay-kot * Fix some pytests (#265) * Fix encoding issue in cleaner unit test * Add VS Code task to run pytests * Fix FileExistsError when running Windows * Add Portuguese Translation (#232) * Add Portuguese Translation * add portuguese translation option * formatting * add missing } * specify absolute path * Feature/migration-rewrite (#278) * start * migration rewrite * update name * convert chowdown to new methods * refactor/remove duplicate code * refactor to unify logger + log to file * remove toolbox * Display report on UI Co-authored-by: hay-kot * refactor/image-minification (#285) * refactor image minification calls * remove nusiance logs Co-authored-by: hay-kot * feature/debug-info (#286) * rename 'ENV' to 'PRODUCTION' and default to true * set env PRODUCTION * refactor file download process * add last_recipe.json and log downloads * changelog + version bump * set env on workflows * bump version Co-authored-by: hay-kot * Basic nutrition editor (#288) * Basic nutrition editor * fix no image on scrape * nutrition display * add recipe images * update by url * new upload options Co-authored-by: hay-kot * Sanitize recipe backup filenames (#287) Fixes #275 * fix page creation fixes #290 * Display categories in sidebar if no pages set (#292) Fixes #291 * Enrich page title with context (#296) - Static pages have their own titles - The name of the recipe is displayed when viewing it * fix: translates phrase for locale de (#298) Co-authored-by: Jonas Schubert * Fix ingredient checkbox click (#305) Fixes #304 v-list-item already flips the checkbox * Localize custom pages and search page (#299) * Localize custom pages and search page * Fix FR translation for step * fixes #306 * fixes #297 * Update changelog * generate docs Co-authored-by: hay-kot Co-authored-by: Nat Co-authored-by: sephrat <34862846+sephrat@users.noreply.github.com> Co-authored-by: Pedro Mata Rodrigues Co-authored-by: JonasSchubert Co-authored-by: Jonas Schubert --- .github/workflows/pytest.yml | 2 + Dockerfile | 3 +- Dockerfile.dev | 2 + docs/docs/changelog/v0.4.2.md | 34 + docs/docs/overrides/api.html | 2 +- docs/mkdocs.yml | 1 + frontend/src/api/api-utils.js | 9 +- frontend/src/api/backup.js | 14 +- frontend/src/api/recipe.js | 5 + .../components/Admin/Backup/ImportDialog.vue | 36 +- .../Backup/ImportSummaryDialog/index.vue | 4 +- .../Admin/General/CreatePageDialog.vue | 4 +- .../Admin/General/CustomPageCreator.vue | 18 +- .../Admin/Migration/MigrationCard.vue | 6 +- .../Admin/Migration/MigrationDialog.vue | 109 + .../FormHelpers/CategoryTagSelector.vue | 2 +- .../Recipe/RecipeEditor/ImageUploadBtn.vue | 76 + .../Recipe/RecipeEditor/NutritionEditor.vue | 81 + .../components/Recipe/RecipeEditor/index.vue | 32 +- .../Recipe/RecipeViewer/Ingredients.vue | 1 + .../components/Recipe/RecipeViewer/index.vue | 5 + frontend/src/components/UI/CardSection.vue | 2 +- .../src/components/UI/CategorySidebar.vue | 40 +- frontend/src/components/UI/TheDownloadBtn.vue | 51 + frontend/src/components/UI/UploadBtn.vue | 20 +- frontend/src/locales/messages/de.json | 2 +- frontend/src/locales/messages/en.json | 20 +- frontend/src/locales/messages/fr.json | 26 +- frontend/src/main.js | 14 + frontend/src/pages/Admin/About/index.vue | 13 + frontend/src/pages/Recipe/ViewRecipe.vue | 14 +- .../src/pages/SearchPage/FilterSelector.vue | 8 +- frontend/src/pages/SearchPage/index.vue | 8 +- frontend/src/routes/admin.js | 25 + frontend/src/routes/index.js | 37 +- mealie/app.py | 20 +- mealie/core/config.py | 10 +- mealie/core/root_logger.py | 43 + mealie/core/security.py | 8 +- mealie/db/init_db.py | 8 +- mealie/db/models/recipe/category.py | 8 +- mealie/db/models/recipe/tag.py | 8 +- mealie/routes/backup_routes.py | 11 +- mealie/routes/debug_routes.py | 16 +- mealie/routes/deps.py | 21 + mealie/routes/migration_routes.py | 30 +- mealie/routes/recipe/recipe_crud_routes.py | 17 +- mealie/routes/recipe/tag_routes.py | 1 + mealie/routes/utility_routes.py | 20 + mealie/schema/debug.py | 3 +- mealie/schema/migration.py | 5 + mealie/services/backups/exports.py | 8 +- mealie/services/image/image.py | 18 +- mealie/services/image/minify.py | 53 +- mealie/services/migrations/_migration_base.py | 173 + mealie/services/migrations/chowdown.py | 110 +- mealie/services/migrations/helpers.py | 12 + mealie/services/migrations/migration.py | 49 + mealie/services/migrations/nextcloud.py | 126 +- mealie/services/scheduler/scheduled_jobs.py | 5 +- mealie/services/scraper/cleaner.py | 15 +- mealie/services/scraper/scraper.py | 6 +- poetry.lock | 4121 +++++++++-------- pyproject.toml | 125 +- .../test_migration_routes.py | 21 +- tests/unit_tests/test_cleaner.py | 2 +- tests/unit_tests/test_config.py | 2 +- tests/unit_tests/test_nextcloud.py | 65 +- 68 files changed, 3351 insertions(+), 2515 deletions(-) create mode 100644 docs/docs/changelog/v0.4.2.md create mode 100644 frontend/src/components/Admin/Migration/MigrationDialog.vue create mode 100644 frontend/src/components/Recipe/RecipeEditor/ImageUploadBtn.vue create mode 100644 frontend/src/components/Recipe/RecipeEditor/NutritionEditor.vue create mode 100644 frontend/src/components/UI/TheDownloadBtn.vue create mode 100644 mealie/core/root_logger.py create mode 100644 mealie/routes/utility_routes.py create mode 100644 mealie/services/migrations/_migration_base.py create mode 100644 mealie/services/migrations/helpers.py create mode 100644 mealie/services/migrations/migration.py diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 5df2230caf5..dc6f341fc6d 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -11,6 +11,8 @@ on: jobs: tests: + env: + PRODUCTION: false runs-on: ubuntu-latest steps: #---------------------------------------------- diff --git a/Dockerfile b/Dockerfile index 53025eccd0d..e1321727d01 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,7 +20,7 @@ RUN apk add --no-cache libxml2-dev \ zlib-dev -ENV ENV True +ENV PRODUCTION true EXPOSE 80 WORKDIR /app/ @@ -48,6 +48,7 @@ COPY ./dev/data/templates /app/data/templates COPY --from=build-stage /app/dist /app/dist VOLUME [ "/app/data/" ] + RUN chmod +x /app/mealie/run.sh CMD /app/mealie/run.sh diff --git a/Dockerfile.dev b/Dockerfile.dev index bce6c5ea0cf..2c5519117da 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -2,6 +2,8 @@ FROM python:3 WORKDIR /app/ +ENV PRODUCTION false + RUN apt-get update -y && \ apt-get install -y python-pip python-dev diff --git a/docs/docs/changelog/v0.4.2.md b/docs/docs/changelog/v0.4.2.md new file mode 100644 index 00000000000..f06a4672062 --- /dev/null +++ b/docs/docs/changelog/v0.4.2.md @@ -0,0 +1,34 @@ +# v0.4.2 + +**App Version: v0.4.2** + +**Database Version: v0.4.0** + +!!! error "Breaking Changes" + 1. With a recent refactor some users been experiencing issues with an environmental variable not being set correct. If you are experiencing issues, please provide your comments [Here](https://github.com/hay-kot/mealie/issues/281). + + 2. If you are a developer, you may experience issues with development as a new environmental variable has been introduced. Setting `PRODUCTION=false` will allow you to develop as normal. + +## Bug Fixes +- Fixed Initialization script (v0.4.1a Hot Fix) - Closes #274 +- Fixed nested list error on recipe scrape - Closes #306 +- Fixed ingredient checkboxes - Closes #304 +- Removed link on recent - Closes #297 +- Categories sidebar is auto generated if no pages are created - Closes #291 +- Fix tag issues on creating custom pages - Closes #290 +- Validate paths on export - Closes #275 +- Walk Nextcloud import directory - Closes #254 + +## General Improvements +- Improved Nextcloud Migration. Mealie will now walk the directories in a zip file looking for directories that match the pattern of a Nextcloud Recipe. Closes #254 + - Rewrite Keywords to Tag Fields + - Rewrite url to orgURL +- Improved Chowdown Migration +- Migration report is now similar to the Backup report +- Tags/Categories are now title cased on import "dinner" -> "Dinner" +- Depreciate `ENV` variable to `PRODUCTION` +- Set `PRODUCTION` env variable to default to true +- Unify Logger across the backend +- mealie.log and last_recipe.json are now downloadable from the frontend from the /admin/about +- New download schema where you request a token and then use that token to hit a single endpoint to download a file. This is a notable change if you are using the API to download backups. +- Recipe images can now be added directly from a URL - [See #117 for details](https://github.com/hay-kot/mealie/issues/117) \ No newline at end of file diff --git a/docs/docs/overrides/api.html b/docs/docs/overrides/api.html index f679a924c9b..a22ab4c1397 100644 --- a/docs/docs/overrides/api.html +++ b/docs/docs/overrides/api.html @@ -14,7 +14,7 @@
diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index ab46a17c748..2b1560f6cb4 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -77,6 +77,7 @@ nav: - Guidelines: "contributors/developers-guide/general-guidelines.md" - Development Road Map: "roadmap.md" - Change Log: + - v0.4.2 Backend/Migrations: "changelog/v0.4.2.md" - v0.4.1 Frontend/UI: "changelog/v0.4.1.md" - v0.4.0 Authentication: "changelog/v0.4.0.md" - v0.3.0 Improvements: "changelog/v0.3.0.md" diff --git a/frontend/src/api/api-utils.js b/frontend/src/api/api-utils.js index 8c4b0e71d13..853d5ac9fa7 100644 --- a/frontend/src/api/api-utils.js +++ b/frontend/src/api/api-utils.js @@ -61,9 +61,16 @@ const apiReq = { processResponse(response); return response; }, -}; + async download(url) { + const response = await this.get(url); + const token = response.data.fileToken; + const tokenURL = baseURL + "utils/download?token=" + token; + window.open(tokenURL, "_blank"); + return response.data; + }, +}; export { apiReq }; export { baseURL }; diff --git a/frontend/src/api/backup.js b/frontend/src/api/backup.js index 3ec9a1285e5..b6afd6e98bb 100644 --- a/frontend/src/api/backup.js +++ b/frontend/src/api/backup.js @@ -4,7 +4,7 @@ import { store } from "@/store"; const backupBase = baseURL + "backups/"; -const backupURLs = { +export const backupURLs = { // Backup available: `${backupBase}available`, createBackup: `${backupBase}export/database`, @@ -13,6 +13,8 @@ const backupURLs = { downloadBackup: fileName => `${backupBase}${fileName}/download`, }; + + export const backupAPI = { /** * Request all backups available on the server @@ -43,19 +45,19 @@ export const backupAPI = { /** * Creates a backup on the serve given a set of options * @param {object} data - * @returns + * @returns */ async create(options) { let response = apiReq.post(backupURLs.createBackup, options); return response; }, /** - * Downloads a file from the server. I don't actually think this is used? - * @param {string} fileName + * Downloads a file from the server. I don't actually think this is used? + * @param {string} fileName * @returns Download URL */ async download(fileName) { - let response = await apiReq.get(backupURLs.downloadBackup(fileName)); - return response.data; + const url = backupURLs.downloadBackup(fileName); + apiReq.download(url); }, }; diff --git a/frontend/src/api/recipe.js b/frontend/src/api/recipe.js index 50e45e59336..42d5c47eb88 100644 --- a/frontend/src/api/recipe.js +++ b/frontend/src/api/recipe.js @@ -61,6 +61,11 @@ export const recipeAPI = { return response; }, + async updateImagebyURL(slug, url) { + const response = apiReq.post(recipeURLs.updateImage(slug), { url: url }); + return response; + }, + async update(data) { let response = await apiReq.put(recipeURLs.update(data.slug), data); store.dispatch("requestRecentRecipes"); diff --git a/frontend/src/components/Admin/Backup/ImportDialog.vue b/frontend/src/components/Admin/Backup/ImportDialog.vue index 0d54aeaa5b6..b379dd9827c 100644 --- a/frontend/src/components/Admin/Backup/ImportDialog.vue +++ b/frontend/src/components/Admin/Backup/ImportDialog.vue @@ -37,14 +37,7 @@ - - {{ $t("general.download") }} - + {{ $t("general.delete") }} @@ -66,9 +59,10 @@ diff --git a/frontend/src/components/Admin/Backup/ImportSummaryDialog/index.vue b/frontend/src/components/Admin/Backup/ImportSummaryDialog/index.vue index 8714c6fea92..4c2f8597d49 100644 --- a/frontend/src/components/Admin/Backup/ImportSummaryDialog/index.vue +++ b/frontend/src/components/Admin/Backup/ImportSummaryDialog/index.vue @@ -45,7 +45,7 @@ \ No newline at end of file + diff --git a/frontend/src/components/Admin/General/CreatePageDialog.vue b/frontend/src/components/Admin/General/CreatePageDialog.vue index 57f6830ed2f..2754e58d03f 100644 --- a/frontend/src/components/Admin/General/CreatePageDialog.vue +++ b/frontend/src/components/Admin/General/CreatePageDialog.vue @@ -17,13 +17,13 @@ diff --git a/frontend/src/components/Admin/General/CustomPageCreator.vue b/frontend/src/components/Admin/General/CustomPageCreator.vue index 9a0ef8e2390..f17b9a7f818 100644 --- a/frontend/src/components/Admin/General/CustomPageCreator.vue +++ b/frontend/src/components/Admin/General/CustomPageCreator.vue @@ -3,10 +3,10 @@

- Custom Pages + {{$t('settings.custom-pages')}} - Create + {{$t('general.create')}}

@@ -41,11 +41,11 @@ - Delete + {{$t('general.delete')}} - Edit + {{$t('general.edit')}} @@ -55,7 +55,7 @@ - Save + {{$t('general.save')}} @@ -76,8 +76,8 @@ export default { customPages: [], newPageData: { create: true, - title: "New Page", - buttonText: "Create", + title: this.$t('settings.new-page'), + buttonText: this.$t('general.create'), data: { name: "", categories: [], @@ -86,8 +86,8 @@ export default { }, editPageData: { create: false, - title: "Edit Page", - buttonText: "Update", + title: this.$t('settings.edit-page'), + buttonText: this.$t('general.update'), data: {}, }, }; diff --git a/frontend/src/components/Admin/Migration/MigrationCard.vue b/frontend/src/components/Admin/Migration/MigrationCard.vue index 8dad1af08f5..f0496caca16 100644 --- a/frontend/src/components/Admin/Migration/MigrationCard.vue +++ b/frontend/src/components/Admin/Migration/MigrationCard.vue @@ -1,5 +1,6 @@