diff --git a/README.md b/README.md index def6909..ee42c56 100644 --- a/README.md +++ b/README.md @@ -115,4 +115,15 @@ Enable the free mode by setting the following environment variable. This will allow you to create a wordpress site without using a licence key using the /createsite command. ``` FREE_MODE: true -``` \ No newline at end of file +``` + + +## Hip2 +HIP2 allows sending HNS to a domain. +To enable HIP2 on your wordpress site you should + +1. Download the [HIP2 plugin](https://git.woodburn.au/nathanwoodburn/hnshosting-wp/raw/branch/main/assets/hns-wallet-plugin.zip) +2. Upload the plugin to your wordpress site +3. Activate the plugin +4. Go to the settings page and enter your HNS wallet address +5. Ensure it works by settings the permalink to post name and saving \ No newline at end of file diff --git a/assets/hns-wallet-plugin.zip b/assets/hns-wallet-plugin.zip new file mode 100644 index 0000000..fab70cb Binary files /dev/null and b/assets/hns-wallet-plugin.zip differ diff --git a/discord-bot/bot.py b/discord-bot/bot.py index cf7fa15..6293b17 100644 --- a/discord-bot/bot.py +++ b/discord-bot/bot.py @@ -71,6 +71,14 @@ async def license(ctx): @tree.command(name="createsite", description="Create a new WordPress site") async def createsite(ctx, domain: str, licence: str = None): + # Verify domain is valid + if domain == None: + await ctx.response.send_message("You must specify a domain",ephemeral=True) + return + if "http://" in domain or "https://" in domain: + await ctx.response.send_message("You must specify a domain without http:// or https://",ephemeral=True) + return + if FREE_LICENCE == True: # If free licences are enabled then auto generate a licence r = requests.post(f"http://{Master_IP}:{Master_Port}/add-licence",headers={"key":os.getenv('LICENCE_KEY')}) if r.status_code == 200: @@ -80,12 +88,12 @@ async def createsite(ctx, domain: str, licence: str = None): else: await ctx.response.send_message(f"Error getting license\n" + json['error']) return - + r = requests.post(f"http://{Master_IP}:{Master_Port}/new-site?domain={domain}",headers={"key":licence}) if r.status_code == 200: json = r.json() if json['success'] == "true": - await ctx.response.send_message(f"Site {domain} creating...\nI'll send you a message when it's ready") + await ctx.response.send_message(f"Site https://{domain} creating...\nI'll send you a message when it's ready") ready = False while ready == False: @@ -96,7 +104,7 @@ async def createsite(ctx, domain: str, licence: str = None): r = requests.get(f"http://{Master_IP}:{Master_Port}/site-info?domain={domain}") json = r.json() if json['success'] == "true": - await ctx.user.send(f"Site {domain} is ready!\nHere is the site info for {json['domain']}\nA: `{json['ip']}`\nTLSA: `{json['tlsa']}`\nMake sure you put the TLSA in either `_443._tcp.{domain}` or `*.{domain}`") + await ctx.user.send(f"Site https://{domain} is ready!\nHere is the site info for {json['domain']}\nA: `{json['ip']}`\nTLSA: `{json['tlsa']}`\nMake sure you put the TLSA in either `_443._tcp.{domain}` or `*.{domain}`") else: await ctx.user.send(f"Error getting site info\n" + json['error']) diff --git a/master/main.py b/master/main.py index 96575b9..c695878 100644 --- a/master/main.py +++ b/master/main.py @@ -233,37 +233,6 @@ def site_status(): else: return jsonify({'success': 'false', 'domain': domain, 'ip': publicIP, 'tlsa': 'none','error': 'No TLSA record found'}) - -@app.route('/info') -def site_status_human(): - domain = request.args.get('domain') - domain = domain.lower() - if domain == None: - return "
IP: " + publicIP + "
TLSA: " + tlsa + "
Make sure to add the TLSA record to `_443._tcp." + domain + "` or `*." + domain + "`
" - else: - return "IP: " + publicIP + "
TLSA: none
No TLSA record found
" - @app.route('/tlsa', methods=['GET']) def tlsa(): domain = request.args.get('domain') @@ -531,19 +500,20 @@ def register_post(): return redirect('/success?domain=' + domain + '&status=creating') @app.route('/success') +@app.route('/info') def success(): if 'domain' not in request.args: return redirect('/') domain = request.args.get('domain') domain = domain.lower() if not site_exists(domain): - return render_template('success.html', message="Error: Domain does not exist\nPlease contact support") + return render_template('success.html', title="Your site is installing." + domain + "
" + publicIP + "
" + tlsa + "
_443._tcp." + domain + "
or *." + domain + "
")
else:
- return render_template('success.html', message="Success\nDomain: " + domain + "\nIP: " + publicIP + "\nTLSA: Pending\nNo TLSA record found")
+ return render_template('success.html', title="Your site is installing." + domain + "
" + publicIP + "
Success
-{{message}}
+{{message | safe}}