mirror of
https://github.com/Jamesits/pve-fake-subscription
synced 2024-08-30 16:52:18 +00:00
fix compatibility issue on PVE 7.2-11 (#4)
This commit is contained in:
parent
7fb0674976
commit
c83063441d
@ -32,6 +32,9 @@ def md5_base64_rs(x: str) -> str:
|
|||||||
def generate_server_id(key: str) -> str:
|
def generate_server_id(key: str) -> str:
|
||||||
return hashlib.md5(key.encode()).hexdigest().upper()
|
return hashlib.md5(key.encode()).hexdigest().upper()
|
||||||
|
|
||||||
|
def dt_string(format: str, offset_secs: int = 0) -> str:
|
||||||
|
return (datetime.now() + timedelta(seconds=offset_secs)).strftime(format)
|
||||||
|
|
||||||
def generate_subscription_pve_pmg(key: str, server_ids: List[str]) -> str:
|
def generate_subscription_pve_pmg(key: str, server_ids: List[str]) -> str:
|
||||||
localinfo = {
|
localinfo = {
|
||||||
"checktime": get_timestamp(),
|
"checktime": get_timestamp(),
|
||||||
@ -39,8 +42,8 @@ def generate_subscription_pve_pmg(key: str, server_ids: List[str]) -> str:
|
|||||||
"key": key,
|
"key": key,
|
||||||
"validdirectory": ",".join(server_ids),
|
"validdirectory": ",".join(server_ids),
|
||||||
"productname": "YajuuSenpai",
|
"productname": "YajuuSenpai",
|
||||||
"regdate": get_timestamp(),
|
"regdate": dt_string("%Y-%m-%d %H:%M:%S"),
|
||||||
"nextduedate": 2147483647,
|
"nextduedate": dt_string("%Y-%m-%d", 1296000),
|
||||||
}
|
}
|
||||||
|
|
||||||
data = base64.standard_b64encode(json.dumps(localinfo).encode()).decode()
|
data = base64.standard_b64encode(json.dumps(localinfo).encode()).decode()
|
||||||
@ -79,8 +82,8 @@ def generate_subscription_pbs(key: str, server_ids: List[str]) -> str:
|
|||||||
"key": key,
|
"key": key,
|
||||||
"message": "Yajuu Senpai has got your back",
|
"message": "Yajuu Senpai has got your back",
|
||||||
"productname": "YajuuSenpai",
|
"productname": "YajuuSenpai",
|
||||||
"regdate": datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
|
"regdate": dt_string("%Y-%m-%d %H:%M:%S"),
|
||||||
"nextduedate": (datetime.now() + timedelta(seconds=1296000)).strftime("%Y-%m-%d"), # 1296000: MAX_LOCAL_KEY_AGE in src/tools/subscription.rs
|
"nextduedate": dt_string("%Y-%m-%d", 1296000), # 1296000: MAX_LOCAL_KEY_AGE in src/tools/subscription.rs
|
||||||
"url": "https://github.com/Jamesits/pve-fake-subscription",
|
"url": "https://github.com/Jamesits/pve-fake-subscription",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user