figenc

[RADIOACTIVE] rsa and symmetric key encryption scripts and executables
git clone git://git.figbert.com/figenc.git
Log | Files | Refs | README

version_check.py (1262B)


      1 import requests, sys
      2 from path import find_path
      3 
      4 def update_available():
      5     """Check against the current app version for
      6     update availability. Return "available" if there's
      7     an update available, "updated" if there's none available,
      8     and "offline" if figENC can't establish a connection.
      9     """
     10     try:
     11         if sys.platform == "darwin":
     12             git_import = requests.get(
     13                 ("https://raw.githubusercontent.com/therealFIGBERT/figENC/"
     14                 "master/Executables/figENC_MacOS/figENC.app/Contents/Resources"
     15                 "/version.txt?token=AEAWGCM6DNTALDSEJWBNUTC5UTU74"
     16                 )
     17             ).text
     18         else:
     19             git_import = requests.get(
     20                 ("https://raw.githubusercontent.com/therealFIGBERT/figENC/"
     21                 "master/Executables/figENC_Windows/version.txt?token=AEAWGCM6DNTALDSEJWBNUTC5UTU74"
     22                 )
     23             ).text
     24     except requests.exceptions.ConnectionError:
     25         return "offline"
     26     version_file = find_path("version.txt")
     27     with open(version_file) as local:
     28         local_version = local.read()
     29     if local_version < git_import:
     30         return "available"
     31     elif local_version > git_import:
     32         return "dev"
     33     else:
     34         return "updated"