Reworked Locals.com uploading
This commit is contained in:
@@ -24,70 +24,66 @@ DevModeMsgBox(Message){
|
||||
}
|
||||
|
||||
|
||||
CheckForUpdates(){
|
||||
CheckForUpdates(GitReleasesAPIURL){
|
||||
; msgbox, checking for updates
|
||||
Message = Checking For Updates
|
||||
SaveOrPostProgress(Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
SaveOrPostProgress(Message,PostType:="ErrorLoggingTextFile")
|
||||
|
||||
data := URLDownloadToVar(GitReleasesAPIURL)
|
||||
; Msgbox % "data: " data
|
||||
|
||||
parsed := JSON.Load(data)
|
||||
|
||||
UpdateVersionNumber := parsed.1.name
|
||||
|
||||
; DevModeMsgBox(UpdateVersionNumber)
|
||||
|
||||
|
||||
; Msgbox % "FreedomScriptsChangelogURL: " FreedomScriptsChangelogURL
|
||||
; Msgbox % "ChangelogIniFilepath: " ChangelogIniFilepath
|
||||
; Msgbox % "ScriptSettingsSectio: " ScriptSettingsSection
|
||||
; Msgbox % "SettingsIniFilepath: " SettingsIniFilepath
|
||||
if(ScriptVersion = UpdateVersionNumber OR ScriptVersion > UpdateVersionNumber){
|
||||
ToolTip
|
||||
return
|
||||
}
|
||||
else, {
|
||||
UpdateAvailable := 1
|
||||
; msgbox, update found!
|
||||
Message = Program Update Found
|
||||
SaveOrPostProgress(Message:=Message,PostType:="ErrorLoggingTextFile")
|
||||
; IniWrite, 1, %SettingsIniFilepath%, %ScriptSettingsSection%, UpdateAvailable
|
||||
; ToolTip
|
||||
return
|
||||
}
|
||||
|
||||
UrlDownloadToFile, %FreedomScriptsChangelogURL%, %ChangelogIniFilepath%
|
||||
if(ErrorLevel){
|
||||
Message = Failed to Download Changelog
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
Return
|
||||
}
|
||||
|
||||
IniRead, UpdateVersion, %ChangelogIniFilepath%, %ScriptSettingsSection%, ScriptVersion, %A_Space%
|
||||
if(UpdateVersion = ""){
|
||||
ToolTip
|
||||
; MsgBox, update version is blank.
|
||||
Return
|
||||
|
||||
}
|
||||
|
||||
|
||||
if(ScriptVersion != UpdateVersion){
|
||||
; msgbox, update found!
|
||||
Message = Script Update Found
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
IniWrite, 1, %SettingsIniFilepath%, %ScriptSettingsSection%, UpdateAvailable
|
||||
|
||||
GuiControl,, UpdateAvailable, Update Available - Click to View
|
||||
}
|
||||
else, {
|
||||
Message = No Updates Found
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
IniWrite, 0, %SettingsIniFilepath%, %ScriptSettingsSection%, UpdateAvailable
|
||||
|
||||
}
|
||||
ToolTip
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
UpdateScript(){
|
||||
; Msgbox % "ChangelogIniFilepath: " ChangelogIniFilepath
|
||||
; Msgbox % "ScriptSettingsSection: " ScriptSettingsSection
|
||||
data := URLDownloadToVar(GitReleasesAPIURL)
|
||||
|
||||
IniRead, Changelog, %ChangelogIniFilepath%, %ScriptSettingsSection%, Changelog, %A_Space%
|
||||
Changelog := StrReplace(Changelog, "--", "`n-")
|
||||
parsed := JSON.Load(data)
|
||||
|
||||
IniRead, UpdateVersion, %ChangelogIniFilepath%, %ScriptSettingsSection%, ScriptVersion, %A_Space%
|
||||
UpdateVersionNumber := parsed.1.name
|
||||
ChangeLog := parsed.1.body
|
||||
exename := parsed.1.assets.1.name
|
||||
exeURL := parsed.1.assets.1.browser_download_url
|
||||
|
||||
if(ScriptVersion = UpdateVersion){
|
||||
IniWrite, 0, %SettingsIniFilepath%, %ScriptSettingsSection%, UpdateAvailable
|
||||
; Msgbox % "UpdateVersionNumber: " UpdateVersionNumber
|
||||
; msgbox, Version: %Version%
|
||||
; Msgbox % "ChangeLog: " ChangeLog
|
||||
; Msgbox % "exeURL: " exeURL
|
||||
; Msgbox % "exename: " exename
|
||||
|
||||
ExeName := StrReplace(exename, ".exe", "")
|
||||
UpdateExeName = %exename% %UpdateVersionNumber%.exe
|
||||
UpdateExeFilepath = %A_ScriptDir%\%UpdateExeName%
|
||||
|
||||
if(ScriptVersion = UpdateVersionNumber){
|
||||
; IniWrite, 0, %SettingsIniFilepath%, %ScriptSettingsSection%, UpdateAvailable
|
||||
MsgBox, You are Up-To-Date
|
||||
; IniRead, UpdateAvailable, %SettingsIniFilepath%, %ScriptSettingsSection%, UpdateAvailable, 0
|
||||
return
|
||||
}
|
||||
|
||||
Changelog = %ScriptVersion% -> %UpdateVersion%`n`n-%Changelog%
|
||||
Changelog = %ScriptVersion% --> %UpdateVersionNumber%`n%Changelog%
|
||||
|
||||
OnMessage(0x44, "OnMsgBoxUpdateAvailable")
|
||||
MsgBox 0x44, Update Available, %Changelog%
|
||||
@@ -95,13 +91,16 @@ UpdateScript(){
|
||||
|
||||
IfMsgBox Yes, {
|
||||
Return
|
||||
} Else IfMsgBox No, {
|
||||
run, "%FreedomainProgramUpdaterFilepath%" "%ScriptSettingsSection%"
|
||||
; Return
|
||||
ExitApp
|
||||
}
|
||||
return
|
||||
}
|
||||
Else IfMsgBox No, {
|
||||
SaveOrPostProgress(Message:="Downloading Update",PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
; Msgbox, downloading to: %A_ScriptDir%\%UpdateExeName%
|
||||
UrlDownloadToFile, %exeURL%, %UpdateExeFilepath%
|
||||
run, "%UpdateExeFilepath%" "%A_ScriptFullPath%"
|
||||
ExitApp
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1020,6 +1019,8 @@ if(TotalTabsFound = 1){
|
||||
|
||||
SaveDriverURL(){ ; save the url of the result page. That way if a tab is not found for a site, we can open up a tab from this tab instead of middle of nowhere. That way we can keep the tabs together
|
||||
try LastWebsitePostURL := driver.URL
|
||||
|
||||
return LastWebsitePostURL
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user