Compare commits
41 Commits
Author | SHA1 | Date |
---|---|---|
Yuriy | 95bda715cb | 4 months ago |
Yuriy | ae2027826f | 4 months ago |
Yuriy | 670b97d6b1 | 4 months ago |
Yuriy | 4a1d2a5d9d | 4 months ago |
Yuriy | 8447b6009a | 4 months ago |
Yuriy | 62e8afebb8 | 5 months ago |
Yuriy | e654611bf3 | 5 months ago |
Yuriy | 6bf72336d0 | 5 months ago |
Yuriy | fd6be690da | 5 months ago |
Yuriy | a3d89a9892 | 6 months ago |
Yuriy | a5bc6225b6 | 6 months ago |
Yuriy | 4ac3c76641 | 6 months ago |
Yuriy | 96a8fb9566 | 6 months ago |
Yuriy | cf56ae8136 | 6 months ago |
Yuriy | 738e1af443 | 6 months ago |
Yuriy | f71def4542 | 6 months ago |
Yuriy | 20c2f44b0c | 6 months ago |
Yuriy | 997ee862ed | 6 months ago |
Yuriy | b378de8106 | 6 months ago |
Yuriy | ed307493b8 | 6 months ago |
Yuriy | 2860e4868f | 6 months ago |
Yuriy | 0e02ae24bd | 6 months ago |
Yuriy | b19482e10d | 6 months ago |
Yuriy | d7d3ce039f | 6 months ago |
Yuriy | 8395c5c367 | 6 months ago |
Yuriy | 124a26c3b0 | 6 months ago |
Yuriy | b5c3b4a606 | 6 months ago |
Yuriy | 43dd2c3f28 | 6 months ago |
Yuriy | 88c48e133e | 6 months ago |
Yuriy | 2e0c81f34f | 7 months ago |
Yuriy | b8ffb10db1 | 7 months ago |
Yuriy | 5671242faf | 7 months ago |
Yuriy | 8a532ac787 | 7 months ago |
Yuriy | f20332d6c6 | 7 months ago |
Yuriy | f625e782eb | 7 months ago |
Yuriy | c18e9897ee | 7 months ago |
Yuriy | 075859934a | 7 months ago |
Yuriy | 88b4b2c119 | 7 months ago |
Yuriy | e32fe026e9 | 11 months ago |
Yuriy | 981051a9e8 | 11 months ago |
Yuriy | f15d3ed2f0 | 11 months ago |
Binary file not shown.
After Width: | Height: | Size: 22 KiB |
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
@ -0,0 +1,47 @@
|
||||
$apiurl=$args[0]
|
||||
$apitoken=$args[1]
|
||||
$filename=$args[2]
|
||||
$filepath=$args[3]
|
||||
|
||||
|
||||
Write-Host "apiurl: $apiurl"
|
||||
Write-Host "apitoken: $apitoken"
|
||||
Write-Host "filename: $filename"
|
||||
Write-Host "filepath: $filepath"
|
||||
|
||||
|
||||
# Load the required .NET assemblies
|
||||
Add-Type -AssemblyName System.Net.Http
|
||||
|
||||
# Create Object and Load the required .NET assemblies
|
||||
$httpClient = New-Object System.Net.Http.HttpClient
|
||||
|
||||
# $url = 'https://git.zinchuk.xyz/api/v1/repos/yuriy/TestRepo/releases/22/assets'
|
||||
# $fileName = 'TestFile58.exe'
|
||||
# $token = '2cf4a54d941'
|
||||
|
||||
$headers = @{
|
||||
'accept' = 'application/json'
|
||||
'Content-Type' = 'multipart/form-data'
|
||||
}
|
||||
|
||||
# $filePath = "C:\Users\yuriy\Syncthing\Git\TestREpo\test.exe"
|
||||
$fileBytes = [System.IO.File]::ReadAllBytes($filePath)
|
||||
$fileStream = [System.IO.MemoryStream]::new($fileBytes)
|
||||
|
||||
$httpClient = [System.Net.Http.HttpClient]::new()
|
||||
$httpClient.DefaultRequestHeaders.Add('Authorization', "Bearer $apitoken")
|
||||
|
||||
$multipartFormData = New-Object System.Net.Http.MultipartFormDataContent
|
||||
$fileContent = New-Object System.Net.Http.StreamContent -ArgumentList $fileStream
|
||||
$fileContent.Headers.ContentDisposition = New-Object System.Net.Http.Headers.ContentDispositionHeaderValue -ArgumentList "form-data"
|
||||
$fileContent.Headers.ContentDisposition.Name = "attachment"
|
||||
$fileContent.Headers.ContentDisposition.FileName = $fileName
|
||||
# $fileContent.Headers.ContentType = [System.Net.Http.Headers.MediaTypeHeaderValue]::Parse("text/plain")
|
||||
$fileContent.Headers.ContentType = [System.Net.Http.Headers.MediaTypeHeaderValue]::Parse("application/x-msdownload")
|
||||
$multipartFormData.Add($fileContent)
|
||||
|
||||
$response = $httpClient.PostAsync($apiurl, $multipartFormData).Result
|
||||
$responseContent = $response.Content.ReadAsStringAsync().Result
|
||||
|
||||
Write-Output $responseContent
|
@ -0,0 +1,62 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Create a new release on on a Gitea site using the Gitea API
|
||||
|
||||
.DESCRIPTION
|
||||
The Add-Numbers function takes two integer parameters, $Number1 and $Number2,
|
||||
and returns the sum of those two numbers.
|
||||
|
||||
.PARAMETER APIURL
|
||||
The Repo Releases API URL of the Gitea site, including the API Key.
|
||||
Example: "https://gitea.example.com/api/v1/repos/yuriy/TESTREPO/releases?token=aaabbbcccdd"
|
||||
|
||||
.PARAMETER ReleaseName
|
||||
Name for the release that will be created
|
||||
|
||||
.PARAMETER ReleaseTag
|
||||
Tag for the release that will be created
|
||||
|
||||
.PARAMETER ReleaseBody
|
||||
Body Text for the release that will be created
|
||||
|
||||
.EXAMPLE
|
||||
Gitea-CreateRelease.ps1 "https://gitea.example.com/api/v1/repos/yuriy/TESTREPO/releases?token=aaabbbcccdd" "1.0" "1.0" "Initial Release"
|
||||
|
||||
.NOTES
|
||||
This function was created as an example for a PowerShell documentation demonstration.
|
||||
|
||||
.LINK
|
||||
https://example.com/powershell-functions
|
||||
#>
|
||||
|
||||
|
||||
$APIURL=$args[0]
|
||||
$ReleaseName=$args[1]
|
||||
$ReleaseTag=$args[2]
|
||||
$ReleaseBody=$args[3]
|
||||
|
||||
<#
|
||||
Write-Host "APIURL: $APIURL"
|
||||
Write-Host "ReleaseTag: $ReleaseTag"
|
||||
Write-Host "ReleaseName: $ReleaseName"
|
||||
Write-Host "ReleaseBody: $ReleaseBody"
|
||||
#>
|
||||
|
||||
$headers = @{
|
||||
"accept" = "application/json"
|
||||
"Content-Type" = "application/json"
|
||||
}
|
||||
$body = @{
|
||||
"body" = "${ReleaseBody}"
|
||||
"draft" = $false
|
||||
"name" = "${ReleaseTag}"
|
||||
"prerelease" = $false
|
||||
"tag_name" = "${ReleaseTag}"
|
||||
# "target_commitish" = "string"
|
||||
} | ConvertTo-Json
|
||||
|
||||
# Write-Host "body: " $body
|
||||
|
||||
$Result = Invoke-RestMethod -Uri $APIURL -Method Post -Headers $headers -Body $body
|
||||
|
||||
Write-Host $Result
|
@ -0,0 +1,63 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Adds two numbers and returns the result.
|
||||
|
||||
.DESCRIPTION
|
||||
The Add-Numbers function takes two integer parameters, $Number1 and $Number2,
|
||||
and returns the sum of those two numbers.
|
||||
|
||||
.PARAMETER Number1
|
||||
The first number to add.
|
||||
|
||||
.PARAMETER Number2
|
||||
The second number to add.
|
||||
|
||||
.EXAMPLE
|
||||
$sum = Add-Numbers -Number1 5 -Number2 10
|
||||
Write-Host "The sum is: $sum"
|
||||
|
||||
.NOTES
|
||||
This function was created as an example for a PowerShell documentation demonstration.
|
||||
|
||||
.LINK
|
||||
https://example.com/powershell-functions
|
||||
#>
|
||||
|
||||
|
||||
$APIURL=$args[0]
|
||||
$ReleaseName=$args[1]
|
||||
$ReleaseTag=$args[2]
|
||||
$ReleaseBody=$args[3]
|
||||
|
||||
|
||||
function CreateRelease {
|
||||
param (
|
||||
[string]$APIURL,
|
||||
[string]$ReleaseName,
|
||||
[string]$ReleaseID,
|
||||
[string]$ReleaseBody,
|
||||
)
|
||||
|
||||
$headers = @{
|
||||
"accept" = "application/json"
|
||||
"Content-Type" = "application/json"
|
||||
}
|
||||
$body = @{
|
||||
"body" = "${ReleaseBody}"
|
||||
"draft" = $false
|
||||
"name" = "${ReleaseTag}"
|
||||
"prerelease" = $false
|
||||
"tag_name" = "${ReleaseTag}"
|
||||
"target_commitish" = "string"
|
||||
} | ConvertTo-Json
|
||||
|
||||
# Write-Host "body: " $body
|
||||
|
||||
$Result = Invoke-RestMethod -Uri $APIURL -Method Post -Headers $headers -Body $body
|
||||
|
||||
Write-Host $Result
|
||||
}
|
||||
|
||||
|
||||
|
||||
Write-FullName -FirstName "John" -LastName "Doe"
|
@ -0,0 +1,149 @@
|
||||
|
||||
CheckLBRYProcess(){
|
||||
; Check if LBRY Process exists
|
||||
Process, Exist,LBRY.exe
|
||||
if(ErrorLevel = 0) ; if doesn't exist
|
||||
{
|
||||
Message = Not Running. Starting up LBRY.exe
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile")
|
||||
|
||||
LBRYExeFilepath = C:\Program Files\LBRY\LBRY.exe
|
||||
if(!FileExist(LBRYExeFilepath)){
|
||||
Message = Failed to Find LBRY.exe executable. LBRY not installed?
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
Return
|
||||
}
|
||||
|
||||
Message = Checking LBRY daemon_settings.yml file for Odysee Wallet Servers
|
||||
SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
|
||||
; FileRead, daemon_settingsFileContent, C:\Users\%A_UserName%\AppData\Local\lbry\lbrynet\daemon_settings.yml
|
||||
|
||||
; if(!InStr(daemon_settingsFileContent, "a-hub1.odysee.com")){
|
||||
; Message = Odysee wallet server is not in daemon_settings.yml. Replacing File with required settings.
|
||||
; SaveOrPostProgress(Message:=Message,PostType:=",DiscordErrorLogging")
|
||||
|
||||
; LBRYDaemonSettingsFP = C:\Users\%A_UserName%\AppData\Local\lbry\lbrynet\daemon_settings.yml
|
||||
; LBRYDaemonSettingsBackupFP = C:\Users\%A_UserName%\AppData\Local\lbry\lbrynet\daemon_settings_BU.yml
|
||||
|
||||
|
||||
; ; Msgbox % "daemon_settingsText: " daemon_settingsText
|
||||
; FileMove, %LBRYDaemonSettingsFP%, %LBRYDaemonSettingsBackupFP%, 1 ; Dest [, Flag (1 = overwrite)]
|
||||
|
||||
; UrlDownloadToFile, https://freedomain.dev/yuriy/video-uploader/raw/branch/main/Assets/daemon_settings.yml , %LBRYDaemonSettingsFP%
|
||||
|
||||
; sleep, 1000
|
||||
|
||||
; if(!FileExist(LBRYDaemonSettingsFP)){
|
||||
; Message = Failed to download the custom daemon_settings.yml file from git. Restoring Original File
|
||||
; SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
; FileMove,%LBRYDaemonSettingsBackupFP%,%LBRYDaemonSettingsFP%, 1
|
||||
; }
|
||||
; }
|
||||
|
||||
|
||||
try run, "%LBRYExeFilepath%"
|
||||
Message = Waiting 1 Minute for LBRY to start up
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip")
|
||||
Sleep, 60000 ; 1 minute
|
||||
|
||||
Process, Exist,LBRY.exe
|
||||
if(ErrorLevel = 0) ; if doesn't exist
|
||||
{
|
||||
Message = Failed to Start LBRY.exe after 60 seconds of waiting
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,ErrorSummaryVar,DiscordErrorLogging")
|
||||
Return
|
||||
}
|
||||
WinMinimize, LBRY
|
||||
}
|
||||
Return
|
||||
}
|
||||
|
||||
|
||||
GetPermanentLBRYURL(UploadResult){
|
||||
SingleQuotationmark = "
|
||||
|
||||
UploadResult := StrSplit(UploadResult, "`n") ; split results by new line
|
||||
|
||||
; Iterate through the array of the results
|
||||
Loop % UploadResult.Length() {
|
||||
PermanentURL := UploadResult[A_Index]
|
||||
if(InStr(PermanentURL, "permanent_url"))
|
||||
Break
|
||||
}
|
||||
|
||||
; Starting Result: "permanent_url": "lbry://Test-Video-161-Numbered#c9ad9afe54c7178d6f870b59bbe129aef8efc3ff",
|
||||
PermanentURL := StrSplit(PermanentURL, "lbry:")
|
||||
PermanentURL := "lbry:" . PermanentURL[2]
|
||||
PermanentURL := StrReplace(PermanentURL, ",", "")
|
||||
PermanentURL := StrReplace(PermanentURL, SingleQuotationmark, "")
|
||||
PermanentURL := StrReplace(PermanentURL, "`n", "")
|
||||
PermanentURL := StrReplace(PermanentURL, "`r", "")
|
||||
|
||||
; End Result lbry://Test-Video-161-Numbered#c9ad9afe54c7178d6f870b59bbe129aef8efc3ff
|
||||
Return PermanentURL
|
||||
}
|
||||
|
||||
|
||||
GetLBRYCanonicalURL(LBRYJSONObject){ ; input json string
|
||||
; ResolveURL := StrSplit(LBRYResolveAPICommand, "lbry://")
|
||||
; ResolveURL := "lbry://" . ResolveURL[2]
|
||||
; StrReplace(Haystack, SearchText [, ReplaceText, OutputVarCount, Limit := -1])
|
||||
LBRYPermanentURLJsonOBJ := StrReplace(LBRYJSONObject, LBRYPermanentURL, "LBRYPermanentURL")
|
||||
; clipboard := LBRYPermanentURLJsonOBJ
|
||||
; DevModeMsgBox(LBRYPermanentURLJsonOBJ)
|
||||
|
||||
try parsed := JSON.Load(LBRYPermanentURLJsonOBJ)
|
||||
try LBRYCanonicalURL := parsed.LBRYPermanentURL.canonical_url
|
||||
|
||||
; DevModeMsgBox(LBRYCanonicalURL)
|
||||
|
||||
if(LBRYCanonicalURL = ""){
|
||||
Return "" ; return blank
|
||||
}
|
||||
|
||||
; otherwise return the LBRY url
|
||||
LBRYCanonicalURL := StrReplace(LBRYCanonicalURL, "lbry://", "https://lbry.tv/")
|
||||
Return LBRYCanonicalURL
|
||||
}
|
||||
|
||||
|
||||
LBRYCMDTextReplacement(LBRYURLSlug){
|
||||
SingleQUote = "
|
||||
LBRYURLSlug := StrReplace(LBRYURLSlug, " ", "_") ; replace all spaces with dashes
|
||||
LBRYURLSlug := StrReplace(LBRYURLSlug, ":", "_") ; replace all colons with dashes
|
||||
LBRYURLSlug := StrReplace(LBRYURLSlug, ",", "_") ; replace all colons with dashes
|
||||
LBRYURLSlug := StrReplace(LBRYURLSlug, "?", "") ; replace all colons with dashes
|
||||
LBRYURLSlug := StrReplace(LBRYURLSlug, "!", "") ; replace all colons with dashes
|
||||
LBRYURLSlug := StrReplace(LBRYURLSlug, "`;", "_") ; replace all colons with dashes
|
||||
LBRYURLSlug := StrReplace(LBRYURLSlug, "/", "_") ; replace all colons with dashes
|
||||
; LBRYURLSlug := StrReplace(LBRYURLSlug, "?", "") ; replace all colons with dashes
|
||||
LBRYURLSlug := StrReplace(LBRYURLSlug, "<", "_") ; replace all colons with dashes
|
||||
LBRYURLSlug := StrReplace(LBRYURLSlug, ">", "_") ; replace all colons with dashes
|
||||
LBRYURLSlug := StrReplace(LBRYURLSlug, SingleQUote, "") ; replace all colons with dashes
|
||||
LBRYURLSlug := StrReplace(LBRYURLSlug, "'", "") ; replace all colons with dashes
|
||||
LBRYURLSlug := StrReplace(LBRYURLSlug, "=", "") ; replace all colons with dashes
|
||||
LBRYURLSlug := StrReplace(LBRYURLSlug, ";", "") ; replace all colons with dashes
|
||||
LBRYURLSlug := StrReplace(LBRYURLSlug, ")", "") ; replace all colons with dashes
|
||||
LBRYURLSlug := StrReplace(LBRYURLSlug, "(", "") ; replace all colons with dashes
|
||||
LBRYURLSlug := StrReplace(LBRYURLSlug, "___", "_") ; replace all colons with dashes
|
||||
LBRYURLSlug := StrReplace(LBRYURLSlug, "__", "_") ; replace all colons with dashes
|
||||
LBRYURLSlug := StrReplace(LBRYURLSlug, "__", "_") ; replace all colons with dashes
|
||||
Return LBRYURLSlug
|
||||
}
|
||||
|
||||
GetLBRYAPIErrorFromString(UploadResult){
|
||||
UploadResultArray := StrSplit(UploadResult, "message")
|
||||
LBRYAPIError := UploadResultArray[2]
|
||||
; LBRYAPIErrorStrLen := StrLen(LBRYAPIError)
|
||||
|
||||
; LBRYAPIErrorStrToTrim := LBRYAPIErrorStrLen - 3
|
||||
; Msgbox % "LBRYAPIErrorStrToTrim: " LBRYAPIErrorStrToTrim
|
||||
LBRYAPIError := SubStr(LBRYAPIError, 4)
|
||||
LBRYAPIError := StrReplace(LBRYAPIError, "}", "")
|
||||
|
||||
|
||||
; Msgbox % "LBRYAPIError: " LBRYAPIError
|
||||
Return LBRYAPIError
|
||||
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
|
||||
|
||||
; Iterate over Locals posts on the home page until found post with title
|
||||
; ------------------------------------------------
|
||||
GrabLocalsPostURLUsingTitle(PostTitle){
|
||||
|
||||
Loop, 10 {
|
||||
Message = Checking Post %A_index% on page for Post Titled`n%PostTitle%
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
ToolTip, %A_Index%
|
||||
|
||||
; first two items can be skipped.
|
||||
; new Post box and Create other forms of posts box
|
||||
if(A_index < 3)
|
||||
Continue
|
||||
|
||||
; Xpath for each post box on the main page
|
||||
Xpath = //body/div/div/div/div/div/div[1]/div[%A_Index%]
|
||||
|
||||
|
||||
try ElementInnerText := driver.findelementbyxpath(Xpath).Attribute("innerText") ;XPATH Inner Text
|
||||
Try ElementOuterHTML := driver.findelementbyxpath(Xpath).Attribute("outerHTML") ;XPATH-ID & Tag
|
||||
|
||||
if(Devmode){
|
||||
Msgbox % "ElementInnerText: " ElementInnerText "`n" "ElementOuterHTML: " ElementOuterHTML
|
||||
}
|
||||
|
||||
|
||||
if(InStr(ElementInnerText, PostTitle)){
|
||||
Message = Found Post Title in Element Number: %A_index%
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
|
||||
; Pull Out the Post URL from the OuterHTML using RegEx
|
||||
regexMatch := RegExMatch(ElementOuterHTML, "data-post-url=""([^""]+)""", match)
|
||||
if (regexMatch)
|
||||
{
|
||||
PostURL := match1
|
||||
Message = URL Pulled out from OuterHTML: %PostURL%
|
||||
Return PostURL
|
||||
}
|
||||
else {
|
||||
Message = Failed to Pull out URL from OuterHTML
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
Return "Failed"
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Message = Failed to find New Post in the first 10 posts
|
||||
SaveOrPostProgress(Message:=Message,PostType:="Tooltip,ErrorLoggingTextFile,DiscordErrorLogging")
|
||||
Return "Failed"
|
||||
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
Function Libraries used in the following Projects:
|
||||
- [Freedomain Social Media Poster](https://git.freedomainplaylists.com/yuriy/Freedomain-Social-Media-Poster)
|
||||
- [Freedomain Video Uploader](https://git.freedomainplaylists.com/yuriy/Freedomain-Video-Uploader)
|
||||
- [Freedomain Reposter](https://git.freedomainplaylists.com/yuriy/Freedomain-Reposter)
|
||||
- [Freedomain Social Media Poster](https://freedomain.dev/yuriy/social-media-poster)
|
||||
- [Freedomain Video Uploader](https://freedomain.dev/yuriy/video-uploader)
|
||||
- [Freedomain Clips Uploader](https://freedomain.dev/yuriy/clips-uploader)
|
||||
- [Freedomain Livestream Scheduler](https://freedomain.dev/yuriy/livestream-scheduler)
|
@ -0,0 +1,197 @@
|
||||
; 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
|
@ -1,11 +1,20 @@
|
||||
URLDownloadToVar(url){
|
||||
|
||||
hObject:=ComObjCreate("WinHttp.WinHttpRequest.5.1")
|
||||
hObject.Open("GET",url)
|
||||
Try, hObject.Open("GET",url)
|
||||
catch e {
|
||||
Message = Error Ocurred when trying to do GET Request using URLDownloadToVar to`n: %URL%
|
||||
SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile,ErrorSummaryVar")
|
||||
}
|
||||
|
||||
try hObject.Send()
|
||||
try {
|
||||
hObject.Send()
|
||||
}
|
||||
catch e {
|
||||
Message = Error Ocurred when trying to hObject.Send() with URLDownloadToVar Function
|
||||
SaveOrPostProgress(Message:=Message,PostType:=",ErrorLoggingTextFile,ErrorSummaryVar")
|
||||
; MsgBox, 4096, Error, Failed to connect to:`n`n%url%`n`nAre you connected to the internet? Or is the website down?`n`nDisable Auto Update Check to disable this message.
|
||||
return ""
|
||||
; msgbox, failed!
|
||||
}
|
||||
|
||||
return hObject.ResponseText
|
||||
|
@ -0,0 +1 @@
|
||||
; Code migrated to Shared-GoTo's
|
@ -0,0 +1,98 @@
|
||||
; https://www.autohotkey.com/boards/viewtopic.php?t=112391
|
||||
|
||||
; Usage:
|
||||
; cred := CredRead("CREDENTIALNAME", NewlineInPassword := 1)
|
||||
; Username := cred.username
|
||||
; Password := cred.password
|
||||
|
||||
; msgbox % cred.username
|
||||
; msgbox % cred.password
|
||||
|
||||
|
||||
; Functions
|
||||
;------------------------------------------------
|
||||
CredWrite(name, username, password)
|
||||
{
|
||||
VarSetCapacity(cred, 24 + A_PtrSize * 7, 0)
|
||||
cbPassword := StrLen(password)*2
|
||||
NumPut(1 , cred, 4+A_PtrSize*0, "UInt") ; Type = CRED_TYPE_GENERIC
|
||||
NumPut(&name , cred, 8+A_PtrSize*0, "Ptr") ; TargetName = name
|
||||
NumPut(cbPassword, cred, 16+A_PtrSize*2, "UInt") ; CredentialBlobSize
|
||||
NumPut(&password , cred, 16+A_PtrSize*3, "UInt") ; CredentialBlob
|
||||
NumPut(3 , cred, 16+A_PtrSize*4, "UInt") ; Persist = CRED_PERSIST_ENTERPRISE (roam across domain)
|
||||
NumPut(&username , cred, 24+A_PtrSize*6, "Ptr") ; UserName
|
||||
return DllCall("Advapi32.dll\CredWriteW"
|
||||
, "Ptr", &cred ; [in] PCREDENTIALW Credential
|
||||
, "UInt", 0 ; [in] DWORD Flags
|
||||
, "UInt") ; BOOL
|
||||
}
|
||||
|
||||
CredDelete(name)
|
||||
{
|
||||
return DllCall("Advapi32.dll\CredDeleteW"
|
||||
, "WStr", name ; [in] LPCWSTR TargetName
|
||||
, "UInt", 1 ; [in] DWORD Type,
|
||||
, "UInt", 0 ; [in] DWORD Flags
|
||||
, "UInt") ; BOOL
|
||||
}
|
||||
|
||||
CredRead(name,NewlineInUsername:=0, NewlineInPassword:=0)
|
||||
{
|
||||
DllCall("Advapi32.dll\CredReadW"
|
||||
, "Str", name ; [in] LPCWSTR TargetName
|
||||
, "UInt", 1 ; [in] DWORD Type = CRED_TYPE_GENERIC (https://learn.microsoft.com/en-us/windows/win32/api/wincred/ns-wincred-credentiala)
|
||||
, "UInt", 0 ; [in] DWORD Flags
|
||||
, "Ptr*", pCred ; [out] PCREDENTIALW *Credential
|
||||
, "UInt") ; BOOL
|
||||
if !pCred{
|
||||
; Username
|
||||
InputBox, Username, Input Username, Username not found. `nPlease Input Username for: `n--%name%--,,,,,,,,%Clipboard% ; , Prompt, HIDE, Width, Height, X, Y, Font, Timeout, Default]
|
||||
if(ErrorLevel)
|
||||
return
|
||||
|
||||
InputBox, Password, Input Password, Password not found. `nPlease Input Password for: `n--%name%--,,,,,,,,%Clipboard% ; , Prompt, HIDE, Width, Height, X, Y, Font, Timeout, Default]
|
||||
if(ErrorLevel)
|
||||
return
|
||||
|
||||
if !CredWrite(name, Username, Password)
|
||||
MsgBox failed to write cred
|
||||
else, { ; try reading the credential that was just saved
|
||||
DllCall("Advapi32.dll\CredReadW"
|
||||
, "Str", name ; [in] LPCWSTR TargetName
|
||||
, "UInt", 1 ; [in] DWORD Type = CRED_TYPE_GENERIC (https://learn.microsoft.com/en-us/windows/win32/api/wincred/ns-wincred-credentiala)
|
||||
, "UInt", 0 ; [in] DWORD Flags
|
||||
, "Ptr*", pCred ; [out] PCREDENTIALW *Credential
|
||||
, "UInt") ; BOOL
|
||||
}
|
||||
if !pCred{
|
||||
msgbox, Failed to read cred. after writing it to Credential Manager.
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
name := StrGet(NumGet(pCred + 8 + A_PtrSize * 0, "UPtr"), 256, "UTF-16")
|
||||
|
||||
; append new line to end if requested
|
||||
if(NewlineInUsername)
|
||||
username := StrGet(NumGet(pCred + 24 + A_PtrSize * 6, "UPtr"), 256, "UTF-16") . "`n"
|
||||
else,
|
||||
username := StrGet(NumGet(pCred + 24 + A_PtrSize * 6, "UPtr"), 256, "UTF-16")
|
||||
|
||||
len := NumGet(pCred + 16 + A_PtrSize * 2, "UInt")
|
||||
|
||||
; append new line to end if requested
|
||||
if(NewlineInPassword)
|
||||
password := StrGet(NumGet(pCred + 16 + A_PtrSize * 3, "UPtr"), len/2, "UTF-16") . "`n"
|
||||
else,
|
||||
password := StrGet(NumGet(pCred + 16 + A_PtrSize * 3, "UPtr"), len/2, "UTF-16")
|
||||
|
||||
|
||||
DllCall("Advapi32.dll\CredFree", "Ptr", pCred)
|
||||
return {"name": name, "username": username, "password": password}
|
||||
}
|
||||
|
||||
|
||||
; Misc
|
||||
;------------------------------------------------
|
||||
; Escape::ExitApp
|
Loading…
Reference in New Issue