feat(chalice): enhanced helper functions
This commit is contained in:
parent
335de960d9
commit
c4ae41b54d
3 changed files with 5 additions and 2 deletions
|
|
@ -318,4 +318,6 @@ def get_domain():
|
|||
def obfuscate(text, keep_last: int = 4):
|
||||
if text is None or not isinstance(text, str):
|
||||
return text
|
||||
if len(text) <= keep_last:
|
||||
return "*" * len(text)
|
||||
return "*" * (len(text) - keep_last) + text[-keep_last:]
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ from os import environ
|
|||
import requests
|
||||
from decouple import config
|
||||
|
||||
from chalicelib.utils import helper
|
||||
from chalicelib.utils.TimeUTC import TimeUTC
|
||||
|
||||
|
||||
|
|
@ -22,7 +23,7 @@ def check():
|
|||
environ["expiration"] = "-1"
|
||||
environ["numberOfSeats"] = "0"
|
||||
return
|
||||
print(f"validating: {license}")
|
||||
print(f"validating: {helper.obfuscate(license)}")
|
||||
r = requests.post('https://api.openreplay.com/os/license', json={"mid": __get_mid(), "license": get_license()})
|
||||
if r.status_code != 200 or "errors" in r.json() or not r.json()["data"].get("valid"):
|
||||
print("license validation failed")
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ def unlock_cron() -> None:
|
|||
|
||||
|
||||
cron_jobs = [
|
||||
{"func": unlock_cron, "trigger": "cron", "hour": "*"},
|
||||
{"func": unlock_cron, "trigger": CronTrigger(day="*")},
|
||||
]
|
||||
|
||||
SINGLE_CRONS = [{"func": telemetry_cron, "trigger": CronTrigger(day_of_week="*"),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue