forked from mdarkness1988/Rust-Server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfix_conn.sh
21 lines (17 loc) · 973 Bytes
/
fix_conn.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash
# $scope.Address = $scope.Address.trim();
# Replace the trimmed address field with the current domain/hostname and RCON port
OLD_TRIM_CODE='scope.Address = $scope.Address.trim();'
NEW_ADDRESS_CODE='scope.Address = $location.host() + '"\":$PORTFORWARD_RCON\";"
if [ ! -z "$RUST_RCON_HOSTNAME" ]; then
NEW_ADDRESS_CODE='scope.Address = '"\"$RUST_RCON_HOSTNAME:$PORTFORWARD_RCON\";"
fi
sed -i -e 's/'"$OLD_TRIM_CODE"'/'"$NEW_ADDRESS_CODE"'/g' /usr/share/nginx/html/js/connection.js
# Replace the help text with our own
OLD_HELP_TEXT="Enter the address (including rcon port) and the rcon password below to connect."
NEW_HELP_TEXT="Enter the rcon password below to connect."
sed -i -e 's/'"$OLD_HELP_TEXT"'/'"$NEW_HELP_TEXT"'/g' /usr/share/nginx/html/html/connect.html
# Remove the address lines (14-19) if they exist
if grep -q "ng-model=\"Address\"" /usr/share/nginx/html/html/connect.html; then
sed -i -e '14,19d' /usr/share/nginx/html/html/connect.html
fi