test the fuckjing webhook dammit

This commit is contained in:
C committed 2025-12-20 16:14:18 -08:00
1 parent cca9d94b36
commit 7cc6503b94
3 files changed
+31 -15

No files matched your search

+28 -12
View File
@@ -7,6 +7,7 @@ import subprocess
import sys import sys
import os import os
def generate_certificate(): def generate_certificate():
"""Generate self-signed certificate using OpenSSL""" """Generate self-signed certificate using OpenSSL"""
@@ -15,12 +16,13 @@ def generate_certificate():
# Check if OpenSSL is available # Check if OpenSSL is available
try: try:
subprocess.run(["openssl", "version"], subprocess.run(["openssl", "version"], capture_output=True, check=True)
capture_output=True, check=True)
except (subprocess.CalledProcessError, FileNotFoundError): except (subprocess.CalledProcessError, FileNotFoundError):
print("ERROR: OpenSSL not found!") print("ERROR: OpenSSL not found!")
print("\nFor Windows, you can:") print("\nFor Windows, you can:")
print("1. Install OpenSSL from: https://slproweb.com/products/Win32OpenSSL.html") print(
"1. Install OpenSSL from: https://slproweb.com/products/Win32OpenSSL.html"
)
print("2. Or use Git Bash which includes OpenSSL") print("2. Or use Git Bash which includes OpenSSL")
print("3. Or use WSL (Windows Subsystem for Linux)") print("3. Or use WSL (Windows Subsystem for Linux)")
return False return False
@@ -31,13 +33,20 @@ def generate_certificate():
# Generate certificate valid for 365 days # Generate certificate valid for 365 days
cmd = [ cmd = [
"openssl", "req", "-x509", "openssl",
"-newkey", "rsa:4096", "req",
"-keyout", key_file, "-x509",
"-out", cert_file, "-newkey",
"-days", "365", "rsa:4096",
"-keyout",
key_file,
"-out",
cert_file,
"-days",
"365",
"-nodes", # No passphrase "-nodes", # No passphrase
"-subj", "/C=US/ST=State/L=City/O=Organization/CN=localhost" "-subj",
"/C=US/ST=State/L=City/O=Organization/CN=localhost",
] ]
try: try:
@@ -45,16 +54,23 @@ def generate_certificate():
print(f"\n✓ Certificate created: {os.path.abspath(cert_file)}") print(f"\n✓ Certificate created: {os.path.abspath(cert_file)}")
print(f"✓ Private key created: {os.path.abspath(key_file)}") print(f"✓ Private key created: {os.path.abspath(key_file)}")
print("\nYou can now run the server with HTTPS:") print("\nYou can now run the server with HTTPS:")
print(f" python src/test_server.py --ssl-cert {cert_file} --ssl-key {key_file} --hook-port 8443") print(
f" python src/test_server.py --ssl-cert {cert_file} --ssl-key {key_file} --hook-port 8443"
)
print("\nOr webhook-only HTTPS:") print("\nOr webhook-only HTTPS:")
print(f" python src/test_server.py --ssl-cert {cert_file} --ssl-key {key_file} --hook-port 8443 --hook-ssl-only") print(
print("\nNote: Self-signed certificates will show security warnings in browsers.") f" python src/test_server.py --ssl-cert {cert_file} --ssl-key {key_file} --hook-port 8443 --hook-ssl-only"
)
print(
"\nNote: Self-signed certificates will show security warnings in browsers."
)
print("For production, use certificates from a trusted CA like Let's Encrypt.") print("For production, use certificates from a trusted CA like Let's Encrypt.")
return True return True
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e:
print(f"ERROR: Failed to generate certificate: {e}") print(f"ERROR: Failed to generate certificate: {e}")
return False return False
if __name__ == "__main__": if __name__ == "__main__":
if not generate_certificate(): if not generate_certificate():
sys.exit(1) sys.exit(1)
+2 -2
View File
@@ -306,9 +306,9 @@ if __name__ == "__main__":
await site1.start() await site1.start()
await site2.start() await site2.start()
print(f"Main server running on {protocol_main}://{args.host}:{args.port}") print(f"Starting main server on {args.host}:{args.port} ({protocol_main})")
print( print(
f"Webhook server running on {protocol_hook}://{args.host}:{args.hook_port}/hook" f"Starting webhook server on {args.host}:{args.hook_port} ({protocol_hook})"
) )
# Keep running # Keep running
+1 -1
View File
@@ -9,7 +9,7 @@ import json
async def test_webhook(): async def test_webhook():
url = "http://localhost:7432/hook" url = "https://studspider.sh:8443/hook"
# Your Square webhook payload # Your Square webhook payload
payload = { payload = {