Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 35 additions & 1 deletion LinuxED.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def select_client(allow_custom=False):
module.exports = require('./core.asar');"""%injdir

# room for expansion (other params can be provided here)
optionsdict = [('Install ED',),('Uninstall ED',),('Update ED',),('Update LinuxED',),('Select Client',)]
optionsdict = [('Install ED',),('Install ED (Beta)',),('Uninstall ED',),('Update ED',),('Update ED (Beta)',),('Update LinuxED',),('Select Client',)]
if currentdir == False:
optionsdict.append(('Use current directory',))
else:
Expand Down Expand Up @@ -204,7 +204,29 @@ def select_client(allow_custom=False):
with open(cfgpath,"w") as cfg: cfg.write("{}")

print("EnhancedDiscord installation complete!\n")
elif option == 'Install ED (Beta)':
if not os.path.exists(enhanceddir):
print("Downloading ED...")
urllib.request.urlretrieve('https://github.com/joe27g/EnhancedDiscord/archive/beta.zip', '%s/EnhancedDiscord.zip' % tempdir)
with zipfile.ZipFile("%s/EnhancedDiscord.zip" % tempdir,"r") as zip_ref:
zip_ref.extractall(tempdir)
shutil.move("%s/EnhancedDiscord-beta" % tempdir, "%s/EnhancedDiscord" % dirpath)
os.remove("%s/EnhancedDiscord.zip" % tempdir)

if not os.path.exists(backuppath):
print("Creating index.js.backup...")
with open(jspath,'r') as original:
with open(backuppath,'w') as backup: backup.write(original.read())

print("Patching index.js...")
with open(jspath,"w") as idx: idx.write(patch)

cfgpath = "%s/config.json"%enhanceddir
if not os.path.exists(cfgpath):
print("Creating config.json...")
with open(cfgpath,"w") as cfg: cfg.write("{}")

print("EnhancedDiscord installation complete!\n")
elif option == 'Update ED':
if os.path.exists(enhanceddir):
print("Updating ED...")
Expand All @@ -217,6 +239,18 @@ def select_client(allow_custom=False):
print("Update complete!")
else:
print("It seems EnhancedDiscord is not installed in the current directory so it was unable to be updated.")
elif option == 'Update ED (Beta)':
if os.path.exists(enhanceddir):
print("Updating ED...")
urllib.request.urlretrieve('https://github.com/joe27g/EnhancedDiscord/archive/beta.zip', '%s/EDUpdate.zip' % tempdir)
with zipfile.ZipFile("%s/EDUpdate.zip" % tempdir,"r") as zip_ref:
zip_ref.extractall(tempdir)
distutils.dir_util.copy_tree('%s/EnhancedDiscord-beta' % tempdir, '%s/EnhancedDiscord' % dirpath)
shutil.rmtree("%s/EnhancedDiscord-beta" % tempdir)
os.remove("%s/EDUpdate.zip" % tempdir)
print("Update complete!")
else:
print("It seems EnhancedDiscord is not installed in the current directory so it was unable to be updated.")
elif option == 'Select Client':
print("Selecting new Discord client...")
backup = (client, jspath, version)
Expand Down