File: //proc/self/root/opt/trading-bot/fix_specific_fetch.sh
#!/bin/bash
# Fix the specific fetch calls that are missing credentials
cd /opt/trading-bot/static
# Fix line 757 - status endpoint
sed -i '757s|fetch(`/status?strategy=${currentStrategy}`)|fetch(`/status?strategy=${currentStrategy}`, {credentials: '"'"'include'"'"'})|' index.html
# Fix line 810 - signals endpoint
sed -i '810s|fetch(`/signals?strategy=${currentStrategy}`)|fetch(`/signals?strategy=${currentStrategy}`, {credentials: '"'"'include'"'"'})|' index.html
# Fix line 839 - positions endpoint
sed -i '839s|fetch(`/positions?strategy=${currentStrategy}`)|fetch(`/positions?strategy=${currentStrategy}`, {credentials: '"'"'include'"'"'})|' index.html
# Fix line 862 - flatten endpoint
sed -i '862s|fetch(`/flatten?strategy=${currentStrategy}`, { method: '"'"'POST'"'"' })|fetch(`/flatten?strategy=${currentStrategy}`, { method: '"'"'POST'"'"', credentials: '"'"'include'"'"' })|' index.html
echo "Fixed critical fetch calls"
echo "Verifying fixes:"
grep -n "fetch(\`/status" index.html
grep -n "fetch(\`/signals" index.html
grep -n "fetch(\`/positions" index.html