Compare commits
14 Commits
3c8d842e3b
...
0.0.5
Author | SHA1 | Date | |
---|---|---|---|
6e6effb1bc
|
|||
00d48b4de1
|
|||
fc9cd70776
|
|||
8b9654370c
|
|||
4471c140c1 | |||
e87675dcbd
|
|||
dc8d6d58e1
|
|||
46826bfe09
|
|||
6d26cb7f2b
|
|||
19b12308d0
|
|||
fd0ad5699b | |||
62a5531304
|
|||
e85fdab068
|
|||
24ac825ed7
|
@ -2,7 +2,7 @@ steps:
|
|||||||
build:
|
build:
|
||||||
image: plugins/kaniko
|
image: plugins/kaniko
|
||||||
settings:
|
settings:
|
||||||
repo: gitea.hottis.de/wn/oidc-python-example
|
repo: gitea.hottis.de/moerp/elo-rezept-rechner
|
||||||
registry:
|
registry:
|
||||||
from_secret: container_registry
|
from_secret: container_registry
|
||||||
tags: latest,${CI_COMMIT_SHA},${CI_COMMIT_TAG}
|
tags: latest,${CI_COMMIT_SHA},${CI_COMMIT_TAG}
|
||||||
@ -30,3 +30,4 @@ steps:
|
|||||||
- ./deployment/deploy.sh
|
- ./deployment/deploy.sh
|
||||||
when:
|
when:
|
||||||
- event: tag
|
- event: tag
|
||||||
|
|
||||||
|
@ -6,8 +6,8 @@ if [ "$IMAGE_TAG" == "" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
IMAGE_NAME=gitea.hottis.de/wn/oidc-python-example
|
IMAGE_NAME=gitea.hottis.de/moerp/elo-rezept-rechner
|
||||||
NAMESPACE=oidc-python-example
|
NAMESPACE=moerp
|
||||||
DEPLOYMENT_DIR=$PWD/deployment
|
DEPLOYMENT_DIR=$PWD/deployment
|
||||||
|
|
||||||
pushd $DEPLOYMENT_DIR > /dev/null
|
pushd $DEPLOYMENT_DIR > /dev/null
|
||||||
@ -22,7 +22,7 @@ kubectl create namespace $NAMESPACE \
|
|||||||
-o yaml | \
|
-o yaml | \
|
||||||
kubectl -f - apply
|
kubectl -f - apply
|
||||||
|
|
||||||
kubectl create secret generic secrets \
|
kubectl create secret generic nutri-secrets \
|
||||||
--dry-run=client \
|
--dry-run=client \
|
||||||
-o yaml \
|
-o yaml \
|
||||||
--save-config \
|
--save-config \
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
"client_id": "nutri",
|
"client_id": "nutri",
|
||||||
"client_secret": "%CLIENT_SECRET%",
|
"client_secret": "%CLIENT_SECRET%",
|
||||||
"redirect_uris": [
|
"redirect_uris": [
|
||||||
"http://localhost:8080/*"
|
"https://nutri.hottis.de/*"
|
||||||
],
|
],
|
||||||
"userinfo_uri": "https://auth2.hottis.de/realms/hottis/protocol/openid-connect/userinfo",
|
"userinfo_uri": "https://auth2.hottis.de/realms/hottis/protocol/openid-connect/userinfo",
|
||||||
"token_uri": "https://auth2.hottis.de/realms/hottis/protocol/openid-connect/token"
|
"token_uri": "https://auth2.hottis.de/realms/hottis/protocol/openid-connect/token"
|
||||||
|
5
deployment/secrets.enc
Normal file
5
deployment/secrets.enc
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
U2FsdGVkX1/th2tFCYckNPvrVu7gmXIYlGBvSx8EWLNPbWTH61+dTDg6x6f7SFi5
|
||||||
|
n17zGVWBkfY2xr6uyHrvN8udF2dN6MTPccZITuEu9z66wtEHoiRQl1drA9og39yg
|
||||||
|
KTtwsbWeO7WSjA1DXoldNZgl0KKKHopw5d9ebZh7t1TRTd1sV4+tNOqqC+Z76vGQ
|
||||||
|
zV+KU8GUd4EpUY0CdxaWttGe59Igpj6fJXEWHJ9jMM5DcSx5wJHx6g8MnBLyahD1
|
||||||
|
pD/ru5bysLlQUEjlSIIr+A==
|
11
src/Run.py
11
src/Run.py
@ -94,6 +94,7 @@ def calculate_nutrition(food, weight):
|
|||||||
# Index-Route
|
# Index-Route
|
||||||
@app.route('/')
|
@app.route('/')
|
||||||
@oidc.require_login
|
@oidc.require_login
|
||||||
|
@oidc.require_keycloak_role('nutri', 'user')
|
||||||
def index():
|
def index():
|
||||||
return render_template('index.html')
|
return render_template('index.html')
|
||||||
|
|
||||||
@ -101,6 +102,7 @@ def index():
|
|||||||
|
|
||||||
@app.route('/get_products')
|
@app.route('/get_products')
|
||||||
@oidc.require_login
|
@oidc.require_login
|
||||||
|
@oidc.require_keycloak_role('nutri', 'user')
|
||||||
def get_products():
|
def get_products():
|
||||||
conn = get_db_connection()
|
conn = get_db_connection()
|
||||||
cursor = conn.cursor()
|
cursor = conn.cursor()
|
||||||
@ -117,6 +119,7 @@ def get_products():
|
|||||||
# Route zum Hinzufügen und Berechnen von Lebensmitteln
|
# Route zum Hinzufügen und Berechnen von Lebensmitteln
|
||||||
@app.route('/add_lm', methods=['GET'])
|
@app.route('/add_lm', methods=['GET'])
|
||||||
@oidc.require_login
|
@oidc.require_login
|
||||||
|
@oidc.require_keycloak_role('nutri', 'user')
|
||||||
def add_lm():
|
def add_lm():
|
||||||
food = request.args.get('food')
|
food = request.args.get('food')
|
||||||
weight = float(request.args.get('weight'))
|
weight = float(request.args.get('weight'))
|
||||||
@ -164,14 +167,14 @@ def add_nutrition():
|
|||||||
|
|
||||||
@app.route('/nutrition')
|
@app.route('/nutrition')
|
||||||
@oidc.require_login
|
@oidc.require_login
|
||||||
|
@oidc.require_keycloak_role('nutri', 'user')
|
||||||
def nutrition():
|
def nutrition():
|
||||||
return render_template('nutrition.html')
|
return render_template('nutrition.html')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
app = ProxyFix(app, x_for=1, x_host=1)
|
||||||
if __name__ == '__main__':
|
|
||||||
#init_db()
|
|
||||||
app.run(debug=True)
|
|
||||||
|
|
||||||
|
|
||||||
|
73
src/nu.csv
73
src/nu.csv
@ -1,10 +1,10 @@
|
|||||||
name,kcal,EW,Fett,KH,BST,Ca
|
name,kcal,EW,Fett,KH,BST,Ca
|
||||||
Zitronensaft,38,0.4,0.5,3.8,0.1,11
|
Zitronensaft,38,0.4,0.5,3.8,0.1,11
|
||||||
Zucker,405,0.0,0.0,100.0,0.0,2
|
Zucker,405,0.0,0.0,100.0,0.0,2
|
||||||
Trinkmilch3.5,65,3.4,3.6,4.7,0.0,120
|
Trinkmilch 3.5%,65,3.4,3.6,4.7,0.0,120
|
||||||
Hühnerei50,137,11.9,9.3,1.5,0.0,51
|
Hühnerei,137,11.9,9.3,1.5,0.0,51
|
||||||
Pflanzenmargarine,722,0.2,80.0,0.4,0.0,8
|
Pflanzenmargarine,722,0.2,80.0,0.4,0.0,8
|
||||||
Sahne30,309,2.4,31.7,3.4,0.0,80
|
Sahne 30%,309,2.4,31.7,3.4,0.0,80
|
||||||
Maisstärke,353,0.4,0.1,85.9,1.0,0
|
Maisstärke,353,0.4,0.1,85.9,1.0,0
|
||||||
Paniermehl,368,10.1,2.1,73.5,5.3,50
|
Paniermehl,368,10.1,2.1,73.5,5.3,50
|
||||||
Weizengrieß,335,9.6,0.8,69.0,7.1,17
|
Weizengrieß,335,9.6,0.8,69.0,7.1,17
|
||||||
@ -18,11 +18,11 @@ Olivenöl,884,0,99.8,0.2,0,0
|
|||||||
Möhre,39,0.8,0.2,6.8,3.6,21
|
Möhre,39,0.8,0.2,6.8,3.6,21
|
||||||
Rote linsen,350,23.9,2.2,52.3,10.8,48
|
Rote linsen,350,23.9,2.2,52.3,10.8,48
|
||||||
Gemüsebruhe verz,7,1.6,0,1,0,12
|
Gemüsebruhe verz,7,1.6,0,1,0,12
|
||||||
Rindfleisch keule,148,20.0,7.6,0,0,6
|
Rindfleisch Keule,148,20.0,7.6,0,0,6
|
||||||
Rinderbouillon,4,0.2,0,1,0,5
|
Rinderbouillon,4,0.2,0,1,0,5
|
||||||
Meerettich iD,78,2.8,0.3,11.7,7.5,105
|
Meerettich iD,78,2.8,0.3,11.7,7.5,105
|
||||||
Saure sahne10,117,3.1,10.0,3.7,0,110
|
Saure sahne 10%,117,3.1,10.0,3.7,0,110
|
||||||
Joghurt3.5, 64,3.3,3.5,4.4,0,120
|
Joghurt 3.5%, 64,3.3,3.5,4.4,0,120
|
||||||
Dill,65,3.7,0.8,8.0,5.3,230
|
Dill,65,3.7,0.8,8.0,5.3,230
|
||||||
Schnittlauch,40,3.6,0.7,1.6,6.0,129
|
Schnittlauch,40,3.6,0.7,1.6,6.0,129
|
||||||
Gartenkresse,41,4.2,0.7,2.5,3.5,214
|
Gartenkresse,41,4.2,0.7,2.5,3.5,214
|
||||||
@ -37,7 +37,7 @@ Apfel,57,0.3,0.6,11.4,2.0,7
|
|||||||
Kiwi grün,55,0.9,0.6,9.1,3.0,28
|
Kiwi grün,55,0.9,0.6,9.1,3.0,28
|
||||||
Banane,93,1.2,0.2,20.0,1.8,8
|
Banane,93,1.2,0.2,20.0,1.8,8
|
||||||
Schweinefleisch bug,217,17.0,16.5,0.0,0.0,9
|
Schweinefleisch bug,217,17.0,16.5,0.0,0.0,9
|
||||||
Gouda48,370,22.7,29.9,0,0,811
|
Gouda 48%,370,22.7,29.9,0,0,811
|
||||||
Blumenkohl,28,2.5,0.3,2.3,2.9,22
|
Blumenkohl,28,2.5,0.3,2.3,2.9,22
|
||||||
Knoblauch,145,6.1,0.1,28.4,1.8,38
|
Knoblauch,145,6.1,0.1,28.4,1.8,38
|
||||||
Senf,88,6.0,4.0,6.0,1.0,124
|
Senf,88,6.0,4.0,6.0,1.0,124
|
||||||
@ -45,21 +45,21 @@ Blattspinat roh,21,2.7,0.3,0.6,2.6,117
|
|||||||
Buttermilch,37,3.5,0.5,4.0,0.0,109
|
Buttermilch,37,3.5,0.5,4.0,0.0,109
|
||||||
Himbeere,37,1.3,0.3,4.8,4.7,40
|
Himbeere,37,1.3,0.3,4.8,4.7,40
|
||||||
Salz dill gurken,9,0.4,0.1,1.3,0.5,18
|
Salz dill gurken,9,0.4,0.1,1.3,0.5,18
|
||||||
Schmand20,205,2.8,20.0,3.6,0.0,100
|
Schmand 20%,205,2.8,20.0,3.6,0.0,100
|
||||||
Aspikpulver,338,84.2,0.1,0.0,0.0,11
|
Aspikpulver,338,84.2,0.1,0.0,0.0,11
|
||||||
Lachs atlantischer,210,20.4,13.4,0.3,0.0,4
|
Lachs atlantischer,210,20.4,13.4,0.3,0.0,4
|
||||||
Pinienkerne,589,24.0,50.7,7.3,7.2,26
|
Pinienkerne,589,24.0,50.7,7.3,7.2,26
|
||||||
Zwieback,385,9.9,4.3,73.1,5.2,42
|
Zwieback,385,9.9,4.3,73.1,5.2,42
|
||||||
Speisequark,72,13.5,0.3,3.2,0.0,92
|
Speisequark,72,13.5,0.3,3.2,0.0,92
|
||||||
Basilikum,47,3.1,0.8,5.1,3.1,369
|
Basilikum,47,3.1,0.8,5.1,3.1,369
|
||||||
Mayonaise50,490,0.5,52.0,5.0,0.0,10
|
Mayonaise 50%,490,0.5,52.0,5.0,0.0,10
|
||||||
Weizenbrötchen,292,10.2,1.8,55.9,3.6,49
|
Weizenbrötchen,292,10.2,1.8,55.9,3.6,49
|
||||||
Seelachs köhler,81,18.3,0.9,0,0,14
|
Seelachs köhler,81,18.3,0.9,0,0,14
|
||||||
Bohnen grün,21,1.7,0.1,2.0,2.3,34
|
Bohnen grün,21,1.7,0.1,2.0,2.3,34
|
||||||
Aprikosen dose,70,0.5,0.1,15.1,1.4,11
|
Aprikosen Dose,70,0.5,0.1,15.1,1.4,11
|
||||||
Orangenfilets,47,1.0,0.2,8.3,2.2,42
|
Orangenfilets,47,1.0,0.2,8.3,2.2,42
|
||||||
Mirabellen dose,66,0.7,0.2,15.0,0.9,12
|
Mirabellen Dose,66,0.7,0.2,15.0,0.9,12
|
||||||
Pfirsich dose,67,0.4,0.1,15.5,1.1,4
|
Pfirsich Dose,67,0.4,0.1,15.5,1.1,4
|
||||||
Vanillezucker,405,0.0,0.0,100.0,0,2
|
Vanillezucker,405,0.0,0.0,100.0,0,2
|
||||||
Vanille pp,346,0.5,0.0,86.0,1,15
|
Vanille pp,346,0.5,0.0,86.0,1,15
|
||||||
Brokkoli,34,3.8,0.2,2.7,3.0,58
|
Brokkoli,34,3.8,0.2,2.7,3.0,58
|
||||||
@ -76,11 +76,54 @@ Mais Dose,81,3.2,1.2,12.6,2.8,8
|
|||||||
Pfefferminze,50,3.8,0.7,5.3,3.0,179
|
Pfefferminze,50,3.8,0.7,5.3,3.0,179
|
||||||
Erdbeere,36,0.8,0.4,5.5,2.0,24
|
Erdbeere,36,0.8,0.4,5.5,2.0,24
|
||||||
Himbeere,37,1.3,0.3,4.8,4.7,40
|
Himbeere,37,1.3,0.3,4.8,4.7,40
|
||||||
Orange/apfelsine,47,1.0,0.2,8.3,2.2,42
|
Orange/Apfelsine,47,1.0,0.2,8.3,2.2,42
|
||||||
Orangensaft frisch,44,0.7,0.1,8.7,0.4,11
|
Orangensaft frisch,44,0.7,0.1,8.7,0.4,11
|
||||||
Weintraube,69,0.7,0.3,15.2,1.5,12
|
Weintraube,69,0.7,0.3,15.2,1.5,12
|
||||||
Naturreis,349,7.2,2.2,74.1,2.2,16
|
Naturreis,349,7.2,2.2,74.1,2.2,16
|
||||||
Mehl405,343,9.8,1.0,71.8,4.0,15
|
Mehl Type 405,343,9.8,1.0,71.8,4.0,15
|
||||||
Mehl550,346,9.8,1.1,72.0,4.3,17
|
Mehl Type 550,346,9.8,1.1,72.0,4.3,17
|
||||||
Milchreis,316,6.4,0.8,80.2,1.1,6
|
Milchreis,316,6.4,0.8,80.2,1.1,6
|
||||||
Kartoffelstärke,341,0.6,0.1,83.1,0.1,35
|
Kartoffelstärke,341,0.6,0.1,83.1,0.1,35
|
||||||
|
Hmilch fettarm 1.5%,47,3.4,1.5,4.9,0.0,123
|
||||||
|
Edamer 30%,254,26.4,16.2,0,0.0,800
|
||||||
|
Gouda alt 48%,414,24.6,33.7,0.1,0.0,871
|
||||||
|
Hackfleisch,207,20.5,14.0,0.0,0.0,6
|
||||||
|
Bockwurst,277,12.3,25.3,0.0,0.1,12
|
||||||
|
Geflügelwurst mager,108,16.2,4.8,0.0,0.0,23
|
||||||
|
Butterschmalz,897,0.3,99.5,0.0,0.0,6
|
||||||
|
Diätmargerine,722,0.2,80.0,0.2,0.0,10
|
||||||
|
Kürbiskerne,590,35.5,46.6,2.7,8.7,10
|
||||||
|
Sonnenblumenkerne geschält,593,22.5,49.0,12.3,6.3,98
|
||||||
|
Butterkeks,441,8.2,11.0,74.7,3.3,47
|
||||||
|
Zwieback,385,9.9,4.3,73.1,5.2,42
|
||||||
|
Schokolade 75% Kakaomasse,598,7.8,42.6,35.0,10.9,73
|
||||||
|
Paniermehl,368,10.1,0.1,73.5,5.3,50
|
||||||
|
Senf,88,6.0,4.0,6.0,1.0,124
|
||||||
|
Schinken geräuchert,152,20.7,7.7,0.0,0.0,2
|
||||||
|
Rinderkeule,148,20.0,7.6,0.0,0.0,6
|
||||||
|
Kirsche süß,62,0.9,0.3,13.3,1.3,17
|
||||||
|
Kirschen sauer,50,0.9,0.5,9.9,1.0,8
|
||||||
|
Eisbergsalat,16,1.0,0.2,2.0,1.1,19
|
||||||
|
Endivie,18,1.8,0.2,1.2,1.9,54
|
||||||
|
Feldsalat,18,1.8,0.4,0.8,1.5,32
|
||||||
|
Gurke,14,0.6,0.2,1.8,0.9,15
|
||||||
|
Kopfsalat,14,1.2,0.2,1.1,1.4,20
|
||||||
|
Schalotte,25,1.5,0.2,3.3,1.5,37
|
||||||
|
Gemüsebrühe verz,7,1.6,0,0,0,12
|
||||||
|
Fleischbrühe,4,0.2,0,1,0,5
|
||||||
|
Hühnerbrühe verz,10,0.4,0,1,0,10
|
||||||
|
Bohnenkaffee,2,0.0,0,0,0,10
|
||||||
|
Sojasauce,70,9.0,0,8,0,20
|
||||||
|
Rote Bete,46,1.5,0.2,8.4,2.5,29
|
||||||
|
Rote Bete Saft,37,1.0,0,8.0,0.3,20
|
||||||
|
Paprika gelb,37,1.2,0.3,5.3,3.6,8
|
||||||
|
Paprika grün,23,1.2,0.2,2.9,2.0,10
|
||||||
|
Paprika rot,43,1.3,0.5,6.4,3.6,10
|
||||||
|
Knollensellerie,27,1.6,0.3,2.3,4.2,50
|
||||||
|
Erdbeeren tiefgefroren,38,0.9,0.4,5.8,2.1,24
|
||||||
|
Himbeeren tiefgefroren,45,1.4,0.3,5.0,4.8,42
|
||||||
|
Dill,65,3.7,0.8,8.0,5.3,230
|
||||||
|
Kerbel,58,4.1,0.6,6.2,5.3,400
|
||||||
|
Majoran,52,2.1,1.1,6.9,2.9,322
|
||||||
|
Oregano,72,2.2,2.0,9.7,2.5,310
|
||||||
|
Thymian,52,1.5,1.2,7.4,3.0,307
|
|
@ -172,15 +172,6 @@ function updateTotalNutrition() {
|
|||||||
document.getElementById('total-ca').innerText = Math.round(totalCa);
|
document.getElementById('total-ca').innerText = Math.round(totalCa);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rufen Sie diese Funktion auf, wenn sich die Haupttabelle ändert
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Diese Funktion sollte aufgerufen werden, wenn ein Produkt hinzugefügt oder entfernt wird
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@ -196,7 +187,7 @@ function updateTotalNutrition() {
|
|||||||
<div class="content">
|
<div class="content">
|
||||||
<form onsubmit="event.preventDefault(); addProduct();" id="product-form">
|
<form onsubmit="event.preventDefault(); addProduct();" id="product-form">
|
||||||
<label for="my_combobox">Wählen Sie ein Lebensmittel</label>
|
<label for="my_combobox">Wählen Sie ein Lebensmittel</label>
|
||||||
<input list="products" name="my_combobox" id="my_combobox" oninput="updateButtonState()" autocomplete="off">
|
<input list="products" name="my_combobox" id="my_combobox" placeholder="Lebensmittel" oninput="updateButtonState()" autocomplete="off">
|
||||||
<datalist id="products">
|
<datalist id="products">
|
||||||
<!-- Produkte werden hier dynamisch eingefügt -->
|
<!-- Produkte werden hier dynamisch eingefügt -->
|
||||||
</datalist>
|
</datalist>
|
||||||
|
Reference in New Issue
Block a user