Skip to content

Commit

Permalink
Remove set_name it was already moved to RconAPI as set_server_name
Browse files Browse the repository at this point in the history
  • Loading branch information
cemathey committed May 22, 2024
1 parent 8f42a99 commit 1c32221
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 29 deletions.
2 changes: 1 addition & 1 deletion rcon/api_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ def set_server_name(self, name: str):
# TODO: server name won't change until map change
# but the cache also needs to be cleared, but can't
# immediately clear or it will just refresh but we
# can use a timer
# can use a timer or clear the cache on match start

gtx = GTXFtp.from_config()
gtx.change_server_name(new_name=name)
Expand Down
4 changes: 2 additions & 2 deletions rcongui/src/components/RconSettings/serverName.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ const ServerName = ({ classes }) => {
}, []);

const save = () => {
postData(`${process.env.REACT_APP_API_URL}set_name`, {
postData(`${process.env.REACT_APP_API_URL}set_server_name`, {
name: name,
})
.then((res) => showResponse(res, "set_name", true))
.then((res) => showResponse(res, "set_server_name", true))
.catch(handle_http_errors);
};

Expand Down
26 changes: 0 additions & 26 deletions rconweb/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
from rcon.api_commands import get_rcon_api
from rcon.commands import CommandFailedError
from rcon.discord import send_to_discord_audit
from rcon.gtx import GTXFtp
from rcon.types import (
PublicInfoMapType,
PublicInfoNameType,
Expand Down Expand Up @@ -78,30 +77,6 @@ def set_temp_msg(request, func, name):
return api_response(failed=failed, error=error, result=None, command=name)


@csrf_exempt
@login_required()
@permission_required("api.can_change_server_name", raise_exception=True)
@record_audit
@require_http_methods(["POST"])
@require_content_type()
def set_name(request):
data = _get_data(request)
failed = False
error = None
try:
# TODO: server name won't change until map change
# but the cache also needs to be cleared, but can't
# immediately clear or it will just refresh
gtx = GTXFtp.from_config()
gtx.change_server_name(data["name"])
except Exception as e:
failed = True
error = repr(e)
return api_response(
failed=failed, error=error, result=None, command="set_server_name"
)


@csrf_exempt
@require_http_methods(["GET"])
def get_version(request):
Expand Down Expand Up @@ -846,7 +821,6 @@ def run_raw_command(request):
("get_version", get_version),
("get_connection_info", get_connection_info),
("get_public_info", get_public_info),
("set_name", set_name),
("run_raw_command", run_raw_command),
]

Expand Down

0 comments on commit 1c32221

Please sign in to comment.