💾 Archived View for g.mikf.pl › gemlog › 2022-12-20-pwsh-srht.gmi captured on 2024-05-10 at 10:43:16. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-01-29)
-=-=-=-=-=-=-
The Powershell script residing in my home directory with .ps1 extension:
Import-Module ` "C:\Users\Mika Feiler\$( )\source\repos\DotnetTarGzipper\$( )\bin\Release\net7.0\DotnetTarGzipper.dll" $GemCap = $env:GemCap Push-Location Set-Location $GemCap & 'C:\Program Files\Git\bin\bash.exe' ` -c 'date -d "$(grep "^## " tinylog.gmi | cut -c 4- | head -1)" \ +"# Mika Feiler%n=> tinylog.gmi %F Tinylog" > gemfeed-tinylog.gmi' Pop-Location $TempFile = New-TemporaryFile Write-Host "Temporary file name '$TempFile'. " $SrHtTokenKey = "SrHtToken_g.mikf.pl" Get-ChildItem $GemCap -File -Recurse -Name | Where-Object { $_ -NotMatch "^(.*[\\\/])?\..*" } | ForEach-Object { $_ -replace '\\', '/' } | New-Tar (Resolve-Path $GemCap) | Compress-Gzip | Set-Content -Path $TempFile -AsByteStream Write-Host "Finished creating archive. " function Get-SrHtToken { $SrHtToken = Get-Secret $SrHtTokenKey -ErrorVariable NoSrhtToken if($NoSrhtToken.Exception -Is ` [System.Management.Automation.ItemNotFoundException]) { Set-Secret $SrHtTokenKey ($SrHtToken = ` Read-Host -AsSecureString -Prompt "Enter the token") } $SrHtToken } Invoke-WebRequest -Method Post ` -Uri "https://pages.sr.ht/publish/g.mikf.pl" ` -Authentication OAuth -Token (Get-SrHtToken) ` -Form @{ protocol = "GEMINI" content = Get-ChildItem $TempFile } ` -RetryIntervalSec 2 -MaximumRetryCount 3 | ForEach-Object { Write-Host $_.RawContent }
outputs
Temporary file name 'C:\Users\Mika Feiler\AppData\Local\Temp\tmp7B90.tmp'. Finished creating archive. HTTP/1.1 200 OK Date: Tue, 20 Dec 2022 19:04:25 GMT Content-Length: 65 Content-Type: text/plain; charset=utf-8 8c55789c139f9c386c3a00565b8f22448355cc684a549f1fcad8348517f0e7b3
with sometimes the
Finished creating archive. Vault SecretStore requires a password. Enter password:
in between, except on first run when it's
Get-Secret: C:\Users\Mika Feiler\thingie_gem.ps1:29 Line | 29 | $SrHtToken = Get-Secret $SrHtTokenKey -ErrorVariable NoSrhtToken | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | The secret SrHtToken_g.mikf.pl was not found. Enter the token: ********************************************************************************************
Prerequisites:
in the post from two weeks ago
I am planning to rewrite the compiled cmdlets in pure Powershell soon now that I know what was at fault in earlier attempts. As I want to achieve modifiability on my ThinkPad Helix without installing Visual Studio 2022 Preview there, not just drop there the assemblies from my larger laptop.