From 9db56dccae5174ef5d24f94dc0b04135e0771574 Mon Sep 17 00:00:00 2001 From: Asmir Avdicevic Date: Fri, 7 Mar 2025 02:54:22 +0100 Subject: [PATCH 1/3] feat: add windows install script --- public/sendme.ps1 | 35 +++++++++++++++++++++++++++++++++++ src/components/SendmePage.jsx | 23 +++++++++++++++++++++-- 2 files changed, 56 insertions(+), 2 deletions(-) create mode 100755 public/sendme.ps1 diff --git a/public/sendme.ps1 b/public/sendme.ps1 new file mode 100755 index 00000000..b6aea5c7 --- /dev/null +++ b/public/sendme.ps1 @@ -0,0 +1,35 @@ +$repo = "n0-computer/sendme" +$release_url = "https://api.github.com/repos/$repo/releases/latest" + +$target = "windows-x86_64" +$zipFile = "sendme.zip" +$extractPath = ".\sendme" + +Write-Host "Fetching latest release for $target..." +$releaseJson = Invoke-RestMethod -Uri $release_url +$releaseUrl = ($releaseJson.assets | Where-Object { $_.browser_download_url -match $target }).browser_download_url + +if (-not $releaseUrl) { + Write-Host "Error: No release found for $target" -ForegroundColor Red + exit 1 +} + +Write-Host "Downloading from $releaseUrl..." +Invoke-WebRequest -Uri $releaseUrl -OutFile $zipFile + +Write-Host "Extracting..." +Expand-Archive -Path $zipFile -DestinationPath $extractPath -Force + +Write-Host "Cleaning up..." +Remove-Item -Force $zipFile + +Write-Host "Installation complete!" + +# Add the 'sendme' folder to PATH +$sendmePath = (Resolve-Path $extractPath).Path + +# Add the folder to the PATH permanently (user level) +$env:Path += ";$sendmePath" +[System.Environment]::SetEnvironmentVariable("Path", $env:Path, [System.EnvironmentVariableTarget]::User) + +Write-Host "'$sendmePath' has been permanently added to user PATH." -ForegroundColor Green \ No newline at end of file diff --git a/src/components/SendmePage.jsx b/src/components/SendmePage.jsx index d26c51e1..f2e014ad 100644 --- a/src/components/SendmePage.jsx +++ b/src/components/SendmePage.jsx @@ -20,16 +20,25 @@ const koulen = localFont({ export default function SendmePage() { const install = `curl -fsSL https://iroh.computer/sendme.sh | sh` + const install_win = `iwr https://iroh.computer/sendme.ps1 -useb | iex` const [copied, setCopied] = React.useState(false) - const handleCopy = () => { - navigator.clipboard.writeText(install); + const _handleCopy = (ins) => { + navigator.clipboard.writeText(ins); setCopied(true); setTimeout(() => { setCopied(false); }, 1300); } + const handleCopy = () => { + _handleCopy(install); + } + + const handleCopyWin = () => { + _handleCopy(install_win); + } + return (
@@ -60,6 +69,16 @@ export default function SendmePage() { ? : } +

On windows:

+

This will copy the sendme binary to the path you ran the script from.
Run it with

./sendme
on unix systems

From b1ff481013baef305d13ab50a782a0270ad31146 Mon Sep 17 00:00:00 2001 From: Asmir Avdicevic Date: Fri, 7 Mar 2025 02:57:40 +0100 Subject: [PATCH 2/3] cleanup --- src/components/SendmePage.jsx | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/components/SendmePage.jsx b/src/components/SendmePage.jsx index f2e014ad..a52ba27e 100644 --- a/src/components/SendmePage.jsx +++ b/src/components/SendmePage.jsx @@ -22,21 +22,26 @@ export default function SendmePage() { const install = `curl -fsSL https://iroh.computer/sendme.sh | sh` const install_win = `iwr https://iroh.computer/sendme.ps1 -useb | iex` const [copied, setCopied] = React.useState(false) + const [copiedWin, setCopiedWin] = React.useState(false) const _handleCopy = (ins) => { navigator.clipboard.writeText(ins); - setCopied(true); - setTimeout(() => { - setCopied(false); - }, 1300); } const handleCopy = () => { _handleCopy(install); + setCopied(true); + setTimeout(() => { + setCopied(false); + }, 1300); } const handleCopyWin = () => { _handleCopy(install_win); + setCopiedWin(true); + setTimeout(() => { + setCopiedWin(false); + }, 1300); } return ( @@ -72,10 +77,10 @@ export default function SendmePage() {

On windows:

From 2a0ec79f404a77050fe22e10292ac058218c2c71 Mon Sep 17 00:00:00 2001 From: Asmir Avdicevic Date: Fri, 11 Apr 2025 09:50:50 +0200 Subject: [PATCH 3/3] update wording --- src/components/SendmePage.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/SendmePage.jsx b/src/components/SendmePage.jsx index a52ba27e..7b3723c4 100644 --- a/src/components/SendmePage.jsx +++ b/src/components/SendmePage.jsx @@ -64,7 +64,7 @@ export default function SendmePage() {

Install

-

Add sendme to your machine using shell:

+

Add sendme to your machine using bash:

-

On windows:

+

On windows with PowerShell: