diff --git a/app/routes/routes.py b/app/routes/routes.py index c3c9eae..4454090 100644 --- a/app/routes/routes.py +++ b/app/routes/routes.py @@ -109,15 +109,22 @@ def before_request(): if current_user.is_authenticated: identity_changed.send(current_app._get_current_object(), identity=Identity(current_user.id)) - @app.route('/static/js/common/user.js') def user_script(): + if current_user.is_authenticated: + user_id = current_user.id if current_user.id else "undefined" + # Ensure roles is a string and default to an empty string if none + user_roles = current_user.roles if current_user.roles else "" + else: + user_id = "undefined" + user_roles = "" + js_content = f""" const user = {{ - id: "{current_user.id}", - roles: "{current_user.roles}" + id: "{user_id}", + roles: "{user_roles}" }}; export default user; """ - + return Response(js_content, mimetype='application/javascript') \ No newline at end of file diff --git a/toloka2web.yaml b/toloka2web.yaml new file mode 100644 index 0000000..b06b837 --- /dev/null +++ b/toloka2web.yaml @@ -0,0 +1,18 @@ +version: '3.8' +services: + toloka2web: + image: maksii/toloka2web:latest + container_name: toloka2web + volumes: + - /path/to/your/config:/app/data + - /path/to/your/downloads:/path/to/your/downloads + environment: + - PORT=80 + - PUID=1024 + - PGID=100 + - CRON_SCHEDULE=0 */2 * * * + - TZ=Europe/Kiev + - API_KEY=your_api_key_here + - FLASK_SECRET_KEY=default_secret_key + restart: unless-stopped + user: "${PUID}:${PGID}" \ No newline at end of file