Skip to content

Commit

Permalink
yaml example and user.js fix
Browse files Browse the repository at this point in the history
  • Loading branch information
maksii committed Jun 25, 2024
1 parent a79cf76 commit 9c5629d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
15 changes: 11 additions & 4 deletions app/routes/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
18 changes: 18 additions & 0 deletions toloka2web.yaml
Original file line number Diff line number Diff line change
@@ -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}"

0 comments on commit 9c5629d

Please sign in to comment.