diff --git a/onionshare/onionshare.py b/onionshare/onionshare.py index 22a7b59f..59fcfb89 100644 --- a/onionshare/onionshare.py +++ b/onionshare/onionshare.py @@ -27,7 +27,7 @@ filename = filehash = filesize = '' @app.route("/{0}".format(slug)) 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(), 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] def main(): + global filename, filehash, filesize load_strings() # validate filename @@ -86,6 +87,8 @@ def main(): filename = sys.argv[1] if not os.path.isfile(filename): sys.exit(strings["not_a_file"].format(filename)) + else: + filename = os.path.abspath(filename) # calculate filehash, file size print strings["calculating_sha1"] @@ -140,3 +143,6 @@ def main(): # shutdown tails_close_port(port) + +if __name__ == '__main__': + main() diff --git a/onionshare/strings.json b/onionshare/strings.json index a342ea25..99802400 100644 --- a/onionshare/strings.json +++ b/onionshare/strings.json @@ -53,15 +53,4 @@ "not_a_file": "{0} non è un file.", "filesize": "Grandezza del file", "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" }}