Last active
July 12, 2026 10:53
-
-
Save silkyland/27123ca16f3f42ebb674a788bac66d38 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # --- Step 4: Create tunnel launcher --- | |
| Write-Host "" | |
| Write-Host "[4/4] Creating tunnel launcher..." -ForegroundColor Yellow | |
| $launcherDir = "$env:USERPROFILE\marketthaipro-sftp" | |
| $launcherPath = "$launcherDir\start-tunnel.ps1" | |
| $shortcutPath = "$env:USERPROFILE\Desktop\Start SFTP Tunnel.lnk" | |
| if (-not (Test-Path $launcherDir)) { | |
| New-Item -ItemType Directory -Path $launcherDir -Force | Out-Null | |
| } | |
| $launcherContent = @' | |
| $Host.UI.RawUI.WindowTitle = "SFTP Tunnel - marketthaipro.com" | |
| Write-Host "===================================================" -ForegroundColor Cyan | |
| Write-Host " SFTP Tunnel to marketthaipro.com" -ForegroundColor Cyan | |
| Write-Host "===================================================" -ForegroundColor Cyan | |
| Write-Host "" | |
| Write-Host "Starting tunnel..." -ForegroundColor Yellow | |
| Write-Host "Browser will open for authentication (first time only)" -ForegroundColor Gray | |
| Write-Host "" | |
| Write-Host "Once you see 'Listening on 127.0.0.1:2222':" -ForegroundColor Green | |
| Write-Host " 1. Open FileZilla" -ForegroundColor White | |
| Write-Host " 2. Host: localhost" -ForegroundColor Cyan | |
| Write-Host " 3. Port: 2222" -ForegroundColor Cyan | |
| Write-Host " 4. Protocol: SFTP" -ForegroundColor Cyan | |
| Write-Host " 5. Enter your username and password" -ForegroundColor White | |
| Write-Host "" | |
| Write-Host "!! Keep this window OPEN while using FileZilla !!" -ForegroundColor Yellow | |
| Write-Host " Close this window to disconnect." -ForegroundColor Gray | |
| Write-Host "" | |
| Write-Host "---------------------------------------------------" -ForegroundColor Gray | |
| cloudflared access tcp --hostname sftp.marketthaipro.com --url localhost:2222 | |
| '@ | |
| Set-Content -Path $launcherPath -Value $launcherContent -Encoding UTF8 | |
| Write-Host " Created launcher: $launcherPath" -ForegroundColor Green | |
| # Create desktop shortcut | |
| $WScriptShell = New-Object -ComObject WScript.Shell | |
| $Shortcut = $WScriptShell.CreateShortcut($shortcutPath) | |
| $Shortcut.TargetPath = "powershell.exe" | |
| $Shortcut.Arguments = "-NoProfile -ExecutionPolicy Bypass -File `"$launcherPath`"" | |
| $Shortcut.WorkingDirectory = $launcherDir | |
| $Shortcut.IconLocation = "powershell.exe,0" | |
| $Shortcut.Description = "Start SFTP tunnel to marketthaipro.com" | |
| $Shortcut.Save() | |
| Write-Host " Created desktop shortcut: Start SFTP Tunnel" -ForegroundColor Green | |
| Write-Host "" | |
| Write-Host "===================================================" -ForegroundColor Cyan | |
| Write-Host " Setup complete!" -ForegroundColor Green | |
| Write-Host "===================================================" -ForegroundColor Cyan | |
| Write-Host "" | |
| Write-Host "HOW TO USE:" -ForegroundColor White | |
| Write-Host " 1. Double-click 'Start SFTP Tunnel' on your Desktop" -ForegroundColor Cyan | |
| Write-Host " 2. Wait for 'Listening on 127.0.0.1:2222'" -ForegroundColor Cyan | |
| Write-Host " 3. Open FileZilla and connect:" -ForegroundColor Cyan | |
| Write-Host " Host: localhost" -ForegroundColor White | |
| Write-Host " Port: 2222" -ForegroundColor White | |
| Write-Host " Protocol: SFTP" -ForegroundColor White | |
| Write-Host " User/Pass: (from admin)" -ForegroundColor White | |
| Write-Host "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment