Compare commits

...

2 Commits

Author SHA1 Message Date
James Swineson
68fe060029 fix line ending issue 2022-09-16 09:11:36 +08:00
James Swineson
c83063441d fix compatibility issue on PVE 7.2-11 (#4) 2022-09-16 09:05:14 +08:00
3 changed files with 16 additions and 13 deletions

View File

@ -5,7 +5,7 @@ Disables the "No valid subscription" dialog on all Proxmox products.
## Features
Works for:
- Proxmox VE (5.x or later, tested up to 7.0)
- Proxmox VE (5.x or later, tested up to 7.2)
- Proxmox Mail Gateway (5.x or later)
- Proxmox Backup Server (1.x)
@ -49,6 +49,6 @@ Run everything as root on a Debian 10 system:
```shell
apt-get install ruby ruby-dev rubygems build-essential
gem install --no-ri --no-rdoc fpm
gem install fpm
./package.sh
```

View File

@ -1,12 +1,12 @@
#!/bin/bash
cd "$( dirname "${BASH_SOURCE[0]}" )"
set -Eeuo pipefail
cd "$( dirname "${BASH_SOURCE[0]}" )" || exit 1
fpm -s dir -t deb --force \
-n pve-fake-subscription \
--description "Pollute the subscription cache of Proxmox VE (>=5.0), Proxmox Mail Gateway (>=5.0) & Proxmox Backup Server (>=1.0) so it won't alert you on dashboard login" \
--url "https://github.com/Jamesits/pve-fake-subscription" \
-v 0.0.7 \
-v 0.0.8 \
--license "GLWTS(Good Luck With That Shit) Public License" \
--depends "python3" \
--architecture all \

View File

@ -32,6 +32,9 @@ def md5_base64_rs(x: str) -> str:
def generate_server_id(key: str) -> str:
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:
localinfo = {
"checktime": get_timestamp(),
@ -39,8 +42,8 @@ def generate_subscription_pve_pmg(key: str, server_ids: List[str]) -> str:
"key": key,
"validdirectory": ",".join(server_ids),
"productname": "YajuuSenpai",
"regdate": get_timestamp(),
"nextduedate": 2147483647,
"regdate": dt_string("%Y-%m-%d %H:%M:%S"),
"nextduedate": dt_string("%Y-%m-%d", 1296000),
}
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,
"message": "Yajuu Senpai has got your back",
"productname": "YajuuSenpai",
"regdate": datetime.now().strftime("%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
"regdate": dt_string("%Y-%m-%d %H:%M:%S"),
"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",
}