diff --git a/backend/twitterbot/models/tweeted.py b/backend/twitterbot/models/tweeted.py index b47c3546f6..9462d62ba6 100644 --- a/backend/twitterbot/models/tweeted.py +++ b/backend/twitterbot/models/tweeted.py @@ -69,9 +69,7 @@ def bluesky_url(self): r"at://(?P.+)/(?P.+)/(?P.+)", self.atproto_uri, ) - if not match: - return None - if match.group("collection") != "app.bsky.feed.post": + if not match or match.group("collection") != "app.bsky.feed.post": return None return f"https://bsky.app/profile/{match.group('authority')}/post/{match.group('key')}" diff --git a/infra/ansible/roles/django/templates/settings.yaml.j2 b/infra/ansible/roles/django/templates/settings.yaml.j2 index 8a65f1f8e7..425dfdaaa5 100644 --- a/infra/ansible/roles/django/templates/settings.yaml.j2 +++ b/infra/ansible/roles/django/templates/settings.yaml.j2 @@ -69,6 +69,8 @@ TWITTERBOT_CREDENTIALS: "CONSUMER_SECRET": "{{consumer_secret_twitterbot_fr}}", "ACCESS_TOKEN": "{{access_token_twitterbot_fr}}", "ACCESS_TOKEN_SECRET": "{{access_token_secret_twitterbot_fr}}", + "ATPROTO_HANDLE": "tournesolbotfr.tournesol.app", + "ATPROTO_PASSWORD": "{{atproto_password_tournesolbot_fr}}", } "@TournesolBot": { "LANGUAGE": "en", @@ -76,6 +78,8 @@ TWITTERBOT_CREDENTIALS: "CONSUMER_SECRET": "{{consumer_secret_twitterbot_en}}", "ACCESS_TOKEN": "{{access_token_twitterbot_en}}", "ACCESS_TOKEN_SECRET": "{{access_token_secret_twitterbot_en}}", + "ATPROTO_HANDLE": "tournesolbot.tournesol.app", + "ATPROTO_PASSWORD": "{{atproto_password_tournesolbot_en}}", } DISCORD_CHANNEL_WEBHOOKS: { diff --git a/infra/ansible/scripts/deploy-without-secrets.sh b/infra/ansible/scripts/deploy-without-secrets.sh index f73053eb9a..c3da271028 100755 --- a/infra/ansible/scripts/deploy-without-secrets.sh +++ b/infra/ansible/scripts/deploy-without-secrets.sh @@ -57,3 +57,5 @@ ansible-playbook -i inventory.yml -l "$ANSIBLE_HOST" "$SETUP_FILE" \ -e "discord_infra_alert_private_webhook=${DISCORD_INFRA_ALERT_PRIVATE_WEBHOOK:-""}" \ -e "discord_twitter_webhook=${DISCORD_TWITTER_WEBHOOK:-""}" \ -e "plausible_analytics_secret_key=$PLAUSIBLE_ANALYTICS_SECRET_KEY" \ + -e "atproto_password_tournesolbot_fr=$ATPROTO_PASSWORD_BOT_FR" \ + -e "atproto_password_tournesolbot_en=$ATPROTO_PASSWORD_BOT_EN" \ diff --git a/infra/ansible/scripts/forget-secrets.sh b/infra/ansible/scripts/forget-secrets.sh index 8cbc209668..c52e016d44 100755 --- a/infra/ansible/scripts/forget-secrets.sh +++ b/infra/ansible/scripts/forget-secrets.sh @@ -30,3 +30,5 @@ unset DISCORD_INFRA_ALERT_WEBHOOK unset DISCORD_INFRA_ALERT_PRIVATE_WEBHOOK unset DISCORD_TWITTER_WEBHOOK unset PLAUSIBLE_ANALYTICS_SECRET_KEY +unset ATPROTO_PASSWORD_BOT_FR +unset ATPROTO_PASSWORD_BOT_EN \ No newline at end of file diff --git a/infra/ansible/scripts/get-vm-secrets.sh b/infra/ansible/scripts/get-vm-secrets.sh index 287db999d0..a342a9c71e 100755 --- a/infra/ansible/scripts/get-vm-secrets.sh +++ b/infra/ansible/scripts/get-vm-secrets.sh @@ -99,3 +99,9 @@ export DISCORD_TWITTER_WEBHOOK PLAUSIBLE_ANALYTICS_SECRET_KEY="$(ssh "$VM_USER@$VM_ADDR" -- sudo cat /root/plausible_analytics_secret_key)" export PLAUSIBLE_ANALYTICS_SECRET_KEY + +ATPROTO_PASSWORD_BOT_FR=$(get_settings_value .TWITTERBOT_CREDENTIALS.\"@TournesolBotFR\".ATPROTO_PASSWORD) +export ATPROTO_PASSWORD_BOT_FR + +ATPROTO_PASSWORD_BOT_EN=$(get_settings_value .TWITTERBOT_CREDENTIALS.\"@TournesolBot\".ATPROTO_PASSWORD) +export ATPROTO_PASSWORD_BOT_EN \ No newline at end of file