Compare commits
47 Commits
reset-scro
...
v0.5.4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8154ee548a | ||
|
|
591bf9d98f | ||
|
|
f202b1f922 | ||
|
|
17b2e37e4e | ||
|
|
0ec8087ac6 | ||
|
|
e580d6f904 | ||
|
|
56d9cafb68 | ||
|
|
32c864c703 | ||
|
|
37280a3da0 | ||
|
|
7f850fba98 | ||
|
|
b40f201430 | ||
|
|
a0d796551c | ||
|
|
fe3a4ab641 | ||
|
|
9a9fe66ccb | ||
|
|
7fe4b75949 | ||
|
|
de5bea6f73 | ||
|
|
b6d43e8e3d | ||
|
|
18b099b115 | ||
|
|
3831eef508 | ||
|
|
75113cc2c7 | ||
|
|
b81f88dc18 | ||
|
|
756ffc8e90 | ||
|
|
ec7df232ed | ||
|
|
35caef1c39 | ||
|
|
9541137ef7 | ||
|
|
756597324d | ||
|
|
55f009ed9e | ||
|
|
9378c4879f | ||
|
|
19aa572bd8 | ||
|
|
66fdd6c428 | ||
|
|
3f419ad7b6 | ||
|
|
f3305a9074 | ||
|
|
09e3b83933 | ||
|
|
b275aef04d | ||
|
|
69e226a0ed | ||
|
|
aac0d5b6c6 | ||
|
|
b47ee0557d | ||
|
|
97e0796af2 | ||
|
|
733bb77ddb | ||
|
|
eda6821288 | ||
|
|
20fc2d868b | ||
|
|
29d78f52ca | ||
|
|
006d6a6f1d | ||
|
|
a210efd62f | ||
|
|
3ec9b5c34d | ||
|
|
fd17614764 | ||
|
|
98b0f8779b |
@@ -1,43 +0,0 @@
|
||||
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.224.2/containers/python-3/.devcontainer/base.Dockerfile
|
||||
|
||||
# [Choice] Python version (use -bullseye variants on local arm64/Apple Silicon): 3, 3.10, 3.9, 3.8, 3.7, 3.6, 3-bullseye, 3.10-bullseye, 3.9-bullseye, 3.8-bullseye, 3.7-bullseye, 3.6-bullseye, 3-buster, 3.10-buster, 3.9-buster, 3.8-buster, 3.7-buster, 3.6-buster
|
||||
ARG VARIANT="3.12-bullseye"
|
||||
FROM mcr.microsoft.com/devcontainers/python:${VARIANT}
|
||||
|
||||
# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
|
||||
ARG NODE_VERSION="none"
|
||||
RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
|
||||
|
||||
# install poetry - respects $POETRY_VERSION & $POETRY_HOME
|
||||
|
||||
RUN echo "export PROMPT_COMMAND='history -a'" >> /home/vscode/.bashrc \
|
||||
&& echo "export HISTFILE=~/commandhistory/.bash_history" >> /home/vscode/.bashrc \
|
||||
&& chown vscode:vscode -R /home/vscode/
|
||||
|
||||
RUN npm install -g @go-task/cli
|
||||
|
||||
ENV PYTHONUNBUFFERED=1 \
|
||||
PYTHONDONTWRITEBYTECODE=1 \
|
||||
PIP_NO_CACHE_DIR=off \
|
||||
PIP_DISABLE_PIP_VERSION_CHECK=on \
|
||||
PIP_DEFAULT_TIMEOUT=100 \
|
||||
POETRY_HOME="/opt/poetry" \
|
||||
POETRY_VIRTUALENVS_IN_PROJECT=true
|
||||
|
||||
# prepend poetry and venv to path
|
||||
ENV PATH="$POETRY_HOME/bin:$PATH"
|
||||
|
||||
RUN curl -sSL https://install.python-poetry.org | python3 -
|
||||
# RUN poetry config virtualenvs.create false
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install --no-install-recommends -y \
|
||||
curl \
|
||||
build-essential \
|
||||
libpq-dev \
|
||||
libwebp-dev \
|
||||
libsasl2-dev libldap2-dev libssl-dev \
|
||||
gnupg gnupg2 gnupg1
|
||||
|
||||
# create directory used for Docker Secrets
|
||||
RUN mkdir -p /run/secrets
|
||||
@@ -1,60 +0,0 @@
|
||||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
|
||||
// https://github.com/microsoft/vscode-dev-containers/tree/v0.224.2/containers/python-3
|
||||
{
|
||||
"name": "Python 3",
|
||||
"build": {
|
||||
"dockerfile": "Dockerfile",
|
||||
"context": "..",
|
||||
"args": {
|
||||
// Update 'VARIANT' to pick a Python version: 3, 3.10, 3.9, 3.8, 3.7, 3.6
|
||||
// Append -bullseye or -buster to pin to an OS version.
|
||||
// Use -bullseye variants on local on arm64/Apple Silicon.
|
||||
"VARIANT": "3.12-bullseye",
|
||||
// Options
|
||||
"NODE_VERSION": "20"
|
||||
}
|
||||
},
|
||||
"mounts": [
|
||||
"source=mealie-devcontainer-workspace,target=/workspaces/mealie/frontend/node_modules,type=volume",
|
||||
"source=mealie-bashhistory,target=/home/vscode/commandhistory,type=volume"
|
||||
],
|
||||
"customizations": {
|
||||
"vscode": {
|
||||
"settings": {
|
||||
"python.defaultInterpreterPath": "/usr/local/bin/python",
|
||||
"python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8",
|
||||
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
|
||||
"python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf",
|
||||
"mypy.runUsingActiveInterpreter": true
|
||||
},
|
||||
"extensions": [
|
||||
"charliermarsh.ruff",
|
||||
"dbaeumer.vscode-eslint",
|
||||
"matangover.mypy",
|
||||
"ms-python.black-formatter",
|
||||
"ms-python.pylint",
|
||||
"ms-python.python",
|
||||
"ms-python.vscode-pylance",
|
||||
"Vue.volar"
|
||||
]
|
||||
}
|
||||
},
|
||||
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||
"forwardPorts": [
|
||||
3000,
|
||||
9000,
|
||||
9091, // used by docker production
|
||||
24678 // used by nuxt when hot-reloading using polling
|
||||
],
|
||||
// Use 'onCreateCommand' to run commands at the end of container creation.
|
||||
// Use 'postCreateCommand' to run commands after the container is created.
|
||||
"onCreateCommand": "sudo chown -R vscode:vscode /workspaces/mealie/frontend/node_modules /home/vscode/commandhistory && task setup",
|
||||
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
|
||||
"remoteUser": "vscode",
|
||||
"features": {
|
||||
"ghcr.io/devcontainers/features/docker-in-docker:2": {
|
||||
"dockerDashComposeVersion": "v2"
|
||||
}
|
||||
},
|
||||
"appPort": 3000
|
||||
}
|
||||
@@ -1,19 +1,18 @@
|
||||
.git
|
||||
.github
|
||||
.dockerignore
|
||||
.gitattributes
|
||||
.gitignore
|
||||
|
||||
.idea
|
||||
.vscode
|
||||
|
||||
**/__pycache__/
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
*.so
|
||||
htmlcov/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.pylintrc
|
||||
.pytest_cache/
|
||||
.venv
|
||||
venv
|
||||
@@ -25,10 +24,6 @@ venv
|
||||
|
||||
*/node_modules
|
||||
*/dist
|
||||
/dist/
|
||||
*/data/db
|
||||
*/mealie/test
|
||||
*/mealie/.temp
|
||||
/mealie/frontend/
|
||||
|
||||
crowdin.yml
|
||||
*/mealie/test
|
||||
*/mealie/.temp
|
||||
6
.flake8
Normal file
@@ -0,0 +1,6 @@
|
||||
[flake8]
|
||||
ignore = [
|
||||
E501 # Line Length - See Black Config in pyproject.toml
|
||||
E402 # Import Not at Top of File
|
||||
]
|
||||
exclude = _all_models.py
|
||||
2
.gitattributes
vendored
@@ -1,2 +1,2 @@
|
||||
*.css linguist-detectable=false
|
||||
*.html linguist-detectable=false
|
||||
*.html linguist-detectable=false
|
||||
41
.github/DISCUSSION_TEMPLATE/feature-request.yaml
vendored
@@ -1,41 +0,0 @@
|
||||
---
|
||||
title: "YOUR TITLE"
|
||||
body:
|
||||
- type: checkboxes
|
||||
id: checks
|
||||
attributes:
|
||||
label: First Check
|
||||
description: |
|
||||
Please confirm and check all the following prior to submission. If you do not do this, your
|
||||
issue may be closed.
|
||||
options:
|
||||
- label: I used the GitHub search to find a similar requests and didn't find it.
|
||||
required: true
|
||||
- label: Checked the [tasks tagged](https://github.com/mealie-recipes/mealie/issues?q=is%3Aissue+is%3Aopen+label%3Atask+) issues and verified my feature is not covered
|
||||
required: true
|
||||
- type: textarea
|
||||
id: problem
|
||||
attributes:
|
||||
label: Please provide a concise description of the problem that would be addressed by this feature.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: solution
|
||||
attributes:
|
||||
label: Please provide a concise description of the feature that would resolve your issue.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: considerations
|
||||
attributes:
|
||||
label: Please consider and list out some caveats or tradeoffs made in your design decision
|
||||
validations:
|
||||
required: true
|
||||
- type: checkboxes
|
||||
id: additional-information
|
||||
attributes:
|
||||
label: Additional Information
|
||||
options:
|
||||
- label: If this is accepted I'm willing to submit a PR to provide this feature
|
||||
- label: If this is accepted I'm willing to help maintain this feature
|
||||
- label: I'm willing to sponsor/pay a developer to do this work
|
||||
@@ -1,9 +0,0 @@
|
||||
---
|
||||
title: OAuth setup with <PROVIDER>
|
||||
body:
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Configuration Example
|
||||
description: Add your example configuration. You can provide code blocks, screenshots, and links.
|
||||
validations:
|
||||
required: true
|
||||
47
.github/ISSUE_TEMPLATE/bug-report.yaml
vendored
@@ -1,20 +1,16 @@
|
||||
---
|
||||
name: Bug Report
|
||||
description: "Submit a bug for the latest version of Mealie"
|
||||
title: "[BUG] - YOUR DESCRIPTIVE TITLE GOES HERE"
|
||||
labels: ["bug", "triage"]
|
||||
description: "submit a bug report for the current release"
|
||||
body:
|
||||
- type: checkboxes
|
||||
id: checks
|
||||
attributes:
|
||||
label: First Check
|
||||
description: |
|
||||
Please confirm and check all the following prior to submission. If you do not do this, your
|
||||
issue may be closed.
|
||||
description: Please confirm and check all the following options.
|
||||
options:
|
||||
- label: This is not a feature request.
|
||||
- label: This is not a feature request
|
||||
required: true
|
||||
- label: I added a very descriptive title to this issue (title field is above this).
|
||||
- label: I added a very descriptive title to this issue.
|
||||
required: true
|
||||
- label: I used the GitHub search to find a similar issue and didn't find it.
|
||||
required: true
|
||||
@@ -22,8 +18,6 @@ body:
|
||||
required: true
|
||||
- label: I already read the docs and didn't find an answer.
|
||||
required: true
|
||||
- label: This issue can be replicated on the demo site (https://demo.mealie.io/).
|
||||
required: false
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
@@ -31,25 +25,6 @@ body:
|
||||
placeholder: A clear and concise description of what the bug is.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: reproduction
|
||||
attributes:
|
||||
label: Steps to Reproduce
|
||||
placeholder: 1) ... 2) ... 3) ...
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: logs
|
||||
attributes:
|
||||
label: Please provide relevant logs
|
||||
placeholder: For example from `docker compose logs` or other system logs.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: version
|
||||
attributes:
|
||||
label: Mealie Version
|
||||
placeholder: Docker image, as well as 'Build' tag from https://yourmealieurl/admin/site-settings, if UI is working
|
||||
- type: dropdown
|
||||
id: os
|
||||
attributes:
|
||||
@@ -61,11 +36,17 @@ body:
|
||||
- Docker (Windows)
|
||||
- Docker (Synology)
|
||||
- Unraid
|
||||
- TrueNAS
|
||||
- Other (please specify below)
|
||||
- Other
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: other
|
||||
id: os-details
|
||||
attributes:
|
||||
label: Additional Deployment Details
|
||||
label: Deployment Details
|
||||
description: You can add more details about your operating system here, in particular if you chose "Other". If you are experiencing issues with deployment, please provide your docker-compose or docker commands
|
||||
- type: input
|
||||
id: mealie-version
|
||||
attributes:
|
||||
label: Mealie Version
|
||||
validations:
|
||||
required: true
|
||||
|
||||
4
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -1,4 +1,4 @@
|
||||
contact_links:
|
||||
- name: Feature Requests
|
||||
url: https://github.com/mealie-recipes/mealie/discussions/new?category=feature-request
|
||||
about: Please add any Feature Requests as a Github Discussion using the form in this issue.
|
||||
url: https://github.com/hay-kot/mealie/issues/122
|
||||
about: Please add any Feature Requests here.
|
||||
|
||||
53
.github/ISSUE_TEMPLATE/recipe-scraper-bug.yaml
vendored
@@ -1,53 +0,0 @@
|
||||
---
|
||||
name: Error Scraping Recipe
|
||||
description: "Submit a bug or issues related to scraping recipes"
|
||||
title: "[SCRAPER] - YOUR TITLE"
|
||||
labels: ["bug", "triage", "scraper"]
|
||||
body:
|
||||
- type: checkboxes
|
||||
id: checks
|
||||
attributes:
|
||||
label: First Check
|
||||
description: |
|
||||
Please confirm and check all the following prior to submission. If you do not do this, your
|
||||
issue may be closed.
|
||||
options:
|
||||
- label: I used the GitHub search to find a similar issue and didn't find it.
|
||||
required: true
|
||||
- label: |
|
||||
I have verified that this issue _is not_ related to the underlying library
|
||||
[hhyrsev/recipe-scrapers](https://github.com/hhursev/recipe-scrapers) by **1)** checking
|
||||
the [debugger](https://demo.mealie.io/g/home/r/create/debug) and data is returned, **2)**
|
||||
verifying that there _are_ errors in the log related to application level code, or
|
||||
**3)** verified that the site provides recipe data, or is otherwise supported by
|
||||
[hhyrsev/recipe-scrapers](https://github.com/hhursev/recipe-scrapers)
|
||||
required: true
|
||||
- label: This issue can be replicated on the demo site (https://demo.mealie.io/)
|
||||
required: false
|
||||
- type: textarea
|
||||
id: urls
|
||||
attributes:
|
||||
label: Please provide 1-5 example URLs that are having errors
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: logs
|
||||
attributes:
|
||||
label: |
|
||||
Please provide your logs for the Mealie container `docker logs <container-id> > mealie.logs`
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
id: os
|
||||
attributes:
|
||||
label: Deployment
|
||||
description: What Deployment system are you using?
|
||||
multiple: true
|
||||
options:
|
||||
- Docker (Linux)
|
||||
- Docker (Windows)
|
||||
- Docker (Synology)
|
||||
- Unraid
|
||||
- Other
|
||||
validations:
|
||||
required: true
|
||||
47
.github/ISSUE_TEMPLATE/v1-bug-report.yaml
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
---
|
||||
name: v1.0.0b Bug Report
|
||||
description: "submit a bug report for the v1 beta"
|
||||
title: "[v1.0.0b] - YOUR TITLE"
|
||||
body:
|
||||
- type: checkboxes
|
||||
id: checks
|
||||
attributes:
|
||||
label: First Check
|
||||
description: Please confirm and check all the following options.
|
||||
options:
|
||||
- label: This is not a feature request
|
||||
required: true
|
||||
- label: I added a very descriptive title to this issue.
|
||||
required: true
|
||||
- label: I used the GitHub search to find a similar issue and didn't find it.
|
||||
required: true
|
||||
- label: I searched the Mealie documentation, with the integrated search.
|
||||
required: true
|
||||
- label: I already read the docs and didn't find an answer.
|
||||
required: true
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
label: What is the issue you are experiencing?
|
||||
placeholder: A clear and concise description of what the bug is.
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
id: os
|
||||
attributes:
|
||||
label: Deployment
|
||||
description: What Deployment system are you using?
|
||||
multiple: true
|
||||
options:
|
||||
- Docker (Linux)
|
||||
- Docker (Windows)
|
||||
- Docker (Synology)
|
||||
- Unraid
|
||||
- Other
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: os-details
|
||||
attributes:
|
||||
label: Deployment Details
|
||||
description: You can add more details about your operating system here, in particular if you chose "Other". If you are experiencing issues with deployment, please provide your docker-compose or docker commands
|
||||
@@ -1,27 +1,27 @@
|
||||
---
|
||||
name: Task
|
||||
name: v1.0.0b Task
|
||||
description: "CONTRIBUTORS ONLY: Submit a Task that needs to be completed"
|
||||
title: "[Task] - TASK DESCRIPTION"
|
||||
title: "[v1.0.0b] [Task] - TASK DESCRIPTION"
|
||||
labels:
|
||||
- task
|
||||
- v2
|
||||
- v1
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thanks for your interest in Mealie! 🚀
|
||||
|
||||
This is a place for Mealie contributors to find tasks that need to get done around the repository. Tasks are different than issues as they are generally related to providing a new feature or improving an existing feature. They are _generally_ not related to an issue.
|
||||
This is a place for Mealie contributors to find tasks that need to get done around the repository. Tasks are different than issues as they are generally related to providing a new feature or improve an existing feature. They are _generally_ not related to an issue.
|
||||
|
||||
**DO NOT** create a task unless
|
||||
- You are a contributor who has prior approval via discord/discussions
|
||||
- You are a contributors who has prior approval via discord/discussions
|
||||
- You have otherwise been given approval to post the tasks
|
||||
|
||||
Otherwise, your post will be closed/deleted.
|
||||
Otherwise, your post will be closed/deleted.
|
||||
|
||||
**Interested in Taking This?**
|
||||
|
||||
If you're interested in completing this task and it hasn't already been taken, comment below and to let others know you're working on it. As you work through the task, I ask that you submit a draft pull request as soon as possible, and tag this issue so we can all collaborate as best as possible.
|
||||
If you're interested in completing this tasks and it hasn't already been taken, comment below and to let others know you're working on it. As you work through the task, I ask that you submit a draft pull request as soon as possible, and tag this issue so we can all collaborate as best as possible.
|
||||
- type: textarea
|
||||
id: problem
|
||||
attributes:
|
||||
@@ -33,6 +33,6 @@ body:
|
||||
id: solution
|
||||
attributes:
|
||||
label: Proposed/Possible Solution(s)?
|
||||
placeholder: Provide as much context around the idea as possible with potential files and roadblocks that may come up.
|
||||
placeholder: Provide as much context around the idea as possible with potential files and roadblocks that may come up
|
||||
validations:
|
||||
required: true
|
||||
63
.github/pull_request_template.md
vendored
@@ -1,63 +0,0 @@
|
||||
<!--
|
||||
This template provides some ideas of things to include in your PR description.
|
||||
|
||||
To start, try providing a short summary of your changes in the Title above. We follow Conventional Commits syntax, please ensure your title is prefixed with one of:
|
||||
- `feat: `
|
||||
- `fix: `
|
||||
- `docs: `
|
||||
- `chore: `
|
||||
- `dev:`
|
||||
|
||||
If a section of the PR template does not apply to this PR, then delete that section.
|
||||
|
||||
PLEASE READ:
|
||||
-------------------------
|
||||
Mealie is moving to a regular, automatic release schedule. This means that all PRs should be in a
|
||||
stable state, ready for release. This includes:
|
||||
|
||||
- Ensuring new tests have been added to cover new features, or to prevent regressions.
|
||||
- Work is fully complete and usable
|
||||
|
||||
-->
|
||||
|
||||
## What this PR does / why we need it:
|
||||
|
||||
_(REQUIRED)_
|
||||
|
||||
<!--
|
||||
What goal is this change working towards?
|
||||
Provide a bullet pointed summary of how each file was changed.
|
||||
Briefly explain any decisions you made with respect to the changes.
|
||||
Include anything here that you didn't include in *Release Notes*
|
||||
above, such as changes to CI or changes to internal methods.
|
||||
|
||||
If there is a UI component to the change, please include before/after images.
|
||||
-->
|
||||
|
||||
## Which issue(s) this PR fixes:
|
||||
|
||||
_(REQUIRED)_
|
||||
|
||||
<!--
|
||||
If this PR fixes one of more issues, list them here.
|
||||
One per line, like so:
|
||||
Fixes #123
|
||||
Fixes #39
|
||||
-->
|
||||
|
||||
## Special notes for your reviewer:
|
||||
|
||||
_(fill-in or delete this section)_
|
||||
|
||||
<!--
|
||||
Is there any particular feedback you would / wouldn't like?
|
||||
Which parts of the code should reviewers focus on?
|
||||
-->
|
||||
|
||||
## Testing
|
||||
|
||||
_(fill-in or delete this section)_
|
||||
|
||||
<!--
|
||||
Describe how you tested this change.
|
||||
-->
|
||||
88
.github/release-drafter.yml
vendored
@@ -1,88 +0,0 @@
|
||||
---
|
||||
name-template: "v$RESOLVED_VERSION"
|
||||
tag-template: "v$RESOLVED_VERSION"
|
||||
change-template: "- $TITLE @$AUTHOR (#$NUMBER)"
|
||||
sort-direction: ascending
|
||||
|
||||
categories:
|
||||
- title: "🚨 Breaking changes"
|
||||
labels:
|
||||
- "breaking-change"
|
||||
- "major"
|
||||
- title: "✨ New features"
|
||||
labels:
|
||||
- "feature"
|
||||
- "minor"
|
||||
- title: "🐛 Bug fixes"
|
||||
labels:
|
||||
- "bugfix"
|
||||
- title: "🧰 Maintenance"
|
||||
collapse-after: 3
|
||||
labels:
|
||||
- "ci"
|
||||
- "chore"
|
||||
- "l10n"
|
||||
- title: "📚 Documentation"
|
||||
labels:
|
||||
- "documentation"
|
||||
- title: "🔨 Internal development"
|
||||
labels:
|
||||
- "dev"
|
||||
- title: "⬆️ Dependency updates"
|
||||
collapse-after: 3
|
||||
labels:
|
||||
- "dependencies"
|
||||
|
||||
version-resolver:
|
||||
major:
|
||||
labels:
|
||||
- "major"
|
||||
- "breaking-change"
|
||||
minor:
|
||||
labels:
|
||||
- "minor"
|
||||
- "feature"
|
||||
patch:
|
||||
labels:
|
||||
- "bugfix"
|
||||
- "chore"
|
||||
- "ci"
|
||||
- "dependencies"
|
||||
- "documentation"
|
||||
- "l10n"
|
||||
- "dev"
|
||||
default: patch
|
||||
|
||||
template: |
|
||||
# 🍴🍴🍴🍴🍴🍴
|
||||
|
||||
## 🎉 Highlights
|
||||
|
||||
- Highlight 1
|
||||
|
||||
- Highlight 2
|
||||
|
||||
$CHANGES
|
||||
|
||||
## 🙏 New Contributors
|
||||
|
||||
!!! Need to source this from GitHub's auto generated release notes !!!
|
||||
|
||||
# 🍴🍴🍴🍴🍴🍴
|
||||
|
||||
autolabeler:
|
||||
- label: 'feature'
|
||||
title:
|
||||
- '/feat/i'
|
||||
- label: 'bugfix'
|
||||
title:
|
||||
- '/fix:/i'
|
||||
- label: 'documentation'
|
||||
title:
|
||||
- '/docs:/i'
|
||||
- label: 'chore'
|
||||
title:
|
||||
- '/chore:/i'
|
||||
- label: 'dev'
|
||||
title:
|
||||
- '/dev:/i'
|
||||
5
.github/semantic.yml
vendored
@@ -1,5 +0,0 @@
|
||||
# Always validate the PR title AND all the commits
|
||||
titleAndCommits: true
|
||||
# Allows use of Merge commits (eg on github: "Merge branch 'master' into feature/ride-unicorns")
|
||||
# this is only relevant when using commitsOnly: true (or titleAndCommits: true)
|
||||
allowMergeCommits: true
|
||||
17
.github/stale.yaml
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
# Number of days of inactivity before an issue becomes stale
|
||||
daysUntilStale: 60
|
||||
# Number of days of inactivity before a stale issue is closed
|
||||
daysUntilClose: 7
|
||||
# Issues with these labels will never be considered stale
|
||||
exemptLabels:
|
||||
- pinned
|
||||
- security
|
||||
# Label to use when marking an issue as stale
|
||||
staleLabel: wontfix
|
||||
# Comment to post when marking an issue as stale. Set to `false` to disable
|
||||
markComment: >
|
||||
This issue has been automatically marked as stale because it has not had
|
||||
recent activity. It will be closed if no further activity occurs. Thank you
|
||||
for your contributions.
|
||||
# Comment to post when closing a stale issue. Set to `false` to disable
|
||||
closeComment: false
|
||||
19
.github/workflows/build-docs.yml
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
name: Publish docs via GitHub Pages
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Deploy docs
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout main
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Deploy docs
|
||||
uses: mhausenblas/mkdocs-deploy-gh-pages@master
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
CONFIG_FILE: docs/mkdocs.yml
|
||||
EXTRA_PACKAGES: build-base
|
||||
102
.github/workflows/build-package.yml
vendored
@@ -1,102 +0,0 @@
|
||||
name: Build Package
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
tag:
|
||||
required: true
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
build-frontend:
|
||||
name: Build frontend
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout 🛎
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup node env 🏗
|
||||
uses: actions/setup-node@v4.0.0
|
||||
with:
|
||||
node-version: 20
|
||||
check-latest: true
|
||||
|
||||
- name: Get yarn cache directory path 🛠
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Cache node_modules 📦
|
||||
uses: actions/cache@v4
|
||||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
|
||||
- name: Install dependencies 👨🏻💻
|
||||
run: yarn
|
||||
working-directory: "frontend"
|
||||
|
||||
- name: Run Build 🚚
|
||||
run: yarn generate
|
||||
working-directory: "frontend"
|
||||
|
||||
- name: Archive built frontend
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: frontend-dist
|
||||
path: frontend/dist
|
||||
retention-days: 5
|
||||
|
||||
build-package:
|
||||
name: Build Python package
|
||||
needs: build-frontend
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Install Task
|
||||
uses: arduino/setup-task@v2
|
||||
with:
|
||||
version: 3.x
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.12"
|
||||
|
||||
- name: Install Poetry
|
||||
uses: snok/install-poetry@v1
|
||||
with:
|
||||
virtualenvs-create: true
|
||||
virtualenvs-in-project: true
|
||||
plugins: |
|
||||
poetry-plugin-export
|
||||
|
||||
- name: Retrieve built frontend
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: frontend-dist
|
||||
path: mealie/frontend
|
||||
|
||||
- name: Override __init__.py
|
||||
run: |
|
||||
echo "__version__ = \"${{ inputs.tag }}\"" > ./mealie/__init__.py
|
||||
|
||||
- name: Build package and requirements.txt
|
||||
env:
|
||||
SKIP_PACKAGE_DEPS: true
|
||||
run: |
|
||||
task py:package
|
||||
|
||||
- name: Archive built package
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: backend-dist
|
||||
path: dist
|
||||
retention-days: 5
|
||||
80
.github/workflows/codeql.yml
vendored
@@ -1,80 +0,0 @@
|
||||
# For most projects, this workflow file will not need changing; you simply need
|
||||
# to commit it to your repository.
|
||||
#
|
||||
# You may wish to alter this file to override the set of languages analyzed,
|
||||
# or to provide custom queries or build logic.
|
||||
#
|
||||
# ******** NOTE ********
|
||||
# We have attempted to detect the languages in your repository. Please check
|
||||
# the `language` matrix defined below to confirm you have the correct set of
|
||||
# supported CodeQL languages.
|
||||
#
|
||||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "mealie-next" ]
|
||||
schedule:
|
||||
- cron: '36 9 * * 3'
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
# Runner size impacts CodeQL analysis time. To learn more, please see:
|
||||
# - https://gh.io/recommended-hardware-resources-for-running-codeql
|
||||
# - https://gh.io/supported-runners-and-hardware-resources
|
||||
# - https://gh.io/using-larger-runners
|
||||
# Consider using larger runners for possible analysis time improvements.
|
||||
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
|
||||
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: [ 'javascript-typescript', 'python' ]
|
||||
# CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ]
|
||||
# Use only 'java-kotlin' to analyze code written in Java, Kotlin or both
|
||||
# Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
|
||||
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v3
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
# By default, queries listed here will override any specified in a config file.
|
||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||
|
||||
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
|
||||
# queries: security-extended,security-and-quality
|
||||
|
||||
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v3
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
||||
|
||||
# If the Autobuild fails above, remove it and uncomment the following three lines.
|
||||
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
|
||||
|
||||
# - run: |
|
||||
# echo "Run, Build Application using script"
|
||||
# ./location_of_script_within_repo/buildscript.sh
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v3
|
||||
with:
|
||||
category: "/language:${{matrix.language}}"
|
||||
30
.github/workflows/dockerbuild.dev-docs.yml
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
name: Docker Build Dev Docs
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- dev
|
||||
|
||||
jobs:
|
||||
push_to_registry:
|
||||
name: Push Docker image to GitHub Packages
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
packages: write
|
||||
contents: read
|
||||
steps:
|
||||
- name: Check out the repo
|
||||
uses: actions/checkout@v2
|
||||
- name: Log in to GitHub Docker Registry
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Build container image
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: ./docs
|
||||
push: true
|
||||
tags: |
|
||||
ghcr.io/${{ github.repository }}/dev-docs:latest
|
||||
49
.github/workflows/dockerbuild.dev.yml
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
name: Docker Build Dev
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- dev
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
#
|
||||
# Checkout
|
||||
#
|
||||
- name: checkout code
|
||||
uses: actions/checkout@v2
|
||||
#
|
||||
# Setup QEMU
|
||||
#
|
||||
- name: Set up QEMU
|
||||
id: qemu
|
||||
uses: docker/setup-qemu-action@v1
|
||||
with:
|
||||
image: tonistiigi/binfmt:latest
|
||||
platforms: all
|
||||
#
|
||||
# Setup Buildx
|
||||
#
|
||||
- name: install buildx
|
||||
id: buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
with:
|
||||
install: true
|
||||
#
|
||||
# Login to Docker Hub
|
||||
#
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
#
|
||||
# Build
|
||||
#
|
||||
- name: build the image
|
||||
run: |
|
||||
docker build --push --no-cache \
|
||||
--tag hkotel/mealie:dev \
|
||||
--platform linux/amd64,linux/arm64 .
|
||||
48
.github/workflows/dockerbuild.prod.yml
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
name: Docker Build Production
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
#
|
||||
# Checkout
|
||||
#
|
||||
- name: checkout code
|
||||
uses: actions/checkout@v2
|
||||
#
|
||||
# Setup QEMU
|
||||
#
|
||||
- name: Set up QEMU
|
||||
id: qemu
|
||||
uses: docker/setup-qemu-action@v1
|
||||
with:
|
||||
image: tonistiigi/binfmt:latest
|
||||
platforms: all
|
||||
#
|
||||
# Setup Buildx
|
||||
#
|
||||
- name: install buildx
|
||||
id: buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
with:
|
||||
install: true
|
||||
#
|
||||
# Login to Docker Hub
|
||||
#
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
#
|
||||
# Build
|
||||
#
|
||||
- name: build the image
|
||||
run: |
|
||||
docker build --push \
|
||||
--tag hkotel/mealie:latest \
|
||||
--platform linux/amd64,linux/arm64 .
|
||||
56
.github/workflows/dockerbuild.release.yml
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
name: Docker Build Production
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
#
|
||||
# Get Release Version
|
||||
#
|
||||
- uses: oprypin/find-latest-tag@v1
|
||||
with:
|
||||
repository: hay-kot/mealie # The repository to scan.
|
||||
releases-only: true # We know that all relevant tags have a GitHub release for them.
|
||||
id: mealie_version # The step ID to refer to later.
|
||||
#
|
||||
# Checkout
|
||||
#
|
||||
- name: checkout code
|
||||
uses: actions/checkout@v2
|
||||
#
|
||||
# Setup QEMU
|
||||
#
|
||||
- name: Set up QEMU
|
||||
id: qemu
|
||||
uses: docker/setup-qemu-action@v1
|
||||
with:
|
||||
image: tonistiigi/binfmt:latest
|
||||
platforms: all
|
||||
#
|
||||
# Setup Buildx
|
||||
#
|
||||
- name: install buildx
|
||||
id: buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
with:
|
||||
install: true
|
||||
#
|
||||
# Login to Docker Hub
|
||||
#
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
#
|
||||
# Build
|
||||
#
|
||||
- name: build the image
|
||||
run: |
|
||||
docker build --push \
|
||||
--tag hkotel/mealie:${{ steps.mealie_version.outputs.tag }} \
|
||||
--platform linux/amd64,linux/arm64 .
|
||||
52
.github/workflows/e2e.yml
vendored
@@ -1,52 +0,0 @@
|
||||
name: E2E Tests
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
timeout-minutes: 60
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ./tests/e2e
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
cache: 'yarn'
|
||||
cache-dependency-path: ./tests/e2e/yarn.lock
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
- name: Retrieve Python package
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: backend-dist
|
||||
path: dist
|
||||
- name: Build Image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
file: ./docker/Dockerfile
|
||||
context: .
|
||||
build-contexts: |
|
||||
packages=dist
|
||||
push: false
|
||||
load: true
|
||||
tags: mealie:e2e
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
- name: Deploy E2E Test Environment
|
||||
run: docker compose up -d
|
||||
working-directory: ./tests/e2e/docker
|
||||
- name: Install dependencies
|
||||
run: npm install -g yarn && yarn
|
||||
- name: Install Playwright Browsers
|
||||
run: yarn playwright install --with-deps
|
||||
- name: Check test environment
|
||||
run: docker ps
|
||||
- name: Run Playwright tests
|
||||
run: yarn playwright test
|
||||
- name: Destroy Test Environment
|
||||
if: always()
|
||||
run: docker compose down --volumes
|
||||
working-directory: ./tests/e2e/docker
|
||||
114
.github/workflows/locale-sync.yml
vendored
@@ -1,114 +0,0 @@
|
||||
name: Automatic Locale Sync
|
||||
|
||||
on:
|
||||
schedule:
|
||||
# Run every Sunday at 2 AM UTC
|
||||
- cron: "0 2 * * 0"
|
||||
workflow_dispatch:
|
||||
# Allow manual triggering from the GitHub UI
|
||||
|
||||
permissions:
|
||||
contents: write # To checkout, commit, and push changes
|
||||
pull-requests: write # To create pull requests
|
||||
|
||||
jobs:
|
||||
sync-locales:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.12"
|
||||
|
||||
- name: Install Poetry
|
||||
uses: snok/install-poetry@v1
|
||||
with:
|
||||
virtualenvs-create: true
|
||||
virtualenvs-in-project: true
|
||||
|
||||
- name: Load cached venv
|
||||
id: cached-poetry-dependencies
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: .venv
|
||||
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
|
||||
|
||||
- name: Check venv cache
|
||||
id: cache-validate
|
||||
if: steps.cached-poetry-dependencies.outputs.cache-hit == 'true'
|
||||
run: |
|
||||
echo "import fastapi;print('venv good?')" > test.py && poetry run python test.py && echo "cache-hit-success=true" >> $GITHUB_OUTPUT
|
||||
rm test.py
|
||||
continue-on-error: true
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install libsasl2-dev libldap2-dev libssl-dev
|
||||
poetry install
|
||||
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
|
||||
|
||||
- name: Run locale generation
|
||||
run: |
|
||||
cd dev/code-generation
|
||||
poetry run python main.py locales
|
||||
env:
|
||||
CROWDIN_API_KEY: ${{ secrets.CROWDIN_API_KEY }}
|
||||
|
||||
- name: Check for changes
|
||||
id: changes
|
||||
run: |
|
||||
if git diff --quiet; then
|
||||
echo "has_changes=false" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "has_changes=true" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Commit and create PR
|
||||
if: steps.changes.outputs.has_changes == 'true'
|
||||
run: |
|
||||
# Configure git
|
||||
git config --local user.email "action@github.com"
|
||||
git config --local user.name "GitHub Action"
|
||||
|
||||
# Use the current branch as the base
|
||||
BASE_BRANCH="${{ github.ref_name }}"
|
||||
echo "Using base branch: $BASE_BRANCH"
|
||||
|
||||
# Create a new branch from the base branch
|
||||
BRANCH_NAME="auto-locale-sync-$(date +%Y%m%d-%H%M%S)"
|
||||
git checkout -b "$BRANCH_NAME"
|
||||
|
||||
# Add and commit changes
|
||||
git add .
|
||||
git commit -m "chore: automatic locale sync"
|
||||
|
||||
# Push the branch
|
||||
git push origin "$BRANCH_NAME"
|
||||
|
||||
sleep 2
|
||||
|
||||
# Create PR using GitHub CLI with explicit repository
|
||||
gh pr create \
|
||||
--repo "${{ github.repository }}" \
|
||||
--title "chore: automatic locale sync" \
|
||||
--base "$BASE_BRANCH" \
|
||||
--head "$BRANCH_NAME" \
|
||||
--body "## Summary
|
||||
|
||||
Automatically generated locale updates from the weekly sync job.
|
||||
|
||||
## Changes
|
||||
- Updated frontend locale files
|
||||
- Generated from latest translation sources" \
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: No changes detected
|
||||
if: steps.changes.outputs.has_changes == 'false'
|
||||
run: echo "No locale changes detected, skipping PR creation"
|
||||
67
.github/workflows/nightly.yml
vendored
@@ -1,67 +0,0 @@
|
||||
name: Docker Nightly Production
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- mealie-next
|
||||
paths-ignore:
|
||||
- '*.md'
|
||||
- '.devcontainer/**'
|
||||
# I'm not excluding .github as changes in there might be to workflows etc
|
||||
- '.vscode/**'
|
||||
- 'docs/**'
|
||||
|
||||
concurrency:
|
||||
group: nightly-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
backend-tests:
|
||||
name: "Backend Server Tests"
|
||||
uses: ./.github/workflows/test-backend.yml
|
||||
|
||||
frontend-tests:
|
||||
name: "Frontend Tests"
|
||||
uses: ./.github/workflows/test-frontend.yml
|
||||
|
||||
build-package:
|
||||
name: Build Package
|
||||
uses: ./.github/workflows/build-package.yml
|
||||
with:
|
||||
tag: nightly
|
||||
|
||||
publish:
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
# The id-token write permission is needed to connect to Depot.dev
|
||||
# as part of the partial-builder.yml action. It needs to be declared
|
||||
# in the parent action, as noted here:
|
||||
# https://github.com/orgs/community/discussions/76409#discussioncomment-8131390
|
||||
id-token: write
|
||||
name: Build Tagged Release
|
||||
if: github.repository == 'mealie-recipes/mealie'
|
||||
uses: ./.github/workflows/publish.yml
|
||||
needs:
|
||||
- frontend-tests
|
||||
- backend-tests
|
||||
- build-package
|
||||
with:
|
||||
tag: nightly
|
||||
secrets:
|
||||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
notify-discord:
|
||||
name: Notify Discord
|
||||
if: github.repository == 'mealie-recipes/mealie'
|
||||
needs:
|
||||
- publish
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Discord notification
|
||||
env:
|
||||
DISCORD_WEBHOOK: ${{ secrets.DISCORD_NIGHTLY_WEBHOOK }}
|
||||
uses: Ilshidur/action-discord@0.3.2
|
||||
with:
|
||||
args: "🚀 New builds of ghcr.io/mealie-recipes/mealie:nightly"
|
||||
@@ -1,33 +0,0 @@
|
||||
name: Trivy Container Scanning
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build and Scan Container
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: true
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Build Dockerfile
|
||||
run: |
|
||||
docker build -t mealie --file=./docker/Dockerfile .
|
||||
|
||||
- name: Run Trivy vulnerability scanner
|
||||
uses: aquasecurity/trivy-action@master
|
||||
with:
|
||||
ignore-unfixed: true
|
||||
image-ref: "mealie"
|
||||
format: "sarif"
|
||||
output: "trivy-results.sarif"
|
||||
env:
|
||||
TRIVY_DB_REPOSITORY: ghcr.io/aquasecurity/trivy-db,public.ecr.aws/aquasecurity/trivy-db
|
||||
|
||||
- name: Upload Trivy scan results to GitHub Security tab
|
||||
uses: github/codeql-action/upload-sarif@v3
|
||||
with:
|
||||
sarif_file: "trivy-results.sarif"
|
||||
61
.github/workflows/publish.yml
vendored
@@ -1,61 +0,0 @@
|
||||
name: Build Containers
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
tag:
|
||||
required: true
|
||||
type: string
|
||||
tags:
|
||||
required: false
|
||||
type: string
|
||||
secrets:
|
||||
DOCKERHUB_USERNAME:
|
||||
required: true
|
||||
DOCKERHUB_TOKEN:
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Log in to the Container registry (ghcr.io)
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Log in to the Container registry (dockerhub)
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- uses: depot/setup-action@v1
|
||||
|
||||
- name: Retrieve Python package
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: backend-dist
|
||||
path: dist
|
||||
|
||||
- name: Build and push Docker image, via Depot.dev
|
||||
uses: depot/build-push-action@v1
|
||||
with:
|
||||
project: srzjb6mhzm
|
||||
file: ./docker/Dockerfile
|
||||
context: .
|
||||
build-contexts: |
|
||||
packages=dist
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: |
|
||||
hkotel/mealie:${{ inputs.tag }}
|
||||
ghcr.io/${{ github.repository }}:${{ inputs.tag }}
|
||||
${{ inputs.tags }}
|
||||
build-args: |
|
||||
COMMIT=${{ github.sha }}
|
||||
42
.github/workflows/pull-request-lint.yml
vendored
@@ -1,42 +0,0 @@
|
||||
name: Pull Request Linter
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
pull_request:
|
||||
types: [edited] # This captures the PR title changing
|
||||
branches:
|
||||
- mealie-next
|
||||
|
||||
jobs:
|
||||
validate-title:
|
||||
name: Validate PR title
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# https://github.com/amannn/action-semantic-pull-request
|
||||
- uses: amannn/action-semantic-pull-request@v5
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
# Configure which types are allowed (newline-delimited).
|
||||
# Default: https://github.com/commitizen/conventional-commit-types
|
||||
types: |
|
||||
feat
|
||||
fix
|
||||
docs
|
||||
chore
|
||||
dev
|
||||
# Configure which scopes are allowed (newline-delimited).
|
||||
# These are regex patterns auto-wrapped in `^ $`.
|
||||
scopes: |
|
||||
deps
|
||||
auto
|
||||
l10n
|
||||
# Configure that a scope must always be provided.
|
||||
requireScope: false
|
||||
# If the PR contains one of these newline-delimited labels, the
|
||||
# validation is skipped. If you want to rerun the validation when
|
||||
# labels change, you might want to use the `labeled` and `unlabeled`
|
||||
# event triggers in your workflow.
|
||||
ignoreLabels: |
|
||||
bot
|
||||
ignore-semantic-pull-request
|
||||
65
.github/workflows/pull-requests.yml
vendored
@@ -1,65 +0,0 @@
|
||||
name: PR CI
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- mealie-next
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
pull-request-lint:
|
||||
name: "Lint PR"
|
||||
uses: ./.github/workflows/pull-request-lint.yml
|
||||
|
||||
backend-tests:
|
||||
name: "Backend Server Tests"
|
||||
uses: ./.github/workflows/test-backend.yml
|
||||
|
||||
frontend-tests:
|
||||
name: "Frontend Tests"
|
||||
uses: ./.github/workflows/test-frontend.yml
|
||||
|
||||
container-scanning:
|
||||
name: "Trivy Container Scanning"
|
||||
uses: ./.github/workflows/partial-trivy-container-scanning.yml
|
||||
|
||||
code-ql:
|
||||
name: "CodeQL"
|
||||
uses: ./.github/workflows/codeql.yml
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
build-package:
|
||||
name: "Build Python package"
|
||||
uses: ./.github/workflows/build-package.yml
|
||||
with:
|
||||
tag: e2e
|
||||
|
||||
end-to-end:
|
||||
name: "End-to-End Tests"
|
||||
needs: build-package
|
||||
uses: ./.github/workflows/e2e.yml
|
||||
|
||||
publish-image:
|
||||
name: "Publish PR Image"
|
||||
if: contains(github.event.pull_request.labels.*.name, 'build-image') && github.repository == 'mealie-recipes/mealie'
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
# The id-token write permission is needed to connect to Depot.dev
|
||||
# as part of the partial-builder.yml action. It needs to be declared
|
||||
# in the parent action, as noted here:
|
||||
# https://github.com/orgs/community/discussions/76409#discussioncomment-8131390
|
||||
id-token: write
|
||||
needs: build-package
|
||||
uses: ./.github/workflows/publish.yml
|
||||
with:
|
||||
tag: pr-${{ github.event.pull_request.number }}
|
||||
secrets:
|
||||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
30
.github/workflows/release-drafter.yml
vendored
@@ -1,30 +0,0 @@
|
||||
---
|
||||
name: Release Drafter
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- mealie-next
|
||||
# pull_request event is required for autolabeler
|
||||
pull_request:
|
||||
types: [opened, labeled, unlabeled, reopened, synchronize]
|
||||
# pull_request_target event is required for autolabeler to support PRs from forks
|
||||
pull_request_target:
|
||||
types: [opened, labeled, unlabeled, reopened, synchronize]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
update_release_draft:
|
||||
permissions:
|
||||
# write permission is required to create a github release
|
||||
contents: write
|
||||
# write permission is required for autolabeler
|
||||
# otherwise, read permission is required at least
|
||||
pull-requests: write
|
||||
name: ✏️ Draft release
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 🚀 Run Release Drafter
|
||||
uses: release-drafter/release-drafter@v6.0.0
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
95
.github/workflows/release.yml
vendored
@@ -1,95 +0,0 @@
|
||||
name: Docker Build Production
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
backend-tests:
|
||||
name: "Backend Server Tests"
|
||||
uses: ./.github/workflows/test-backend.yml
|
||||
|
||||
frontend-tests:
|
||||
name: "Frontend Tests"
|
||||
uses: ./.github/workflows/test-frontend.yml
|
||||
|
||||
build-package:
|
||||
name: Build Package
|
||||
uses: ./.github/workflows/build-package.yml
|
||||
with:
|
||||
tag: release
|
||||
|
||||
publish:
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
# The id-token write permission is needed to connect to Depot.dev
|
||||
# as part of the partial-builder.yml action. It needs to be declared
|
||||
# in the parent action, as noted here:
|
||||
# https://github.com/orgs/community/discussions/76409#discussioncomment-8131390
|
||||
id-token: write
|
||||
name: Build Tagged Release
|
||||
uses: ./.github/workflows/publish.yml
|
||||
needs:
|
||||
- backend-tests
|
||||
- frontend-tests
|
||||
- build-package
|
||||
with:
|
||||
tag: ${{ github.event.release.tag_name }}
|
||||
tags: |
|
||||
hkotel/mealie:latest
|
||||
ghcr.io/${{ github.repository }}:latest
|
||||
secrets:
|
||||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
notify-discord:
|
||||
name: Notify Discord
|
||||
needs:
|
||||
- publish
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Discord notification
|
||||
env:
|
||||
DISCORD_WEBHOOK: ${{ secrets.DISCORD_RELEASE_WEBHOOK }}
|
||||
uses: Ilshidur/action-discord@0.3.2
|
||||
with:
|
||||
args: "🚀 Version {{ EVENT_PAYLOAD.release.tag_name }} of Mealie has been released. See the release notes https://github.com/mealie-recipes/mealie/releases/tag/{{ EVENT_PAYLOAD.release.tag_name }}"
|
||||
|
||||
update-image-tags:
|
||||
name: Update image tag in sample docker-compose files
|
||||
needs:
|
||||
- publish
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- name: Checkout 🛎
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Extract Version From Tag Name
|
||||
run: echo "VERSION_NUM=$(echo ${{ github.event.release.tag_name }} | sed 's/^v//')" >> $GITHUB_ENV
|
||||
|
||||
- name: Modify version strings
|
||||
run: |
|
||||
sed -i 's/:v[0-9]*.[0-9]*.[0-9]*/:v${{ env.VERSION_NUM }}/' docs/docs/documentation/getting-started/installation/installation-checklist.md
|
||||
sed -i 's/:v[0-9]*.[0-9]*.[0-9]*/:v${{ env.VERSION_NUM }}/' docs/docs/documentation/getting-started/installation/sqlite.md
|
||||
sed -i 's/:v[0-9]*.[0-9]*.[0-9]*/:v${{ env.VERSION_NUM }}/' docs/docs/documentation/getting-started/installation/postgres.md
|
||||
sed -i 's/^version = "[^"]*"/version = "${{ env.VERSION_NUM }}"/' pyproject.toml
|
||||
sed -i 's/^\s*"version": "[^"]*"/"version": "${{ env.VERSION_NUM }}"/' frontend/package.json
|
||||
|
||||
- name: Create Pull Request
|
||||
uses: peter-evans/create-pull-request@v6
|
||||
# This doesn't currently work for us because it creates the PR but the workflows don't run.
|
||||
# TODO: Provide a personal access token as a parameter here, that solves that problem.
|
||||
# https://github.com/peter-evans/create-pull-request
|
||||
with:
|
||||
commit-message: "Update image tag, for release ${{ github.event.release.tag_name }}"
|
||||
branch: "docs/newrelease-update-version-${{ github.event.release.tag_name }}"
|
||||
labels: |
|
||||
documentation
|
||||
delete-branch: true
|
||||
base: mealie-next
|
||||
title: "docs(auto): Update image tag, for release ${{ github.event.release.tag_name }}"
|
||||
body: "Auto-generated by `.github/workflows/release.yml`, on publish of release ${{ github.event.release.tag_name }}"
|
||||
56
.github/workflows/scheduled-checks.yml
vendored
@@ -1,56 +0,0 @@
|
||||
name: Scheduled Checks
|
||||
|
||||
on:
|
||||
schedule:
|
||||
# Every monday at 7 AM
|
||||
- cron: 0 7 * * 1
|
||||
|
||||
jobs:
|
||||
update:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- name: Checkout 🛎
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.12"
|
||||
|
||||
- name: Set PY
|
||||
shell: bash
|
||||
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
|
||||
|
||||
- name: Cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.cache/pre-commit
|
||||
~/.cache/pip
|
||||
key: pre-commit-${{ env.PY }}-${{ hashFiles('.pre-commit-config.yaml') }}
|
||||
|
||||
- name: Install pre-commit
|
||||
shell: bash
|
||||
run: pip install -U pre-commit
|
||||
|
||||
- name: Run `pre-commit autoupdate`
|
||||
shell: bash
|
||||
run: pre-commit autoupdate --color=always
|
||||
|
||||
- name: Create Pull Request
|
||||
uses: peter-evans/create-pull-request@v6
|
||||
# This doesn't currently work for us because it creates the PR but the workflows don't run.
|
||||
# TODO: Provide a personal access token as a parameter here, that solves that problem.
|
||||
# https://github.com/peter-evans/create-pull-request
|
||||
with:
|
||||
commit-message: "Update pre-commit hooks"
|
||||
branch: "fix/update-pre-commit-hooks"
|
||||
labels: |
|
||||
chore
|
||||
delete-branch: true
|
||||
base: mealie-next
|
||||
title: "chore(auto): Update pre-commit hooks"
|
||||
body: "Auto-generated by `.github/workflows/scheduled-checks.yml`"
|
||||
42
.github/workflows/stale.yml
vendored
@@ -1,42 +0,0 @@
|
||||
# Documentation: https://github.com/marketplace/actions/close-stale-issues
|
||||
name: 'Stale: Flag and close stale issues and PRs'
|
||||
on:
|
||||
schedule:
|
||||
- cron: '30 1 * * *'
|
||||
|
||||
permissions:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@v9
|
||||
with:
|
||||
stale-issue-label: 'stale'
|
||||
exempt-issue-labels: 'pinned,security,early-stages,bug: confirmed,feedback,task'
|
||||
stale-issue-message: 'This issue has been automatically marked as stale because it has been open 90 days with no activity.'
|
||||
days-before-issue-stale: 90
|
||||
# This stops an issue from ever getting closed automatically.
|
||||
days-before-issue-close: -1
|
||||
stale-pr-label: 'stale'
|
||||
stale-pr-message: 'This PR has been automatically marked as stale because it has been open 90 days with no activity.'
|
||||
days-before-pr-stale: 90
|
||||
# This stops a PR from ever getting closed automatically.
|
||||
days-before-pr-close: -1
|
||||
# If an issue/PR has a milestone, it's exempt from being marked as stale.
|
||||
exempt-all-milestones: true
|
||||
# How many API calls will we allow the action to make, essentially.
|
||||
# Doco: https://github.com/actions/stale?tab=readme-ov-file#operations-per-run
|
||||
operations-per-run: 150
|
||||
########################################################################
|
||||
# The below are just default values, but populating here for reference #
|
||||
########################################################################
|
||||
# Automatically remove the stale label when the issues or the pull requests are updated
|
||||
remove-stale-when-updated: true
|
||||
# The reason used when closing issues. Valid values are `completed` and `not_planned`.
|
||||
close-issue-reason: 'not_planned'
|
||||
# If true, PRs currently in draft will not be marked as stale automatically.
|
||||
# We can mark them stale (after `days-before-pr-stale`), though we don't auto-close.
|
||||
exempt-draft-pr: false
|
||||
78
.github/workflows/test-all.yml
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
name: Project Tests
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- dev
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- dev
|
||||
types: [synchronize, opened, reopened, ready_for_review]
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
env:
|
||||
PRODUCTION: false
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
postgres:
|
||||
image: postgres
|
||||
env:
|
||||
POSTGRES_USER: mealie
|
||||
POSTGRES_PASSWORD: mealie
|
||||
POSTGRES_DB: mealie
|
||||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
|
||||
ports:
|
||||
- 5432:5432
|
||||
steps:
|
||||
#----------------------------------------------
|
||||
# check-out repo and set-up python
|
||||
#----------------------------------------------
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v2
|
||||
- name: Set up python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: 3.9
|
||||
#----------------------------------------------
|
||||
# ----- install & configure poetry -----
|
||||
#----------------------------------------------
|
||||
- name: Install Poetry
|
||||
uses: snok/install-poetry@v1
|
||||
with:
|
||||
virtualenvs-create: true
|
||||
virtualenvs-in-project: true
|
||||
#----------------------------------------------
|
||||
# load cached venv if cache exists
|
||||
#----------------------------------------------
|
||||
- name: Load cached venv
|
||||
id: cached-poetry-dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: .venv
|
||||
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
|
||||
#----------------------------------------------
|
||||
# install dependencies if cache does not exist
|
||||
#----------------------------------------------
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get install libsasl2-dev libldap2-dev libssl-dev
|
||||
poetry install
|
||||
poetry add "psycopg2-binary==2.8.6"
|
||||
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
|
||||
#----------------------------------------------
|
||||
# run test suite
|
||||
#----------------------------------------------
|
||||
- name: Run Test Suite
|
||||
run: |
|
||||
make test-all
|
||||
#----------------------------------------------
|
||||
# run test suite
|
||||
#----------------------------------------------
|
||||
- name: Run Test Suite Postgres
|
||||
env:
|
||||
DB_ENGINE: postgres
|
||||
POSTGRES_SERVER: localhost
|
||||
run: |
|
||||
make test-all
|
||||
110
.github/workflows/test-backend.yml
vendored
@@ -1,110 +0,0 @@
|
||||
name: Backend Lint and Test
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
env:
|
||||
PRODUCTION: false
|
||||
|
||||
strategy:
|
||||
fail-fast: true
|
||||
matrix:
|
||||
# Database ENV Variables as Specified by Mealie
|
||||
Database: [sqlite, postgres]
|
||||
|
||||
# Services
|
||||
services:
|
||||
postgres:
|
||||
image: postgres
|
||||
env:
|
||||
POSTGRES_USER: mealie
|
||||
POSTGRES_PASSWORD: mealie
|
||||
POSTGRES_DB: mealie
|
||||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
|
||||
ports:
|
||||
- 5432:5432
|
||||
ldap:
|
||||
image: rroemhild/test-openldap
|
||||
ports:
|
||||
- 10389:10389
|
||||
- 10636:10636
|
||||
|
||||
# Steps
|
||||
steps:
|
||||
- name: Install Task
|
||||
uses: arduino/setup-task@v2
|
||||
with:
|
||||
version: 3.x
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.12"
|
||||
|
||||
- name: Install Poetry
|
||||
uses: snok/install-poetry@v1
|
||||
with:
|
||||
virtualenvs-create: true
|
||||
virtualenvs-in-project: true
|
||||
|
||||
- name: Load cached venv
|
||||
id: cached-poetry-dependencies
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: .venv
|
||||
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
|
||||
|
||||
- name: Check venv cache
|
||||
id: cache-validate
|
||||
if: steps.cached-poetry-dependencies.outputs.cache-hit == 'true'
|
||||
run: |
|
||||
echo "import fastapi;print('venv good?')" > test.py && poetry run python test.py && echo "cache-hit-success=true" >> $GITHUB_OUTPUT
|
||||
rm test.py
|
||||
continue-on-error: true
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install libsasl2-dev libldap2-dev libssl-dev
|
||||
poetry install
|
||||
poetry add "psycopg2-binary==2.9.9"
|
||||
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' || steps.cache-validate.outputs.cache-hit-success != 'true'
|
||||
|
||||
- name: Formatting (Ruff)
|
||||
run: |
|
||||
poetry run ruff format . --check
|
||||
|
||||
- name: Lint (Ruff)
|
||||
run: |
|
||||
task py:lint
|
||||
|
||||
- name: Mypy Typecheck
|
||||
run: |
|
||||
task py:mypy
|
||||
|
||||
- name: Pytest
|
||||
env:
|
||||
DB_ENGINE: ${{ matrix.Database }}
|
||||
POSTGRES_SERVER: localhost
|
||||
LDAP_AUTH_ENABLED: True
|
||||
LDAP_SERVER_URL: ldap://localhost:10389
|
||||
LDAP_TLS_INSECURE: true
|
||||
LDAP_ENABLE_STARTTLS: false
|
||||
LDAP_BASE_DN: "ou=people,dc=planetexpress,dc=com"
|
||||
LDAP_QUERY_BIND: "cn=admin,dc=planetexpress,dc=com"
|
||||
LDAP_QUERY_PASSWORD: "GoodNewsEveryone"
|
||||
LDAP_USER_FILTER: "(&(|({id_attribute}={input})({mail_attribute}={input}))(|(memberOf=cn=ship_crew,ou=people,dc=planetexpress,dc=com)(memberOf=cn=admin_staff,ou=people,dc=planetexpress,dc=com)))"
|
||||
LDAP_ADMIN_FILTER: "memberOf=cn=admin_staff,ou=people,dc=planetexpress,dc=com"
|
||||
LDAP_ID_ATTRIBUTE: uid
|
||||
LDAP_NAME_ATTRIBUTE: cn
|
||||
LDAP_MAIL_ATTRIBUTE: mail
|
||||
run: |
|
||||
task py:test
|
||||
47
.github/workflows/test-frontend.yml
vendored
@@ -1,47 +0,0 @@
|
||||
name: Frontend Lint and Test
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout 🛎
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup node env 🏗
|
||||
uses: actions/setup-node@v4.0.0
|
||||
with:
|
||||
node-version: 20
|
||||
check-latest: true
|
||||
|
||||
- name: Get yarn cache directory path 🛠
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Cache node_modules 📦
|
||||
uses: actions/cache@v4
|
||||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
|
||||
- name: Install dependencies 👨🏻💻
|
||||
run: yarn
|
||||
working-directory: "frontend"
|
||||
|
||||
- name: Prepare nuxt 🚀
|
||||
run: yarn nuxt prepare
|
||||
working-directory: "frontend"
|
||||
|
||||
- name: Run linter 👀
|
||||
run: yarn lint
|
||||
working-directory: "frontend"
|
||||
|
||||
- name: Run tests 🧪
|
||||
run: yarn test:ci
|
||||
working-directory: "frontend"
|
||||
28
.gitignore
vendored
@@ -3,25 +3,18 @@
|
||||
*__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
*.temp
|
||||
|
||||
# frontend/.env.development
|
||||
docs/site/
|
||||
*temp/*
|
||||
.secret
|
||||
frontend/dist/
|
||||
frontend/.output/*
|
||||
frontend/.yarn/*
|
||||
frontend/.yarnrc.yml
|
||||
|
||||
dev/code-generation/generated/*
|
||||
dev/data/mealie.db-journal
|
||||
dev/data/backups/*
|
||||
dev/data/debug/*
|
||||
dev/data/img/*
|
||||
dev/data/migration/*
|
||||
dev/data/users/*
|
||||
dev/data/groups/*
|
||||
|
||||
.DS_Store
|
||||
node_modules
|
||||
@@ -55,10 +48,11 @@ pnpm-debug.log*
|
||||
env/
|
||||
build/
|
||||
develop-eggs/
|
||||
/dist/
|
||||
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
!frontend/src/components/Recipe/Parts/
|
||||
@@ -69,9 +63,6 @@ wheels/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
|
||||
# frontend copied into Python module for packaging purposes
|
||||
/mealie/frontend/
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
@@ -93,7 +84,6 @@ coverage.xml
|
||||
*.cover
|
||||
.hypothesis/
|
||||
.pytest_cache/
|
||||
.ruff_cache/
|
||||
test.db
|
||||
|
||||
# Translations
|
||||
@@ -160,12 +150,8 @@ dev/data/backups/dev_sample_data*.zip
|
||||
dev/data/recipes/*
|
||||
dev/scripts/output/app_routes.py
|
||||
dev/scripts/output/javascriptAPI/*
|
||||
dev/code-generation/generated/openapi.json
|
||||
dev/code-generation/generated/test_routes.py
|
||||
lcov.info
|
||||
dev/code-generation/openapi.json
|
||||
|
||||
.run/
|
||||
.task/*
|
||||
.dev.env
|
||||
frontend/eslint.config.deprecated.js
|
||||
mealie/services/scraper/ingredient_nlp/model.crfmodel
|
||||
.gitignore
|
||||
frontend/.nuxt/**
|
||||
frontend/static/sw.js
|
||||
dev/code-generation/generated/*
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v5.0.0
|
||||
hooks:
|
||||
- id: check-yaml
|
||||
exclude: "mkdocs.yml"
|
||||
- id: check-json
|
||||
exclude: (.vscode|.devcontainer)
|
||||
- id: check-toml
|
||||
- id: end-of-file-fixer
|
||||
- id: trailing-whitespace
|
||||
exclude: ^tests/data/
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
# Ruff version.
|
||||
rev: v0.12.2
|
||||
hooks:
|
||||
- id: ruff
|
||||
- id: ruff-format
|
||||
88
.pylintrc
@@ -60,7 +60,17 @@ confidence=
|
||||
# --enable=similarities". If you want to run only the classes checker, but have
|
||||
# no Warning level messages displayed, use "--disable=all --enable=classes
|
||||
# --disable=W".
|
||||
disable=raw-checker-failed,
|
||||
disable=print-statement,
|
||||
parameter-unpacking,
|
||||
unpacking-in-except,
|
||||
old-raise-syntax,
|
||||
backtick,
|
||||
long-suffix,
|
||||
old-ne-operator,
|
||||
old-octal-literal,
|
||||
import-star-module-level,
|
||||
non-ascii-bytes-literal,
|
||||
raw-checker-failed,
|
||||
bad-inline-option,
|
||||
locally-disabled,
|
||||
file-ignored,
|
||||
@@ -68,10 +78,67 @@ disable=raw-checker-failed,
|
||||
useless-suppression,
|
||||
deprecated-pragma,
|
||||
use-symbolic-message-instead,
|
||||
missing-function-docstring,
|
||||
missing-class-docstring,
|
||||
missing-module-docstring,
|
||||
too-few-public-methods
|
||||
apply-builtin,
|
||||
basestring-builtin,
|
||||
buffer-builtin,
|
||||
cmp-builtin,
|
||||
coerce-builtin,
|
||||
execfile-builtin,
|
||||
file-builtin,
|
||||
long-builtin,
|
||||
raw_input-builtin,
|
||||
reduce-builtin,
|
||||
standarderror-builtin,
|
||||
unicode-builtin,
|
||||
xrange-builtin,
|
||||
coerce-method,
|
||||
delslice-method,
|
||||
getslice-method,
|
||||
setslice-method,
|
||||
no-absolute-import,
|
||||
old-division,
|
||||
dict-iter-method,
|
||||
dict-view-method,
|
||||
next-method-called,
|
||||
metaclass-assignment,
|
||||
indexing-exception,
|
||||
raising-string,
|
||||
reload-builtin,
|
||||
oct-method,
|
||||
hex-method,
|
||||
nonzero-method,
|
||||
cmp-method,
|
||||
input-builtin,
|
||||
round-builtin,
|
||||
intern-builtin,
|
||||
unichr-builtin,
|
||||
map-builtin-not-iterating,
|
||||
zip-builtin-not-iterating,
|
||||
range-builtin-not-iterating,
|
||||
filter-builtin-not-iterating,
|
||||
using-cmp-argument,
|
||||
eq-without-hash,
|
||||
div-method,
|
||||
idiv-method,
|
||||
rdiv-method,
|
||||
exception-message-attribute,
|
||||
invalid-str-codec,
|
||||
sys-max-int,
|
||||
bad-python3-import,
|
||||
deprecated-string-function,
|
||||
deprecated-str-translate-call,
|
||||
deprecated-itertools-function,
|
||||
deprecated-types-field,
|
||||
next-method-defined,
|
||||
dict-items-not-iterating,
|
||||
dict-keys-not-iterating,
|
||||
dict-values-not-iterating,
|
||||
deprecated-operator-function,
|
||||
deprecated-urllib-function,
|
||||
xreadlines-attribute,
|
||||
deprecated-sys-function,
|
||||
exception-escape,
|
||||
comprehension-escape
|
||||
|
||||
# Enable the message, report, category or checker with the given id(s). You can
|
||||
# either give multiple identifier separated by comma (,) or put this option
|
||||
@@ -225,9 +292,7 @@ good-names=i,
|
||||
k,
|
||||
ex,
|
||||
Run,
|
||||
_,
|
||||
e,
|
||||
db
|
||||
_
|
||||
|
||||
# Good variable names regexes, separated by a comma. If names match any regex,
|
||||
# they will always be accepted
|
||||
@@ -390,7 +455,7 @@ indent-after-paren=4
|
||||
indent-string=' '
|
||||
|
||||
# Maximum number of characters on a single line.
|
||||
max-line-length=120
|
||||
max-line-length=100
|
||||
|
||||
# Maximum number of lines in a module.
|
||||
max-module-lines=1000
|
||||
@@ -411,6 +476,7 @@ ignore-comments=yes
|
||||
|
||||
# Ignore docstrings when computing similarities.
|
||||
ignore-docstrings=yes
|
||||
w54
|
||||
# Ignore imports when computing similarities.
|
||||
ignore-imports=no
|
||||
|
||||
@@ -518,5 +584,5 @@ valid-metaclass-classmethod-first-arg=cls
|
||||
|
||||
# Exceptions that will emit a warning when being caught. Defaults to
|
||||
# "BaseException, Exception".
|
||||
overgeneral-exceptions=builtins.BaseException,
|
||||
builtins.Exception
|
||||
overgeneral-exceptions=BaseException,
|
||||
Exception
|
||||
|
||||
3
.vscode/extensions.json
vendored
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"recommendations": ["lokalise.i18n-ally"]
|
||||
}
|
||||
25
.vscode/launch.json
vendored
@@ -1,25 +0,0 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Mealie Backend",
|
||||
"type": "python",
|
||||
"request": "launch",
|
||||
"module": "uvicorn",
|
||||
"args": [
|
||||
"mealie.app:app",
|
||||
"--port",
|
||||
"9000"
|
||||
],
|
||||
"env": {
|
||||
"PRODUCTION": "False",
|
||||
},
|
||||
"justMyCode": false,
|
||||
"jinja": true,
|
||||
"preLaunchTask": "Init Database"
|
||||
}
|
||||
]
|
||||
}
|
||||
81
.vscode/settings.json
vendored
@@ -1,69 +1,20 @@
|
||||
{
|
||||
"cSpell.enableFiletypes": [
|
||||
"!javascript",
|
||||
"!python",
|
||||
"!yaml"
|
||||
],
|
||||
"cSpell.words": [
|
||||
"chowdown",
|
||||
"compression",
|
||||
"hkotel",
|
||||
"nextcloud",
|
||||
"performant",
|
||||
"postgres",
|
||||
"webp"
|
||||
],
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.fixAll.eslint": "explicit",
|
||||
"source.organizeImports": "never"
|
||||
},
|
||||
"editor.formatOnSave": true,
|
||||
"eslint.useFlatConfig": true,
|
||||
"eslint.workingDirectories": [
|
||||
"./frontend"
|
||||
],
|
||||
"files.exclude": {
|
||||
"**/__pycache__": true,
|
||||
"**/.DS_Store": true,
|
||||
"**/.git": true,
|
||||
"**/.hg": true,
|
||||
"**/.svn": true,
|
||||
"**/CVS": true
|
||||
},
|
||||
"i18n-ally.enabledFrameworks": [
|
||||
"vue"
|
||||
],
|
||||
"i18n-ally.keystyle": "nested",
|
||||
"i18n-ally.localesPaths": "frontend/lang/messages",
|
||||
"i18n-ally.sourceLanguage": "en-US",
|
||||
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",
|
||||
"python.testing.autoTestDiscoverOnSaveEnabled": false,
|
||||
"python.testing.pytestArgs": [
|
||||
"tests"
|
||||
],
|
||||
"python.testing.pytestEnabled": true,
|
||||
"python.formatting.provider": "black",
|
||||
"python.pythonPath": ".venv/bin/python3.9",
|
||||
"python.linting.pylintEnabled": false,
|
||||
"python.linting.enabled": true,
|
||||
"python.testing.unittestEnabled": false,
|
||||
"python.analysis.typeCheckingMode": "off",
|
||||
"python.testing.nosetestsEnabled": false,
|
||||
"python.testing.pytestEnabled": true,
|
||||
"python.testing.autoTestDiscoverOnSaveEnabled": false,
|
||||
"python.testing.pytestArgs": ["tests"],
|
||||
"cSpell.enableFiletypes": ["!javascript", "!python", "!yaml"],
|
||||
"i18n-ally.localesPaths": "frontend/src/locales/messages",
|
||||
"i18n-ally.sourceLanguage": "en-US",
|
||||
"i18n-ally.enabledFrameworks": ["vue"],
|
||||
"i18n-ally.keystyle": "nested",
|
||||
"cSpell.words": ["compression", "hkotel", "performant", "postgres", "webp"],
|
||||
"search.mode": "reuseEditor",
|
||||
"python.testing.unittestArgs": [
|
||||
"-v",
|
||||
"-s",
|
||||
"./tests",
|
||||
"-p",
|
||||
"test_*.py"
|
||||
],
|
||||
"explorer.fileNesting.enabled": true,
|
||||
"explorer.fileNesting.patterns": {
|
||||
"package.json": "package-lock.json, yarn.lock, .eslintrc.js, tsconfig.json, .prettierrc, .editorconfig",
|
||||
"pyproject.toml": "poetry.lock, alembic.ini, .pylintrc",
|
||||
"netlify.toml": "runtime.txt",
|
||||
"README.md": "LICENSE, SECURITY.md"
|
||||
},
|
||||
"[vue]": {
|
||||
"editor.formatOnSave": false
|
||||
},
|
||||
"[python]": {
|
||||
"editor.formatOnSave": true,
|
||||
"editor.defaultFormatter": "charliermarsh.ruff"
|
||||
}
|
||||
"python.linting.flake8Enabled": true,
|
||||
"conventionalCommits.scopes": ["frontend"]
|
||||
}
|
||||
|
||||
27
.vscode/tasks.json
vendored
@@ -2,13 +2,22 @@
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "Production: Build and Start Docker Compose",
|
||||
"command": "task docker:prod",
|
||||
"label": "DEV: Build and Start Docker Compose",
|
||||
"command": "make docker-dev",
|
||||
"type": "shell",
|
||||
"args": [],
|
||||
"problemMatcher": [
|
||||
"$tsc"
|
||||
],
|
||||
"problemMatcher": ["$tsc"],
|
||||
"presentation": {
|
||||
"reveal": "always"
|
||||
},
|
||||
"group": "test"
|
||||
},
|
||||
{
|
||||
"label": "Production: Build and Start Docker Compose",
|
||||
"command": "make docker-prod",
|
||||
"type": "shell",
|
||||
"args": [],
|
||||
"problemMatcher": ["$tsc"],
|
||||
"presentation": {
|
||||
"reveal": "always"
|
||||
},
|
||||
@@ -16,7 +25,7 @@
|
||||
},
|
||||
{
|
||||
"label": "Dev: Start Backend",
|
||||
"command": "task py",
|
||||
"command": "make backend",
|
||||
"type": "shell",
|
||||
"presentation": {
|
||||
"reveal": "always",
|
||||
@@ -26,7 +35,7 @@
|
||||
},
|
||||
{
|
||||
"label": "Dev: Start Frontend",
|
||||
"command": "task ui",
|
||||
"command": "make frontend",
|
||||
"type": "shell",
|
||||
"presentation": {
|
||||
"reveal": "always",
|
||||
@@ -36,7 +45,7 @@
|
||||
},
|
||||
{
|
||||
"label": "Dev: Start Docs Server",
|
||||
"command": "task docs",
|
||||
"command": "make docs",
|
||||
"type": "shell",
|
||||
"presentation": {
|
||||
"reveal": "always",
|
||||
@@ -46,7 +55,7 @@
|
||||
},
|
||||
{
|
||||
"label": "Run python tests",
|
||||
"command": "task py:test",
|
||||
"command": "make test",
|
||||
"type": "shell",
|
||||
"presentation": {
|
||||
"reveal": "always"
|
||||
|
||||
34
Caddyfile
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
auto_https off
|
||||
admin off
|
||||
}
|
||||
|
||||
:80 {
|
||||
@proxied path /api/* /docs /openapi.json
|
||||
|
||||
@static {
|
||||
file
|
||||
path *.ico *.css *.js *.gif *.jpg *.jpeg *.png *.svg *.woff *.woff2 *.webp
|
||||
}
|
||||
|
||||
encode gzip zstd
|
||||
|
||||
# Handles Recipe Images / Assets
|
||||
handle_path /api/media/recipes/* {
|
||||
header @static Cache-Control max-age=31536000
|
||||
root * /app/data/recipes/
|
||||
file_server
|
||||
}
|
||||
|
||||
handle @proxied {
|
||||
uri strip_suffix /
|
||||
reverse_proxy http://127.0.0.1:9000
|
||||
}
|
||||
|
||||
handle {
|
||||
header @static Cache-Control max-age=31536000
|
||||
root * /app/dist
|
||||
try_files {path}.html {path} /
|
||||
file_server
|
||||
}
|
||||
}
|
||||
142
Dockerfile
Normal file
@@ -0,0 +1,142 @@
|
||||
###############################################
|
||||
# Frontend Builder Image
|
||||
###############################################
|
||||
FROM node:lts-alpine as frontend-build
|
||||
WORKDIR /app
|
||||
COPY ./frontend/package*.json ./
|
||||
RUN npm install
|
||||
COPY ./frontend/ .
|
||||
RUN npm run build
|
||||
|
||||
###############################################
|
||||
# Base Image
|
||||
###############################################
|
||||
FROM python:3.9-slim as python-base
|
||||
|
||||
ENV MEALIE_HOME="/app"
|
||||
|
||||
ENV PYTHONUNBUFFERED=1 \
|
||||
PYTHONDONTWRITEBYTECODE=1 \
|
||||
PIP_NO_CACHE_DIR=off \
|
||||
PIP_DISABLE_PIP_VERSION_CHECK=on \
|
||||
PIP_DEFAULT_TIMEOUT=100 \
|
||||
POETRY_HOME="/opt/poetry" \
|
||||
POETRY_VIRTUALENVS_IN_PROJECT=true \
|
||||
POETRY_NO_INTERACTION=1 \
|
||||
PYSETUP_PATH="/opt/pysetup" \
|
||||
VENV_PATH="/opt/pysetup/.venv"
|
||||
|
||||
# prepend poetry and venv to path
|
||||
ENV PATH="$POETRY_HOME/bin:$VENV_PATH/bin:$PATH"
|
||||
|
||||
# create user account
|
||||
RUN useradd -u 911 -U -d $MEALIE_HOME -s /bin/bash abc \
|
||||
&& usermod -G users abc \
|
||||
&& mkdir $MEALIE_HOME
|
||||
|
||||
###############################################
|
||||
# Builder Image
|
||||
###############################################
|
||||
FROM python-base as builder-base
|
||||
RUN apt-get update \
|
||||
&& apt-get install --no-install-recommends -y \
|
||||
curl \
|
||||
build-essential \
|
||||
libpq-dev \
|
||||
libwebp-dev \
|
||||
# LDAP Dependencies
|
||||
libsasl2-dev libldap2-dev libssl-dev \
|
||||
gnupg gnupg2 gnupg1 \
|
||||
debian-keyring \
|
||||
debian-archive-keyring \
|
||||
apt-transport-https \
|
||||
&& curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | apt-key add - \
|
||||
&& curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | tee /etc/apt/sources.list.d/caddy-stable.list \
|
||||
&& apt-get update \
|
||||
&& apt-get install --no-install-recommends -y \
|
||||
caddy \
|
||||
&& pip install -U --no-cache-dir pip
|
||||
|
||||
# install poetry - respects $POETRY_VERSION & $POETRY_HOME
|
||||
ENV POETRY_VERSION=1.1.6
|
||||
RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | python -
|
||||
|
||||
# copy project requirement files here to ensure they will be cached.
|
||||
WORKDIR $PYSETUP_PATH
|
||||
COPY ./poetry.lock ./pyproject.toml ./
|
||||
|
||||
# install runtime deps - uses $POETRY_VIRTUALENVS_IN_PROJECT internally
|
||||
RUN poetry install -E pgsql --no-dev
|
||||
|
||||
###############################################
|
||||
# Development Image
|
||||
###############################################
|
||||
FROM python-base as development
|
||||
ENV PRODUCTION=false
|
||||
|
||||
# copying poetry and venv into image
|
||||
COPY --from=builder-base $POETRY_HOME $POETRY_HOME
|
||||
COPY --from=builder-base $PYSETUP_PATH $PYSETUP_PATH
|
||||
|
||||
# copy backend
|
||||
COPY ./mealie $MEALIE_HOME/mealie
|
||||
COPY ./poetry.lock ./pyproject.toml $MEALIE_HOME/
|
||||
|
||||
#! Future
|
||||
# COPY ./alembic ./alembic.ini $MEALIE_HOME/
|
||||
|
||||
# venv already has runtime deps installed we get a quicker install
|
||||
WORKDIR $MEALIE_HOME
|
||||
RUN . $VENV_PATH/bin/activate && poetry install
|
||||
WORKDIR /
|
||||
|
||||
RUN chmod +x $MEALIE_HOME/mealie/run.sh
|
||||
ENTRYPOINT $MEALIE_HOME/mealie/run.sh "reload"
|
||||
|
||||
###############################################
|
||||
# Production Image
|
||||
###############################################
|
||||
FROM python-base as production
|
||||
ENV PRODUCTION=true
|
||||
|
||||
# curl for used by healthcheck
|
||||
RUN apt-get update \
|
||||
&& apt-get install --no-install-recommends -y \
|
||||
curl \
|
||||
&& apt-get autoremove \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# copying poetry and venv into image
|
||||
COPY --from=builder-base $POETRY_HOME $POETRY_HOME
|
||||
COPY --from=builder-base $PYSETUP_PATH $PYSETUP_PATH
|
||||
|
||||
# copying caddy into image
|
||||
COPY --from=builder-base /usr/bin/caddy /usr/bin/caddy
|
||||
|
||||
# copy backend
|
||||
COPY ./mealie $MEALIE_HOME/mealie
|
||||
COPY ./poetry.lock ./pyproject.toml $MEALIE_HOME/
|
||||
COPY ./gunicorn_conf.py $MEALIE_HOME
|
||||
|
||||
#! Future
|
||||
# COPY ./alembic ./alembic.ini $MEALIE_HOME/
|
||||
|
||||
# venv already has runtime deps installed we get a quicker install
|
||||
WORKDIR $MEALIE_HOME
|
||||
RUN . $VENV_PATH/bin/activate && poetry install -E pgsql --no-dev
|
||||
WORKDIR /
|
||||
|
||||
# copy frontend
|
||||
COPY --from=frontend-build /app/dist $MEALIE_HOME/dist
|
||||
COPY ./dev/data/templates $MEALIE_HOME/data/templates
|
||||
COPY ./Caddyfile $MEALIE_HOME
|
||||
|
||||
VOLUME [ "$MEALIE_HOME/data/" ]
|
||||
ENV APP_PORT=80
|
||||
|
||||
EXPOSE ${APP_PORT}
|
||||
|
||||
HEALTHCHECK CMD curl -fs http://localhost:${APP_PORT} || exit 1
|
||||
|
||||
RUN chmod +x $MEALIE_HOME/mealie/run.sh
|
||||
ENTRYPOINT $MEALIE_HOME/mealie/run.sh
|
||||
682
LICENSE
@@ -1,661 +1,21 @@
|
||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
our General Public Licenses are intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU Affero General Public License from time to time. Such new versions
|
||||
will be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU Affero General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU Affero General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU Affero General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If your software can interact with users remotely through a computer
|
||||
network, you should also make sure that it provides a way for users to
|
||||
get its source. For example, if your program is a web application, its
|
||||
interface could display a "Source" link that leads users to an archive
|
||||
of the code. There are many ways you could offer source, and different
|
||||
solutions will be better for different programs; see section 13 for the
|
||||
specific requirements.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2020, Hayden Kotelman
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -1,3 +0,0 @@
|
||||
# Maintainers Guide
|
||||
|
||||
See -> [/docs/docs/contributors/developers-guide/maintainers.md](/docs/docs/contributors/developers-guide/maintainers.md)
|
||||
133
README.md
@@ -1,15 +1,19 @@
|
||||
[![Latest Release][latest-release-shield]][latest-release-url]
|
||||
[![Contributors][contributors-shield]][contributors-url]
|
||||
[![Forks][forks-shield]][forks-url]
|
||||
[![Stargazers][stars-shield]][stars-url]
|
||||
[![Issues][issues-shield]][issues-url]
|
||||
[![AGPL License][license-shield]][license-url]
|
||||
[![Docker Pulls][docker-pull]][docker-url]
|
||||
[![GHCR Pulls][ghcr-pulls]][ghcr-url]
|
||||
[![MIT License][license-shield]][license-url]
|
||||
[![Docker Pulls][docker-pull]][docker-pull]
|
||||
[](https://www.codefactor.io/repository/github/hay-kot/mealie)
|
||||
[](https://github.com/hay-kot/mealie/actions/workflows/dockerbuild.release.yml)
|
||||
[](https://github.com/hay-kot/mealie/actions/workflows/test-all.yml)
|
||||
[](https://github.com/hay-kot/mealie/actions/workflows/dockerbuild.dev.yml)
|
||||
[](https://github.com/hay-kot/mealie/actions/workflows/test-all.yml)
|
||||
|
||||
<!-- PROJECT LOGO -->
|
||||
<br />
|
||||
<p align="center">
|
||||
<a href="https://github.com/mealie-recipes/mealie">
|
||||
<a href="https://github.com/hay-kot/mealie">
|
||||
<svg style="width:100px;height:100px" viewBox="0 0 24 24">
|
||||
<path fill="currentColor" d="M8.1,13.34L3.91,9.16C2.35,7.59 2.35,5.06 3.91,3.5L10.93,10.5L8.1,13.34M13.41,13L20.29,19.88L18.88,21.29L12,14.41L5.12,21.29L3.71,19.88L13.36,10.22L13.16,10C12.38,9.23 12.38,7.97 13.16,7.19L17.5,2.82L18.43,3.74L15.19,7L16.15,7.94L19.39,4.69L20.31,5.61L17.06,8.85L18,9.81L21.26,6.56L22.18,7.5L17.81,11.84C17.03,12.62 15.77,12.62 15,11.84L14.78,11.64L13.41,13Z" />
|
||||
</svg>
|
||||
@@ -18,89 +22,110 @@
|
||||
<h3 align="center">Mealie</h3>
|
||||
|
||||
<p align="center">
|
||||
A Place For All Your Recipes
|
||||
A Place for All Your Recipes
|
||||
<br />
|
||||
<a href="https://docs.mealie.io/"><strong>Explore the docs »</strong></a>
|
||||
<a href="https://github.com/mealie-recipes/mealie">
|
||||
<a href="https://hay-kot.github.io/mealie/"><strong>Explore the docs »</strong></a>
|
||||
<a href="https://github.com/hay-kot/mealie">
|
||||
</a>
|
||||
<br />
|
||||
<a href="https://demo.mealie.io/">View Demo</a>
|
||||
<a href="https://mealie-demo.hay-kot.dev/">View Demo</a>
|
||||
·
|
||||
<a href="https://github.com/mealie-recipes/mealie/issues">Report Bug</a>
|
||||
<a href="https://github.com/hay-kot/mealie/issues">Report Bug</a>
|
||||
·
|
||||
<a href="https://github.com/mealie-recipes/mealie/pkgs/container/mealie">GitHub Container Registry</a>
|
||||
<a href="https://hay-kot.github.io/mealie/api/redoc/">API</a>
|
||||
·
|
||||
<a href="https://github.com/hay-kot/mealie/issues">
|
||||
Request Feature
|
||||
</a>
|
||||
·
|
||||
<a href="https://hub.docker.com/r/hkotel/mealie"> Docker Hub
|
||||
</a>
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
|
||||
[![Product Name Screen Shot][product-screenshot]](https://docs.mealie.io)
|
||||
[![Product Name Screen Shot][product-screenshot]](https://example.com)
|
||||
|
||||
# About The Project
|
||||
|
||||
Mealie is a self hosted recipe manager, meal planner and shopping list with a RestAPI backend and a reactive frontend built in Vue for a pleasant user experience for the whole family. Easily add recipes into your database by providing the URL and Mealie will automatically import the relevant data, or add a family recipe with the UI editor. Mealie also provides an API for interactions from 3rd party applications.
|
||||
Mealie is a self hosted recipe manager and meal planner with a RestAPI backend and a reactive frontend application built in Vue for a pleasant user experience for the whole family. Easily add recipes into your database by providing the url and Mealie will automatically import the relevant data or add a family recipe with the UI editor. Mealie also provides an API for interactions from 3rd party applications.
|
||||
|
||||
[Remember to join the Discord](https://discord.gg/QuStdQGSGK)!
|
||||
|
||||
- [Remember to join the Discord](https://discord.gg/QuStdQGSGK)!
|
||||
- [Documentation](https://docs.mealie.io/)
|
||||
|
||||
|
||||
## Key Features
|
||||
- Recipe imports: Create recipes, by **importing from a URL** or entering data manually
|
||||
- Meal Planner: Use the **Meal Planner** to plan your what you'll cook for the next week
|
||||
- Shopping List: Put the necessary ingredients on your **Shopping List**, organised into sections of your local supermarket
|
||||
- Cookbooks: Group recipes into **Cookbooks** based on your own criteria
|
||||
- Docker: Easy **Docker** deployment
|
||||
- Localisation: **Translations** for 35+ languages
|
||||
- 🔍 Fuzzy search
|
||||
- 🏷️ Tag recipes with categories or tags for flexible sorting
|
||||
- 🕸 Import recipes from around the web by URL
|
||||
- 💪 Powerful bulk Category/Tag assignment
|
||||
- 📱 Beautiful Mobile Views
|
||||
- 📆 Create Meal Plans
|
||||
- 🛒 Generate shopping lists
|
||||
- 🐳 Easy setup with Docker
|
||||
- 🎨 Customize your interface with color themes
|
||||
- 💾 Export all your data in any format with Jinja2 Templates
|
||||
- 🔒 Keep your data safe with automated backup and easy restore options
|
||||
- 🌍 localized in many languages
|
||||
- ➕ Plus tons more!
|
||||
- Flexible API
|
||||
- Custom key/value pairs for recipes
|
||||
- Webhook support
|
||||
- Interactive API Documentation thanks to [FastAPI](https://fastapi.tiangolo.com/) and [Swagger](https://petstore.swagger.io/)
|
||||
- Raw JSON Recipe Editor
|
||||
- Migration from other platforms
|
||||
- Chowdown
|
||||
- Nextcloud Cookbook
|
||||
- Random meal plan generation
|
||||
|
||||
## FAQ
|
||||
|
||||
### Why An API?
|
||||
An API allows integration into applications like [Home Assistant](https://www.home-assistant.io/) that can act as notification engines to provide custom notifications based of Meal Plan data to remind you to defrost the chicken, marinade the steak, or start the CrockPot. Additionally, you can access nearly any backend service via the API giving you total control to extend the application. To explore the API spin up your server and navigate to http://yourserver.com/docs for interactive API documentation.
|
||||
|
||||
### Why a Database?
|
||||
Some users of static-site generator applications like ChowDown have expressed concerns about their data being stuck in a database. Considering this is a new project it is a valid concern to be worried about your data. Mealie specifically addresses this concern by provided automatic daily backups that export your data in json, plain-text markdown files, and/or custom Jinja2 templates. **This puts you in controls of how your data is represented** when exported from Mealie, which means you can easily migrate to any other service provided Mealie doesn't work for you.
|
||||
|
||||
As to why we need a database?
|
||||
|
||||
- **Developer Experience:** Without a database a lot of the work to maintain your data is taken on by the developer instead of a battle tested platform for storing data.
|
||||
- **Multi User Support:** With a solid database as backend storage for your data Mealie can better support multi-user sites and avoid read/write access errors when multiple actions are taken at the same time.
|
||||
|
||||
|
||||
<!-- CONTRIBUTING -->
|
||||
## Contributing
|
||||
|
||||
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**. If you're going to be working on the code-base, you'll want to use the nightly documentation to ensure you get the latest information.
|
||||
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are **greatly appreciated**. Especially test. Literally any tests. See the [Contributors Guide](https://hay-kot.github.io/mealie/contributors/non-coders/) for help getting started.
|
||||
|
||||
- See the [Contributors Guide](https://nightly.mealie.io/contributors/developers-guide/code-contributions/) for help getting started.
|
||||
- We use [VSCode Dev Containers](https://code.visualstudio.com/docs/remote/containers) to make it easy for contributors to get started!
|
||||
|
||||
If you are not a coder, you can still contribute financially. Financial contributions help me prioritize working on this project over others and helps me know that there is a real demand for project development.
|
||||
If you are not a coder, you can still contribute financially. financial contributions help me prioritize working on this project over others and helps me know that there is a real demand for project development.
|
||||
|
||||
<a href="https://www.buymeacoffee.com/haykot" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-green.png" alt="Buy Me A Coffee" style="height: 30px !important;width: 107px !important;" ></a>
|
||||
|
||||
### Translations
|
||||
|
||||
Translations can be a great way for **non-coders** to contribute to the project. We use [Crowdin](https://crowdin.com/project/mealie) to allow several contributors to work on translating Mealie. You can simply help by voting for your preferred translations, or even by completely translating Mealie into a new language.
|
||||
|
||||
For more information, check out the translation page on the [contributor's guide](https://nightly.mealie.io/contributors/translating/).
|
||||
|
||||
<!-- LICENSE -->
|
||||
## License
|
||||
Distributed under the AGPL License. See `LICENSE` for more information.
|
||||
Distributed under the MIT License. See `LICENSE` for more information.
|
||||
|
||||
|
||||
## Sponsors
|
||||
|
||||
Huge thanks to all the sponsors of this project on [Github Sponsors](https://github.com/sponsors/hay-kot) and Buy Me a Coffee. Without you, this project would surely not be possible.
|
||||
|
||||
Thanks to Depot for providing build instances for our Docker image builds.
|
||||
|
||||
[](https://depot.dev?utm_source=Mealie)
|
||||
<!-- CONTACT -->
|
||||
## Contact
|
||||
Project Link: [https://github.com/hay-kot/mealie](https://github.com/hay-kot/mealie)
|
||||
|
||||
|
||||
|
||||
<!-- MARKDOWN LINKS & IMAGES -->
|
||||
<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->
|
||||
[contributors-shield]: https://img.shields.io/github/contributors/mealie-recipes/mealie.svg?style=flat-square
|
||||
[docker-pull]: https://img.shields.io/docker/pulls/hkotel/mealie?style=flat-square
|
||||
[docker-url]: https://hub.docker.com/r/hkotel/mealie
|
||||
[ghcr-pulls]: https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fipitio.github.io%2Fbackage%2Fmealie-recipes%2Fmealie%2Fmealie.json&query=%24.downloads&style=flat-square&label=ghcr%20pulls
|
||||
[ghcr-url]: https://github.com/mealie-recipes/mealie/pkgs/container/mealie
|
||||
[contributors-url]: https://github.com/mealie-recipes/mealie/graphs/contributors
|
||||
[stars-shield]: https://img.shields.io/github/stars/mealie-recipes/mealie.svg?style=flat-square
|
||||
[stars-url]: https://github.com/mealie-recipes/mealie/stargazers
|
||||
[issues-shield]: https://img.shields.io/github/issues/mealie-recipes/mealie.svg?style=flat-square
|
||||
[issues-url]: https://github.com/mealie-recipes/mealie/issues
|
||||
[latest-release-shield]: https://img.shields.io/github/v/release/mealie-recipes/mealie?style=flat-square&label=latest%20release
|
||||
[latest-release-url]: https://github.com/mealie-recipes/mealie/releases
|
||||
[license-shield]: https://img.shields.io/github/license/mealie-recipes/mealie.svg?style=flat-square
|
||||
[license-url]: https://github.com/mealie-recipes/mealie/blob/mealie-next/LICENSE
|
||||
[contributors-shield]: https://img.shields.io/github/contributors/hay-kot/mealie.svg?style=flat-square
|
||||
[docker-pull]: https://img.shields.io/docker/pulls/hkotel/mealie
|
||||
[contributors-url]: https://github.com/hay-kot/mealie/graphs/contributors
|
||||
[forks-shield]: https://img.shields.io/github/forks/hay-kot/mealie.svg?style=flat-square
|
||||
[forks-url]: https://github.com/hay-kot/mealie/network/members
|
||||
[stars-shield]: https://img.shields.io/github/stars/hay-kot/mealie.svg?style=flat-square
|
||||
[stars-url]: https://github.com/hay-kot/mealie/stargazers
|
||||
[issues-shield]: https://img.shields.io/github/issues/hay-kot/mealie.svg?style=flat-square
|
||||
[issues-url]: https://github.com/hay-kot/mealie/issues
|
||||
[license-shield]: https://img.shields.io/github/license/hay-kot/mealie.svg?style=flat-square
|
||||
[license-url]: https://github.com/hay-kot/mealie/blob/master/LICENSE.txt
|
||||
[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=flat-square&logo=linkedin&colorB=555
|
||||
[linkedin-url]: https://linkedin.com/in/hay-kot
|
||||
[product-screenshot]: docs/docs/assets/img/home_screenshot.png
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
Since this software is still considered beta/WIP support is always only given for the latest version. Security patches are only available for the latest version and not back-ported to older versions.
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
For general security vulnerabilities you're welcome to open a GitHub issues or contribute a fix. If you feel the vulnerability should not be disclosed you can open a generic issue on GitHub and email to the details to [ob92oy0sl@mozmail.com](mailto:ob92oy0sl@mozmail.com) which is monitored by the maintainer.
|
||||
262
Taskfile.yml
@@ -1,262 +0,0 @@
|
||||
# https://taskfile.dev
|
||||
|
||||
version: "3"
|
||||
vars:
|
||||
GREETING: Hello, World!
|
||||
env:
|
||||
DEFAULT_GROUP: Home
|
||||
DEFAULT_HOUSEHOLD: Family
|
||||
PRODUCTION: false
|
||||
API_PORT: 9000
|
||||
API_DOCS: True
|
||||
TOKEN_TIME: 256 # hours
|
||||
# mailplit SMTP config
|
||||
# start dev:services to use mailpit
|
||||
SMTP_HOST: localhost
|
||||
SMTP_PORT: 1025
|
||||
SMTP_FROM_NAME: MealieDev
|
||||
SMTP_FROM_EMAIL: mealie@example.com
|
||||
SMTP_AUTH_STRATEGY: NONE
|
||||
BASE_URL: http://localhost:3000
|
||||
LANG: en-US
|
||||
|
||||
# loads .env file if it exists
|
||||
dotenv:
|
||||
- .env
|
||||
- .dev.env
|
||||
tasks:
|
||||
docs:gen:
|
||||
desc: runs the API documentation generator
|
||||
cmds:
|
||||
- poetry run python dev/code-generation/gen_docs_api.py
|
||||
|
||||
docs:
|
||||
desc: runs the documentation server
|
||||
dir: docs
|
||||
deps:
|
||||
- docs:gen
|
||||
cmds:
|
||||
- poetry run python -m mkdocs serve
|
||||
|
||||
setup:ui:
|
||||
desc: setup frontend dependencies
|
||||
dir: frontend
|
||||
run: once
|
||||
cmds:
|
||||
- yarn install
|
||||
sources:
|
||||
- package.json
|
||||
- yarn.lock
|
||||
generates:
|
||||
- node_modules/**
|
||||
|
||||
setup:py:
|
||||
desc: setup python dependencies
|
||||
run: once
|
||||
cmds:
|
||||
- poetry install --with main,dev,postgres
|
||||
- poetry run pre-commit install
|
||||
sources:
|
||||
- poetry.lock
|
||||
- pyproject.toml
|
||||
- .pre-commit-config.yaml
|
||||
|
||||
setup:
|
||||
desc: setup all dependencies
|
||||
deps:
|
||||
- setup:ui
|
||||
- setup:py
|
||||
|
||||
dev:generate:
|
||||
desc: run code generators
|
||||
cmds:
|
||||
- poetry run python dev/code-generation/main.py {{ .CLI_ARGS }}
|
||||
- task: py:format
|
||||
|
||||
dev:services:
|
||||
desc: starts postgres and mailpit containers
|
||||
dir: docker
|
||||
cmds:
|
||||
- docker compose -f docker-compose.dev.yml up
|
||||
|
||||
dev:clean:
|
||||
desc: cleans up dev environment !! removes all data files !!
|
||||
vars:
|
||||
DEV_DATA: ""
|
||||
cmds:
|
||||
- rm -r ./dev/data/recipes/
|
||||
- rm -r ./dev/data/users/
|
||||
- rm -f ./dev/data/mealie*.db
|
||||
- rm -f ./dev/data/mealie.log
|
||||
- rm -f ./dev/data/.secret
|
||||
|
||||
py:mypy:
|
||||
desc: runs python type checking
|
||||
cmds:
|
||||
- poetry run mypy mealie
|
||||
|
||||
py:test:
|
||||
desc: runs python tests (support args after '--')
|
||||
cmds:
|
||||
- poetry run pytest {{ .CLI_ARGS }}
|
||||
|
||||
py:format:
|
||||
desc: runs python code formatter
|
||||
cmds:
|
||||
- poetry run ruff format .
|
||||
|
||||
py:lint:
|
||||
desc: runs python linter
|
||||
cmds:
|
||||
- poetry run ruff check mealie
|
||||
|
||||
py:check:
|
||||
desc: runs all linters, type checkers, and formatters
|
||||
deps:
|
||||
- py:format
|
||||
- py:lint
|
||||
- py:mypy
|
||||
- py:test
|
||||
|
||||
py:coverage:
|
||||
desc: runs python coverage and generates html report
|
||||
cmds:
|
||||
- poetry run pytest
|
||||
- poetry run coverage report -m
|
||||
- poetry run coveragepy-lcov
|
||||
- poetry run coverage html
|
||||
- open htmlcov/index.html
|
||||
|
||||
py:package:copy-frontend:
|
||||
desc: copy the frontend files into the Python package
|
||||
internal: true
|
||||
deps:
|
||||
- ui:generate
|
||||
cmds:
|
||||
- rm -rf mealie/frontend
|
||||
- cp -a frontend/dist mealie/frontend
|
||||
sources:
|
||||
- frontend/dist/**
|
||||
generates:
|
||||
- mealie/frontend/**
|
||||
|
||||
py:package:generate-requirements:
|
||||
desc: Generate requirements file to pin all packages, effectively a "pip freeze" before installation begins
|
||||
internal: true
|
||||
cmds:
|
||||
- poetry export -n --only=main --extras=pgsql --output=dist/requirements.txt
|
||||
# Include mealie in the requirements, hashing the package that was just built to ensure it's the one installed
|
||||
- echo "mealie[pgsql]=={{.MEALIE_VERSION}} \\" >> dist/requirements.txt
|
||||
- poetry run pip hash dist/mealie-{{.MEALIE_VERSION}}-py3-none-any.whl | tail -n1 | tr -d '\n' >> dist/requirements.txt
|
||||
- echo " \\" >> dist/requirements.txt
|
||||
- poetry run pip hash dist/mealie-{{.MEALIE_VERSION}}.tar.gz | tail -n1 >> dist/requirements.txt
|
||||
vars:
|
||||
MEALIE_VERSION:
|
||||
sh: poetry version --short
|
||||
sources:
|
||||
- poetry.lock
|
||||
- pyproject.toml
|
||||
- dist/mealie-*.whl
|
||||
- dist/mealie-*.tar.gz
|
||||
generates:
|
||||
- dist/requirements.txt
|
||||
|
||||
py:package:deps-parallel:
|
||||
desc: Run py:package dependencies in parallel
|
||||
internal: true
|
||||
deps:
|
||||
- setup:py
|
||||
- py:package:copy-frontend
|
||||
|
||||
py:package:deps:
|
||||
desc: Dependencies of py:package, skippable by setting SKIP_PACKAGE_DEPS=true
|
||||
internal: true
|
||||
cmds:
|
||||
- task: py:package:deps-parallel
|
||||
status:
|
||||
- '{{ .SKIP_PACKAGE_DEPS | default "false"}}'
|
||||
|
||||
py:package:
|
||||
desc: builds Python packages (sdist and wheel) in top-level dist directory
|
||||
deps:
|
||||
- py:package:deps
|
||||
cmds:
|
||||
- poetry build -n --output=dist
|
||||
- task: py:package:generate-requirements
|
||||
|
||||
py:
|
||||
desc: runs the backend server
|
||||
cmds:
|
||||
- poetry run python mealie/app.py
|
||||
|
||||
py:postgres:
|
||||
desc: runs the backend server configured for containerized postgres
|
||||
env:
|
||||
DB_ENGINE: postgres
|
||||
POSTGRES_USER: mealie
|
||||
POSTGRES_PASSWORD: mealie
|
||||
POSTGRES_SERVER: localhost
|
||||
POSTGRES_PORT: 5432
|
||||
POSTGRES_DB: mealie
|
||||
cmds:
|
||||
- poetry run python mealie/app.py
|
||||
|
||||
py:migrate:
|
||||
desc: generates a new database migration file e.g. task py:migrate -- "add new column"
|
||||
cmds:
|
||||
- poetry run alembic --config mealie/alembic/alembic.ini revision --autogenerate -m "{{ .CLI_ARGS }}"
|
||||
- task: py:format
|
||||
|
||||
ui:build:
|
||||
desc: builds the frontend in frontend/dist
|
||||
dir: frontend
|
||||
cmds:
|
||||
- yarn build
|
||||
|
||||
ui:generate:
|
||||
desc: generates a static version of the frontend in frontend/dist
|
||||
dir: frontend
|
||||
deps:
|
||||
- setup:ui
|
||||
cmds:
|
||||
- yarn generate
|
||||
|
||||
ui:lint:
|
||||
desc: runs the frontend linter
|
||||
dir: frontend
|
||||
cmds:
|
||||
- yarn lint
|
||||
|
||||
ui:test:
|
||||
desc: runs the frontend tests
|
||||
dir: frontend
|
||||
cmds:
|
||||
- yarn test
|
||||
|
||||
ui:check:
|
||||
desc: runs all frontend checks
|
||||
deps:
|
||||
- ui:lint
|
||||
- ui:test
|
||||
|
||||
ui:
|
||||
desc: runs the frontend server
|
||||
dir: frontend
|
||||
cmds:
|
||||
- yarn run dev --no-fork
|
||||
|
||||
docker:build-from-package:
|
||||
desc: Builds the Docker image from the existing Python package in dist/
|
||||
deps:
|
||||
- py:package
|
||||
cmds:
|
||||
- docker build --tag mealie:dev --file docker/Dockerfile --build-arg COMMIT={{.GIT_COMMIT}} --build-context packages=dist .
|
||||
vars:
|
||||
GIT_COMMIT:
|
||||
sh: git rev-parse HEAD
|
||||
|
||||
docker:prod:
|
||||
desc: builds and runs the production docker image locally
|
||||
dir: docker
|
||||
cmds:
|
||||
- docker compose -f docker-compose.yml -p mealie up -d --build
|
||||
64
cliff.toml
@@ -1,64 +0,0 @@
|
||||
# configuration file for git-cliff (0.1.0)
|
||||
|
||||
[changelog]
|
||||
# changelog header
|
||||
header = """
|
||||
# Changelog\n
|
||||
All notable changes to this project will be documented in this file.\n
|
||||
"""
|
||||
# template for the changelog body
|
||||
# https://tera.netlify.app/docs/#introduction
|
||||
body = """
|
||||
{% if version %}\
|
||||
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
|
||||
{% else %}\
|
||||
## [unreleased]
|
||||
{% endif %}\
|
||||
{% for group, commits in commits | group_by(attribute="group") %}
|
||||
### {{ group | upper_first }}
|
||||
{% for commit in commits %}
|
||||
- {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message | upper_first }}\
|
||||
{% endfor %}
|
||||
{% endfor %}\n
|
||||
"""
|
||||
# remove the leading and trailing whitespace from the template
|
||||
trim = true
|
||||
# changelog footer
|
||||
footer = """
|
||||
<!-- generated by git-cliff -->
|
||||
"""
|
||||
|
||||
[git]
|
||||
# parse the commits based on https://www.conventionalcommits.org
|
||||
conventional_commits = true
|
||||
# filter out the commits that are not conventional
|
||||
filter_unconventional = true
|
||||
# regex for preprocessing the commit messages
|
||||
commit_preprocessors = [
|
||||
{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](https://github.com/hay-kot/mealie/issues/${2}))"},
|
||||
]
|
||||
# regex for parsing and grouping commits
|
||||
commit_parsers = [
|
||||
{ message = "^feat", group = "Features"},
|
||||
{ message = "^fix", group = "Bug Fixes"},
|
||||
{ message = "^doc", group = "Documentation"},
|
||||
{ message = "^perf", group = "Performance"},
|
||||
{ message = "^refactor", group = "Refactor"},
|
||||
{ message = "^style", group = "Styling"},
|
||||
{ message = "^test", group = "Testing"},
|
||||
{ message = "^chore\\(release\\): prepare for", skip = true},
|
||||
{ message = "^chore", group = "Miscellaneous Tasks"},
|
||||
{ body = ".*security", group = "Security"},
|
||||
]
|
||||
# filter out the commits that are not matched by commit parsers
|
||||
filter_commits = false
|
||||
# glob pattern for matching git tags
|
||||
tag_pattern = "v[0-9]*"
|
||||
# regex for skipping tags
|
||||
skip_tags = "v0.1.0-beta.1"
|
||||
# regex for ignoring tags
|
||||
ignore_tags = ""
|
||||
# sort the tags chronologically
|
||||
date_order = false
|
||||
# sort the commits inside sections by oldest/newest order
|
||||
sort_commits = "oldest"
|
||||
18
crowdin.yml
@@ -1,16 +1,6 @@
|
||||
preserve_hierarchy: false
|
||||
pull_request_title: "chore(l10n): New Crowdin updates"
|
||||
pull_request_labels: [
|
||||
"l10n"
|
||||
]
|
||||
files:
|
||||
- source: /frontend/lang/messages/en-US.json
|
||||
translation: /frontend/lang/messages/%locale%.json
|
||||
- source: /mealie/lang/messages/en-US.json
|
||||
translation: /mealie/lang/messages/%locale%.json
|
||||
- source: /mealie/repos/seed/resources/foods/locales/en-US.json
|
||||
translation: /mealie/repos/seed/resources/foods/locales/%locale%.json
|
||||
- source: /mealie/repos/seed/resources/units/locales/en-US.json
|
||||
translation: /mealie/repos/seed/resources/units/locales/%locale%.json
|
||||
- source: /mealie/repos/seed/resources/labels/locales/en-US.json
|
||||
translation: /mealie/repos/seed/resources/labels/locales/%locale%.json
|
||||
- source: /frontend/src/locales/messages/en-US.json
|
||||
translation: /frontend/src/locales/messages/%locale%.json
|
||||
- source: /frontend/src/locales/dateTimeFormats/en-US.json
|
||||
translation: /frontend/src/locales/dateTimeFormats/%locale%.json
|
||||
|
||||
@@ -1,116 +0,0 @@
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
|
||||
from slugify import slugify
|
||||
from utils import render_python_template
|
||||
|
||||
CWD = Path(__file__).parent
|
||||
|
||||
TEMPLATE = CWD / "templates" / "test_data.py.j2"
|
||||
TEST_DATA = CWD.parent.parent / "tests" / "data"
|
||||
GENERATED = CWD / "generated"
|
||||
|
||||
|
||||
@dataclass
|
||||
class TestDataPath:
|
||||
var: str
|
||||
path: str
|
||||
|
||||
@classmethod
|
||||
def from_path(cls, path: Path):
|
||||
var = str(path)
|
||||
var = var.replace(str(TEST_DATA), "")
|
||||
|
||||
rel_path = var.removeprefix("/")
|
||||
|
||||
# Remove any file extension
|
||||
var = var.split(".")[0]
|
||||
var = var.replace("'", "")
|
||||
var = slugify(var, separator="_")
|
||||
|
||||
return cls(var, rel_path)
|
||||
|
||||
|
||||
@dataclass
|
||||
class DataDir:
|
||||
name: str
|
||||
path: Path
|
||||
children: list[TestDataPath]
|
||||
|
||||
|
||||
def get_data_paths(path: Path) -> list[DataDir]:
|
||||
"""
|
||||
Recursively walks the given path and returns a list of TestDataPaths
|
||||
"""
|
||||
|
||||
def recursive_test_paths(p: Path) -> list[TestDataPath]:
|
||||
test_paths = []
|
||||
for child in p.iterdir():
|
||||
if child.is_dir():
|
||||
test_paths += recursive_test_paths(child)
|
||||
else:
|
||||
test_paths.append(TestDataPath.from_path(child))
|
||||
return [x for x in test_paths if not None]
|
||||
|
||||
data_paths = []
|
||||
|
||||
for p in path.iterdir():
|
||||
if p.is_dir():
|
||||
data_paths.append(DataDir(p.name, p, recursive_test_paths(p)))
|
||||
|
||||
return data_paths
|
||||
|
||||
|
||||
def rename_non_compliant_paths():
|
||||
"""
|
||||
Recursively itterates through a directory and renames all files/folders to be
|
||||
kabab case.
|
||||
"""
|
||||
|
||||
ignore_files = ["DS_Store", ".gitkeep", "af-ZA.json", "en-US.json"]
|
||||
|
||||
ignore_extensions = [".pyc", ".pyo", ".py"]
|
||||
|
||||
def recursive_rename(p: Path):
|
||||
for child in p.iterdir():
|
||||
if str(child).startswith("."):
|
||||
continue
|
||||
|
||||
if child.suffix in ignore_extensions:
|
||||
continue
|
||||
|
||||
if child.name in ignore_files:
|
||||
continue
|
||||
|
||||
if child.is_dir():
|
||||
recursive_rename(child)
|
||||
|
||||
else:
|
||||
new_name = slugify(child.stem)
|
||||
extension = child.suffix
|
||||
if new_name != child.name:
|
||||
child.rename(child.parent / f"{new_name}{extension}")
|
||||
|
||||
recursive_rename(TEST_DATA)
|
||||
|
||||
|
||||
def main():
|
||||
rename_non_compliant_paths()
|
||||
|
||||
GENERATED.mkdir(exist_ok=True)
|
||||
data_dirs = get_data_paths(TEST_DATA)
|
||||
|
||||
all_children = [x.children for x in data_dirs]
|
||||
|
||||
# Flatten list of lists
|
||||
all_children = [item for sublist in all_children for item in sublist]
|
||||
|
||||
render_python_template(
|
||||
TEMPLATE,
|
||||
GENERATED / "__init__.py",
|
||||
{"children": all_children},
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -1,91 +0,0 @@
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
from fastapi import FastAPI
|
||||
from jinja2 import Template
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
from utils import PROJECT_DIR, CodeTemplates, HTTPRequest, RouteObject
|
||||
|
||||
CWD = Path(__file__).parent
|
||||
|
||||
OUTFILE = PROJECT_DIR / "tests" / "utils" / "api_routes" / "__init__.py"
|
||||
|
||||
|
||||
class PathObject(BaseModel):
|
||||
model_config = ConfigDict(arbitrary_types_allowed=True)
|
||||
route_object: RouteObject
|
||||
http_verbs: list[HTTPRequest]
|
||||
|
||||
|
||||
def force_include_in_schema(app: FastAPI):
|
||||
# clear schema cache
|
||||
app.openapi_schema = None
|
||||
for route in app.routes:
|
||||
route.include_in_schema = True
|
||||
|
||||
|
||||
def get_path_objects(app: FastAPI):
|
||||
force_include_in_schema(app)
|
||||
paths = []
|
||||
for key, value in app.openapi().items():
|
||||
if key == "paths":
|
||||
for key, value2 in value.items():
|
||||
verbs = []
|
||||
for k, v in value2.items():
|
||||
verbs.append(HTTPRequest(request_type=k, **v))
|
||||
|
||||
paths.append(
|
||||
PathObject(
|
||||
route_object=RouteObject(key),
|
||||
http_verbs=verbs,
|
||||
)
|
||||
)
|
||||
|
||||
return paths
|
||||
|
||||
|
||||
def dump_open_api(app: FastAPI):
|
||||
"""Writes the Open API as JSON to a json file"""
|
||||
OPEN_API_FILE = CWD / "openapi.json"
|
||||
|
||||
with open(OPEN_API_FILE, "w") as f:
|
||||
f.write(json.dumps(app.openapi()))
|
||||
|
||||
|
||||
def read_template(file: Path):
|
||||
with open(file) as f:
|
||||
return f.read()
|
||||
|
||||
|
||||
def generate_python_templates(static_paths: list[PathObject], function_paths: list[PathObject]):
|
||||
template = Template(read_template(CodeTemplates.pytest_routes))
|
||||
content = template.render(
|
||||
paths={
|
||||
"prefix": "/api",
|
||||
"static_paths": static_paths,
|
||||
"function_paths": function_paths,
|
||||
}
|
||||
)
|
||||
with open(OUTFILE, "w") as f:
|
||||
f.write(content)
|
||||
|
||||
return
|
||||
|
||||
|
||||
def main():
|
||||
from mealie.app import app
|
||||
|
||||
dump_open_api(app)
|
||||
paths = get_path_objects(app)
|
||||
|
||||
static_paths = [x.route_object for x in paths if not x.route_object.is_function]
|
||||
function_paths = [x.route_object for x in paths if x.route_object.is_function]
|
||||
|
||||
static_paths.sort(key=lambda x: x.router_slug)
|
||||
function_paths.sort(key=lambda x: x.router_slug)
|
||||
|
||||
generate_python_templates(static_paths, function_paths)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -1,100 +0,0 @@
|
||||
import pathlib
|
||||
import re
|
||||
from dataclasses import dataclass, field
|
||||
|
||||
from utils import PROJECT_DIR, log, render_python_template
|
||||
|
||||
template = """# This file is auto-generated by gen_schema_exports.py
|
||||
{% for file in data.module.files %}{{ file.import_str() }}
|
||||
{% endfor %}
|
||||
|
||||
__all__ = [
|
||||
{% for file in data.module.files %}
|
||||
{%- for class in file.classes -%}
|
||||
"{{ class }}",
|
||||
{%- endfor -%}
|
||||
{%- endfor %}
|
||||
]
|
||||
|
||||
"""
|
||||
|
||||
SCHEMA_PATH = PROJECT_DIR / "mealie" / "schema"
|
||||
|
||||
SKIP = {"static", "__pycache__"}
|
||||
|
||||
|
||||
class PyFile:
|
||||
import_path: str
|
||||
"""The import path of the file"""
|
||||
|
||||
classes: list[str]
|
||||
"""A list of classes in the file"""
|
||||
|
||||
def __init__(self, path: pathlib.Path):
|
||||
self.import_path = path.stem
|
||||
self.classes = []
|
||||
|
||||
self.classes = PyFile.extract_classes(path)
|
||||
self.classes.sort()
|
||||
|
||||
def import_str(self) -> str:
|
||||
"""Returns a string that can be used to import the file"""
|
||||
return f"from .{self.import_path} import {', '.join(self.classes)}"
|
||||
|
||||
@staticmethod
|
||||
def extract_classes(file_path: pathlib.Path) -> list[str]:
|
||||
name = file_path.stem
|
||||
|
||||
if name == "__init__" or name.startswith("_"):
|
||||
return []
|
||||
|
||||
classes = re.findall(r"(?m)^class\s(\w+)", file_path.read_text())
|
||||
return classes
|
||||
|
||||
|
||||
@dataclass
|
||||
class Modules:
|
||||
directory: pathlib.Path
|
||||
"""The directory to search for modules"""
|
||||
|
||||
files: list[PyFile] = field(default_factory=list)
|
||||
"""A list of files in the directory"""
|
||||
|
||||
def __post_init__(self):
|
||||
for file in self.directory.glob("*.py"):
|
||||
if file.name.startswith("_"):
|
||||
continue
|
||||
|
||||
pfile = PyFile(file)
|
||||
|
||||
if len(pfile.classes) > 0:
|
||||
self.files.append(pfile)
|
||||
|
||||
else:
|
||||
log.debug(f"Skipping {file.name} as it has no classes")
|
||||
|
||||
|
||||
def find_modules(root: pathlib.Path) -> list[Modules]:
|
||||
"""Finds all the top level modules in the provided folder"""
|
||||
modules: list[Modules] = []
|
||||
for file in root.iterdir():
|
||||
if file.is_dir() and file.name not in SKIP:
|
||||
modules.append(Modules(directory=file))
|
||||
|
||||
return modules
|
||||
|
||||
|
||||
def main():
|
||||
modules = find_modules(SCHEMA_PATH)
|
||||
|
||||
for module in modules:
|
||||
log.debug(f"Module: {module.directory.name}")
|
||||
for file in module.files:
|
||||
log.debug(f" File: {file.import_path}")
|
||||
log.debug(f" Classes: [{', '.join(file.classes)}]")
|
||||
|
||||
render_python_template(template, module.directory / "__init__.py", {"module": module})
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -1,225 +0,0 @@
|
||||
import os
|
||||
import pathlib
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
|
||||
import dotenv
|
||||
import requests
|
||||
from jinja2 import Template
|
||||
from pydantic import ConfigDict
|
||||
from requests import Response
|
||||
from utils import CodeDest, CodeKeys, inject_inline, log
|
||||
|
||||
from mealie.schema._mealie import MealieModel
|
||||
|
||||
BASE = pathlib.Path(__file__).parent.parent.parent
|
||||
|
||||
API_KEY = dotenv.get_key(BASE / ".env", "CROWDIN_API_KEY") or os.environ.get("CROWDIN_API_KEY", "")
|
||||
|
||||
|
||||
@dataclass
|
||||
class LocaleData:
|
||||
name: str
|
||||
dir: str = "ltr"
|
||||
|
||||
|
||||
LOCALE_DATA: dict[str, LocaleData] = {
|
||||
"af-ZA": LocaleData(name="Afrikaans (Afrikaans)"),
|
||||
"ar-SA": LocaleData(name="العربية (Arabic)", dir="rtl"),
|
||||
"bg-BG": LocaleData(name="Български (Bulgarian)"),
|
||||
"ca-ES": LocaleData(name="Català (Catalan)"),
|
||||
"cs-CZ": LocaleData(name="Čeština (Czech)"),
|
||||
"da-DK": LocaleData(name="Dansk (Danish)"),
|
||||
"de-DE": LocaleData(name="Deutsch (German)"),
|
||||
"el-GR": LocaleData(name="Ελληνικά (Greek)"),
|
||||
"en-GB": LocaleData(name="British English"),
|
||||
"en-US": LocaleData(name="American English"),
|
||||
"es-ES": LocaleData(name="Español (Spanish)"),
|
||||
"et-EE": LocaleData(name="Eesti (Estonian)"),
|
||||
"fi-FI": LocaleData(name="Suomi (Finnish)"),
|
||||
"fr-BE": LocaleData(name="Belge (Belgian)"),
|
||||
"fr-CA": LocaleData(name="Français canadien (Canadian French)"),
|
||||
"fr-FR": LocaleData(name="Français (French)"),
|
||||
"gl-ES": LocaleData(name="Galego (Galician)"),
|
||||
"he-IL": LocaleData(name="עברית (Hebrew)", dir="rtl"),
|
||||
"hr-HR": LocaleData(name="Hrvatski (Croatian)"),
|
||||
"hu-HU": LocaleData(name="Magyar (Hungarian)"),
|
||||
"is-IS": LocaleData(name="Íslenska (Icelandic)"),
|
||||
"it-IT": LocaleData(name="Italiano (Italian)"),
|
||||
"ja-JP": LocaleData(name="日本語 (Japanese)"),
|
||||
"ko-KR": LocaleData(name="한국어 (Korean)"),
|
||||
"lt-LT": LocaleData(name="Lietuvių (Lithuanian)"),
|
||||
"lv-LV": LocaleData(name="Latviešu (Latvian)"),
|
||||
"nl-NL": LocaleData(name="Nederlands (Dutch)"),
|
||||
"no-NO": LocaleData(name="Norsk (Norwegian)"),
|
||||
"pl-PL": LocaleData(name="Polski (Polish)"),
|
||||
"pt-BR": LocaleData(name="Português do Brasil (Brazilian Portuguese)"),
|
||||
"pt-PT": LocaleData(name="Português (Portuguese)"),
|
||||
"ro-RO": LocaleData(name="Română (Romanian)"),
|
||||
"ru-RU": LocaleData(name="Pусский (Russian)"),
|
||||
"sk-SK": LocaleData(name="Slovenčina (Slovak)"),
|
||||
"sl-SI": LocaleData(name="Slovenščina (Slovenian)"),
|
||||
"sr-SP": LocaleData(name="српски (Serbian)"),
|
||||
"sv-SE": LocaleData(name="Svenska (Swedish)"),
|
||||
"tr-TR": LocaleData(name="Türkçe (Turkish)"),
|
||||
"uk-UA": LocaleData(name="Українська (Ukrainian)"),
|
||||
"vi-VN": LocaleData(name="Tiếng Việt (Vietnamese)"),
|
||||
"zh-CN": LocaleData(name="简体中文 (Chinese simplified)"),
|
||||
"zh-TW": LocaleData(name="繁體中文 (Chinese traditional)"),
|
||||
}
|
||||
|
||||
LOCALE_TEMPLATE = """// This Code is auto generated by gen_ts_locales.py
|
||||
export const LOCALES = [{% for locale in locales %}
|
||||
{
|
||||
name: "{{ locale.name }}",
|
||||
value: "{{ locale.locale }}",
|
||||
progress: {{ locale.progress }},
|
||||
dir: "{{ locale.dir }}",
|
||||
},{% endfor %}
|
||||
];
|
||||
|
||||
"""
|
||||
|
||||
|
||||
class TargetLanguage(MealieModel):
|
||||
model_config = ConfigDict(populate_by_name=True, extra="allow")
|
||||
|
||||
id: str
|
||||
name: str
|
||||
locale: str
|
||||
dir: str = "ltr"
|
||||
threeLettersCode: str
|
||||
twoLettersCode: str
|
||||
progress: float = 0.0
|
||||
|
||||
|
||||
class CrowdinApi:
|
||||
project_name = "Mealie"
|
||||
project_id = "451976"
|
||||
api_key = API_KEY
|
||||
|
||||
def __init__(self, api_key: str | None):
|
||||
self.api_key = api_key or API_KEY
|
||||
|
||||
@property
|
||||
def headers(self) -> dict:
|
||||
return {
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": f"Bearer {self.api_key}",
|
||||
}
|
||||
|
||||
def get_projects(self) -> Response:
|
||||
return requests.get("https://api.crowdin.com/api/v2/projects", headers=self.headers)
|
||||
|
||||
def get_project(self) -> Response:
|
||||
return requests.get(f"https://api.crowdin.com/api/v2/projects/{self.project_id}", headers=self.headers)
|
||||
|
||||
def get_languages(self) -> list[TargetLanguage]:
|
||||
response = self.get_project()
|
||||
tls = response.json()["data"]["targetLanguages"]
|
||||
|
||||
models = [TargetLanguage(**t) for t in tls]
|
||||
|
||||
models.insert(
|
||||
0,
|
||||
TargetLanguage(
|
||||
id="en-US",
|
||||
name="English",
|
||||
locale="en-US",
|
||||
dir="ltr",
|
||||
threeLettersCode="en",
|
||||
twoLettersCode="en",
|
||||
progress=100,
|
||||
),
|
||||
)
|
||||
|
||||
progress: list[dict] = self.get_progress()["data"]
|
||||
|
||||
for model in models:
|
||||
if model.locale in LOCALE_DATA:
|
||||
locale_data = LOCALE_DATA[model.locale]
|
||||
model.name = locale_data.name
|
||||
model.dir = locale_data.dir
|
||||
|
||||
for p in progress:
|
||||
if p["data"]["languageId"] == model.id:
|
||||
model.progress = p["data"]["translationProgress"]
|
||||
|
||||
models.sort(key=lambda x: x.locale, reverse=True)
|
||||
return models
|
||||
|
||||
def get_progress(self) -> dict:
|
||||
response = requests.get(
|
||||
f"https://api.crowdin.com/api/v2/projects/{self.project_id}/languages/progress?limit=500",
|
||||
headers=self.headers,
|
||||
)
|
||||
return response.json()
|
||||
|
||||
|
||||
PROJECT_DIR = Path(__file__).parent.parent.parent
|
||||
|
||||
|
||||
datetime_dir = PROJECT_DIR / "frontend" / "lang" / "dateTimeFormats"
|
||||
locales_dir = PROJECT_DIR / "frontend" / "lang" / "messages"
|
||||
nuxt_config = PROJECT_DIR / "frontend" / "nuxt.config.ts"
|
||||
i18n_config = PROJECT_DIR / "frontend" / "i18n.config.ts"
|
||||
reg_valid = PROJECT_DIR / "mealie" / "schema" / "_mealie" / "validators.py"
|
||||
|
||||
"""
|
||||
This snippet walks the message and dat locales directories and generates the import information
|
||||
for the nuxt.config.ts file and automatically injects it into the nuxt.config.ts file. Note that
|
||||
the code generation ID is hardcoded into the script and required in the nuxt config.
|
||||
"""
|
||||
|
||||
|
||||
def inject_nuxt_values():
|
||||
all_date_locales = [
|
||||
f'"{match.stem}": require("./lang/dateTimeFormats/{match.name}"),' for match in datetime_dir.glob("*.json")
|
||||
]
|
||||
|
||||
all_langs = []
|
||||
for match in locales_dir.glob("*.json"):
|
||||
lang_string = f'{{ code: "{match.stem}", file: "{match.name.replace(".json", ".ts")}" }},'
|
||||
all_langs.append(lang_string)
|
||||
|
||||
log.debug(f"injecting locales into nuxt config -> {nuxt_config}")
|
||||
inject_inline(nuxt_config, CodeKeys.nuxt_local_messages, all_langs)
|
||||
inject_inline(i18n_config, CodeKeys.nuxt_local_dates, all_date_locales)
|
||||
|
||||
|
||||
def inject_registration_validation_values():
|
||||
all_langs = []
|
||||
for match in locales_dir.glob("*.json"):
|
||||
lang_string = f'"{match.stem}",'
|
||||
all_langs.append(lang_string)
|
||||
|
||||
# sort
|
||||
all_langs.sort()
|
||||
|
||||
log.debug(f"injecting locales into user registration validation -> {reg_valid}")
|
||||
inject_inline(reg_valid, CodeKeys.nuxt_local_messages, all_langs)
|
||||
|
||||
|
||||
def generate_locales_ts_file():
|
||||
api = CrowdinApi(None)
|
||||
models = api.get_languages()
|
||||
tmpl = Template(LOCALE_TEMPLATE)
|
||||
rendered = tmpl.render(locales=models)
|
||||
|
||||
log.debug(f"generating locales ts file -> {CodeDest.use_locales}")
|
||||
with open(CodeDest.use_locales, "w") as f:
|
||||
f.write(rendered) # type:ignore
|
||||
|
||||
|
||||
def main():
|
||||
if API_KEY is None or API_KEY == "":
|
||||
log.error("CROWDIN_API_KEY is not set")
|
||||
return
|
||||
|
||||
generate_locales_ts_file()
|
||||
inject_nuxt_values()
|
||||
inject_registration_validation_values()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -1,235 +0,0 @@
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
from jinja2 import Template
|
||||
from pydantic2ts import generate_typescript_defs
|
||||
from utils import log
|
||||
|
||||
# ============================================================
|
||||
|
||||
template = """// This Code is auto generated by gen_ts_types.py
|
||||
{% for name in global %}import {{ name }} from "@/components/global/{{ name }}.vue";
|
||||
{% endfor %}{% for name in layout %}import {{ name }} from "@/components/layout/{{ name }}.vue";
|
||||
{% endfor %}
|
||||
declare module "vue" {
|
||||
export interface GlobalComponents {
|
||||
// Global Components
|
||||
{% for name in global -%}
|
||||
{{ " " }}{{ name }}: typeof {{ name }};
|
||||
{% endfor -%}
|
||||
{{ " " }}// Layout Components
|
||||
{% for name in layout -%}
|
||||
{{ " " }}{{ name }}: typeof {{ name }};
|
||||
{% endfor -%}{{ " }"}}
|
||||
}
|
||||
|
||||
export {};
|
||||
|
||||
"""
|
||||
|
||||
CWD = Path(__file__).parent
|
||||
PROJECT_DIR = Path(__file__).parent.parent.parent
|
||||
|
||||
|
||||
def generate_global_components_types() -> None:
|
||||
destination_file = PROJECT_DIR / "frontend" / "types" / "components.d.ts"
|
||||
|
||||
component_paths = {
|
||||
"global": PROJECT_DIR / "frontend" / "components" / "global",
|
||||
"layout": PROJECT_DIR / "frontend" / "components" / "Layout",
|
||||
}
|
||||
|
||||
def render_template(template: str, data: dict) -> str | None:
|
||||
tmpl = Template(template)
|
||||
return tmpl.render(**data)
|
||||
|
||||
def build_data() -> dict:
|
||||
data = {}
|
||||
for name, path in component_paths.items():
|
||||
components = [component.stem for component in path.glob("*.vue")]
|
||||
components.sort()
|
||||
data[name] = components
|
||||
|
||||
return data
|
||||
|
||||
def write_template(text: str) -> None:
|
||||
destination_file.write_text(text)
|
||||
|
||||
text = render_template(template, build_data())
|
||||
|
||||
if text:
|
||||
write_template(text)
|
||||
|
||||
|
||||
# ============================================================
|
||||
# Pydantic To Typescript Generator
|
||||
|
||||
|
||||
def generate_typescript_types() -> None: # noqa: C901
|
||||
def contains_number(s: str) -> bool:
|
||||
return bool(re.search(r"\d", s))
|
||||
|
||||
def remove_numbers(s: str) -> str:
|
||||
return re.sub(r"\d", "", s)
|
||||
|
||||
def extract_type_name(line: str) -> str:
|
||||
# Looking for "export type EnumName = enumVal1 | enumVal2 | ..."
|
||||
if not (line.startswith("export type") and "=" in line):
|
||||
return ""
|
||||
|
||||
return line.split(" ")[2]
|
||||
|
||||
def extract_property_type_name(line: str) -> str:
|
||||
# Looking for " fieldName: FieldType;" or " fieldName: FieldType & string;"
|
||||
if not (line.startswith(" ") and ":" in line):
|
||||
return ""
|
||||
|
||||
return line.split(":")[1].strip().split(";")[0]
|
||||
|
||||
def extract_interface_name(line: str) -> str:
|
||||
# Looking for "export interface InterfaceName {"
|
||||
if not (line.startswith("export interface") and "{" in line):
|
||||
return ""
|
||||
|
||||
return line.split(" ")[2]
|
||||
|
||||
def is_comment_line(line: str) -> bool:
|
||||
s = line.strip()
|
||||
return s.startswith("/*") or s.startswith("*")
|
||||
|
||||
def clean_output_file(file: Path) -> None:
|
||||
"""
|
||||
json2ts generates duplicate types off of our enums and appends a number to the end of the type name.
|
||||
Our Python code (hopefully) doesn't have any duplicate enum names, or types with numbers in them,
|
||||
so we can safely remove the numbers.
|
||||
|
||||
To do this, we read the output line-by-line and replace any type names that contain numbers with
|
||||
the same type name, but without the numbers.
|
||||
|
||||
Note: the issue arrises from the JSON package json2ts, not the Python package pydantic2ts,
|
||||
otherwise we could just fix pydantic2ts.
|
||||
"""
|
||||
|
||||
# First pass: build a map of type names to their numberless counterparts and lines to skip
|
||||
replacement_map = {}
|
||||
lines_to_skip = set()
|
||||
wait_for_semicolon = False
|
||||
wait_for_close_bracket = False
|
||||
skip_comments = False
|
||||
with open(file) as f:
|
||||
for i, line in enumerate(f.readlines()):
|
||||
if wait_for_semicolon:
|
||||
if ";" in line:
|
||||
wait_for_semicolon = False
|
||||
lines_to_skip.add(i)
|
||||
continue
|
||||
if wait_for_close_bracket:
|
||||
if "}" in line:
|
||||
wait_for_close_bracket = False
|
||||
lines_to_skip.add(i)
|
||||
continue
|
||||
|
||||
if type_name := extract_type_name(line):
|
||||
if not contains_number(type_name):
|
||||
continue
|
||||
|
||||
replacement_map[type_name] = remove_numbers(type_name)
|
||||
if ";" not in line:
|
||||
wait_for_semicolon = True
|
||||
lines_to_skip.add(i)
|
||||
|
||||
elif type_name := extract_interface_name(line):
|
||||
if not contains_number(type_name):
|
||||
continue
|
||||
|
||||
replacement_map[type_name] = remove_numbers(type_name)
|
||||
if "}" not in line:
|
||||
wait_for_close_bracket = True
|
||||
lines_to_skip.add(i)
|
||||
|
||||
elif skip_comments and is_comment_line(line):
|
||||
lines_to_skip.add(i)
|
||||
|
||||
# we've passed the opening comments and empty line at the header
|
||||
elif not skip_comments and not line.strip():
|
||||
skip_comments = True
|
||||
|
||||
# Second pass: rewrite or remove lines as needed.
|
||||
# We have to do two passes here because definitions don't always appear in the same order as their usage.
|
||||
lines = []
|
||||
with open(file) as f:
|
||||
for i, line in enumerate(f.readlines()):
|
||||
if i in lines_to_skip:
|
||||
continue
|
||||
|
||||
if type_name := extract_property_type_name(line):
|
||||
if type_name in replacement_map:
|
||||
line = line.replace(type_name, replacement_map[type_name])
|
||||
|
||||
lines.append(line)
|
||||
|
||||
with open(file, "w") as f:
|
||||
f.writelines(lines)
|
||||
|
||||
def path_to_module(path: Path):
|
||||
str_path: str = str(path)
|
||||
|
||||
str_path = str_path.removeprefix(str(PROJECT_DIR))
|
||||
str_path = str_path.removeprefix("/")
|
||||
str_path = str_path.replace("/", ".")
|
||||
|
||||
return str_path
|
||||
|
||||
schema_path = PROJECT_DIR / "mealie" / "schema"
|
||||
types_dir = PROJECT_DIR / "frontend" / "lib" / "api" / "types"
|
||||
|
||||
ignore_dirs = ["__pycache__", "static", "_mealie"]
|
||||
|
||||
skipped_files: list[Path] = []
|
||||
skipped_dirs: list[Path] = []
|
||||
failed_modules: list[Path] = []
|
||||
|
||||
for module in schema_path.iterdir():
|
||||
if module.is_dir() and module.stem in ignore_dirs:
|
||||
skipped_dirs.append(module)
|
||||
continue
|
||||
|
||||
if not module.is_dir() or not module.joinpath("__init__.py").is_file():
|
||||
skipped_files.append(module)
|
||||
continue
|
||||
|
||||
ts_out_name = module.name.replace("_", "-") + ".ts"
|
||||
out_path = types_dir.joinpath(ts_out_name)
|
||||
|
||||
try:
|
||||
path_as_module = path_to_module(module)
|
||||
generate_typescript_defs(path_as_module, str(out_path), exclude=("MealieModel")) # type: ignore
|
||||
clean_output_file(out_path)
|
||||
except Exception:
|
||||
failed_modules.append(module)
|
||||
log.exception(f"Module Error: {module}")
|
||||
|
||||
log.debug("\n📁 Skipped Directories:")
|
||||
for skipped_dir in skipped_dirs:
|
||||
log.debug(f" 📁 {skipped_dir.name}")
|
||||
|
||||
log.debug("📄 Skipped Files:")
|
||||
for f in skipped_files:
|
||||
log.debug(f" 📄 {f.name}")
|
||||
|
||||
if len(failed_modules) > 0:
|
||||
log.error("❌ Failed Modules:")
|
||||
for f in failed_modules:
|
||||
log.error(f" ❌ {f.name}")
|
||||
|
||||
|
||||
def main():
|
||||
log.debug("\n-- Starting Global Components Generator --")
|
||||
generate_global_components_types()
|
||||
|
||||
log.debug("\n-- Starting Pydantic To Typescript Generator --")
|
||||
generate_typescript_types()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -1,53 +0,0 @@
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
|
||||
import gen_py_pytest_data_paths
|
||||
import gen_py_pytest_routes
|
||||
import gen_py_schema_exports
|
||||
import gen_ts_locales
|
||||
import gen_ts_types
|
||||
from utils import log
|
||||
|
||||
CWD = Path(__file__).parent
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="Run code generators")
|
||||
parser.add_argument(
|
||||
"generators",
|
||||
nargs="*",
|
||||
help="Specific generators to run (schema, types, locales, data-paths, routes). If none specified, all will run.", # noqa: E501 - long line
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
# Define all available generators
|
||||
all_generators = {
|
||||
"schema": (gen_py_schema_exports.main, "schema exports"),
|
||||
"types": (gen_ts_types.main, "frontend types"),
|
||||
"locales": (gen_ts_locales.main, "locales"),
|
||||
"data-paths": (gen_py_pytest_data_paths.main, "test data paths"),
|
||||
"routes": (gen_py_pytest_routes.main, "pytest routes"),
|
||||
}
|
||||
|
||||
# Determine which generators to run
|
||||
if args.generators:
|
||||
# Validate requested generators
|
||||
invalid_generators = [g for g in args.generators if g not in all_generators]
|
||||
if invalid_generators:
|
||||
log.error(f"Invalid generator(s): {', '.join(invalid_generators)}")
|
||||
log.info(f"Available generators: {', '.join(all_generators.keys())}")
|
||||
return
|
||||
|
||||
generators_to_run = [(all_generators[g][0], all_generators[g][1]) for g in args.generators]
|
||||
else:
|
||||
# Run all generators (default behavior)
|
||||
generators_to_run = list(all_generators.values())
|
||||
|
||||
# Run the selected generators
|
||||
for func, name in generators_to_run:
|
||||
log.info(f"Generating {name}...")
|
||||
func()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -1,7 +0,0 @@
|
||||
from pathlib import Path
|
||||
|
||||
CWD = Path(__file__).parent
|
||||
|
||||
{% for f in data.children %}
|
||||
{{ f.var }} = CWD / "{{ f.path }}"
|
||||
{% endfor %}
|
||||
@@ -1,11 +0,0 @@
|
||||
# This Content is Auto Generated for Pytest
|
||||
prefix = "{{paths.prefix}}"
|
||||
{% for path in paths.static_paths %}
|
||||
{{ path.router_slug }} = "{{path.prefix}}{{ path.route }}"
|
||||
"""`{{path.prefix}}{{ path.route }}`"""{% endfor %}
|
||||
{% for path in paths.function_paths %}
|
||||
|
||||
def {{path.router_slug}}({{path.var|join(", ")}}):
|
||||
"""`{{ paths.prefix }}{{ path.route }}`"""
|
||||
return f"{prefix}{{ path.route }}"
|
||||
{% endfor %}
|
||||
@@ -1,25 +0,0 @@
|
||||
from .open_api_parser import OpenAPIParser
|
||||
from .route import HTTPRequest, ParameterIn, RequestBody, RequestType, RouteObject, RouterParameter
|
||||
from .static import PROJECT_DIR, CodeDest, CodeKeys, CodeTemplates, Directories
|
||||
from .template import CodeSlicer, find_start_end, get_indentation_of_string, inject_inline, log, render_python_template
|
||||
|
||||
__all__ = [
|
||||
"CodeDest",
|
||||
"CodeKeys",
|
||||
"CodeSlicer",
|
||||
"CodeTemplates",
|
||||
"Directories",
|
||||
"find_start_end",
|
||||
"get_indentation_of_string",
|
||||
"HTTPRequest",
|
||||
"inject_inline",
|
||||
"log",
|
||||
"OpenAPIParser",
|
||||
"ParameterIn",
|
||||
"PROJECT_DIR",
|
||||
"render_python_template",
|
||||
"RequestBody",
|
||||
"RequestType",
|
||||
"RouteObject",
|
||||
"RouterParameter",
|
||||
]
|
||||
@@ -1,74 +0,0 @@
|
||||
import json
|
||||
import logging
|
||||
import random
|
||||
import string
|
||||
from datetime import datetime
|
||||
from uuid import UUID
|
||||
|
||||
logger = logging.getLogger("anonymize_backups")
|
||||
|
||||
|
||||
def is_uuid4(value: str):
|
||||
try:
|
||||
UUID(value)
|
||||
return True
|
||||
except ValueError:
|
||||
return False
|
||||
|
||||
|
||||
def is_iso_datetime(value: str):
|
||||
try:
|
||||
datetime.fromisoformat(value)
|
||||
return True
|
||||
except ValueError:
|
||||
return False
|
||||
|
||||
|
||||
def random_string(length=10):
|
||||
return "".join(random.choice(string.ascii_lowercase) for _ in range(length))
|
||||
|
||||
|
||||
def clean_value(value):
|
||||
try:
|
||||
match value:
|
||||
# preserve non-strings
|
||||
case int(value) | float(value):
|
||||
return value
|
||||
case None:
|
||||
return value
|
||||
# preserve UUIDs and datetimes
|
||||
case str(value) if is_uuid4(value) or is_iso_datetime(value):
|
||||
return value
|
||||
# randomize strings
|
||||
case str(value):
|
||||
return random_string()
|
||||
case _:
|
||||
pass
|
||||
|
||||
except Exception as e:
|
||||
logger.exception(e)
|
||||
|
||||
logger.error(f"Failed to anonymize value: {value}")
|
||||
return value
|
||||
|
||||
|
||||
def walk_data_and_anonymize(data):
|
||||
for k, v in data.items():
|
||||
if isinstance(v, list):
|
||||
for item in v:
|
||||
walk_data_and_anonymize(item)
|
||||
else:
|
||||
# preserve alembic version number and enums
|
||||
if k in ["auth_method", "version_num"]:
|
||||
continue
|
||||
|
||||
data[k] = clean_value(v)
|
||||
|
||||
|
||||
def anonymize_database_json(input_filepath: str, output_filepath: str):
|
||||
with open(input_filepath) as f:
|
||||
data = json.load(f)
|
||||
|
||||
walk_data_and_anonymize(data)
|
||||
with open(output_filepath, "w") as f:
|
||||
json.dump(data, f)
|
||||
@@ -1,132 +0,0 @@
|
||||
import json
|
||||
import re
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from fastapi import FastAPI
|
||||
from humps import camelize
|
||||
from slugify import slugify
|
||||
|
||||
from .static import Directories
|
||||
|
||||
|
||||
def get_openapi_spec_by_ref(app, type_reference: str) -> dict:
|
||||
if not type_reference:
|
||||
return None
|
||||
|
||||
schemas = app["components"]["schemas"]
|
||||
type_text = type_reference.split("/")[-1]
|
||||
return schemas.get(type_text, type_reference)
|
||||
|
||||
|
||||
def recursive_dict_search(data: dict[str, Any], key: str) -> Any:
|
||||
"""
|
||||
Walks a dictionary searching for a key and returns all the keys
|
||||
matching the provided key"""
|
||||
if key in data:
|
||||
return data[key]
|
||||
for _, v in data.items():
|
||||
if isinstance(v, dict):
|
||||
result = recursive_dict_search(v, key)
|
||||
if result:
|
||||
return result
|
||||
return None
|
||||
|
||||
|
||||
class APIFunction:
|
||||
def __init__(self, app, route: str, verb: str, data: dict):
|
||||
self.name_camel = camelize(data.get("summary"))
|
||||
self.name_snake = slugify(data.get("summary"), separator="_")
|
||||
|
||||
self.http_verb = verb
|
||||
self.path_vars = re.findall(r"\{(.*?)\}", route)
|
||||
self.path_is_func = "{" in route
|
||||
self.js_route = route.replace("{", "${")
|
||||
self.py_route = route
|
||||
|
||||
self.body_schema = get_openapi_spec_by_ref(app, recursive_dict_search(data, "$ref"))
|
||||
|
||||
def path_args(self) -> str:
|
||||
return ", ".join(x + ": string | number" for x in self.path_vars)
|
||||
|
||||
# body: Optional[list[str]] = []
|
||||
# path_params: Optional[list[str]] = []
|
||||
# query_params: Optional[list[str]] = []
|
||||
|
||||
|
||||
# class APIModule(BaseModel):
|
||||
# name: str
|
||||
# functions: list[APIFunction]
|
||||
|
||||
|
||||
class OpenAPIParser:
|
||||
def __init__(self, app: FastAPI) -> None:
|
||||
self.app = app
|
||||
self.spec = app.openapi()
|
||||
|
||||
self.modules = {}
|
||||
|
||||
def dump(self, out_path: Path) -> Path:
|
||||
"""Writes the Open API as JSON to a json file"""
|
||||
OPEN_API_FILE = out_path or Directories.out_dir / "openapi.json"
|
||||
|
||||
with open(OPEN_API_FILE, "w") as f:
|
||||
f.write(json.dumps(self.spec, indent=4))
|
||||
|
||||
def _group_by_module_tag(self):
|
||||
"""
|
||||
Itterates over all routes and groups them by module. Modules are determined
|
||||
by the suffix text before : in the first tag for the router. These are used
|
||||
to generate the typescript class interface for interacting with the API
|
||||
"""
|
||||
modules = {}
|
||||
|
||||
all_paths = self.spec["paths"]
|
||||
for path, http_verbs in all_paths.items():
|
||||
for _, value in http_verbs.items():
|
||||
if "tags" in value:
|
||||
tag: str = value["tags"][0]
|
||||
if ":" in tag:
|
||||
tag = tag.removeprefix('"').split(":")[0].replace(" ", "")
|
||||
if modules.get(tag):
|
||||
modules[tag][path] = http_verbs
|
||||
else:
|
||||
modules[tag] = {path: http_verbs}
|
||||
|
||||
return modules
|
||||
|
||||
def _get_openapi_spec(self, type_reference: str) -> dict:
|
||||
schemas = self.app["components"]["schemas"]
|
||||
type_text = type_reference.split("/")[-1]
|
||||
return schemas.get(type_text, type_reference)
|
||||
|
||||
def _fill_schema_references(self, raw_modules: dict) -> dict:
|
||||
for _, routes in raw_modules.items():
|
||||
for _, verbs in routes.items():
|
||||
for _, value in verbs.items():
|
||||
if "requestBody" in value:
|
||||
try:
|
||||
schema_ref = value["requestBody"]["content"]["application/json"]["schema"]["$ref"]
|
||||
schema = self._get_openapi_spec(schema_ref)
|
||||
value["requestBody"]["content"]["application/json"]["schema"] = schema
|
||||
except Exception:
|
||||
continue
|
||||
|
||||
return raw_modules
|
||||
|
||||
def get_by_module(self) -> dict:
|
||||
"""Returns paths where tags are split by : and left right is considered the module"""
|
||||
raw_modules = self._group_by_module_tag()
|
||||
|
||||
modules = {}
|
||||
for module_name, routes in raw_modules.items():
|
||||
for route, verbs in routes.items():
|
||||
for verb, value in verbs.items():
|
||||
function = APIFunction(self.spec, route, verb, value)
|
||||
|
||||
if modules.get(module_name):
|
||||
modules[module_name].append(function)
|
||||
else:
|
||||
modules[module_name] = [function]
|
||||
|
||||
return modules
|
||||
@@ -1,92 +0,0 @@
|
||||
import re
|
||||
from enum import Enum
|
||||
|
||||
from humps import camelize
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
from slugify import slugify
|
||||
|
||||
|
||||
class RouteObject:
|
||||
def __init__(self, route_string) -> None:
|
||||
self.prefix = "/" + route_string.split("/")[1]
|
||||
self.route = "/" + route_string.split("/", 2)[2]
|
||||
self.js_route = self.route.replace("{", "${")
|
||||
self.parts = route_string.split("/")[1:]
|
||||
self.var = re.findall(r"\{(.*?)\}", route_string)
|
||||
self.is_function = "{" in self.route
|
||||
self.router_slug = slugify("_".join(self.parts[1:]), separator="_")
|
||||
self.router_camel = camelize(self.router_slug)
|
||||
|
||||
|
||||
class RequestType(str, Enum):
|
||||
get = "get"
|
||||
put = "put"
|
||||
post = "post"
|
||||
patch = "patch"
|
||||
delete = "delete"
|
||||
|
||||
|
||||
class ParameterIn(str, Enum):
|
||||
query = "query"
|
||||
path = "path"
|
||||
header = "header"
|
||||
|
||||
|
||||
class RouterParameter(BaseModel):
|
||||
model_config = ConfigDict(extra="allow")
|
||||
|
||||
required: bool = False
|
||||
name: str
|
||||
location: ParameterIn = Field(..., alias="in")
|
||||
|
||||
|
||||
class RequestBody(BaseModel):
|
||||
model_config = ConfigDict(extra="allow")
|
||||
|
||||
required: bool = False
|
||||
|
||||
|
||||
class HTTPRequest(BaseModel):
|
||||
model_config = ConfigDict(extra="allow", populate_by_name=True)
|
||||
|
||||
request_type: RequestType
|
||||
description: str = ""
|
||||
summary: str
|
||||
request_body: RequestBody | None = None
|
||||
|
||||
parameters: list[RouterParameter] = []
|
||||
tags: list[str] | None = []
|
||||
|
||||
def list_as_js_object_string(self, parameters, braces=True):
|
||||
if len(parameters) == 0:
|
||||
return ""
|
||||
|
||||
if braces:
|
||||
return "{" + ", ".join(parameters) + "}"
|
||||
else:
|
||||
return ", ".join(parameters)
|
||||
|
||||
def payload(self):
|
||||
return "payload" if self.request_body else ""
|
||||
|
||||
def function_args(self):
|
||||
all_params = [p.name for p in self.parameters]
|
||||
if self.request_body:
|
||||
all_params.append("payload")
|
||||
return self.list_as_js_object_string(all_params)
|
||||
|
||||
def query_params(self):
|
||||
params = [param.name for param in self.parameters if param.location == ParameterIn.query]
|
||||
return self.list_as_js_object_string(params)
|
||||
|
||||
def path_params(self):
|
||||
params = [param.name for param in self.parameters if param.location == ParameterIn.path]
|
||||
return self.list_as_js_object_string(parameters=params, braces=False)
|
||||
|
||||
@property
|
||||
def summary_camel(self):
|
||||
return camelize(slugify(self.summary))
|
||||
|
||||
@property
|
||||
def js_docs(self):
|
||||
return self.description.replace("\n", " \n * ")
|
||||
@@ -1,26 +0,0 @@
|
||||
from pathlib import Path
|
||||
|
||||
PARENT = Path(__file__).parent.parent
|
||||
PROJECT_DIR = Path(__file__).parent.parent.parent.parent
|
||||
|
||||
|
||||
class Directories:
|
||||
out_dir = PARENT / "generated"
|
||||
|
||||
|
||||
class CodeTemplates:
|
||||
interface = PARENT / "templates" / "interface.js"
|
||||
pytest_routes = PARENT / "templates" / "test_routes.py.j2"
|
||||
|
||||
|
||||
class CodeDest:
|
||||
interface = PARENT / "generated" / "interface.js"
|
||||
pytest_routes = PARENT / "generated" / "test_routes.py"
|
||||
use_locales = PROJECT_DIR / "frontend" / "composables" / "use-locales" / "available-locales.ts"
|
||||
|
||||
|
||||
class CodeKeys:
|
||||
"""Hard coded comment IDs that are used to generate code"""
|
||||
|
||||
nuxt_local_messages = "MESSAGE_LOCALES"
|
||||
nuxt_local_dates = "DATE_LOCALES"
|
||||
@@ -1,117 +0,0 @@
|
||||
import logging
|
||||
import subprocess
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
|
||||
from jinja2 import Template
|
||||
from rich.logging import RichHandler
|
||||
|
||||
FORMAT = "%(message)s"
|
||||
logging.basicConfig(level=logging.INFO, format=FORMAT, datefmt="[%X]", handlers=[RichHandler()])
|
||||
|
||||
log = logging.getLogger("rich")
|
||||
|
||||
|
||||
def render_python_template(template_file: Path | str, dest: Path, data: dict):
|
||||
"""Render and Format a Jinja2 Template for Python Code"""
|
||||
if isinstance(template_file, Path):
|
||||
tplt = Template(template_file.read_text())
|
||||
else:
|
||||
tplt = Template(template_file)
|
||||
|
||||
text = tplt.render(data=data)
|
||||
|
||||
dest.write_text(text)
|
||||
|
||||
# lint/format file with Ruff
|
||||
log.info(f"Formatting {dest}")
|
||||
subprocess.run(["poetry", "run", "ruff", "check", str(dest), "--fix"])
|
||||
subprocess.run(["poetry", "run", "ruff", "format", str(dest)])
|
||||
|
||||
|
||||
@dataclass
|
||||
class CodeSlicer:
|
||||
start: int
|
||||
end: int
|
||||
|
||||
indentation: str | None
|
||||
text: list[str]
|
||||
|
||||
_next_line = None
|
||||
|
||||
def purge_lines(self) -> None:
|
||||
start = self.start + 1
|
||||
end = self.end
|
||||
del self.text[start:end]
|
||||
|
||||
def push_line(self, string: str) -> None:
|
||||
self._next_line = self._next_line or self.start + 1
|
||||
self.text.insert(self._next_line, (self.indentation or "") + string + "\n")
|
||||
self._next_line += 1
|
||||
|
||||
|
||||
def get_indentation_of_string(line: str) -> str:
|
||||
# Extract everything before the comment
|
||||
if "//" in line:
|
||||
indentation = line.split("//")[0]
|
||||
elif "#" in line:
|
||||
indentation = line.split("#")[0]
|
||||
else:
|
||||
indentation = line
|
||||
|
||||
# Keep only the whitespace, remove any non-whitespace characters
|
||||
return "".join(c for c in indentation if c.isspace())
|
||||
|
||||
|
||||
def find_start_end(file_text: list[str], gen_id: str) -> tuple[int, int, str | None]:
|
||||
start = None
|
||||
end = None
|
||||
indentation = None
|
||||
|
||||
for i, line in enumerate(file_text):
|
||||
if "CODE_GEN_ID:" in line and gen_id in line:
|
||||
start = i
|
||||
indentation = get_indentation_of_string(line)
|
||||
if f"END: {gen_id}" in line:
|
||||
end = i
|
||||
|
||||
if start is None or end is None:
|
||||
raise Exception("Could not find start and end of code generation block")
|
||||
|
||||
if start > end:
|
||||
raise Exception(f"Start ({start=}) of code generation block is after end ({end=})")
|
||||
|
||||
return start, end, indentation
|
||||
|
||||
|
||||
def inject_inline(file_path: Path, key: str, code: list[str]) -> None:
|
||||
"""Injects a list of strings into the file where the key is found in the format defined
|
||||
by the code-generation. Strings are properly indented and a '\n' is added to the end of
|
||||
each string.
|
||||
|
||||
Start -> 'CODE_GEN_ID: <key>'
|
||||
End -> 'END: <key>'
|
||||
|
||||
If no 'CODE_GEN_ID: <key>' is found, and exception is raised
|
||||
|
||||
Args:
|
||||
file_path (Path): Write to file
|
||||
key (str): CODE_GEN_ID: <key>
|
||||
code (list[str]): List of strings to inject.
|
||||
|
||||
"""
|
||||
|
||||
with open(file_path) as f:
|
||||
file_text = f.readlines()
|
||||
|
||||
start, end, indentation = find_start_end(file_text, key)
|
||||
|
||||
slicer = CodeSlicer(start, end, indentation, file_text)
|
||||
|
||||
slicer.purge_lines()
|
||||
|
||||
for line in code:
|
||||
slicer.push_line(line)
|
||||
|
||||
with open(file_path, "w") as file:
|
||||
file.writelines(slicer.text)
|
||||
BIN
dev/data/backups/test_backup_2021-Apr-27.zip
Normal file
24
dev/data/templates/recipes.md
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
|
||||

|
||||
|
||||
# {{ recipe.name }}
|
||||
{{ recipe.description }}
|
||||
|
||||
## Ingredients
|
||||
{% for ingredient in recipe.recipeIngredient %}
|
||||
- [ ] {{ ingredient }} {% endfor %}
|
||||
|
||||
## Instructions
|
||||
{% for step in recipe.recipeInstructions %}
|
||||
- [ ] {{ step.text }} {% endfor %}
|
||||
|
||||
{% for note in recipe.notes %}
|
||||
**{{ note.title }}:** {{ note.text }}
|
||||
{% endfor %}
|
||||
|
||||
---
|
||||
|
||||
Tags: {{ recipe.tags }}
|
||||
Categories: {{ recipe.categories }}
|
||||
Original URL: {{ recipe.orgURL }}
|
||||
@@ -1,336 +0,0 @@
|
||||
import json
|
||||
import random
|
||||
import string
|
||||
import time
|
||||
from dataclasses import dataclass
|
||||
|
||||
import requests
|
||||
from rich.console import Console
|
||||
from rich.table import Table
|
||||
|
||||
console = Console()
|
||||
|
||||
|
||||
def random_string(length: int) -> str:
|
||||
return "".join(random.choice(string.ascii_lowercase) for _ in range(length))
|
||||
|
||||
|
||||
def payload_factory() -> dict:
|
||||
return {"name": random_string(15)}
|
||||
|
||||
|
||||
def recipe_data(name: str, slug: str, id: str, userId: str, groupId: str) -> dict:
|
||||
return {
|
||||
"id": id,
|
||||
"userId": userId,
|
||||
"groupId": groupId,
|
||||
"name": name,
|
||||
"slug": slug,
|
||||
"image": "tNRG",
|
||||
"recipeYield": "9 servings",
|
||||
"totalTime": "33 Minutes",
|
||||
"prepTime": "20 Minutes",
|
||||
"cookTime": None,
|
||||
"performTime": "13 Minutes",
|
||||
"description": "These Levain Bakery-Style Peanut Butter Cookies are the ULTIMATE for serious PB lovers! Supremely thick and chewy with gooey centers and a soft texture, they're packed with peanut butter flavor and Reese's Pieces for the most amazing cookie ever!",
|
||||
"recipeCategory": [],
|
||||
"tags": [],
|
||||
"tools": [],
|
||||
"rating": None,
|
||||
"orgURL": "https://thedomesticrebel.com/2021/04/28/levain-bakery-style-ultimate-peanut-butter-cookies/",
|
||||
"recipeIngredient": [
|
||||
{
|
||||
"title": None,
|
||||
"note": "1 cup unsalted butter, cut into cubes",
|
||||
"unit": None,
|
||||
"food": None,
|
||||
"disableAmount": True,
|
||||
"quantity": 1,
|
||||
"originalText": None,
|
||||
"referenceId": "ea3b6702-9532-4fbc-a40b-f99917831c26",
|
||||
},
|
||||
{
|
||||
"title": None,
|
||||
"note": "1 cup light brown sugar",
|
||||
"unit": None,
|
||||
"food": None,
|
||||
"disableAmount": True,
|
||||
"quantity": 1,
|
||||
"originalText": None,
|
||||
"referenceId": "c5bbfefb-1e23-4ffd-af88-c0363a0fae82",
|
||||
},
|
||||
{
|
||||
"title": None,
|
||||
"note": "1/2 cup granulated white sugar",
|
||||
"unit": None,
|
||||
"food": None,
|
||||
"disableAmount": True,
|
||||
"quantity": 1,
|
||||
"originalText": None,
|
||||
"referenceId": "034f481b-c426-4a17-b983-5aea9be4974b",
|
||||
},
|
||||
{
|
||||
"title": None,
|
||||
"note": "2 large eggs",
|
||||
"unit": None,
|
||||
"food": None,
|
||||
"disableAmount": True,
|
||||
"quantity": 1,
|
||||
"originalText": None,
|
||||
"referenceId": "37c1f796-3bdb-4856-859f-dbec90bc27e4",
|
||||
},
|
||||
{
|
||||
"title": None,
|
||||
"note": "2 tsp vanilla extract",
|
||||
"unit": None,
|
||||
"food": None,
|
||||
"disableAmount": True,
|
||||
"quantity": 1,
|
||||
"originalText": None,
|
||||
"referenceId": "85561ace-f249-401d-834c-e600a2f6280e",
|
||||
},
|
||||
{
|
||||
"title": None,
|
||||
"note": "1/2 cup creamy peanut butter",
|
||||
"unit": None,
|
||||
"food": None,
|
||||
"disableAmount": True,
|
||||
"quantity": 1,
|
||||
"originalText": None,
|
||||
"referenceId": "ac91bda0-e8a8-491a-976a-ae4e72418cfd",
|
||||
},
|
||||
{
|
||||
"title": None,
|
||||
"note": "1 tsp cornstarch",
|
||||
"unit": None,
|
||||
"food": None,
|
||||
"disableAmount": True,
|
||||
"quantity": 1,
|
||||
"originalText": None,
|
||||
"referenceId": "4d1256b3-115e-4475-83cd-464fbc304cb0",
|
||||
},
|
||||
{
|
||||
"title": None,
|
||||
"note": "1 tsp baking soda",
|
||||
"unit": None,
|
||||
"food": None,
|
||||
"disableAmount": True,
|
||||
"quantity": 1,
|
||||
"originalText": None,
|
||||
"referenceId": "64627441-39f9-4ee3-8494-bafe36451d12",
|
||||
},
|
||||
{
|
||||
"title": None,
|
||||
"note": "1/2 tsp salt",
|
||||
"unit": None,
|
||||
"food": None,
|
||||
"disableAmount": True,
|
||||
"quantity": 1,
|
||||
"originalText": None,
|
||||
"referenceId": "7ae212d0-3cd1-44b0-899e-ec5bd91fd384",
|
||||
},
|
||||
{
|
||||
"title": None,
|
||||
"note": "1 cup cake flour",
|
||||
"unit": None,
|
||||
"food": None,
|
||||
"disableAmount": True,
|
||||
"quantity": 1,
|
||||
"originalText": None,
|
||||
"referenceId": "06967994-8548-4952-a8cc-16e8db228ebd",
|
||||
},
|
||||
{
|
||||
"title": None,
|
||||
"note": "2 cups all-purpose flour",
|
||||
"unit": None,
|
||||
"food": None,
|
||||
"disableAmount": True,
|
||||
"quantity": 1,
|
||||
"originalText": None,
|
||||
"referenceId": "bdb33b23-c767-4465-acf8-3b8e79eb5691",
|
||||
},
|
||||
{
|
||||
"title": None,
|
||||
"note": "2 cups peanut butter chips",
|
||||
"unit": None,
|
||||
"food": None,
|
||||
"disableAmount": True,
|
||||
"quantity": 1,
|
||||
"originalText": None,
|
||||
"referenceId": "12ba0af8-affd-4fb2-9cca-6f1b3e8d3aef",
|
||||
},
|
||||
{
|
||||
"title": None,
|
||||
"note": "1½ cups Reese's Pieces candies",
|
||||
"unit": None,
|
||||
"food": None,
|
||||
"disableAmount": True,
|
||||
"quantity": 1,
|
||||
"originalText": None,
|
||||
"referenceId": "4bdc0598-a3eb-41ee-8af0-4da9348fbfe2",
|
||||
},
|
||||
],
|
||||
"dateAdded": "2022-09-03",
|
||||
"dateUpdated": "2022-09-10T15:18:19.866085",
|
||||
"createdAt": "2022-09-03T18:31:17.488118",
|
||||
"updatedAt": "2022-09-10T15:18:19.869630",
|
||||
"recipeInstructions": [
|
||||
{
|
||||
"id": "60ae53a3-b3ff-40ee-bae3-89fea0b1c637",
|
||||
"title": "",
|
||||
"text": "Preheat oven to 410° degrees F. Line 2 baking sheets with parchment paper or silicone liners; set aside.",
|
||||
"ingredientReferences": [],
|
||||
},
|
||||
{
|
||||
"id": "4e1c30c2-2e96-4a0a-b750-23c9ea3640f8",
|
||||
"title": "",
|
||||
"text": "In the bowl of a stand mixer, cream together the cubed butter, brown sugar and granulated sugar with the paddle attachment for 30 seconds on low speed. Increase speed to medium and beat for another 30 seconds, then increase to medium-high speed and beat for another 30 seconds until mixture is creamy and smooth. Beat in the eggs, one at a time, followed by the vanilla extract and peanut butter, scraping down the sides and bottom of the bowl as needed.",
|
||||
"ingredientReferences": [],
|
||||
},
|
||||
{
|
||||
"id": "9fb8e2a2-d410-445c-bafc-c059203e6f4b",
|
||||
"title": "",
|
||||
"text": "Add in the cornstarch, baking soda, salt, cake flour, and all-purpose flour and mix on low speed until just combined. Fold in the peanut butter chips and Reese's Pieces candies by hand until fully incorporated. Chill the dough uncovered in the fridge for 15 minutes.",
|
||||
"ingredientReferences": [],
|
||||
},
|
||||
{
|
||||
"id": "1ceb9aa4-49f7-4d4a-996f-3c715eb74642",
|
||||
"title": "",
|
||||
"text": 'Using a digital kitchen scale for accuracy, weigh out 6 ounces of cookie dough in a loose, rough textured ball. I like to make my cookie dough balls kind of tall as well. You do not want the dough balls to be smooth and compacted. Place on the baking sheet. Repeat with remaining dough balls, staggering on the baking sheet at least 3" apart from one another, and only placing 4 dough balls per baking sheet.',
|
||||
"ingredientReferences": [],
|
||||
},
|
||||
{
|
||||
"id": "591993fc-72bb-4091-8a12-84640c523fc1",
|
||||
"title": "",
|
||||
"text": "Bake one baking sheet at a time in the center rack of the oven for 10-13 minutes or until the tops are light golden brown and the exterior is dry and dull looking. Centers will be slightly underdone and gooey; this is okay and the cookies will finish cooking some once removed from the oven. Let stand on the baking sheets for at least 30 minutes before serving; the cookies are very delicate and fragile once removed from the oven and need time to set before being moved. Keep remaining dough refrigerated while other cookies bake.",
|
||||
"ingredientReferences": [],
|
||||
},
|
||||
],
|
||||
"nutrition": {
|
||||
"calories": None,
|
||||
"fatContent": None,
|
||||
"proteinContent": None,
|
||||
"carbohydrateContent": None,
|
||||
"fiberContent": None,
|
||||
"sodiumContent": None,
|
||||
"sugarContent": None,
|
||||
},
|
||||
"settings": {
|
||||
"public": True,
|
||||
"showNutrition": False,
|
||||
"showAssets": False,
|
||||
"landscapeView": False,
|
||||
"disableComments": False,
|
||||
"disableAmount": True,
|
||||
"locked": False,
|
||||
},
|
||||
"assets": [],
|
||||
"notes": [],
|
||||
"extras": {},
|
||||
"comments": [],
|
||||
}
|
||||
|
||||
|
||||
def login(username="changeme@example.com", password="MyPassword"):
|
||||
payload = {"username": username, "password": password}
|
||||
r = requests.post("http://localhost:9000/api/auth/token", payload)
|
||||
|
||||
# Bearer
|
||||
token = json.loads(r.text).get("access_token")
|
||||
return {"Authorization": f"Bearer {token}"}
|
||||
|
||||
|
||||
def populate_data(token):
|
||||
for _ in range(300):
|
||||
payload = payload_factory()
|
||||
r = requests.post("http://localhost:9000/api/recipes", json=payload, headers=token)
|
||||
|
||||
if r.status_code != 201:
|
||||
console.print(f"Error: {r.status_code}")
|
||||
console.print(r.text)
|
||||
exit()
|
||||
|
||||
recipe_json = requests.get(f"http://localhost:9000/api/recipes/{payload['name']}", headers=token)
|
||||
|
||||
if recipe_json.status_code != 200:
|
||||
console.print(f"Error: {recipe_json.status_code}")
|
||||
console.print(recipe_json.text)
|
||||
exit()
|
||||
|
||||
recipe = json.loads(recipe_json.text)
|
||||
update_data = recipe_data(recipe["name"], recipe["slug"], recipe["id"], recipe["userId"], recipe["groupId"])
|
||||
|
||||
r = requests.put(f"http://localhost:9000/api/recipes/{update_data['slug']}", json=update_data, headers=token)
|
||||
if r.status_code != 200:
|
||||
console.print(f"Error: {r.status_code}")
|
||||
console.print(r.text)
|
||||
exit()
|
||||
|
||||
|
||||
@dataclass(slots=True)
|
||||
class Result:
|
||||
recipes: int
|
||||
time: float
|
||||
|
||||
|
||||
def time_request(url, headers) -> Result:
|
||||
start = time.time()
|
||||
r = requests.get(url, headers=headers)
|
||||
end = time.time()
|
||||
|
||||
return Result(len(r.json()["items"]), end - start)
|
||||
|
||||
|
||||
def main():
|
||||
token = login()
|
||||
# populate_data(token)
|
||||
|
||||
results: list[Result] = []
|
||||
|
||||
for _ in range(10):
|
||||
result = time_request("http://localhost:9000/api/recipes?perPage=-1&page=1&loadFood=true", token)
|
||||
results.append(result)
|
||||
|
||||
min, max, average = 99, 0, 0
|
||||
|
||||
for result in results:
|
||||
if result.time < min:
|
||||
min = result.time
|
||||
|
||||
if result.time > max:
|
||||
max = result.time
|
||||
|
||||
average += result.time
|
||||
|
||||
tbl1 = Table(title="Requests")
|
||||
|
||||
tbl1.add_column("Recipes", justify="right", style="cyan", no_wrap=True)
|
||||
tbl1.add_column("Time", justify="right", style="magenta")
|
||||
|
||||
for result in results:
|
||||
tbl1.add_row(
|
||||
str(result.recipes),
|
||||
str(result.time),
|
||||
)
|
||||
|
||||
tbl2 = Table(title="Summary")
|
||||
|
||||
tbl2.add_column("Min", justify="right", style="green")
|
||||
tbl2.add_column("Max", justify="right", style="green")
|
||||
tbl2.add_column("Average", justify="right", style="green")
|
||||
|
||||
tbl2.add_row(
|
||||
str(round(min * 1000)) + "ms",
|
||||
str(round(max * 1000)) + "ms",
|
||||
str(round((average / len(results)) * 1000)) + "ms",
|
||||
)
|
||||
|
||||
console = Console()
|
||||
console.print(tbl1)
|
||||
console.print(tbl2)
|
||||
|
||||
# Best Time 289 / 405/ 247
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -1,12 +1,7 @@
|
||||
import json
|
||||
|
||||
from fastapi import FastAPI
|
||||
from freezegun import freeze_time
|
||||
|
||||
from mealie.app import app
|
||||
from mealie.core.config import determine_data_dir
|
||||
|
||||
DATA_DIR = determine_data_dir()
|
||||
from mealie.core.config import DATA_DIR
|
||||
|
||||
"""Script to export the ReDoc documentation page into a standalone HTML file."""
|
||||
|
||||
@@ -39,12 +34,11 @@ HTML_TEMPLATE = """<!-- Custom HTML site displayed as the Home chapter -->
|
||||
HTML_PATH = DATA_DIR.parent.parent.joinpath("docs/docs/overrides/api.html")
|
||||
|
||||
|
||||
def generate_api_docs(my_app: FastAPI):
|
||||
def generate_api_docs(my_app):
|
||||
with open(HTML_PATH, "w") as fd:
|
||||
text = HTML_TEMPLATE.replace("MY_SPECIFIC_TEXT", json.dumps(my_app.openapi()))
|
||||
fd.write(text)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
with freeze_time("2024-01-20T17:00:55Z"):
|
||||
generate_api_docs(app)
|
||||
generate_api_docs(app)
|
||||
141
dev/scripts/app_routes_gen.py
Normal file
@@ -0,0 +1,141 @@
|
||||
import re
|
||||
from enum import Enum
|
||||
from itertools import groupby
|
||||
from pathlib import Path
|
||||
|
||||
import slugify
|
||||
from fastapi import FastAPI
|
||||
from humps import camelize
|
||||
from jinja2 import Template
|
||||
from mealie.app import app
|
||||
from pydantic import BaseModel
|
||||
|
||||
CWD = Path(__file__).parent
|
||||
OUT_DIR = CWD / "output"
|
||||
OUT_FILE = OUT_DIR / "app_routes.py"
|
||||
|
||||
JS_DIR = OUT_DIR / "javascriptAPI"
|
||||
JS_OUT_FILE = JS_DIR / "apiRoutes.js"
|
||||
TEMPLATES_DIR = CWD / "templates"
|
||||
|
||||
PYTEST_TEMPLATE = TEMPLATES_DIR / "pytest_routes.j2"
|
||||
JS_REQUESTS = TEMPLATES_DIR / "js_requests.j2"
|
||||
JS_ROUTES = TEMPLATES_DIR / "js_routes.j2"
|
||||
JS_INDEX = TEMPLATES_DIR / "js_index.j2"
|
||||
|
||||
JS_DIR.mkdir(exist_ok=True, parents=True)
|
||||
|
||||
|
||||
class RouteObject:
|
||||
def __init__(self, route_string) -> None:
|
||||
self.prefix = "/" + route_string.split("/")[1]
|
||||
self.route = "/" + route_string.split("/", 2)[2]
|
||||
self.js_route = self.route.replace("{", "${")
|
||||
self.parts = route_string.split("/")[1:]
|
||||
self.var = re.findall(r"\{(.*?)\}", route_string)
|
||||
self.is_function = "{" in self.route
|
||||
self.router_slug = slugify.slugify("_".join(self.parts[1:]), separator="_")
|
||||
self.router_camel = camelize(self.router_slug)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return f"""Route: {self.route}
|
||||
Parts: {self.parts}
|
||||
Function: {self.is_function}
|
||||
Var: {self.var}
|
||||
Slug: {self.router_slug}
|
||||
"""
|
||||
|
||||
|
||||
class RequestType(str, Enum):
|
||||
get = "get"
|
||||
put = "put"
|
||||
post = "post"
|
||||
patch = "patch"
|
||||
delete = "delete"
|
||||
|
||||
|
||||
class HTTPRequest(BaseModel):
|
||||
request_type: RequestType
|
||||
description: str = ""
|
||||
summary: str
|
||||
tags: list[str]
|
||||
|
||||
@property
|
||||
def summary_camel(self):
|
||||
return camelize(self.summary)
|
||||
|
||||
@property
|
||||
def js_docs(self):
|
||||
return self.description.replace("\n", " \n * ")
|
||||
|
||||
|
||||
class PathObject(BaseModel):
|
||||
route_object: RouteObject
|
||||
http_verbs: list[HTTPRequest]
|
||||
|
||||
class Config:
|
||||
arbitrary_types_allowed = True
|
||||
|
||||
|
||||
def get_path_objects(app: FastAPI):
|
||||
paths = []
|
||||
|
||||
for key, value in app.openapi().items():
|
||||
if key == "paths":
|
||||
for key, value in value.items():
|
||||
|
||||
paths.append(
|
||||
PathObject(
|
||||
route_object=RouteObject(key),
|
||||
http_verbs=[HTTPRequest(request_type=k, **v) for k, v in value.items()],
|
||||
)
|
||||
)
|
||||
|
||||
return paths
|
||||
|
||||
|
||||
def read_template(file: Path):
|
||||
with open(file, "r") as f:
|
||||
return f.read()
|
||||
|
||||
|
||||
def generate_template(app):
|
||||
paths = get_path_objects(app)
|
||||
|
||||
static_paths = [x.route_object for x in paths if not x.route_object.is_function]
|
||||
function_paths = [x.route_object for x in paths if x.route_object.is_function]
|
||||
|
||||
static_paths.sort(key=lambda x: x.router_slug)
|
||||
function_paths.sort(key=lambda x: x.router_slug)
|
||||
|
||||
template = Template(read_template(PYTEST_TEMPLATE))
|
||||
content = template.render(paths={"prefix": "/api", "static_paths": static_paths, "function_paths": function_paths})
|
||||
with open(OUT_FILE, "w") as f:
|
||||
f.write(content)
|
||||
|
||||
template = Template(read_template(JS_ROUTES))
|
||||
content = template.render(
|
||||
paths={"prefix": "/api", "static_paths": static_paths, "function_paths": function_paths, "all_paths": paths}
|
||||
)
|
||||
with open(JS_OUT_FILE, "w") as f:
|
||||
f.write(content)
|
||||
|
||||
all_tags = []
|
||||
for k, g in groupby(paths, lambda x: x.http_verbs[0].tags[0]):
|
||||
template = Template(read_template(JS_REQUESTS))
|
||||
content = template.render(paths={"all_paths": list(g), "export_name": camelize(k)})
|
||||
|
||||
all_tags.append(camelize(k))
|
||||
|
||||
with open(JS_DIR.joinpath(camelize(k) + ".js"), "w") as f:
|
||||
f.write(content)
|
||||
|
||||
template = Template(read_template(JS_INDEX))
|
||||
content = template.render(files={"files": all_tags})
|
||||
|
||||
with open(JS_DIR.joinpath("index.js"), "w") as f:
|
||||
f.write(content)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
generate_template(app)
|
||||
@@ -1,75 +0,0 @@
|
||||
import glob
|
||||
import json
|
||||
import pathlib
|
||||
|
||||
|
||||
def get_seed_locale_names() -> set[str]:
|
||||
"""Find all locales in the seed/resources/ folder
|
||||
|
||||
Returns:
|
||||
A set of every file name where there's both a seed label and seed food file
|
||||
"""
|
||||
|
||||
LABELS_PATH = "/workspaces/mealie/mealie/repos/seed/resources/labels/locales/"
|
||||
FOODS_PATH = "/workspaces/mealie/mealie/repos/seed/resources/foods/locales/"
|
||||
label_locales = glob.glob("*.json", root_dir=LABELS_PATH)
|
||||
foods_locales = glob.glob("*.json", root_dir=FOODS_PATH)
|
||||
|
||||
# ensure that a locale has both a label and a food seed file
|
||||
return set(label_locales).intersection(foods_locales)
|
||||
|
||||
|
||||
def get_labels_from_file(locale: str) -> list[str]:
|
||||
"""Query a locale to get all of the labels so that they can be added to the new foods seed format
|
||||
|
||||
Returns:
|
||||
All of the labels found within the seed file for a given locale
|
||||
"""
|
||||
|
||||
locale_path = pathlib.Path("/workspaces/mealie/mealie/repos/seed/resources/labels/locales/" + locale)
|
||||
label_names = [label["name"] for label in json.loads(locale_path.read_text(encoding="utf-8"))]
|
||||
return label_names
|
||||
|
||||
|
||||
def transform_foods(locale: str):
|
||||
"""
|
||||
Convert the current food seed file for a locale into a new format which maps each food to a label
|
||||
|
||||
Existing format of foods seed file is a dictionary where each key is a food name and the values are a dictionary
|
||||
of attributes such as name and plural_name
|
||||
|
||||
New format maps each food to a label. The top-level dictionary has each key as a label e.g. "Fruits".
|
||||
Each label key as a value that is a dictionary with an element called "foods"
|
||||
"Foods" is a dictionary of each food for that label, with a key of the english food name e.g. "baking-soda"
|
||||
and a value of attributes, including the translated name of the item e.g. "bicarbonate of soda" for en-GB.
|
||||
"""
|
||||
|
||||
locale_path = pathlib.Path("/workspaces/mealie/mealie/repos/seed/resources/foods/locales/" + locale)
|
||||
|
||||
with open(locale_path, encoding="utf-8") as infile:
|
||||
data = json.load(infile)
|
||||
|
||||
first_value = next(iter(data.values()))
|
||||
if isinstance(first_value, dict) and "foods" in first_value:
|
||||
# Locale is already in the new format, skipping transformation
|
||||
return
|
||||
|
||||
transformed_data = {"": {"foods": dict(data.items())}}
|
||||
|
||||
# Seeding for labels now pulls from the foods file and parses the labels from there (as top-level keys),
|
||||
# thus we need to add all of the existing labels to the new food seed file and give them an empty foods dictionary
|
||||
label_names = get_labels_from_file(locale)
|
||||
for label in label_names:
|
||||
transformed_data[label] = {"foods": {}}
|
||||
|
||||
with open(locale_path, "w", encoding="utf-8") as outfile:
|
||||
json.dump(transformed_data, outfile, indent=4, ensure_ascii=False)
|
||||
|
||||
|
||||
def main():
|
||||
for locale in get_seed_locale_names():
|
||||
transform_foods(locale)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
32
dev/scripts/github_get_release_fixes.py
Normal file
@@ -0,0 +1,32 @@
|
||||
import json
|
||||
|
||||
import requests
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class GithubIssue(BaseModel):
|
||||
url: str
|
||||
number: int
|
||||
title: str
|
||||
|
||||
|
||||
def get_issues_by_label(label="fixed-pending-release") -> list[GithubIssue]:
|
||||
|
||||
issues_url = f"https://api.github.com/repos/hay-kot/mealie/issues?labels={label}"
|
||||
|
||||
response = requests.get(issues_url)
|
||||
issues = json.loads(response.text)
|
||||
return [GithubIssue(**issue) for issue in issues]
|
||||
|
||||
|
||||
def format_markdown_list(issues: list[GithubIssue]) -> str:
|
||||
return "\n".join(f"- [{issue.number}]({issue.url}) - {issue.title}" for issue in issues)
|
||||
|
||||
|
||||
def main() -> None:
|
||||
issues = get_issues_by_label()
|
||||
print(format_markdown_list(issues))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
156
dev/scripts/output/app_routes.py
Normal file
@@ -0,0 +1,156 @@
|
||||
# This Content is Auto Generated for Pytest
|
||||
|
||||
|
||||
class AppRoutes:
|
||||
def __init__(self) -> None:
|
||||
self.prefix = '/api'
|
||||
|
||||
self.about_events = "/api/about/events"
|
||||
self.about_events_notifications = "/api/about/events/notifications"
|
||||
self.about_events_notifications_test = "/api/about/events/notifications/test"
|
||||
self.about_recipes_defaults = "/api/about/recipes/defaults"
|
||||
self.auth_refresh = "/api/auth/refresh"
|
||||
self.auth_token = "/api/auth/token"
|
||||
self.auth_token_long = "/api/auth/token/long"
|
||||
self.backups_available = "/api/backups/available"
|
||||
self.backups_export_database = "/api/backups/export/database"
|
||||
self.backups_upload = "/api/backups/upload"
|
||||
self.categories = "/api/categories"
|
||||
self.categories_empty = "/api/categories/empty"
|
||||
self.debug = "/api/debug"
|
||||
self.debug_last_recipe_json = "/api/debug/last-recipe-json"
|
||||
self.debug_log = "/api/debug/log"
|
||||
self.debug_statistics = "/api/debug/statistics"
|
||||
self.debug_version = "/api/debug/version"
|
||||
self.groups = "/api/groups"
|
||||
self.groups_self = "/api/groups/self"
|
||||
self.meal_plans_all = "/api/meal-plans/all"
|
||||
self.meal_plans_create = "/api/meal-plans/create"
|
||||
self.meal_plans_this_week = "/api/meal-plans/this-week"
|
||||
self.meal_plans_today = "/api/meal-plans/today"
|
||||
self.meal_plans_today_image = "/api/meal-plans/today/image"
|
||||
self.migrations = "/api/migrations"
|
||||
self.recipes_category = "/api/recipes/category"
|
||||
self.recipes_create = "/api/recipes/create"
|
||||
self.recipes_create_from_zip = "/api/recipes/create-from-zip"
|
||||
self.recipes_create_url = "/api/recipes/create-url"
|
||||
self.recipes_summary = "/api/recipes/summary"
|
||||
self.recipes_summary_uncategorized = "/api/recipes/summary/uncategorized"
|
||||
self.recipes_summary_untagged = "/api/recipes/summary/untagged"
|
||||
self.recipes_tag = "/api/recipes/tag"
|
||||
self.recipes_test_scrape_url = "/api/recipes/test-scrape-url"
|
||||
self.shopping_lists = "/api/shopping-lists"
|
||||
self.site_settings = "/api/site-settings"
|
||||
self.site_settings_custom_pages = "/api/site-settings/custom-pages"
|
||||
self.site_settings_webhooks_test = "/api/site-settings/webhooks/test"
|
||||
self.tags = "/api/tags"
|
||||
self.tags_empty = "/api/tags/empty"
|
||||
self.themes = "/api/themes"
|
||||
self.themes_create = "/api/themes/create"
|
||||
self.users = "/api/users"
|
||||
self.users_api_tokens = "/api/users/api-tokens"
|
||||
self.users_self = "/api/users/self"
|
||||
self.users_sign_ups = "/api/users/sign-ups"
|
||||
self.utils_download = "/api/utils/download"
|
||||
|
||||
def about_events_id(self, id):
|
||||
return f"{self.prefix}/about/events/{id}"
|
||||
|
||||
def about_events_notifications_id(self, id):
|
||||
return f"{self.prefix}/about/events/notifications/{id}"
|
||||
|
||||
def backups_file_name_delete(self, file_name):
|
||||
return f"{self.prefix}/backups/{file_name}/delete"
|
||||
|
||||
def backups_file_name_download(self, file_name):
|
||||
return f"{self.prefix}/backups/{file_name}/download"
|
||||
|
||||
def backups_file_name_import(self, file_name):
|
||||
return f"{self.prefix}/backups/{file_name}/import"
|
||||
|
||||
def categories_category(self, category):
|
||||
return f"{self.prefix}/categories/{category}"
|
||||
|
||||
def debug_log_num(self, num):
|
||||
return f"{self.prefix}/debug/log/{num}"
|
||||
|
||||
def groups_id(self, id):
|
||||
return f"{self.prefix}/groups/{id}"
|
||||
|
||||
def meal_plans_id(self, id):
|
||||
return f"{self.prefix}/meal-plans/{id}"
|
||||
|
||||
def meal_plans_id_shopping_list(self, id):
|
||||
return f"{self.prefix}/meal-plans/{id}/shopping-list"
|
||||
|
||||
def meal_plans_plan_id(self, plan_id):
|
||||
return f"{self.prefix}/meal-plans/{plan_id}"
|
||||
|
||||
def media_recipes_recipe_slug_assets_file_name(self, recipe_slug, file_name):
|
||||
return f"{self.prefix}/media/recipes/{recipe_slug}/assets/{file_name}"
|
||||
|
||||
def media_recipes_recipe_slug_images_file_name(self, recipe_slug, file_name):
|
||||
return f"{self.prefix}/media/recipes/{recipe_slug}/images/{file_name}"
|
||||
|
||||
def migrations_import_type_file_name_delete(self, import_type, file_name):
|
||||
return f"{self.prefix}/migrations/{import_type}/{file_name}/delete"
|
||||
|
||||
def migrations_import_type_file_name_import(self, import_type, file_name):
|
||||
return f"{self.prefix}/migrations/{import_type}/{file_name}/import"
|
||||
|
||||
def migrations_import_type_upload(self, import_type):
|
||||
return f"{self.prefix}/migrations/{import_type}/upload"
|
||||
|
||||
def recipes_recipe_slug(self, recipe_slug):
|
||||
return f"{self.prefix}/recipes/{recipe_slug}"
|
||||
|
||||
def recipes_recipe_slug_assets(self, recipe_slug):
|
||||
return f"{self.prefix}/recipes/{recipe_slug}/assets"
|
||||
|
||||
def recipes_recipe_slug_image(self, recipe_slug):
|
||||
return f"{self.prefix}/recipes/{recipe_slug}/image"
|
||||
|
||||
def recipes_recipe_slug_zip(self, recipe_slug):
|
||||
return f"{self.prefix}/recipes/{recipe_slug}/zip"
|
||||
|
||||
def recipes_slug_comments(self, slug):
|
||||
return f"{self.prefix}/recipes/{slug}/comments"
|
||||
|
||||
def recipes_slug_comments_id(self, slug, id):
|
||||
return f"{self.prefix}/recipes/{slug}/comments/{id}"
|
||||
|
||||
def shopping_lists_id(self, id):
|
||||
return f"{self.prefix}/shopping-lists/{id}"
|
||||
|
||||
def site_settings_custom_pages_id(self, id):
|
||||
return f"{self.prefix}/site-settings/custom-pages/{id}"
|
||||
|
||||
def tags_tag(self, tag):
|
||||
return f"{self.prefix}/tags/{tag}"
|
||||
|
||||
def themes_id(self, id):
|
||||
return f"{self.prefix}/themes/{id}"
|
||||
|
||||
def users_api_tokens_token_id(self, token_id):
|
||||
return f"{self.prefix}/users/api-tokens/{token_id}"
|
||||
|
||||
def users_id(self, id):
|
||||
return f"{self.prefix}/users/{id}"
|
||||
|
||||
def users_id_favorites(self, id):
|
||||
return f"{self.prefix}/users/{id}/favorites"
|
||||
|
||||
def users_id_favorites_slug(self, id, slug):
|
||||
return f"{self.prefix}/users/{id}/favorites/{slug}"
|
||||
|
||||
def users_id_image(self, id):
|
||||
return f"{self.prefix}/users/{id}/image"
|
||||
|
||||
def users_id_password(self, id):
|
||||
return f"{self.prefix}/users/{id}/password"
|
||||
|
||||
def users_id_reset_password(self, id):
|
||||
return f"{self.prefix}/users/{id}/reset-password"
|
||||
|
||||
def users_sign_ups_token(self, token):
|
||||
return f"{self.prefix}/users/sign-ups/{token}"
|
||||
11
dev/scripts/publish-release-branch.sh
Normal file
@@ -0,0 +1,11 @@
|
||||
git checkout dev
|
||||
git merge --strategy=ours master # keep the content of this branch, but record a merge
|
||||
git checkout master
|
||||
git merge dev # fast-forward master up to the merge
|
||||
|
||||
|
||||
## TODOs
|
||||
|
||||
# Create New Branch v0.x.x
|
||||
# Push Branch Version to Github
|
||||
# Create Pull Request
|
||||
7
dev/scripts/templates/js_index.j2
Normal file
@@ -0,0 +1,7 @@
|
||||
{% for api in files.files %}
|
||||
import { {{ api }}API } from "./{{api}}.js" {% endfor %}
|
||||
|
||||
export const api = {
|
||||
{% for api in files.files %}
|
||||
{{api}}: {{api}}API, {% endfor %}
|
||||
}
|
||||
19
dev/scripts/templates/js_requests.j2
Normal file
@@ -0,0 +1,19 @@
|
||||
// This Content is Auto Generated
|
||||
import { API_ROUTES } from "./apiRoutes"
|
||||
|
||||
export const {{paths.export_name}}API = { {% for path in paths.all_paths %} {% for verb in path.http_verbs %} {% if path.route_object.is_function %}
|
||||
/** {{ verb.js_docs }} {% for v in path.route_object.var %}
|
||||
* @param {{ v }} {% endfor %}
|
||||
*/
|
||||
{{ verb.summary_camel }}({{path.route_object.var|join(", ")}}) {
|
||||
const response = await apiReq.{{ verb.request_type.value }}(API_ROUTES.{{ path.route_object.router_camel }}({{path.route_object.var|join(", ")}}))
|
||||
return response.data
|
||||
}, {% else %}
|
||||
/** {{ verb.js_docs }} {% for v in path.route_object.var %}
|
||||
* @param {{ v }} {% endfor %}
|
||||
*/
|
||||
{{ verb.summary_camel }}() {
|
||||
const response = await apiReq.{{ verb.request_type.value }}(API_ROUTES.{{ path.route_object.router_camel }})
|
||||
return response.data
|
||||
},{% endif %} {% endfor %} {% endfor %}
|
||||
}
|
||||
7
dev/scripts/templates/js_routes.j2
Normal file
@@ -0,0 +1,7 @@
|
||||
// This Content is Auto Generated
|
||||
const prefix = '{{paths.prefix}}'
|
||||
export const API_ROUTES = { {% for path in paths.static_paths %}
|
||||
{{ path.router_camel }}: `${prefix}{{ path.route }}`,{% endfor %}
|
||||
{% for path in paths.function_paths %}
|
||||
{{path.router_camel}}: ({{path.var|join(", ")}}) => `${prefix}{{ path.js_route }}`,{% endfor %}
|
||||
}
|
||||
12
dev/scripts/templates/pytest_routes.j2
Normal file
@@ -0,0 +1,12 @@
|
||||
# This Content is Auto Generated for Pytest
|
||||
|
||||
|
||||
class AppRoutes:
|
||||
def __init__(self) -> None:
|
||||
self.prefix = '{{paths.prefix}}'
|
||||
{% for path in paths.static_paths %}
|
||||
self.{{ path.router_slug }} = "{{path.prefix}}{{ path.route }}"{% endfor %}
|
||||
{% for path in paths.function_paths %}
|
||||
def {{path.router_slug}}(self, {{path.var|join(", ")}}):
|
||||
return f"{self.prefix}{{ path.route }}"
|
||||
{% endfor %}
|
||||
45
docker-compose.dev.yml
Normal file
@@ -0,0 +1,45 @@
|
||||
# Use changeme@email.com/MyPassword as user/password credentials
|
||||
version: "3.1"
|
||||
services:
|
||||
# Vue Frontend
|
||||
mealie-frontend:
|
||||
container_name: mealie-frontend
|
||||
image: mealie-frontend:dev
|
||||
build:
|
||||
context: ./frontend
|
||||
dockerfile: frontend.Dockerfile
|
||||
restart: always
|
||||
ports:
|
||||
- 9920:8080
|
||||
environment:
|
||||
VUE_APP_API_BASE_URL: "http://mealie-api:9000"
|
||||
volumes:
|
||||
- ./frontend/:/app
|
||||
- /app/node_modules
|
||||
|
||||
# Fast API
|
||||
mealie-api:
|
||||
container_name: mealie-api
|
||||
image: mealie-api:dev
|
||||
build:
|
||||
context: ./
|
||||
target: development
|
||||
dockerfile: Dockerfile
|
||||
restart: always
|
||||
ports:
|
||||
- 9921:9000
|
||||
environment:
|
||||
TZ: America/Anchorage # Specify Correct Timezone for Date/Time to line up correctly.
|
||||
volumes:
|
||||
- ./dev/data:/app/dev/data
|
||||
- ./mealie:/app/mealie
|
||||
|
||||
# Mkdocs
|
||||
mealie-docs:
|
||||
container_name: mealie-docs
|
||||
image: squidfunk/mkdocs-material
|
||||
restart: always
|
||||
ports:
|
||||
- 9922:8000
|
||||
volumes:
|
||||
- ./docs:/docs
|
||||
30
docker-compose.yml
Normal file
@@ -0,0 +1,30 @@
|
||||
version: "3.1"
|
||||
services:
|
||||
mealie:
|
||||
build:
|
||||
context: ./
|
||||
target: production
|
||||
dockerfile: Dockerfile
|
||||
container_name: mealie
|
||||
restart: always
|
||||
depends_on:
|
||||
- "postgres"
|
||||
ports:
|
||||
- 9090:80
|
||||
environment:
|
||||
DB_ENGINE: postgres # Optional: 'sqlite', 'postgres'
|
||||
POSTGRES_USER: mealie
|
||||
POSTGRES_PASSWORD: mealie
|
||||
POSTGRES_SERVER: postgres
|
||||
POSTGRES_PORT: 5432
|
||||
POSTGRES_DB: mealie
|
||||
# WORKERS_PER_CORE: 0.5
|
||||
# MAX_WORKERS: 8
|
||||
# WEB_CONCURRENCY: 2
|
||||
postgres:
|
||||
container_name: postgres
|
||||
image: postgres
|
||||
restart: always
|
||||
environment:
|
||||
POSTGRES_PASSWORD: mealie
|
||||
POSTGRES_USER: mealie
|
||||
@@ -1,162 +0,0 @@
|
||||
###############################################
|
||||
# Frontend Build
|
||||
###############################################
|
||||
FROM node:20 AS frontend-builder
|
||||
|
||||
WORKDIR /frontend
|
||||
|
||||
COPY frontend .
|
||||
|
||||
RUN yarn install \
|
||||
--prefer-offline \
|
||||
--frozen-lockfile \
|
||||
--non-interactive \
|
||||
--production=false \
|
||||
# https://github.com/docker/build-push-action/issues/471
|
||||
--network-timeout 1000000
|
||||
|
||||
RUN yarn generate
|
||||
|
||||
###############################################
|
||||
# Base Image - Python
|
||||
###############################################
|
||||
FROM python:3.12-slim AS python-base
|
||||
|
||||
ENV MEALIE_HOME="/app"
|
||||
|
||||
ENV PYTHONUNBUFFERED=1 \
|
||||
PYTHONDONTWRITEBYTECODE=1 \
|
||||
PIP_NO_CACHE_DIR=off \
|
||||
PIP_DISABLE_PIP_VERSION_CHECK=on \
|
||||
PIP_DEFAULT_TIMEOUT=100 \
|
||||
VENV_PATH="/opt/mealie"
|
||||
|
||||
# prepend venv to path
|
||||
ENV PATH="$VENV_PATH/bin:$PATH"
|
||||
|
||||
# create user account
|
||||
RUN useradd -u 911 -U -d $MEALIE_HOME -s /bin/bash abc \
|
||||
&& usermod -G users abc \
|
||||
&& mkdir $MEALIE_HOME
|
||||
|
||||
###############################################
|
||||
# Backend Package Build
|
||||
###############################################
|
||||
FROM python-base AS backend-builder
|
||||
RUN apt-get update \
|
||||
&& apt-get install --no-install-recommends -y \
|
||||
curl \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ENV POETRY_HOME="/opt/poetry" \
|
||||
POETRY_NO_INTERACTION=1
|
||||
|
||||
# prepend poetry to path
|
||||
ENV PATH="$POETRY_HOME/bin:$PATH"
|
||||
|
||||
# install poetry - respects $POETRY_VERSION & $POETRY_HOME
|
||||
ENV POETRY_VERSION=2.0.1
|
||||
RUN curl -sSL https://install.python-poetry.org | python3 -
|
||||
|
||||
# install poetry plugins needed to build the package
|
||||
RUN poetry self add "poetry-plugin-export>=1.9"
|
||||
|
||||
WORKDIR /mealie
|
||||
|
||||
# copy project files here to ensure they will be cached.
|
||||
COPY poetry.lock pyproject.toml ./
|
||||
COPY mealie ./mealie
|
||||
|
||||
# Copy frontend to package it into the wheel
|
||||
COPY --from=frontend-builder /frontend/dist ./mealie/frontend
|
||||
|
||||
# Build the source and binary package
|
||||
RUN poetry build --output=dist
|
||||
|
||||
# Create the requirements file, which is used to install the built package and
|
||||
# its pinned dependencies later. mealie is included to ensure the built one is
|
||||
# what's installed.
|
||||
RUN export MEALIE_VERSION=$(poetry version --short) \
|
||||
&& poetry export --only=main --extras=pgsql --output=dist/requirements.txt \
|
||||
&& echo "mealie[pgsql]==$MEALIE_VERSION \\" >> dist/requirements.txt \
|
||||
&& poetry run pip hash dist/mealie-$MEALIE_VERSION-py3-none-any.whl | tail -n1 | tr -d '\n' >> dist/requirements.txt \
|
||||
&& echo " \\" >> dist/requirements.txt \
|
||||
&& poetry run pip hash dist/mealie-$MEALIE_VERSION.tar.gz | tail -n1 >> dist/requirements.txt
|
||||
|
||||
###############################################
|
||||
# Package Container
|
||||
# Only role is to hold the packages, or be overriden by a --build-context flag.
|
||||
###############################################
|
||||
FROM scratch AS packages
|
||||
COPY --from=backend-builder /mealie/dist /
|
||||
|
||||
###############################################
|
||||
# Python Virtual Environment Build
|
||||
###############################################
|
||||
# Install packages required to build the venv, in parallel to building the wheel
|
||||
FROM python-base AS venv-builder-base
|
||||
RUN apt-get update \
|
||||
&& apt-get install --no-install-recommends -y \
|
||||
build-essential \
|
||||
libpq-dev \
|
||||
libwebp-dev \
|
||||
# LDAP Dependencies
|
||||
libsasl2-dev libldap2-dev libssl-dev \
|
||||
gnupg gnupg2 gnupg1 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
RUN python3 -m venv --upgrade-deps $VENV_PATH
|
||||
|
||||
# Install the wheel and all dependencies into the venv
|
||||
FROM venv-builder-base AS venv-builder
|
||||
|
||||
# Copy built package (wheel) and its dependency requirements
|
||||
COPY --from=packages * /dist/
|
||||
|
||||
# Install the wheel with exact versions of dependencies into the venv
|
||||
RUN . $VENV_PATH/bin/activate \
|
||||
&& pip install --require-hashes -r /dist/requirements.txt --find-links /dist
|
||||
|
||||
###############################################
|
||||
# Production Image
|
||||
###############################################
|
||||
FROM python-base AS production
|
||||
LABEL org.opencontainers.image.source="https://github.com/mealie-recipes/mealie"
|
||||
ENV PRODUCTION=true
|
||||
ENV TESTING=false
|
||||
|
||||
ARG COMMIT
|
||||
ENV GIT_COMMIT_HASH=$COMMIT
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install --no-install-recommends -y \
|
||||
gosu \
|
||||
iproute2 \
|
||||
libldap-common \
|
||||
libldap-2.5 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# create directory used for Docker Secrets
|
||||
RUN mkdir -p /run/secrets
|
||||
|
||||
# Copy venv into image. It contains a fully-installed mealie backend and frontend.
|
||||
COPY --from=venv-builder $VENV_PATH $VENV_PATH
|
||||
|
||||
# install nltk data for the ingredient parser
|
||||
ENV NLTK_DATA="/nltk_data/"
|
||||
RUN mkdir -p $NLTK_DATA
|
||||
RUN python -m nltk.downloader -d $NLTK_DATA averaged_perceptron_tagger_eng
|
||||
|
||||
VOLUME [ "$MEALIE_HOME/data/" ]
|
||||
ENV APP_PORT=9000
|
||||
|
||||
EXPOSE ${APP_PORT}
|
||||
|
||||
HEALTHCHECK CMD python -m mealie.scripts.healthcheck || exit 1
|
||||
|
||||
ENV HOST 0.0.0.0
|
||||
|
||||
EXPOSE ${APP_PORT}
|
||||
COPY ./docker/entry.sh $MEALIE_HOME/run.sh
|
||||
|
||||
RUN chmod +x $MEALIE_HOME/run.sh
|
||||
ENTRYPOINT ["/app/run.sh"]
|
||||
@@ -1,20 +0,0 @@
|
||||
services:
|
||||
mailpit:
|
||||
image: axllent/mailpit:latest
|
||||
container_name: mealie_dev_mailpit
|
||||
restart: no
|
||||
environment:
|
||||
- "MP_SMTP_AUTH_ACCEPT_ANY=true"
|
||||
- "MP_SMTP_AUTH_ALLOW_INSECURE=true"
|
||||
ports:
|
||||
- "8025:8025"
|
||||
- "1025:1025"
|
||||
postgres:
|
||||
container_name: mealie_dev_postgres
|
||||
image: postgres:15
|
||||
restart: no
|
||||
ports:
|
||||
- "5432:5432"
|
||||
environment:
|
||||
POSTGRES_PASSWORD: mealie
|
||||
POSTGRES_USER: mealie
|
||||
@@ -1,38 +0,0 @@
|
||||
services:
|
||||
mealie:
|
||||
container_name: mealie
|
||||
image: mealie:dev
|
||||
build:
|
||||
context: ../
|
||||
target: production
|
||||
dockerfile: ./docker/Dockerfile
|
||||
restart: always
|
||||
volumes:
|
||||
- mealie-data:/app/data/
|
||||
ports:
|
||||
- 9091:9000
|
||||
environment:
|
||||
ALLOW_SIGNUP: "false"
|
||||
LOG_LEVEL: "DEBUG"
|
||||
|
||||
DB_ENGINE: sqlite # Optional: 'sqlite', 'postgres'
|
||||
# =====================================
|
||||
# Postgres Config
|
||||
POSTGRES_USER: mealie
|
||||
POSTGRES_PASSWORD: mealie
|
||||
POSTGRES_SERVER: postgres
|
||||
POSTGRES_PORT: 5432
|
||||
POSTGRES_DB: mealie
|
||||
# =====================================
|
||||
# Email Configuration
|
||||
# SMTP_HOST=
|
||||
# SMTP_PORT=587
|
||||
# SMTP_FROM_NAME=Mealie
|
||||
# SMTP_AUTH_STRATEGY=TLS # Options: 'TLS', 'SSL', 'NONE'
|
||||
# SMTP_FROM_EMAIL=
|
||||
# SMTP_USER=
|
||||
# SMTP_PASSWORD=
|
||||
|
||||
volumes:
|
||||
mealie-data:
|
||||
driver: local
|
||||
@@ -1,82 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Start Backend API
|
||||
|
||||
# Get PUID/PGID
|
||||
PUID=${PUID:-911}
|
||||
PGID=${PGID:-911}
|
||||
BASH_SOURCE=${BASH_SOURCE:-$0}
|
||||
|
||||
add_user() {
|
||||
groupmod -o -g "$PGID" abc
|
||||
usermod -o -u "$PUID" abc
|
||||
}
|
||||
|
||||
change_user() {
|
||||
if [ "$(id -u)" = $PUID ]; then
|
||||
echo "
|
||||
User uid: $PUID
|
||||
User gid: $PGID
|
||||
"
|
||||
elif [ "$(id -u)" = "0" ]; then
|
||||
# If container is started as root then create a new user and switch to it
|
||||
add_user
|
||||
chown -R $PUID:$PGID /app
|
||||
|
||||
echo "Switching to dedicated user"
|
||||
exec gosu $PUID "$BASH_SOURCE" "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
init() {
|
||||
# $MEALIE_HOME directory
|
||||
cd /app
|
||||
|
||||
# Activate our virtual environment here
|
||||
. /opt/mealie/bin/activate
|
||||
}
|
||||
|
||||
load_secrets() {
|
||||
# Each of these environment variables will support a `_FILE` suffix that allows
|
||||
# for setting the environment variable through the Docker Compose secret
|
||||
# pattern.
|
||||
local -a secret_supported_vars=(
|
||||
"POSTGRES_USER"
|
||||
"POSTGRES_PASSWORD"
|
||||
"POSTGRES_SERVER"
|
||||
"POSTGRES_PORT"
|
||||
"POSTGRES_DB"
|
||||
"POSTGRES_URL_OVERRIDE"
|
||||
|
||||
"SMTP_HOST"
|
||||
"SMTP_PORT"
|
||||
"SMTP_USER"
|
||||
"SMTP_PASSWORD"
|
||||
|
||||
"LDAP_SERVER_URL"
|
||||
"LDAP_QUERY_PASSWORD"
|
||||
|
||||
"OIDC_CONFIGURATION_URL"
|
||||
"OIDC_CLIENT_ID"
|
||||
"OIDC_CLIENT_SECRET"
|
||||
|
||||
"OPENAI_BASE_URL"
|
||||
"OPENAI_API_KEY"
|
||||
)
|
||||
|
||||
# If any secrets are set, prefer them over base environment variables.
|
||||
for var in "${secret_supported_vars[@]}"; do
|
||||
file_var="${var}_FILE"
|
||||
if [ -n "${!file_var}" ]; then
|
||||
export "$var=$(<"${!file_var}")"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
change_user
|
||||
init
|
||||
load_secrets
|
||||
|
||||
# Start API
|
||||
HOST_IP=`/sbin/ip route|awk '/default/ { print $3 }'`
|
||||
|
||||
exec mealie
|
||||
15
docs/Caddyfile
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
auto_https off
|
||||
}
|
||||
|
||||
:80 {
|
||||
root * /srv
|
||||
encode gzip
|
||||
uri strip_suffix /
|
||||
|
||||
handle {
|
||||
try_files {path} {path}/ /index.html
|
||||
file_server
|
||||
}
|
||||
|
||||
}
|
||||
10
docs/Dockerfile
Normal file
@@ -0,0 +1,10 @@
|
||||
FROM python:3.8-slim as build-stage
|
||||
WORKDIR /app
|
||||
RUN pip install --no-cache-dir mkdocs mkdocs-material
|
||||
COPY . .
|
||||
RUN mkdocs build
|
||||
|
||||
FROM caddy:alpine
|
||||
WORKDIR /app
|
||||
COPY ./Caddyfile /etc/caddy/Caddyfile
|
||||
COPY --from=build-stage /app/site /srv
|
||||
11
docs/docker-compose.yml
Normal file
@@ -0,0 +1,11 @@
|
||||
version: "3"
|
||||
services:
|
||||
wiki:
|
||||
container_name: mealie-docs
|
||||
image: mealie-docs
|
||||
ports:
|
||||
- 8888:80
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
restart: always
|
||||
BIN
docs/docs/assets/gifs/URL-import.gif
Normal file
|
After Width: | Height: | Size: 11 MiB |
BIN
docs/docs/assets/gifs/api-extras.gif
Normal file
|
After Width: | Height: | Size: 14 MiB |
BIN
docs/docs/assets/gifs/backup-demo-v1.gif
Normal file
|
After Width: | Height: | Size: 1.8 MiB |
BIN
docs/docs/assets/gifs/bulk-add-demo.gif
Normal file
|
After Width: | Height: | Size: 2.9 MiB |
BIN
docs/docs/assets/gifs/create-custom-page-demo.gif
Normal file
|
After Width: | Height: | Size: 2.1 MiB |
BIN
docs/docs/assets/gifs/homepage-settings-v1.gif
Normal file
|
After Width: | Height: | Size: 1.9 MiB |
BIN
docs/docs/assets/gifs/meal-planner-demoV3.gif
Normal file
|
After Width: | Height: | Size: 5.4 MiB |
BIN
docs/docs/assets/gifs/theme-demo-v3.gif
Normal file
|
After Width: | Height: | Size: 4.6 MiB |
BIN
docs/docs/assets/img/Toolbox-Categories.webp
Normal file
|
After Width: | Height: | Size: 100 KiB |