feat: Add cert renewing
This commit is contained in:
parent
0e71442339
commit
1c80c65b0f
main.py
templates
27
main.py
27
main.py
@ -313,6 +313,33 @@ def publish():
|
|||||||
response.set_cookie('auth', '', expires=0)
|
response.set_cookie('auth', '', expires=0)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
@app.route('/renew')
|
||||||
|
def renew():
|
||||||
|
if 'auth' not in request.cookies:
|
||||||
|
return redirect('/')
|
||||||
|
auth = request.cookies['auth']
|
||||||
|
|
||||||
|
for i in cookies:
|
||||||
|
if i['cookie'] == auth:
|
||||||
|
# Load site content
|
||||||
|
if os.path.isfile(f'sites/{i["name"]}.json'):
|
||||||
|
with open(f'sites/{i["name"]}.json') as file:
|
||||||
|
data = json.load(file)
|
||||||
|
|
||||||
|
def regenerate_ssl_and_write_nginx():
|
||||||
|
tlsa = nginx.generate_ssl(i['name'])
|
||||||
|
data['tlsa'] = tlsa
|
||||||
|
with open(f'sites/{i["name"]}.json', 'w') as file:
|
||||||
|
json.dump(data, file)
|
||||||
|
nginx.write_nginx_conf(i['name'])
|
||||||
|
|
||||||
|
threading.Thread(target=regenerate_ssl_and_write_nginx).start()
|
||||||
|
return redirect('/publishing')
|
||||||
|
|
||||||
|
response = make_response(redirect('/'))
|
||||||
|
response.set_cookie('auth', '', expires=0)
|
||||||
|
return response
|
||||||
|
|
||||||
@app.route('/nostr')
|
@app.route('/nostr')
|
||||||
def nostr():
|
def nostr():
|
||||||
if 'auth' not in request.cookies:
|
if 'auth' not in request.cookies:
|
||||||
|
@ -10,10 +10,10 @@
|
|||||||
<meta name="twitter:card" content="summary">
|
<meta name="twitter:card" content="summary">
|
||||||
<meta property="og:type" content="website">
|
<meta property="og:type" content="website">
|
||||||
<meta property="og:title" content="HNS Links">
|
<meta property="og:title" content="HNS Links">
|
||||||
<meta name="description" content="Create a links page for your domain">
|
|
||||||
<meta property="og:description" content="Create a links page for your domain">
|
<meta property="og:description" content="Create a links page for your domain">
|
||||||
<meta property="og:image" content="https://links.hns.au/assets/img/dashboard.png">
|
|
||||||
<meta name="twitter:description" content="Create a links page for your domain">
|
<meta name="twitter:description" content="Create a links page for your domain">
|
||||||
|
<meta name="description" content="Create a links page for your domain">
|
||||||
|
<meta property="og:image" content="https://links.hns.au/assets/img/dashboard.png">
|
||||||
<link rel="icon" type="image/png" sizes="600x627" href="/assets/img/favicon.png">
|
<link rel="icon" type="image/png" sizes="600x627" href="/assets/img/favicon.png">
|
||||||
<link rel="icon" type="image/png" sizes="600x627" href="/assets/img/favicon.png">
|
<link rel="icon" type="image/png" sizes="600x627" href="/assets/img/favicon.png">
|
||||||
<link rel="icon" type="image/png" sizes="600x627" href="/assets/img/favicon.png">
|
<link rel="icon" type="image/png" sizes="600x627" href="/assets/img/favicon.png">
|
||||||
|
File diff suppressed because one or more lines are too long
@ -10,10 +10,10 @@
|
|||||||
<meta name="twitter:card" content="summary">
|
<meta name="twitter:card" content="summary">
|
||||||
<meta property="og:type" content="website">
|
<meta property="og:type" content="website">
|
||||||
<meta property="og:title" content="HNS Links">
|
<meta property="og:title" content="HNS Links">
|
||||||
<meta name="description" content="Create a links page for your domain">
|
|
||||||
<meta property="og:description" content="Create a links page for your domain">
|
<meta property="og:description" content="Create a links page for your domain">
|
||||||
<meta property="og:image" content="https://links.hns.au/assets/img/dashboard.png">
|
|
||||||
<meta name="twitter:description" content="Create a links page for your domain">
|
<meta name="twitter:description" content="Create a links page for your domain">
|
||||||
|
<meta name="description" content="Create a links page for your domain">
|
||||||
|
<meta property="og:image" content="https://links.hns.au/assets/img/dashboard.png">
|
||||||
<script type="application/ld+json">
|
<script type="application/ld+json">
|
||||||
{
|
{
|
||||||
"@context": "http://schema.org",
|
"@context": "http://schema.org",
|
||||||
|
@ -10,10 +10,10 @@
|
|||||||
<meta name="twitter:card" content="summary">
|
<meta name="twitter:card" content="summary">
|
||||||
<meta property="og:type" content="website">
|
<meta property="og:type" content="website">
|
||||||
<meta property="og:title" content="HNS Links">
|
<meta property="og:title" content="HNS Links">
|
||||||
<meta name="description" content="Create a links page for your domain">
|
|
||||||
<meta property="og:description" content="Create a links page for your domain">
|
<meta property="og:description" content="Create a links page for your domain">
|
||||||
<meta property="og:image" content="https://links.hns.au/assets/img/dashboard.png">
|
|
||||||
<meta name="twitter:description" content="Create a links page for your domain">
|
<meta name="twitter:description" content="Create a links page for your domain">
|
||||||
|
<meta name="description" content="Create a links page for your domain">
|
||||||
|
<meta property="og:image" content="https://links.hns.au/assets/img/dashboard.png">
|
||||||
<link rel="icon" type="image/png" sizes="600x627" href="/assets/img/favicon.png">
|
<link rel="icon" type="image/png" sizes="600x627" href="/assets/img/favicon.png">
|
||||||
<link rel="icon" type="image/png" sizes="600x627" href="/assets/img/favicon.png">
|
<link rel="icon" type="image/png" sizes="600x627" href="/assets/img/favicon.png">
|
||||||
<link rel="icon" type="image/png" sizes="600x627" href="/assets/img/favicon.png">
|
<link rel="icon" type="image/png" sizes="600x627" href="/assets/img/favicon.png">
|
||||||
|
@ -10,10 +10,10 @@
|
|||||||
<meta name="twitter:card" content="summary">
|
<meta name="twitter:card" content="summary">
|
||||||
<meta property="og:type" content="website">
|
<meta property="og:type" content="website">
|
||||||
<meta property="og:title" content="HNS Links">
|
<meta property="og:title" content="HNS Links">
|
||||||
<meta name="description" content="Create a links page for your domain">
|
|
||||||
<meta property="og:description" content="Create a links page for your domain">
|
<meta property="og:description" content="Create a links page for your domain">
|
||||||
<meta property="og:image" content="https://links.hns.au/assets/img/dashboard.png">
|
|
||||||
<meta name="twitter:description" content="Create a links page for your domain">
|
<meta name="twitter:description" content="Create a links page for your domain">
|
||||||
|
<meta name="description" content="Create a links page for your domain">
|
||||||
|
<meta property="og:image" content="https://links.hns.au/assets/img/dashboard.png">
|
||||||
<link rel="icon" type="image/png" sizes="600x627" href="/assets/img/favicon.png">
|
<link rel="icon" type="image/png" sizes="600x627" href="/assets/img/favicon.png">
|
||||||
<link rel="icon" type="image/png" sizes="600x627" href="/assets/img/favicon.png">
|
<link rel="icon" type="image/png" sizes="600x627" href="/assets/img/favicon.png">
|
||||||
<link rel="icon" type="image/png" sizes="600x627" href="/assets/img/favicon.png">
|
<link rel="icon" type="image/png" sizes="600x627" href="/assets/img/favicon.png">
|
||||||
|
@ -10,10 +10,10 @@
|
|||||||
<meta name="twitter:card" content="summary">
|
<meta name="twitter:card" content="summary">
|
||||||
<meta property="og:type" content="website">
|
<meta property="og:type" content="website">
|
||||||
<meta property="og:title" content="HNS Links">
|
<meta property="og:title" content="HNS Links">
|
||||||
<meta name="description" content="Create a links page for your domain">
|
|
||||||
<meta property="og:description" content="Create a links page for your domain">
|
<meta property="og:description" content="Create a links page for your domain">
|
||||||
<meta property="og:image" content="https://links.hns.au/assets/img/dashboard.png">
|
|
||||||
<meta name="twitter:description" content="Create a links page for your domain">
|
<meta name="twitter:description" content="Create a links page for your domain">
|
||||||
|
<meta name="description" content="Create a links page for your domain">
|
||||||
|
<meta property="og:image" content="https://links.hns.au/assets/img/dashboard.png">
|
||||||
<link rel="icon" type="image/png" sizes="600x627" href="/assets/img/favicon.png">
|
<link rel="icon" type="image/png" sizes="600x627" href="/assets/img/favicon.png">
|
||||||
<link rel="icon" type="image/png" sizes="600x627" href="/assets/img/favicon.png">
|
<link rel="icon" type="image/png" sizes="600x627" href="/assets/img/favicon.png">
|
||||||
<link rel="icon" type="image/png" sizes="600x627" href="/assets/img/favicon.png">
|
<link rel="icon" type="image/png" sizes="600x627" href="/assets/img/favicon.png">
|
||||||
@ -93,7 +93,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<p style="display: inline-block;">Text</p><input class="form-control form-control-color" type="color" style="display: inline-block;margin-left: 25px;height: 2em;" name="btn_fg" value="{{btn_fg}}">
|
<p style="display: inline-block;">Text</p><input class="form-control form-control-color" type="color" style="display: inline-block;margin-left: 25px;height: 2em;" name="btn_fg" value="{{btn_fg}}">
|
||||||
</div>
|
</div>
|
||||||
</div><input class="btn btn-primary" type="submit" value="Save" style="margin-right: 20px;"><a class="btn btn-primary" role="button" href="/publish">Publish</a>
|
</div><input class="btn btn-primary" type="submit" value="Save" style="margin: 10px;margin-right: 20px;"><a class="btn btn-primary" role="button" href="/publish" style="margin: 10px;">Publish</a><a class="btn btn-primary" role="button" href="/renew" style="margin: 10px;">Refresh SSL cert</a>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6" style="text-align: center;">{{preview|safe}}<a class="btn btn-primary" role="button" href="/nostr" style="margin-top: 1em;">Link Nostr</a></div>
|
<div class="col-md-6" style="text-align: center;">{{preview|safe}}<a class="btn btn-primary" role="button" href="/nostr" style="margin-top: 1em;">Link Nostr</a></div>
|
||||||
|
@ -10,10 +10,10 @@
|
|||||||
<meta name="twitter:card" content="summary">
|
<meta name="twitter:card" content="summary">
|
||||||
<meta property="og:type" content="website">
|
<meta property="og:type" content="website">
|
||||||
<meta property="og:title" content="HNS Links">
|
<meta property="og:title" content="HNS Links">
|
||||||
<meta name="description" content="Create a links page for your domain">
|
|
||||||
<meta property="og:description" content="Create a links page for your domain">
|
<meta property="og:description" content="Create a links page for your domain">
|
||||||
<meta property="og:image" content="https://links.hns.au/assets/img/dashboard.png">
|
|
||||||
<meta name="twitter:description" content="Create a links page for your domain">
|
<meta name="twitter:description" content="Create a links page for your domain">
|
||||||
|
<meta name="description" content="Create a links page for your domain">
|
||||||
|
<meta property="og:image" content="https://links.hns.au/assets/img/dashboard.png">
|
||||||
<link rel="icon" type="image/png" sizes="600x627" href="/assets/img/favicon.png">
|
<link rel="icon" type="image/png" sizes="600x627" href="/assets/img/favicon.png">
|
||||||
<link rel="icon" type="image/png" sizes="600x627" href="/assets/img/favicon.png">
|
<link rel="icon" type="image/png" sizes="600x627" href="/assets/img/favicon.png">
|
||||||
<link rel="icon" type="image/png" sizes="600x627" href="/assets/img/favicon.png">
|
<link rel="icon" type="image/png" sizes="600x627" href="/assets/img/favicon.png">
|
||||||
|
Loading…
Reference in New Issue
Block a user