Moved auto update check to before GUI creation, updated to use gitea API
This commit is contained in:
@@ -10,15 +10,10 @@ if(InStr(A_ScriptName, ".ahk")){
|
|||||||
Menu, Tray, Icon, %A_ScriptDir%\assets\FreedomainSMP.ico
|
Menu, Tray, Icon, %A_ScriptDir%\assets\FreedomainSMP.ico
|
||||||
}
|
}
|
||||||
|
|
||||||
/*IconLocation :
|
|
||||||
if(!FileExist())
|
|
||||||
FileInstall, %A_ScriptDir%\Lib\FreedomainShare_Scheduled.ico, Dest [, Flag (1 = overwrite)]
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
ErrorLoggingDirectory = %1%
|
ErrorLoggingDirectory = %1%
|
||||||
; Add menus to the toolbar icon
|
|
||||||
|
|
||||||
|
|
||||||
|
; Add menus to the toolbar icon
|
||||||
Menu, tray, NoStandard ; remove standard tray
|
Menu, tray, NoStandard ; remove standard tray
|
||||||
|
|
||||||
Menu, Tray, Add, Exit, KillScript
|
Menu, Tray, Add, Exit, KillScript
|
||||||
@@ -35,7 +30,7 @@ global FullScriptName
|
|||||||
|
|
||||||
;---Notes/Extra Info/#Includes------------------------------------------------------
|
;---Notes/Extra Info/#Includes------------------------------------------------------
|
||||||
ScriptName = Freedomain Social Media Poster
|
ScriptName = Freedomain Social Media Poster
|
||||||
ScriptVersion = 2.71
|
ScriptVersion = 2.70
|
||||||
FullScriptName := ScriptName . " " . ScriptVersion
|
FullScriptName := ScriptName . " " . ScriptVersion
|
||||||
|
|
||||||
;---ToDo---
|
;---ToDo---
|
||||||
@@ -163,7 +158,7 @@ IniRead, TotalRunTime, %SettingsIniFilepath%, %ScriptSettingsSection%, TotalRunT
|
|||||||
;---Auto Updater Settings---
|
;---Auto Updater Settings---
|
||||||
;------------------------------------------------
|
;------------------------------------------------
|
||||||
; Misc Auto Update settings
|
; Misc Auto Update settings
|
||||||
global FreedomainProgramUpdaterFilepath
|
/*global FreedomainProgramUpdaterFilepath
|
||||||
FreedomainProgramUpdaterFilepath := A_ScriptDir . "\Freedomain Program Updater.exe"
|
FreedomainProgramUpdaterFilepath := A_ScriptDir . "\Freedomain Program Updater.exe"
|
||||||
|
|
||||||
global FreedomainProgramUpdaterURL
|
global FreedomainProgramUpdaterURL
|
||||||
@@ -174,6 +169,10 @@ FreedomScriptsChangelogURL = https://freedomainplaylists.com/wp-content/Freedoma
|
|||||||
|
|
||||||
global UpdateURL
|
global UpdateURL
|
||||||
UpdateURL = https://freedomainplaylists.com/wp-content/FreedomainScripts/Freedomain`%20Social`%20Media`%20Poster.exe
|
UpdateURL = https://freedomainplaylists.com/wp-content/FreedomainScripts/Freedomain`%20Social`%20Media`%20Poster.exe
|
||||||
|
*/
|
||||||
|
|
||||||
|
global GitReleasesAPIURL
|
||||||
|
GitReleasesAPIURL = https://git.zinchuk.xyz/api/v1/repos/yuriy/Freedomain_Social_Media_Poster/releases
|
||||||
|
|
||||||
; Save filepath of the current script to %SettingsIniFilepath% so it can be read and used by the script updater
|
; Save filepath of the current script to %SettingsIniFilepath% so it can be read and used by the script updater
|
||||||
; Append informatio to ini files for Freedomain Program Updater
|
; Append informatio to ini files for Freedomain Program Updater
|
||||||
@@ -191,6 +190,10 @@ if(!FileExist(FreedomainProgramUpdaterFilepath)){
|
|||||||
; ToolTip
|
; ToolTip
|
||||||
}
|
}
|
||||||
|
|
||||||
|
; check for updates if the setting is enabled
|
||||||
|
if(AutoUpdateCheck AND !UpdateAvailable AND !SkipUpdateCheckThisRun){
|
||||||
|
CheckForUpdates()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
;---Load Settings From Previous Post---
|
;---Load Settings From Previous Post---
|
||||||
@@ -399,7 +402,7 @@ Gui, Add, Button,xp+%Marginspace% yp+35 w%EditBoxThirdsWidth% h30 gSaveAsTemplat
|
|||||||
Gui, Add, Button,x+%MarginSpace% w%EditBoxThirdsWidth% h30 gLoadTemplate, Load Template
|
Gui, Add, Button,x+%MarginSpace% w%EditBoxThirdsWidth% h30 gLoadTemplate, Load Template
|
||||||
Gui, Add, Button, x+%MarginSpace% w%EditBoxThirdsWidth% h30 gLoadLastPost, Load Last Post
|
Gui, Add, Button, x+%MarginSpace% w%EditBoxThirdsWidth% h30 gLoadLastPost, Load Last Post
|
||||||
if(UpdateAvailable)
|
if(UpdateAvailable)
|
||||||
Gui, Add, Button, x%MarginSpaceDoubled% y+%MarginSpace% w%EditBoxHalfWidths% h30 gUpdateScript vUpdateAvailable, Update Available - Click to Install
|
Gui, Add, Button, x%MarginSpaceDoubled% y+%MarginSpace% w%EditBoxHalfWidths% h30 gUpdateScript vUpdateAvailable, Program Update Available
|
||||||
else,
|
else,
|
||||||
Gui, Add, Button, x%MarginSpaceDoubled% y+%MarginSpace% w%EditBoxHalfWidths% h30 gUpdateScript vUpdateAvailable, Program is Up-to-Date
|
Gui, Add, Button, x%MarginSpaceDoubled% y+%MarginSpace% w%EditBoxHalfWidths% h30 gUpdateScript vUpdateAvailable, Program is Up-to-Date
|
||||||
|
|
||||||
@@ -425,10 +428,11 @@ if(DevMode){
|
|||||||
Gui, Font, Normal
|
Gui, Font, Normal
|
||||||
gui, Font, s5
|
gui, Font, s5
|
||||||
; Miscellaneous Settings
|
; Miscellaneous Settings
|
||||||
DevModToggleButton := PlatformsGroupBoxXLocation + 130
|
DevModToggleButton := PlatformsGroupBoxXLocation + 80
|
||||||
Gui, Add, Button, x%DevModToggleButton% y5 w50 h10 gToggleDevMode, DevMode
|
Gui, Add, Button, x%DevModToggleButton% y5 w50 h10 gToggleDevMode, DevMode
|
||||||
Gui, Add, Button, x+5 yp+0 w50 h10 gToggleTestingMode, Testing Mode
|
Gui, Add, Button, x+5 yp+0 w50 h10 gToggleTestingMode, Testing Mode
|
||||||
Gui, Add, Button, x+5 yp+0 w50 h10 gToggleManualSubmit, Manual Submit
|
Gui, Add, Button, x+5 yp+0 w50 h10 gToggleManualSubmit, Manual Submit
|
||||||
|
Gui, Add, Button, x+5 yp+0 w50 h10 gOpenGiteaPage, Gitea
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -494,9 +498,6 @@ ControlFocus, Edit1, %FullScriptName%
|
|||||||
|
|
||||||
;---Check for Update---
|
;---Check for Update---
|
||||||
;------------------------------------------------
|
;------------------------------------------------
|
||||||
if(AutoUpdateCheck AND !UpdateAvailable AND !SkipUpdateCheckThisRun){
|
|
||||||
CheckForUpdates()
|
|
||||||
}
|
|
||||||
Return
|
Return
|
||||||
|
|
||||||
|
|
||||||
@@ -596,6 +597,10 @@ ToggleDevMode()
|
|||||||
run, "%A_ScriptFullPath%" "LastPost"
|
run, "%A_ScriptFullPath%" "LastPost"
|
||||||
Return
|
Return
|
||||||
|
|
||||||
|
OpenGiteaPage:
|
||||||
|
run, https://git.zinchuk.xyz/yuriy/Freedomain_Social_Media_Poster
|
||||||
|
Return
|
||||||
|
|
||||||
CompileScript:
|
CompileScript:
|
||||||
; msgbox, compiling
|
; msgbox, compiling
|
||||||
IniWrite, %changelog%, %ChangelogIniFilepath%, %ScriptSettingsSection%, Changelog
|
IniWrite, %changelog%, %ChangelogIniFilepath%, %ScriptSettingsSection%, Changelog
|
||||||
|
|||||||
@@ -30,7 +30,46 @@ DevModeMsgBox(Message){
|
|||||||
CheckForUpdates(){
|
CheckForUpdates(){
|
||||||
; msgbox, checking for updates
|
; msgbox, checking for updates
|
||||||
Message = 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
|
||||||
|
|
||||||
|
|
||||||
|
if(True)
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; Msgbox % "FreedomScriptsChangelogURL: " FreedomScriptsChangelogURL
|
; Msgbox % "FreedomScriptsChangelogURL: " FreedomScriptsChangelogURL
|
||||||
@@ -68,7 +107,9 @@ CheckForUpdates(){
|
|||||||
IniWrite, 0, %SettingsIniFilepath%, %ScriptSettingsSection%, UpdateAvailable
|
IniWrite, 0, %SettingsIniFilepath%, %ScriptSettingsSection%, UpdateAvailable
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
ToolTip
|
ToolTip
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user