diff --git a/index.html b/index.html new file mode 100644 index 00000000..9688198a --- /dev/null +++ b/index.html @@ -0,0 +1,72 @@ + + + OnionShare + + + +

{{ filename }} ▼

+ +
+

File size: {{ filesize }} bytes

+

SHA1 checksum: {{ filehash }}

+
+ + diff --git a/onionshare.py b/onionshare.py index 65613cea..5f7d2c70 100755 --- a/onionshare.py +++ b/onionshare.py @@ -9,7 +9,7 @@ sys.path.append(os.path.dirname(__file__)+'/lib') from stem.control import Controller from stem import SocketError -from flask import Flask, Markup, Response, request, make_response, send_from_directory +from flask import Flask, Markup, Response, request, make_response, send_from_directory, render_template_string app = Flask(__name__) # generate an unguessable string @@ -21,7 +21,8 @@ filename = filehash = filesize = '' @app.route("/{0}".format(slug)) def index(): global filename, filesize, filehash, slug - return "OnionShare

{1}

SHA1 checksum: {2}
File size: {3} bytes

".format(slug, os.path.basename(filename), filehash, filesize) + return render_template_string(open('{0}/index.html'.format(os.path.dirname(__file__))).read(), + slug=slug, filename=os.path.basename(filename), filehash=filehash, filesize=filesize) @app.route("/{0}/download".format(slug)) def download():