Merge branch 'master' into gui

This commit is contained in:
Micah Lee 2014-05-29 22:35:20 -04:00
commit 33cd3ba0ea
2 changed files with 7 additions and 12 deletions

View File

@ -27,7 +27,7 @@ filename = filehash = filesize = ''
@app.route("/{0}".format(slug)) @app.route("/{0}".format(slug))
def index(): def index():
global filename, filesize, filehash, slug global filename, filesize, filehash, slug, strings
return render_template_string(open('{0}/index.html'.format(os.path.dirname(__file__))).read(), 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, strings=strings) slug=slug, filename=os.path.basename(filename), filehash=filehash, filesize=filesize, strings=strings)
@ -78,6 +78,7 @@ def load_strings(default="en"):
strings = translated[lang] strings = translated[lang]
def main(): def main():
global filename, filehash, filesize
load_strings() load_strings()
# validate filename # validate filename
@ -86,6 +87,8 @@ def main():
filename = sys.argv[1] filename = sys.argv[1]
if not os.path.isfile(filename): if not os.path.isfile(filename):
sys.exit(strings["not_a_file"].format(filename)) sys.exit(strings["not_a_file"].format(filename))
else:
filename = os.path.abspath(filename)
# calculate filehash, file size # calculate filehash, file size
print strings["calculating_sha1"] print strings["calculating_sha1"]
@ -140,3 +143,6 @@ def main():
# shutdown # shutdown
tails_close_port(port) tails_close_port(port)
if __name__ == '__main__':
main()

View File

@ -53,15 +53,4 @@
"not_a_file": "{0} non è un file.", "not_a_file": "{0} non è un file.",
"filesize": "Grandezza del file", "filesize": "Grandezza del file",
"sha1_checksum": "firma SHA1" "sha1_checksum": "firma SHA1"
}, "fi": {
"punching_a_hole": "Avataan reikä palomuuriin.",
"closing_hole": "Suljetaan palomuurin reikä.",
"calculating_sha1": "Lasketaan SHA1 tarkistussumma.",
"connecting_ctrlport": "Luodaan piilopalvelu porttiin {0} Tor-hallintaportin avulla.",
"cant_connect_ctrlport": "Yhteyttä Tor-hallintaporttiin {0} ei voitu luoda. Onko Tor-ohjelma ajossa?",
"give_this_url": "Anna tämä osoite henkilölle jolle haluat lähettää tiedoston:",
"ctrlc_to_stop": "Paina Ctrl-C pysäyttääksesi palvelun",
"not_a_file": "{0} ei ole tiedosto.",
"filesize": "Tiedoston koko",
"sha1_checksum": "SHA1 tarkistussumma"
}} }}