Skip to content

Commit

Permalink
fix: termux change server address as http starts
Browse files Browse the repository at this point in the history
  • Loading branch information
Crissium committed Oct 18, 2023
1 parent fd3af7c commit 8fd5f0e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion http_server/change_server_address.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
See https://stackoverflow.com/a/28950776/18655501
Change all occurrences of things inside 'http://[address]:2628/api' to the actual IP address of the server.
Change all occurrences of things inside 'http://[address]:2628/api' to the actual IP address of the server,
or the command line argument.
"""

import socket
Expand Down
7 changes: 4 additions & 3 deletions termux_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ echo -e "history_size: 100\nnum_suggestions: 10\nsources:\n- /sdcard/Documents/D
# Create Termux:Widget shortcuts
mkdir -p ~/.shortcuts
PROJECT_DIR=$(pwd)
echo -e "#!/bin/sh\ntermux-wake-lock\npython $PROJECT_DIR/server/server.py &> ~/.silverdict/server.log &" > ~/.shortcuts/silverdict_server.sh
echo -e "#!/bin/sh\ntermux-wake-lock\npython $PROJECT_DIR/http_server/http_server.py &> ~/.silverdict/http_server.log &" > ~/.shortcuts/silverdict_http_server.sh
echo -e "#!/bin/sh\ntermux-wake-lock\npython $PROJECT_DIR/server/server.py &> ~/.silverdict/server.log &\npython $PROJECT_DIR/http_server/http_server.py &> ~/.silverdict/http_server.log &" > ~/.shortcuts/silverdict_all.sh
echo -e "#!/bin/sh\ntermux-wake-lock\npython $PROJECT_DIR/server/server.py &> ~/.silverdict/server.log &" > ~/.shortcuts/SilverDict-Server.sh
echo -e "#!/bin/sh\ntermux-wake-lock\ncd $PROJECT_DIR/http_server\npython change_server_address.py\npython http_server.py &> ~/.silverdict/http_server.log &" > ~/.shortcuts/SilverDict-HTTP.sh
echo -e "#!/bin/sh\nkillall -SIGTERM python\ntermux-wake-unlock\nexit" > ~/.shortcuts/SilverDict-Stop.sh
chmod +x ~/.shortcuts/*
# Release the lock upon logout
echo "#!/bin/sh\ntermux-wake-unlock" >> ~/.bash_logout

0 comments on commit 8fd5f0e

Please sign in to comment.