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 ## Features
Works for: 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 Mail Gateway (5.x or later)
- Proxmox Backup Server (1.x) - Proxmox Backup Server (1.x)
@ -49,6 +49,6 @@ Run everything as root on a Debian 10 system:
```shell ```shell
apt-get install ruby ruby-dev rubygems build-essential apt-get install ruby ruby-dev rubygems build-essential
gem install --no-ri --no-rdoc fpm gem install fpm
./package.sh ./package.sh
``` ```

View File

@ -1,12 +1,12 @@
#!/bin/bash #!/bin/bash
set -Eeuo pipefail
cd "$( dirname "${BASH_SOURCE[0]}" )" cd "$( dirname "${BASH_SOURCE[0]}" )" || exit 1
fpm -s dir -t deb --force \ fpm -s dir -t deb --force \
-n pve-fake-subscription \ -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" \ --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" \ --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" \ --license "GLWTS(Good Luck With That Shit) Public License" \
--depends "python3" \ --depends "python3" \
--architecture all \ --architecture all \

View File

@ -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",
} }