v2: ID verification by state, 15 photos/5 albums, 20 quick replies, logo, mobile polish
This commit is contained in:
60
deploy/add-onsethost-fallback.py
Normal file
60
deploy/add-onsethost-fallback.py
Normal file
@@ -0,0 +1,60 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Interim: expose via exposedgays.onsethost.com using existing *.onsethost.com tunnel rule."""
|
||||
import json
|
||||
import re
|
||||
import urllib.request
|
||||
import paramiko
|
||||
|
||||
PASS = "Bbt9115xty9176!"
|
||||
ONSETHOST_ZID = "f266ece9a3e8dd1a401a7a334e320213"
|
||||
TUNNEL = "03079a26-f14c-4622-b463-ba54a24f7472"
|
||||
APP_UUID = "ira4bw4nhbvm87o7s3fgqu6v"
|
||||
CF = "https://api.cloudflare.com/client/v4"
|
||||
|
||||
c = paramiko.SSHClient()
|
||||
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
c.connect("10.10.0.1", username="admin", password=PASS, timeout=15)
|
||||
_, o, e = c.exec_command("cat /usr/local/etc/wan-dns-failover.env", timeout=30)
|
||||
o.channel.recv_exit_status()
|
||||
TOK = re.search(r"CLOUDFLARE_API_TOKEN=([^\s\"']+)", (o.read() + e.read()).decode()).group(1)
|
||||
c.close()
|
||||
|
||||
# DNS for exposedgays.onsethost.com -> tunnel (proxied)
|
||||
body = {
|
||||
"type": "CNAME",
|
||||
"name": "exposedgays.onsethost.com",
|
||||
"content": f"{TUNNEL}.cfargotunnel.com",
|
||||
"ttl": 1,
|
||||
"proxied": True,
|
||||
}
|
||||
req = urllib.request.Request(
|
||||
f"{CF}/zones/{ONSETHOST_ZID}/dns_records",
|
||||
data=json.dumps(body).encode(),
|
||||
method="POST",
|
||||
headers={"Authorization": f"Bearer {TOK}", "Content-Type": "application/json"},
|
||||
)
|
||||
try:
|
||||
with urllib.request.urlopen(req, timeout=30) as r:
|
||||
res = json.load(r)
|
||||
print("DNS POST:", res.get("success"), res.get("errors"))
|
||||
except Exception as ex:
|
||||
print("DNS:", ex)
|
||||
|
||||
# Add domain to Coolify app via DB
|
||||
ssh = paramiko.SSHClient()
|
||||
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
ssh.connect("10.10.0.10", username="localadministrator", password=PASS, timeout=30)
|
||||
cmds = [
|
||||
f"docker exec coolify-db psql -U coolify -d coolify -t -A -c \"SELECT fqdn FROM applications WHERE uuid='{APP_UUID}';\"",
|
||||
f"docker exec coolify-db psql -U coolify -d coolify -c \"UPDATE applications SET fqdn='https://exposedgays.com,https://www.exposedgays.com,https://exposedgays.onsethost.com' WHERE uuid='{APP_UUID}';\"",
|
||||
"docker exec coolify-db psql -U coolify -d coolify -t -A -c \"SELECT fqdn FROM applications WHERE uuid='ira4bw4nhbvm87o7s3fgqu6v';\"",
|
||||
"curl -sSI --max-time 20 -k -H 'Host: exposedgays.onsethost.com' https://127.0.0.1/ | head -10",
|
||||
"curl -sSI --max-time 20 https://exposedgays.onsethost.com/ 2>&1 | head -12",
|
||||
"curl -sSL --max-time 20 https://exposedgays.onsethost.com/ 2>&1 | head -c 300",
|
||||
]
|
||||
for cmd in cmds:
|
||||
print(f"\n$ {cmd[:100]}")
|
||||
_, o, e = ssh.exec_command(cmd, timeout=40)
|
||||
o.channel.recv_exit_status()
|
||||
print((o.read() + e.read()).decode(errors="replace")[:2000])
|
||||
ssh.close()
|
||||
Reference in New Issue
Block a user