You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
197 lines
5.0 KiB
Plaintext
197 lines
5.0 KiB
Plaintext
; This #include needs to be at the bottom of the parent script
|
|
|
|
|
|
|
|
CheckForUpdates:
|
|
UpdateStartTime := A_TickCount ; start time
|
|
|
|
|
|
; The GUI buttons must have variable set to vUpdateAvailable and vChromeUpdateAvailable for button to get updated
|
|
|
|
; The following variables need to be set in the parent script
|
|
; GitReleasesAPIURL
|
|
; ChromeFilepath
|
|
|
|
Message = Checking for Updates
|
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
|
|
|
if(CheckForUpdates(GitReleasesAPIURL, ScriptVersion)){
|
|
GuiControl,,UpdateAvailable, Update Available!
|
|
}
|
|
|
|
; check for Post Scheduler Update
|
|
if(ScriptNameAcronym = "FVU"){
|
|
if(CheckForUpdates(PostSchedulerGitReleasesAPIURL, PostSchedulerVersion)){
|
|
GuiControl,,PostSchedulerUpdateAvailable, FPS Update Available!
|
|
}
|
|
}
|
|
|
|
if(CheckForChromeUpdates(ChromeFilepath)){
|
|
GuiControl,,ChromeUpdateAvailable, Chrome Update Available!
|
|
ChromeUpdateAvailable := 1
|
|
}
|
|
|
|
; calculate run time and convert to seconds
|
|
TimeToCheckforUpdates := round(((A_TickCount - UpdateStartTime) / 1000), 2)
|
|
|
|
Message = Update Check took %TimeToCheckforUpdates% seconds to complete
|
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
|
; Msgbox % "TimeToCheckforUpdates: " TimeToCheckforUpdates
|
|
; Msgbox % "URunTime: " URunTime
|
|
|
|
ToolTip
|
|
Return
|
|
|
|
; UpdatePostScheduler:
|
|
|
|
|
|
|
|
Return
|
|
|
|
|
|
UpdateChrome:
|
|
|
|
; if chroem doesn't exist, download it
|
|
if(ChromeFilepath = ""){
|
|
Status := DownloadLatestChromium()
|
|
if(Status)
|
|
GuiControl,,ChromeUpdateAvailable, Chrome Up-To-Date
|
|
Return
|
|
}
|
|
|
|
if(CheckForChromeUpdates = "")
|
|
Status := CheckForChromeUpdates(ChromeFilepath)
|
|
|
|
if(!status){
|
|
OnMessage(0x44, "OnMsgBoxConfirmChromiumOverwrite")
|
|
MsgBox 0x41, Already Up-to-Date, Yor current Chromium version is already up to date. `nDo you want to download and overwrite it?
|
|
OnMessage(0x44, "")
|
|
|
|
IfMsgBox OK, {
|
|
Return
|
|
} Else IfMsgBox Cancel, {
|
|
ToolTip
|
|
}
|
|
}
|
|
|
|
Status := DownloadLatestChromium()
|
|
if(Status)
|
|
GuiControl,,ChromeUpdateAvailable, Chrome Up-To-Date
|
|
|
|
Return
|
|
/*
|
|
*/
|
|
|
|
|
|
|
|
PasteClipboardToEditBox:
|
|
if(A_GuiControl = "PasteClipboardToSMPBody"){
|
|
GuiControl,,PostBody, %Clipboard%
|
|
}
|
|
|
|
if(A_GuiControl = "PasteClipboardToSMPTitle"){
|
|
GuiControl,,PostTitle, %Clipboard%
|
|
}
|
|
|
|
if(A_GuiControl = "PasteClipboardToFLSTitle"){
|
|
GuiControl,,LivestreamTitle, %Clipboard%
|
|
}
|
|
|
|
if(A_GuiControl = "PasteClipboardToFLSDescription"){
|
|
GuiControl,,LivestreamDescription, %Clipboard%
|
|
}
|
|
|
|
if(A_GuiControl = "PasteClipboardToFLSTags"){
|
|
GuiControl,,LivestreamTags, %Clipboard%
|
|
}
|
|
|
|
|
|
Return
|
|
|
|
OpenErrorLog:
|
|
run, %ErrorLoggingFilePath%
|
|
Return
|
|
|
|
OpenGiteaPage:
|
|
if(ScriptAbbreviatedName = "FLS")
|
|
URL = https://freedomain.dev/yuriy/livestream-scheduler
|
|
|
|
if(ScriptAbbreviatedName = "FVU")
|
|
URL = https://freedomain.dev/yuriy/video-uploader
|
|
|
|
if(ScriptAbbreviatedName = "FSMP")
|
|
URL = https://freedomain.dev/yuriy/social-media-poster
|
|
|
|
|
|
run, %URL%
|
|
Return
|
|
|
|
|
|
|
|
|
|
UpdatePostScheduler:
|
|
; Close any existing instances of the Post Scheduler
|
|
|
|
; Kill any active intances of the Post Scheduler so the .exe file can be overwriten
|
|
process, close, Freedomain Post Scheduler.exe
|
|
|
|
|
|
; Msgbox % "PostSchedulerGitReleasesAPIURL: " PostSchedulerGitReleasesAPIURL
|
|
data := URLDownloadToVar(PostSchedulerGitReleasesAPIURL)
|
|
|
|
try parsed := JSON.Load(data)
|
|
catch e {
|
|
Message = Failed to check for updates. Gitea Releases API returned blank or malformed data.
|
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
|
Return
|
|
}
|
|
|
|
UpdateVersionNumber := parsed.1.name
|
|
ChangeLog := parsed.1.body
|
|
exename := parsed.1.assets.1.name
|
|
exeURL := parsed.1.assets.1.browser_download_url
|
|
|
|
|
|
|
|
; Msgbox % "exename: " exename
|
|
|
|
; ExeName := StrReplace(exename, ".exe", "")
|
|
; UpdateExeName = %exename%.exe
|
|
UpdateExeFilepath = %A_ScriptDir%\%ExeName%
|
|
|
|
if(PostSchedulerVersion =< UpdateVersionNumber){
|
|
; IniWrite, 0, %SettingsIniFilepath%, %ScriptSettingsSection%, UpdateAvailable
|
|
MsgBox, You are Up-To-Date, There are no new updates to download.
|
|
; IniRead, UpdateAvailable, %SettingsIniFilepath%, %ScriptSettingsSection%, UpdateAvailable, 0
|
|
return
|
|
}
|
|
|
|
Changelog = %PostSchedulerVersion% --> %UpdateVersionNumber%`n`nChangelog:`n%Changelog%
|
|
|
|
OnMessage(0x44, "OnMsgBoxUpdateAvailable")
|
|
MsgBox 0x44, Update Available For %exename%, %Changelog%
|
|
OnMessage(0x44, "")
|
|
|
|
IfMsgBox Yes, {
|
|
Return
|
|
}
|
|
Else IfMsgBox No, {
|
|
SaveOrPostProgress(Message:="Downloading Update",PostType:="Tooltip,ErrorLoggingTextFile")
|
|
|
|
if(FileExist(UpdateExeFilepath)){
|
|
FileDelete, %UpdateExeFilepath%
|
|
if(ErrorLevel){
|
|
Message = Failed to Delete %UpdateExeFilepath%. `nPlease Close the process manually and try the update again.
|
|
MsgBox 0x10,, %Message%
|
|
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
|
Return
|
|
}
|
|
}
|
|
|
|
|
|
UrlDownloadToFile, %exeURL%, %UpdateExeFilepath%
|
|
run, "%UpdateExeFilepath%" "%A_ScriptFullPath%"
|
|
ToolTip
|
|
; ExitApp
|
|
}
|
|
return |