Handle demo URLs and redirect them to root

This commit is contained in:
Alex Kelly 2020-01-06 14:31:05 -05:00
parent efe4533e72
commit 60b260c86f

View file

@ -1,6 +1,6 @@
#!/usr/bin/env python
"""Utilize crypto domains DNS and either redirect, or display information."""
from bottle import Bottle, run, response, request, static_file
from bottle import Bottle, run, response, request, static_file, redirect
import json
import requests
import json2html
@ -60,6 +60,8 @@ def root():
def redirectDomain(domain, action=None):
"""Handle the actual redirect for the domain queried"""
lookupResult = domainLookup(domain)
if domain == 'yourdomain.crypto' or domain == 'yourdomain.zil':
redirect('/')
if lookupResult:
redirect_url = lookupResult['ipfs']['redirect_domain']
ipfs_hash = lookupResult['ipfs']['html']