From 4a2370b658e9e0415135ba97124ab025c5c0127a Mon Sep 17 00:00:00 2001 From: lub Date: Wed, 2 Aug 2023 19:00:08 +0200 Subject: [PATCH] generate /preview URL directly --- dotfiles/bin/.bin/nextcloud-screenshot.ps1 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dotfiles/bin/.bin/nextcloud-screenshot.ps1 b/dotfiles/bin/.bin/nextcloud-screenshot.ps1 index 1e07566..9f99e86 100755 --- a/dotfiles/bin/.bin/nextcloud-screenshot.ps1 +++ b/dotfiles/bin/.bin/nextcloud-screenshot.ps1 @@ -41,14 +41,15 @@ if ((Get-Item $tmpPath).Length -eq 0) { } magick $tmpPath $webpPath +Remove-Item $tmpPath + if ((Get-Item $webpPath).Length -eq 0) { Remove-Item $webpPath throw ('WebP file "{0}" is empty' -f $webpPath) -} else { - Remove-Item $tmpPath } + $webpName = (Split-Path -Leaf $webpPath) $nextcloudPath = $config.Path + '/' + $webpName @@ -87,7 +88,7 @@ try { throw $_ Remove-Item $webpPath } -$share.ocs.data.url | wl-copy --trim-newline +$share.ocs.data.url + '/preview' | wl-copy --trim-newline notify-send 'Screenshot URL in clipboard' --expire-time=1000 Remove-Item $webpPath