Update server.py
This commit is contained in:
parent
fbcc11e871
commit
487a86e57e
1 changed files with 3 additions and 3 deletions
|
@ -41,13 +41,13 @@ def loadcert_backend():
|
||||||
if allowed_file(cert.filename) and allowed_file(privkey.filename):
|
if allowed_file(cert.filename) and allowed_file(privkey.filename):
|
||||||
for i in os.listdir(homefolder + "/certs/"):
|
for i in os.listdir(homefolder + "/certs/"):
|
||||||
thisname = "-".join(i.split("-")[:-1])
|
thisname = "-".join(i.split("-")[:-1])
|
||||||
if (open(homefolder + "/certs/" + thisname + "-privkey.pem").read() == privkeyy) and (open(homefolder + "/certs/" + thisname + "-chain.pem").read() == certt):
|
if (open(homefolder + "/certs/" + thisname + "-privkey.pem").read() == privkeyy.decode()) and (open(homefolder + "/certs/" + thisname + "-chain.pem").read() == certt.decode()):
|
||||||
resp = make_response('<meta name="viewport" content="width=device-width, initial-scale=1.0"><link rel="stylesheet" href="/style.css">The certificate seems to already exist, loading the used file.<br><br><p><a href="/" class=go style="color: white;">Go home</a></p>')
|
resp = make_response('<meta name="viewport" content="width=device-width, initial-scale=1.0"><link rel="stylesheet" href="/style.css">The certificate seems to already exist, loading the used file.<br><br><p><a href="/" class=go style="color: white;">Go home</a></p>')
|
||||||
resp.set_cookie('certname',thisname)
|
resp.set_cookie('certname',thisname)
|
||||||
return resp
|
return resp
|
||||||
random_name = str(uuid.uuid4())
|
random_name = str(uuid.uuid4())
|
||||||
open(homefolder + "/certs/" + random_name + "-chain.pem", 'w').write(certt)
|
open(homefolder + "/certs/" + random_name + "-chain.pem", 'wb').write(certt)
|
||||||
open(homefolder + "/certs/" + random_name + "-privkey.pem", 'w').write(privkeyy)
|
open(homefolder + "/certs/" + random_name + "-privkey.pem", 'wb').write(privkeyy)
|
||||||
resp = make_response('<meta name="viewport" content="width=device-width, initial-scale=1.0"><link rel="stylesheet" href="/style.css">Success!<br><br><p><a href="/" class=go style="color: white;">Go home</a></p>')
|
resp = make_response('<meta name="viewport" content="width=device-width, initial-scale=1.0"><link rel="stylesheet" href="/style.css">Success!<br><br><p><a href="/" class=go style="color: white;">Go home</a></p>')
|
||||||
resp.set_cookie('certname',random_name)
|
resp.set_cookie('certname',random_name)
|
||||||
return resp
|
return resp
|
||||||
|
|
Loading…
Add table
Reference in a new issue