Serve correct certs from app. Enable Windows and Android icons.

This commit is contained in:
Aldo Cortesi 2014-01-24 10:46:34 +13:00
parent 9044b8b8f5
commit 47c7e37723
2 changed files with 8 additions and 8 deletions

View File

@ -1,4 +1,5 @@
import flask import flask
import os.path
mapp = flask.Flask(__name__) mapp = flask.Flask(__name__)
mapp.debug = True mapp.debug = True
@ -13,15 +14,14 @@ def index():
@mapp.route("/cert/pem") @mapp.route("/cert/pem")
def certs_pem(): def certs_pem():
p = master().server.config.cacert capath = master().server.config.cacert
p = os.path.splitext(capath)[0] + "-cert.pem"
return flask.Response(open(p).read(), mimetype='application/x-x509-ca-cert') return flask.Response(open(p).read(), mimetype='application/x-x509-ca-cert')
@mapp.route("/cert/p12") @mapp.route("/cert/p12")
def certs_p12(): def certs_p12():
return flask.render_template("certs.html", section="certs") capath = master().server.config.cacert
p = os.path.splitext(capath)[0] + "-cert.p12"
return flask.Response(open(p).read(), mimetype='application/x-pkcs12')
@mapp.route("/cert/cer")
def certs_cer():
return flask.render_template("certs.html", section="certs")

View File

@ -8,9 +8,9 @@
<a href="/cert/pem"><i class="fa fa-apple fa-5x"></i></a> <a href="/cert/pem"><i class="fa fa-apple fa-5x"></i></a>
</p> </p>
<p><i class="fa fa-windows fa-5x"></i></p> <p><a href="/cert/p12"><i class="fa fa-windows fa-5x"></i></a></p>
<p><i class="fa fa-android fa-5x"></i></p> <p><a href="/cert/pem"><i class="fa fa-android fa-5x"></i></a></p>
</div> </div>
</div> </div>