diff --git a/.github/workflows/HEVC.yml b/.github/workflows/HEVC.yml new file mode 100644 index 00000000..d73b4c98 --- /dev/null +++ b/.github/workflows/HEVC.yml @@ -0,0 +1,29 @@ +name: Download HEVC + +on: + workflow_dispatch: + +permissions: + contents: write + +jobs: + download-and-save: + runs-on: windows-latest + + steps: + - name: Checkout repository + uses: actions/checkout@main + + - name: Download HEVC package + run: | + . "Scripts\HEVC.ps1" + + - name: Commit and push changes + run: | + # Save Microsoft.HEVCVideoExtension_8wekyb3d8bbwe.appx to HEVC folder + git config user.name "${{ github.actor }}" + git config user.email "${{ github.actor }}@users.noreply.github.com" + + git add HEVC/Microsoft.HEVCVideoExtension_8wekyb3d8bbwe.appx + git commit -m "Update Microsoft.HEVCVideoExtension_8wekyb3d8bbwe.appx" + git push diff --git a/Scripts/HEVC.ps1 b/Scripts/HEVC.ps1 new file mode 100644 index 00000000..4a019eae --- /dev/null +++ b/Scripts/HEVC.ps1 @@ -0,0 +1,50 @@ +# https://store.rg-adguard.net +# https://apps.microsoft.com/detail/9N4WGH0Z6VHQ + +if (-not (Test-Path -Path HEVC)) +{ + New-Item -Path HEVC -ItemType Directory -Force +} + +try +{ + $Body = @{ + type = "url" + url = "https://apps.microsoft.com/detail/9N4WGH0Z6VHQ" + ring = "Retail" + lang = "en-US" + } + $Parameters = @{ + Uri = "https://ru.store.rg-adguard.net/api/GetFiles" + Method = "Post" + ContentType = "application/x-www-form-urlencoded" + Body = $Body + UseBasicParsing = $true + Verbose = $true + } + $Raw = Invoke-WebRequest @Parameters +} +catch [System.Net.WebException] +{ + Write-Verbose -Message "Connection could not be established with https://store.rg-adguard.net" -Verbose + + exit 1 # Exit with a non-zero status to fail the job +} + +# Get a temp URL +$TempURL = $Raw.Links.href | Sort-Object -Property Length -Descending | Select-Object -First 1 +if (-not $TempURL) +{ + Write-Verbose -Message "https://store.rg-adguard.net does not output correct URL" -Verbose + + exit 1 # Exit with a non-zero status to fail the job +} + +# Download archive +$Parameters = @{ + Uri = $TempURL + OutFile = "HEVC\Microsoft.HEVCVideoExtension_8wekyb3d8bbwe.appx" + Verbose = $true + UseBasicParsing = $true +} +Invoke-WebRequest @Parameters diff --git a/src/Sophia_Script_for_Windows_11/Module/Private/InitialActions.ps1 b/src/Sophia_Script_for_Windows_11/Module/Private/InitialActions.ps1 index 51a4592a..2c10105e 100644 --- a/src/Sophia_Script_for_Windows_11/Module/Private/InitialActions.ps1 +++ b/src/Sophia_Script_for_Windows_11/Module/Private/InitialActions.ps1 @@ -580,7 +580,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd); # Check SecurityHealthService service try { - Get-Service -Name SecurityHealthService -ErrorAction Stop | Start-Service -ErrorAction Stop -ErrorAction Stop + Get-Service -Name SecurityHealthService -ErrorAction Stop | Start-Service -ErrorAction Stop } catch {