From 5d4888dc1bea78e76c4b0976fb925369d0121a1a Mon Sep 17 00:00:00 2001 From: Alie Date: Sat, 24 Feb 2024 11:28:59 +0100 Subject: [PATCH] added a migration tool from file to api --- newarch_migration_tool.sh | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 newarch_migration_tool.sh diff --git a/newarch_migration_tool.sh b/newarch_migration_tool.sh new file mode 100644 index 0000000..5fd62ac --- /dev/null +++ b/newarch_migration_tool.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +APP="" +SECRET="" +BACKEND="" + +# This script should be run on your bitch repository after a sync + +# Get token to work on the API +token=$(curl $BACKEND/login -H "Content-type: application/json" -d "{\"app\":\"$APP\",\"secret\":\"$SECRET\"}' | jq -r .token) + +# Add the rejected urls +while read url; do + curl $BACKEND/images -H "Authorization: Bearer $token" -H "Content-type: application/json" -d "{\"url\": \"$url\", \"status\": \"unavailable\", \"tags\": [\"sleeping\", \"2girl\"]}" + echo "" +done