Compare commits

..

3 Commits

Author SHA1 Message Date
a6f67d1320 Bump version: 1.2.3 → 1.2.4
All checks were successful
Build and Publish Docker Image / build-and-push (push) Successful in 1m23s
2025-07-15 19:22:06 +01:00
796acd1b4e update stream url if its changed 2025-07-15 19:21:55 +01:00
900d3c1cfe ints 2025-07-15 18:47:54 +01:00
5 changed files with 52 additions and 13 deletions

View File

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

View File

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

View File

@ -1 +1 @@
1.2.3
1.2.4

View File

@ -88,6 +88,7 @@ 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
@ -97,19 +98,45 @@ def validate_account() -> Tuple[Response, int]:
result = single_account_check(account_data, stream_urls)
if result:
if expiry_date and stream and int(result["data"]["user_info"]["exp_date"]) != expiry_date:
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
):
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
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, result["data"]["user_info"]["max_connections"]
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")
):
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,
)
return jsonify({"message": "Account is valid and updated", "data": result}), 200
return jsonify({"message": "Account is valid", "data": result}), 200
else:

View File

@ -167,6 +167,18 @@ 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.