diff --git a/AppData.json b/AppData.json index 166150f..b06ca12 100644 --- a/AppData.json +++ b/AppData.json @@ -45,8 +45,9 @@ "name": "FloSharedSecret", "icon": "Icon/SharedSecret.png", "type": "Gui", - "location": "apps/FLO-Shared-Secret/", - "exec": "./FLO_Secret" + "location": "apps/FLO-shared-secret/", + "exec": "bin/FLO_Secret", + "github": "https://github.com/akhil2015/FLO-shared-secret.git" }, { "id": "7", diff --git a/apps/FLO-Shared-Secret/FLO_Secret b/apps/FLO-Shared-Secret/FLO_Secret deleted file mode 100755 index b8c9668..0000000 Binary files a/apps/FLO-Shared-Secret/FLO_Secret and /dev/null differ diff --git a/apps/FLO-Shared-Secret/Flo.png b/apps/FLO-Shared-Secret/Flo.png deleted file mode 100644 index 229d45c..0000000 Binary files a/apps/FLO-Shared-Secret/Flo.png and /dev/null differ diff --git a/apps/FLO-Shared-Secret/flo.png b/apps/FLO-Shared-Secret/flo.png deleted file mode 100644 index 229d45c..0000000 Binary files a/apps/FLO-Shared-Secret/flo.png and /dev/null differ diff --git a/main.py b/main.py index 12a97dd..119bad7 100755 --- a/main.py +++ b/main.py @@ -92,27 +92,48 @@ class FLOappStore: print(app["name"]) self.appWin = Toplevel() self.appWin.title(app["name"]) - self.appWin.geometry("500x100") - self.appWin.resizable(0,0) - if(app["type"] == "Gui"): - openButton = Button(self.appWin,text="Open App",command=lambda :self.openGuiApp(app)) - updateButton = Button(self.appWin) - openButton.pack() - elif(app["type"] == "Cmdline"): - openButton = Button(self.appWin,text="Open Terminal",command=lambda :self.openCmdLineApp(app)) - openButton.pack() + #self.appWin.geometry("500x100") + #self.appWin.resizable(0,0) + if(app["type"] == "Gui" or app["type"] == "Cmdline"): + if(os.path.isdir(app["location"]) and subprocess.Popen("git config --get remote.origin.url",cwd=app["location"],stdout=subprocess.PIPE,shell=True).communicate()[0].decode("utf-8").strip()==app["github"]): + openButton = Button(self.appWin,text="Open App",command=lambda :self.openApp(app)) + openButton.pack() + if(subprocess.Popen("git diff --raw",cwd=app["location"],stdout=subprocess.PIPE,shell=True).communicate()[0].decode("utf-8")!=""): + updateButton = Button(self.appWin,text="Update App",command=lambda :self.updateApp(app)) + updateButton.pack() + removeButton = Button(self.appWin,text="Remove App",command=lambda :self.removeApp(app)) + removeButton.pack() + else: + downloadButton = Button(self.appWin,text="Download App",command=lambda :self.downloadApp(app)) + downloadButton.pack() elif(app["type"] == "Webapp"): openButton = Button(self.appWin,text="Open Browser",command=lambda :self.openBrowserApp(app)) openButton.pack() self.appWin.mainloop() - def openGuiApp(self,app): + def downloadApp(self,app): self.appWin.destroy() - subprocess.Popen(app["exec"], cwd=app["location"]) + subprocess.Popen(['rm', '-rf', app['location']]) + subprocess.Popen("gnome-terminal -- git clone %s"%(app["github"]),cwd="apps/",shell=True) + messagebox.showinfo(app['name'], f"Downloading {app['name']}...\n Please Wait until the downloader closes") - def openCmdLineApp(self,app): + def removeApp(self,app): self.appWin.destroy() - subprocess.Popen(["gnome-terminal --command %s" % (app["exec"])],cwd=app["location"],stdout=subprocess.PIPE,shell=True) + subprocess.Popen(['rm', '-rf', app['location']]) + messagebox.showinfo(app['name'], f"Removed {app['name']}...") + + def updateApp(self,app): + self.appWin.destroy() + subprocess.Popen("gnome-terminal -- git fetch --all",cwd=app['location'],shell=True) + subprocess.Popen("gnome-terminal -- git reset --hard HEAD ",cwd=app['location'],shell=True) + messagebox.showinfo(app['name'], f"Updating {app['name']}...\n Please Wait until the updater closes") + + def openApp(self,app): + self.appWin.destroy() + if(app["type"] == "Gui"): + subprocess.Popen(app["exec"], cwd=app["location"]) + elif(app["type"] == "Cmdline"): + subprocess.Popen(["gnome-terminal --command",app["exec"]],cwd=app["location"],stdout=subprocess.PIPE,shell=True) def openBrowserApp(self,app): self.appWin.destroy() diff --git a/test.py b/test.py index 78fffbc..d72c508 100644 --- a/test.py +++ b/test.py @@ -4,8 +4,10 @@ import subprocess import os import webbrowser import json - - -i=[] -i = i+[1] -print(i) \ No newline at end of file +app={} +app["location"] = 'apps/FLO-shared-secret/' +app["github"] = "https://github.com/akhil2015/FLO-shared-secret.git" +print(os.path.isdir(app["location"])) +#print(os.path.isdir(app["location"]) and subprocess.Popen("git config --get remote.origin.url",cwd=app["location"],stdout=subprocess.PIPE,shell=True).communicate()[0].decode("utf-8")==app["github"]) +#print(subprocess.Popen("git diff --raw",cwd=app["location"],stdout=subprocess.PIPE,shell=True).communicate()[0]=="") +subprocess.Popen(['rm', '-rf', app['location']]) \ No newline at end of file