Compare commits

..

No commits in common. "a6f67d13201c41188bdc428a07754a5291a69df3" and "2b601a5e445772c1cf19d13430c02e8f1cccaf68" have entirely different histories.

5 changed files with 10 additions and 49 deletions

View File

@ -1,5 +1,5 @@
[tool.bumpversion]
current_version = "1.2.4"
current_version = "1.2.3"
commit = true
tag = true
tag_name = "{new_version}"

View File

@ -1,6 +1,6 @@
{
"[python]": {
"editor.defaultFormatter": "mikoz.black-py"
"editor.defaultFormatter": "ms-python.black-formatter"
},
"python.formatting.provider": "none"
}

View File

@ -1 +1 @@
1.2.4
1.2.3

View File

@ -88,7 +88,6 @@ def validate_account() -> Tuple[Response, int]:
password = data.get("password")
expiry_date = data.get("expiry_date")
stream = data.get("stream")
stream_url = data.get("streamURL")
if not all([username, password]):
return jsonify({"message": "Missing required fields"}), 400
@ -98,45 +97,19 @@ def validate_account() -> Tuple[Response, int]:
result = single_account_check(account_data, stream_urls)
if result:
if result["url"] != stream_url:
from ktvmanager.lib.database import update_stream_url
update_stream_url(result["url"], stream_url)
return (
jsonify({"message": "Account is valid and updated", "data": result}),
200,
)
if (
expiry_date
and stream
and int(result["data"]["user_info"]["exp_date"]) != expiry_date
):
if expiry_date and stream and int(result["data"]["user_info"]["exp_date"]) != expiry_date:
from ktvmanager.lib.database import update_expiry_date
update_expiry_date(
username, stream, result["data"]["user_info"]["exp_date"]
)
return (
jsonify({"message": "Account is valid and updated", "data": result}),
200,
)
return jsonify({"message": "Account is valid and updated", "data": result}), 200
if (
int(result.get("data", {}).get("user_info", {}).get("max_connections"))
and data.get("max_connections")
and int(result["data"]["user_info"]["max_connections"])
!= data.get("max_connections")
):
if result.get("data", {}).get("user_info", {}).get("max_connections") and data.get("max_connections") and result["data"]["user_info"]["max_connections"] != data.get("max_connections"):
from ktvmanager.lib.database import update_max_connections
update_max_connections(
username, stream, int(result["data"]["user_info"]["max_connections"])
)
return (
jsonify({"message": "Account is valid and updated", "data": result}),
200,
username, stream, result["data"]["user_info"]["max_connections"]
)
return jsonify({"message": "Account is valid and updated", "data": result}), 200
return jsonify({"message": "Account is valid", "data": result}), 200
else:

View File

@ -167,18 +167,6 @@ def update_max_connections(username: str, stream: str, max_connections: int) ->
_execute_query(query, params)
def update_stream_url(new_stream: str, old_stream: str) -> None:
"""Updates the stream URL of an account.
Args:
new_stream: The stream of the account.
old_stream: The new stream URL.
"""
query = "UPDATE userAccounts SET streamURL = %s WHERE streamURL = %s"
params = (new_stream, old_stream)
_execute_query(query, params)
def delete_account(user_id: int) -> Response:
"""Deletes an account for a user.