diff --git a/public/sendme.ps1 b/public/sendme.ps1 new file mode 100755 index 0000000..b6aea5c --- /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 d26c51e..7b3723c 100644 --- a/src/components/SendmePage.jsx +++ b/src/components/SendmePage.jsx @@ -20,16 +20,30 @@ 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 [copiedWin, setCopiedWin] = React.useState(false) + + const _handleCopy = (ins) => { + navigator.clipboard.writeText(ins); + } const handleCopy = () => { - navigator.clipboard.writeText(install); + _handleCopy(install); setCopied(true); setTimeout(() => { setCopied(false); }, 1300); } + const handleCopyWin = () => { + _handleCopy(install_win); + setCopiedWin(true); + setTimeout(() => { + setCopiedWin(false); + }, 1300); + } + return (
Add sendme to your machine using shell:
+Add sendme to your machine using bash:
+On windows with PowerShell:
+This will copy the sendme binary to the path you ran the script from.
Run it with
./sendmeon unix systems