Moved auto update check to before GUI creation, updated to use gitea API
This commit is contained in:
@@ -30,45 +30,86 @@ DevModeMsgBox(Message){
|
||||
CheckForUpdates(){
|
||||
; msgbox, checking for updates
|
||||
Message = Checking For Updates
|
||||
SaveOrPostProgress(Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
SaveOrPostProgress(Message,PostType:="ErrorLoggingTextFile")
|
||||
|
||||
data := URLDownloadToVar(GitReleasesAPIURL)
|
||||
; Msgbox % "data: " data
|
||||
|
||||
; [{"id":3,"tag_name":"v2.71","target_commitish":"main","name":"2.71","body":"- Fixed and expanded Parler login check\r\n- Fixed long time bug where a newly created website tab would not get connected to properly\r\n- Temporarily removed Auto Update Support until I can integrate with gitea API","url":"https://git.zinchuk.xyz/api/v1/repos/yuriy/Freedomain_Social_Media_Poster/releases/3","html_url":"https://git.zinchuk.xyz/yuriy/Freedomain_Social_Media_Poster/releases/tag/v2.71","tarball_url":"https://git.zinchuk.xyz/yuriy/Freedomain_Social_Media_Poster/archive/v2.71.tar.gz","zipball_url":"https://git.zinchuk.xyz/yuriy/Freedomain_Social_Media_Poster/archive/v2.71.zip","draft":false,"prerelease":true,"created_at":"2023-01-26T23:45:25-05:00","published_at":"2023-01-26T23:45:25-05:00","author":{"id":1,"login":"yuriy","login_name":"","full_name":"Yuriy Zinchuk","email":"yuriy@noreply.localhost","avatar_url":"https://secure.gravatar.com/avatar/82acf184352c9232da15222248417df0?d=identicon","language":"","is_admin":false,"last_login":"0001-01-01T00:00:00Z","created":"2023-01-02T16:40:09-05:00","restricted":false,"active":false,"prohibit_login":false,"location":"","website":"","description":"","visibility":"public","followers_count":0,"following_count":0,"starred_repos_count":0,"username":"yuriy"},"assets":[{"id":4,"name":"Freedomain Social Media Poster.exe","size":1708544,"download_count":0,"created_at":"2023-01-26T23:45:19-05:00","uuid":"2ee05d49-a314-4079-bcc8-b6857dc29e98","browser_download_url":"https://git.zinchuk.xyz/attachments/2ee05d49-a314-4079-bcc8-b6857dc29e98"}]},{"id":2,"tag_name":"v2.70","target_commitish":"main","name":"2.70","body":"* Initial commit of V2.7 to git\r\n* Pushed codebase to personal [git instance](https://git.zinchuk.xyz/yuriy/Freedomain_Social_Media_Poster/)\r\n* Fixed Locals Posting\r\n* Fixed Gettr Posting\r\n* Fixed Flote Posting\r\n* Fixed MeWe Posting\r\n* Fixed Minds Posting\r\n* Fixed Steemit Posting\r\n* Fixed LinkedIn Image Posting\r\n* Removed Tumblr Support\r\n* Removed Pintrest support","url":"https://git.zinchuk.xyz/api/v1/repos/yuriy/Freedomain_Social_Media_Poster/releases/2","html_url":"https://git.zinchuk.xyz/yuriy/Freedomain_Social_Media_Poster/releases/tag/v2.70","tarball_url":"https://git.zinchuk.xyz/yuriy/Freedomain_Social_Media_Poster/archive/v2.70.tar.gz","zipball_url":"https://git.zinchuk.xyz/yuriy/Freedomain_Social_Media_Poster/archive/v2.70.zip","draft":false,"prerelease":true,"created_at":"2023-01-25T22:38:24-05:00","published_at":"2023-01-25T22:38:24-05:00","author":{"id":1,"login":"yuriy","login_name":"","full_name":"Yuriy Zinchuk","email":"yuriy@noreply.localhost","avatar_url":"https://secure.gravatar.com/avatar/82acf184352c9232da15222248417df0?d=identicon","language":"","is_admin":false,"last_login":"0001-01-01T00:00:00Z","created":"2023-01-02T16:40:09-05:00","restricted":false,"active":false,"prohibit_login":false,"location":"","website":"","description":"","visibility":"public","followers_count":0,"following_count":0,"starred_repos_count":0,"username":"yuriy"},"assets":[{"id":2,"name":"Freedomain Social Media Poster.exe","size":1707520,"download_count":1,"created_at":"2023-01-25T22:36:17-05:00","uuid":"d91a4ab0-b1fb-4c2f-adfa-e986e587cf0a","browser_download_url":"https://git.zinchuk.xyz/attachments/d91a4ab0-b1fb-4c2f-adfa-e986e587cf0a"}]}]
|
||||
|
||||
parsed := JSON.Load(data)
|
||||
|
||||
Version := parsed.1.name
|
||||
|
||||
; msgbox, Version: %Version%`nScriptVersion: %ScriptVersion%
|
||||
|
||||
if(ScriptVersion = Version){
|
||||
ToolTip
|
||||
return
|
||||
}
|
||||
else, {
|
||||
; msgbox, update found!
|
||||
; Message = Program Update Found
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
IniWrite, 1, %SettingsIniFilepath%, %ScriptSettingsSection%, UpdateAvailable
|
||||
|
||||
; GuiControl,, UpdateAvailable, Update Available - Click to View
|
||||
}
|
||||
; return
|
||||
|
||||
; @todo DELETE the rest of this.
|
||||
/*
|
||||
Msgbox % "Version: " Version
|
||||
ChangeLog := parsed.1.body
|
||||
exename := parsed.1.assets.1.name
|
||||
exeURL := parsed.1.assets.1.browser_download_url
|
||||
Msgbox % "exeURL: " exeURL
|
||||
Msgbox % "exename: " exename
|
||||
|
||||
|
||||
; Msgbox % "FreedomScriptsChangelogURL: " FreedomScriptsChangelogURL
|
||||
; Msgbox % "ChangelogIniFilepath: " ChangelogIniFilepath
|
||||
; Msgbox % "ScriptSettingsSectio: " ScriptSettingsSection
|
||||
; Msgbox % "SettingsIniFilepath: " SettingsIniFilepath
|
||||
|
||||
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(True)
|
||||
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
|
||||
; Msgbox % "FreedomScriptsChangelogURL: " FreedomScriptsChangelogURL
|
||||
; Msgbox % "ChangelogIniFilepath: " ChangelogIniFilepath
|
||||
; Msgbox % "ScriptSettingsSectio: " ScriptSettingsSection
|
||||
; Msgbox % "SettingsIniFilepath: " SettingsIniFilepath
|
||||
|
||||
}
|
||||
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
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -153,11 +194,11 @@ UpdateScript(){
|
||||
; sleep, 5000
|
||||
|
||||
if(SaveFilepath = ""){
|
||||
SaveFilepath := ErrorLoggingDirectory
|
||||
}
|
||||
SaveFilepath := ErrorLoggingDirectory
|
||||
}
|
||||
|
||||
; if(!FileExist(SaveFilepath))
|
||||
FileCreateDir, %SaveFilepath%
|
||||
; if(!FileExist(SaveFilepath))
|
||||
FileCreateDir, %SaveFilepath%
|
||||
|
||||
/* if(!TakeScreenshotsOfErrors)
|
||||
Return
|
||||
@@ -982,14 +1023,14 @@ if(TotalTabsFound = 1){
|
||||
|
||||
; NumberOfTabLoops := Driver.Windows.Count + 2
|
||||
loop % NumberOfTabLoops { ; loop through tabs to find matching tab
|
||||
try driver.SwitchToNextWindow()
|
||||
try driver.SwitchToNextWindow()
|
||||
|
||||
; sleep, 1000
|
||||
; msgbox, looping through tabs
|
||||
try CurrentTabTitle := driver.window.title
|
||||
; sleep, 1000
|
||||
; msgbox, looping through tabs
|
||||
try CurrentTabTitle := driver.window.title
|
||||
|
||||
; caused by tab being manually closed. Not sure if this is the only cause though.
|
||||
if(CurrentTabTitle = "") {
|
||||
; caused by tab being manually closed. Not sure if this is the only cause though.
|
||||
if(CurrentTabTitle = "") {
|
||||
Message = CurrentTabTitle: %CurrentTabTitle%
|
||||
DevModeMsgBox(Message)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user