feat: ent ORM, admin UI, client auth, Fyne GUI, Windows/MSI packaging
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
# frpc configuration
|
||||
# Generated by frpc installer
|
||||
# Edit this file to configure your frp client.
|
||||
|
||||
serverAddr = "127.0.0.1"
|
||||
serverPort = 7000
|
||||
auth.token = ""
|
||||
|
||||
# Uncomment and set the URL to auto-fetch config from frps:
|
||||
# configURL = "http://your-server:7500/admin/api/frpc/proxy-config/YOUR_KEY"
|
||||
@@ -0,0 +1,148 @@
|
||||
; frpc Windows Installer (NSIS)
|
||||
; Build: makensis frpc.nsi
|
||||
; Requires: NSIS 3.x (https://nsis.sourceforge.io)
|
||||
|
||||
!define PRODUCT_NAME "frpc"
|
||||
!define PRODUCT_VERSION "0.62.0"
|
||||
!define PRODUCT_PUBLISHER "frp Contributors"
|
||||
!define PRODUCT_WEB_SITE "https://github.com/fatedier/frp"
|
||||
!define PRODUCT_DIR "$PROGRAMFILES64\${PRODUCT_NAME}"
|
||||
!define PRODUCT_UNINSTALL_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
|
||||
|
||||
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
|
||||
OutFile "..\..\bin\frpc-${PRODUCT_VERSION}-setup.exe"
|
||||
InstallDir "${PRODUCT_DIR}"
|
||||
InstallDirRegKey HKLM "${PRODUCT_UNINSTALL_KEY}" "InstallLocation"
|
||||
RequestExecutionLevel admin
|
||||
|
||||
SetCompressor lzma
|
||||
|
||||
; Pages (setup wizard)
|
||||
Page license
|
||||
Page components
|
||||
Page directory
|
||||
Page instfiles
|
||||
Page custom setFinishPage
|
||||
|
||||
; Uninstaller pages
|
||||
UninstPage uninstConfirm
|
||||
UninstPage instfiles
|
||||
|
||||
; License data
|
||||
LicenseData "..\..\packaging\windows\license.txt"
|
||||
|
||||
; Languages
|
||||
!insertmacro MUI_LANGUAGE "English"
|
||||
|
||||
; Include modern UI
|
||||
!include "MUI2.nsh"
|
||||
!include "FileFunc.nsh"
|
||||
!include "WinMessages.nsh"
|
||||
!include "LogicLib.nsh"
|
||||
|
||||
Var FinishPage
|
||||
Var RunNowCheckbox
|
||||
Var ShowReadmeCheckbox
|
||||
Var RunNowState
|
||||
Var ReadmeState
|
||||
|
||||
Function setFinishPage
|
||||
nsDialogs::Create 1018
|
||||
Pop $FinishPage
|
||||
|
||||
${NSD_CreateLabel} 0 0 100% 24 "Setup Complete"
|
||||
Pop $0
|
||||
|
||||
${NSD_CreateCheckbox} 0 30 100% 12 "Run frpc now"
|
||||
Pop $RunNowCheckbox
|
||||
${NSD_Check} $RunNowCheckbox
|
||||
|
||||
${NSD_CreateCheckbox} 0 46 100% 12 "Open config directory"
|
||||
Pop $ShowReadmeCheckbox
|
||||
|
||||
nsDialogs::Show
|
||||
FunctionEnd
|
||||
|
||||
Function .onGUIEnd
|
||||
${NSD_GetState} $RunNowCheckbox $RunNowState
|
||||
${NSD_GetState} $ShowReadmeCheckbox $ReadmeState
|
||||
|
||||
${If} $RunNowState == ${BST_CHECKED}
|
||||
ExecShell "open" "$INSTDIR\frpc.exe"
|
||||
${EndIf}
|
||||
|
||||
${If} $ReadmeState == ${BST_CHECKED}
|
||||
ExecShell "open" "$PROGRAMDATA\frpc"
|
||||
${EndIf}
|
||||
FunctionEnd
|
||||
|
||||
Section "frpc (required)" SEC_FRPC
|
||||
SectionIn RO
|
||||
SetOutPath "$INSTDIR"
|
||||
File "..\..\bin\frpc-windows-amd64.exe"
|
||||
Rename "$INSTDIR\frpc-windows-amd64.exe" "$INSTDIR\frpc.exe"
|
||||
|
||||
; Config directory
|
||||
CreateDirectory "$PROGRAMDATA\frpc"
|
||||
SetOutPath "$PROGRAMDATA\frpc"
|
||||
File "/oname=frpc.toml" "..\..\packaging\windows\frpc.default.toml"
|
||||
|
||||
WriteUninstaller "$INSTDIR\uninstall.exe"
|
||||
|
||||
; Registry for uninstaller
|
||||
WriteRegStr HKLM "${PRODUCT_UNINSTALL_KEY}" "DisplayName" "${PRODUCT_NAME}"
|
||||
WriteRegStr HKLM "${PRODUCT_UNINSTALL_KEY}" "UninstallString" "$INSTDIR\uninstall.exe"
|
||||
WriteRegStr HKLM "${PRODUCT_UNINSTALL_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
|
||||
WriteRegStr HKLM "${PRODUCT_UNINSTALL_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
|
||||
WriteRegStr HKLM "${PRODUCT_UNINSTALL_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
|
||||
WriteRegStr HKLM "${PRODUCT_UNINSTALL_KEY}" "DisplayIcon" "$INSTDIR\frpc.exe,0"
|
||||
WriteRegStr HKLM "${PRODUCT_UNINSTALL_KEY}" "InstallLocation" "$INSTDIR"
|
||||
WriteRegDWORD HKLM "${PRODUCT_UNINSTALL_KEY}" "NoModify" 1
|
||||
WriteRegDWORD HKLM "${PRODUCT_UNINSTALL_KEY}" "NoRepair" 1
|
||||
SectionEnd
|
||||
|
||||
Section "Start Menu Shortcuts" SEC_SHORTCUTS
|
||||
CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}"
|
||||
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\frpc.lnk" "$INSTDIR\frpc.exe" "" "$INSTDIR\frpc.exe" 0
|
||||
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Config Directory.lnk" "$PROGRAMDATA\frpc"
|
||||
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe"
|
||||
SectionEnd
|
||||
|
||||
Section "Add to PATH" SEC_PATH
|
||||
EnVar::AddValue "PATH" "$INSTDIR"
|
||||
Pop $0
|
||||
SectionEnd
|
||||
|
||||
Section "Desktop Shortcut" SEC_DESKTOP
|
||||
CreateShortCut "$DESKTOP\frpc.lnk" "$INSTDIR\frpc.exe" "" "$INSTDIR\frpc.exe" 0
|
||||
SectionEnd
|
||||
|
||||
; Descriptions
|
||||
LangString DESC_SEC_FRPC ${LANG_ENGLISH} "frpc binary and default configuration."
|
||||
LangString DESC_SEC_SHORTCUTS ${LANG_ENGLISH} "Start menu shortcuts for frpc."
|
||||
LangString DESC_SEC_PATH ${LANG_ENGLISH} "Add frpc installation directory to system PATH."
|
||||
LangString DESC_SEC_DESKTOP ${LANG_ENGLISH} "Create a desktop shortcut for frpc."
|
||||
|
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_FRPC} $(DESC_SEC_FRPC)
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_SHORTCUTS} $(DESC_SEC_SHORTCUTS)
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_PATH} $(DESC_SEC_PATH)
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_DESKTOP} $(DESC_SEC_DESKTOP)
|
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
||||
|
||||
Section "Uninstall"
|
||||
Delete "$INSTDIR\frpc.exe"
|
||||
Delete "$INSTDIR\uninstall.exe"
|
||||
RMDir "$INSTDIR"
|
||||
|
||||
Delete "$SMPROGRAMS\${PRODUCT_NAME}\frpc.lnk"
|
||||
Delete "$SMPROGRAMS\${PRODUCT_NAME}\Config Directory.lnk"
|
||||
Delete "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall.lnk"
|
||||
RMDir "$SMPROGRAMS\${PRODUCT_NAME}"
|
||||
|
||||
Delete "$DESKTOP\frpc.lnk"
|
||||
|
||||
EnVar::DeleteValue "PATH" "$INSTDIR"
|
||||
|
||||
DeleteRegKey HKLM "${PRODUCT_UNINSTALL_KEY}"
|
||||
SectionEnd
|
||||
@@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Wix xmlns="http://wixtoolset.org/schemas/v3/wxs">
|
||||
<Product
|
||||
Name="frpc"
|
||||
Id="*"
|
||||
UpgradeCode="A1B2C3D4-E5F6-7890-ABCD-EF1234567890"
|
||||
Language="1033"
|
||||
Codepage="1252"
|
||||
Version="0.62.0"
|
||||
Manufacturer="frp Contributors">
|
||||
|
||||
<Package
|
||||
InstallerVersion="200"
|
||||
Compressed="yes"
|
||||
InstallScope="perMachine"
|
||||
Description="frp Client"
|
||||
Comments="frpc is the client component of frp - a fast reverse proxy." />
|
||||
|
||||
<Media Id="1" Cabinet="frpc.cab" EmbedCab="yes" />
|
||||
|
||||
<Directory Id="TARGETDIR" Name="SourceDir">
|
||||
<Directory Id="ProgramFiles64Folder">
|
||||
<Directory Id="INSTALLDIR" Name="frpc">
|
||||
<Component Id="FrpcBinary" Guid="E1B2C3D4-E5F6-7890-ABCD-EF1234567894">
|
||||
<File Id="FrpcExe" Name="frpc.exe" DiskId="1" Source="bin/frpc-windows-amd64.exe" KeyPath="yes" />
|
||||
</Component>
|
||||
</Directory>
|
||||
</Directory>
|
||||
|
||||
<Directory Id="ProgramMenuFolder">
|
||||
<Directory Id="ApplicationProgramsFolder" Name="frpc">
|
||||
<Component Id="StartMenuShortcuts" Guid="A2B2C3D4-E5F6-7890-ABCD-EF1234567892">
|
||||
<Shortcut Id="FrpcShortcut" Name="frpc" Target="[INSTALLDIR]frpc.exe" WorkingDirectory="INSTALLDIR" Description="frp client" />
|
||||
<Shortcut Id="UninstallShortcut" Name="Uninstall frpc" Target="[System64Folder]msiexec.exe" Arguments="/x [ProductCode]" />
|
||||
<RemoveFolder Id="RemoveApplicationProgramsFolder" On="uninstall" />
|
||||
<RegistryValue Root="HKCU" Key="Software\frp\frpc" Name="installed" Type="integer" Value="1" />
|
||||
</Component>
|
||||
</Directory>
|
||||
</Directory>
|
||||
</Directory>
|
||||
|
||||
<Feature Id="Main" Title="frpc" Description="frp client binary" Level="1">
|
||||
<ComponentRef Id="FrpcBinary" />
|
||||
<ComponentRef Id="StartMenuShortcuts" />
|
||||
</Feature>
|
||||
</Product>
|
||||
</Wix>
|
||||
@@ -0,0 +1,309 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
frpc Windows Setup Wizard (Interactive PowerShell Installer)
|
||||
.DESCRIPTION
|
||||
Interactive installer for frpc with EULA acceptance, directory selection,
|
||||
and optional features (PATH, shortcuts, desktop icon).
|
||||
.PARAMETER Unattended
|
||||
Run in silent mode with defaults.
|
||||
.PARAMETER InstallDir
|
||||
Installation directory (default: $env:ProgramFiles\frpc).
|
||||
.EXAMPLE
|
||||
.\install.ps1
|
||||
.\install.ps1 -Unattended
|
||||
#>
|
||||
|
||||
param(
|
||||
[switch]$Unattended,
|
||||
[string]$InstallDir = "$env:ProgramFiles\frpc"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
$host.UI.RawUI.WindowTitle = "frpc Setup Wizard"
|
||||
$env:FRPC_VERSION = "0.62.0"
|
||||
|
||||
function Write-Banner {
|
||||
Clear-Host
|
||||
Write-Host "========================================" -ForegroundColor Cyan
|
||||
Write-Host " frpc - frp Client v$env:FRPC_VERSION" -ForegroundColor Cyan
|
||||
Write-Host " Setup Wizard" -ForegroundColor Cyan
|
||||
Write-Host "========================================" -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
}
|
||||
|
||||
function Show-License {
|
||||
param([string]$Path)
|
||||
Write-Banner
|
||||
Write-Host "License Agreement" -ForegroundColor Yellow
|
||||
Write-Host "==================" -ForegroundColor Yellow
|
||||
Write-Host ""
|
||||
if (Test-Path $Path) {
|
||||
Get-Content $Path | ForEach-Object { Write-Host $_ }
|
||||
} else {
|
||||
Write-Host "frpc is licensed under the Apache License, Version 2.0."
|
||||
Write-Host "See http://www.apache.org/licenses/LICENSE-2.0"
|
||||
}
|
||||
Write-Host ""
|
||||
if (-not $Unattended) {
|
||||
$choice = $host.UI.PromptForChoice(
|
||||
"License Agreement",
|
||||
"Do you accept the terms?",
|
||||
[System.Management.Automation.Host.ChoiceDescription[]]@(
|
||||
@{Label="&Agree"; Help="I accept the agreement"},
|
||||
@{Label="&Decline"; Help="I do not accept the agreement"}
|
||||
),
|
||||
1
|
||||
)
|
||||
if ($choice -ne 0) {
|
||||
Write-Host "Setup cancelled. You must accept the license to install." -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Select-Directory {
|
||||
param([string]$DefaultPath)
|
||||
Write-Banner
|
||||
Write-Host "Installation Directory" -ForegroundColor Yellow
|
||||
Write-Host "======================" -ForegroundColor Yellow
|
||||
Write-Host ""
|
||||
Write-Host "Default: $DefaultPath" -ForegroundColor Gray
|
||||
Write-Host ""
|
||||
|
||||
if (-not $Unattended) {
|
||||
$input = Read-Host "Press Enter to accept, or type a custom path"
|
||||
if ($input -ne "") {
|
||||
return $input
|
||||
}
|
||||
}
|
||||
return $DefaultPath
|
||||
}
|
||||
|
||||
function Select-Components {
|
||||
Write-Banner
|
||||
Write-Host "Select Components" -ForegroundColor Yellow
|
||||
Write-Host "=================" -ForegroundColor Yellow
|
||||
Write-Host ""
|
||||
|
||||
$components = @{
|
||||
"Main" = @{Desc="frpc binary and config"; Default=$true}
|
||||
"Path" = @{Desc="Add to system PATH"; Default=$true}
|
||||
"StartMenu" = @{Desc="Start Menu shortcuts"; Default=$true}
|
||||
"Desktop" = @{Desc="Desktop shortcut"; Default=$false}
|
||||
}
|
||||
|
||||
$selected = @{}
|
||||
$i = 1
|
||||
$choices = @()
|
||||
|
||||
foreach ($key in $components.Keys) {
|
||||
$c = $components[$key]
|
||||
$default = if ($c.Default) { "Y" } else { "N" }
|
||||
$displayDefault = if ($c.Default) { "Yes" } else { "No" }
|
||||
Write-Host " $i. $($c.Desc) [$displayDefault]" -ForegroundColor Gray
|
||||
$choices += @{Key=$key; Default=$default}
|
||||
$i++
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
if (-not $Unattended) {
|
||||
Write-Host "Press Enter for defaults, or type numbers to toggle (e.g. 1,3):" -ForegroundColor Yellow
|
||||
$input = Read-Host
|
||||
if ($input -ne "") {
|
||||
$toggleIndices = $input -split ',' | ForEach-Object { $_.Trim() } | Where-Object { $_ -ne "" }
|
||||
for ($j = 0; $j -lt $choices.Count; $j++) {
|
||||
$idx = $j + 1
|
||||
$isToggled = [string]$idx -in $toggleIndices
|
||||
$c = $components[$choices[$j].Key]
|
||||
$default = $c.Default
|
||||
$selected[$choices[$j].Key] = if ($isToggled) { -not $default } else { $default }
|
||||
}
|
||||
} else {
|
||||
foreach ($ch in $choices) { $selected[$ch.Key] = $components[$ch.Key].Default }
|
||||
}
|
||||
} else {
|
||||
foreach ($ch in $choices) { $selected[$ch.Key] = $components[$ch.Key].Default }
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "Selected components:" -ForegroundColor Green
|
||||
foreach ($key in $selected.Keys) {
|
||||
$mark = if ($selected[$key]) { "[X]" } else { "[ ]" }
|
||||
Write-Host " $mark $($components[$key].Desc)" -ForegroundColor $(if ($selected[$key]) { "Green" } else { "DarkGray" })
|
||||
}
|
||||
Start-Sleep 1
|
||||
|
||||
return $selected
|
||||
}
|
||||
|
||||
function Install-Frpc {
|
||||
param(
|
||||
[string]$InstallDir,
|
||||
[hashtable]$Components,
|
||||
[string]$BinarySource
|
||||
)
|
||||
|
||||
Write-Banner
|
||||
Write-Host "Installing frpc..." -ForegroundColor Yellow
|
||||
Write-Host "==================" -ForegroundColor Yellow
|
||||
Write-Host ""
|
||||
|
||||
# Create directories
|
||||
Write-Host " Creating directories..." -NoNewline
|
||||
New-Item -Path $InstallDir -ItemType Directory -Force | Out-Null
|
||||
$configDir = "$env:ProgramData\frpc"
|
||||
New-Item -Path $configDir -ItemType Directory -Force | Out-Null
|
||||
Write-Host " OK" -ForegroundColor Green
|
||||
|
||||
# Copy binary
|
||||
Write-Host " Copying frpc.exe..." -NoNewline
|
||||
if ($BinarySource -and (Test-Path $BinarySource)) {
|
||||
Copy-Item -Path $BinarySource -Destination "$InstallDir\frpc.exe" -Force
|
||||
} else {
|
||||
# Download from GitHub
|
||||
$url = "https://github.com/fatedier/frp/releases/download/v$env:FRPC_VERSION/frp_${env:FRPC_VERSION}_windows_amd64.zip"
|
||||
$zipPath = "$env:TEMP\frpc.zip"
|
||||
Write-Host ""
|
||||
Write-Host " Downloading from GitHub..." -NoNewline
|
||||
Invoke-WebRequest -Uri $url -OutFile $zipPath -UseBasicParsing
|
||||
Expand-Archive -Path $zipPath -DestinationPath "$env:TEMP\frpc" -Force
|
||||
$exePath = Get-ChildItem -Path "$env:TEMP\frpc" -Recurse -Filter "frpc.exe" | Select-Object -First 1 -ExpandProperty FullName
|
||||
if (-not $exePath) { throw "frpc.exe not found in archive" }
|
||||
Copy-Item -Path $exePath -Destination "$InstallDir\frpc.exe" -Force
|
||||
}
|
||||
Write-Host " OK" -ForegroundColor Green
|
||||
|
||||
# Config file
|
||||
Write-Host " Creating config..." -NoNewline
|
||||
$configFile = "$configDir\frpc.toml"
|
||||
if (-not (Test-Path $configFile)) {
|
||||
@"
|
||||
# frpc configuration
|
||||
# Edit this file to configure your frp client.
|
||||
|
||||
serverAddr = "127.0.0.1"
|
||||
serverPort = 7000
|
||||
auth.token = ""
|
||||
"@ | Out-File -FilePath $configFile -Encoding utf8
|
||||
}
|
||||
Write-Host " OK" -ForegroundColor Green
|
||||
|
||||
# PATH
|
||||
if ($Components["Path"]) {
|
||||
Write-Host " Adding to PATH..." -NoNewline
|
||||
$currentPath = [Environment]::GetEnvironmentVariable("PATH", "Machine")
|
||||
if ($currentPath -notlike "*$InstallDir*") {
|
||||
$newPath = "$currentPath;$InstallDir"
|
||||
[Environment]::SetEnvironmentVariable("PATH", $newPath, "Machine")
|
||||
$env:PATH = "$env:PATH;$InstallDir"
|
||||
}
|
||||
Write-Host " OK" -ForegroundColor Green
|
||||
}
|
||||
|
||||
# Start Menu
|
||||
if ($Components["StartMenu"]) {
|
||||
Write-Host " Creating Start Menu shortcuts..." -NoNewline
|
||||
$startMenu = "$([Environment]::GetFolderPath('CommonStartMenu'))\Programs\frpc"
|
||||
New-Item -Path $startMenu -ItemType Directory -Force | Out-Null
|
||||
$wshell = New-Object -ComObject WScript.Shell
|
||||
$shortcut = $wshell.CreateShortcut("$startMenu\frpc.lnk")
|
||||
$shortcut.TargetPath = "$InstallDir\frpc.exe"
|
||||
$shortcut.Save()
|
||||
$unlink = $wshell.CreateShortcut("$startMenu\Uninstall frpc.lnk")
|
||||
$unlink.TargetPath = "$InstallDir\uninstall.ps1"
|
||||
$unlink.Save()
|
||||
Write-Host " OK" -ForegroundColor Green
|
||||
}
|
||||
|
||||
# Desktop
|
||||
if ($Components["Desktop"]) {
|
||||
Write-Host " Creating desktop shortcut..." -NoNewline
|
||||
$desktop = [Environment]::GetFolderPath('Desktop')
|
||||
$wshell = New-Object -ComObject WScript.Shell
|
||||
$shortcut = $wshell.CreateShortcut("$desktop\frpc.lnk")
|
||||
$shortcut.TargetPath = "$InstallDir\frpc.exe"
|
||||
$shortcut.Save()
|
||||
Write-Host " OK" -ForegroundColor Green
|
||||
}
|
||||
|
||||
# Write uninstall script
|
||||
Write-Host " Creating uninstaller..." -NoNewline
|
||||
@"
|
||||
param([switch]`$Silent)
|
||||
`$InstallDir = "$InstallDir"
|
||||
if (-not `$Silent) {
|
||||
`$choice = `$host.UI.PromptForChoice("Uninstall frpc", "Remove frpc from this computer?", @(@{Label="&Yes"; Help=""}, @{Label="&No"; Help=""}), 1)
|
||||
if (`$choice -ne 0) { exit }
|
||||
}
|
||||
# Remove files
|
||||
Remove-Item -Path "`$InstallDir\frpc.exe" -Force -ErrorAction SilentlyContinue
|
||||
Remove-Item -Path "`$InstallDir\uninstall.ps1" -Force -ErrorAction SilentlyContinue
|
||||
Remove-Item -Path "`$InstallDir" -Force -ErrorAction SilentlyContinue
|
||||
# Remove shortcuts
|
||||
Remove-Item -Path "$([Environment]::GetFolderPath('CommonStartMenu'))\Programs\frpc" -Recurse -Force -ErrorAction SilentlyContinue
|
||||
Remove-Item -Path "$([Environment]::GetFolderPath('Desktop'))\frpc.lnk" -Force -ErrorAction SilentlyContinue
|
||||
Write-Host "frpc has been uninstalled."
|
||||
"@ | Out-File -FilePath "$InstallDir\uninstall.ps1" -Encoding utf8
|
||||
Write-Host " OK" -ForegroundColor Green
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "Installation complete!" -ForegroundColor Green
|
||||
Write-Host ""
|
||||
Write-Host "Quick start:" -ForegroundColor Yellow
|
||||
Write-Host " frpc --help"
|
||||
Write-Host " frpc --server-config http://your-server:7500/admin/api/frpc/proxy-config/YOUR_KEY"
|
||||
Write-Host " frpc -c $configFile"
|
||||
Write-Host ""
|
||||
Write-Host "Auth with provisioning token:" -ForegroundColor Yellow
|
||||
Write-Host " frpc auth login --server http://your-server:7500 --client-name myclient"
|
||||
Write-Host ""
|
||||
}
|
||||
|
||||
# ===== Main =====
|
||||
|
||||
$scriptDir = Split-Path -Parent $PSCommandPath
|
||||
$binarySource = Join-Path $scriptDir "..\bin\frpc-windows-amd64.exe"
|
||||
if (-not (Test-Path $binarySource)) {
|
||||
$binarySource = Join-Path $scriptDir "frpc-windows-amd64.exe"
|
||||
}
|
||||
if (-not (Test-Path $binarySource)) {
|
||||
$binarySource = $null
|
||||
}
|
||||
|
||||
# Check admin rights
|
||||
$isAdmin = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
|
||||
if (-not $isAdmin) {
|
||||
Write-Host "This installer requires administrator privileges." -ForegroundColor Red
|
||||
Write-Host "Please run PowerShell as Administrator and try again." -ForegroundColor Yellow
|
||||
if (-not $Unattended) {
|
||||
Start-Sleep 2
|
||||
# Self-elevate
|
||||
$script = "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`""
|
||||
Start-Process powershell -Verb RunAs -ArgumentList $script
|
||||
}
|
||||
exit 1
|
||||
}
|
||||
|
||||
if ($Unattended) {
|
||||
Install-Frpc -InstallDir $InstallDir -Components @{
|
||||
Main=$true; Path=$true; StartMenu=$true; Desktop=$false
|
||||
} -BinarySource $binarySource
|
||||
} else {
|
||||
Show-License -Path (Join-Path $scriptDir "license.txt")
|
||||
$dir = Select-Directory -DefaultPath $InstallDir
|
||||
$components = Select-Components
|
||||
Install-Frpc -InstallDir $dir -Components $components -BinarySource $binarySource
|
||||
Write-Host ""
|
||||
$runNow = $host.UI.PromptForChoice(
|
||||
"Setup Complete",
|
||||
"Run frpc now?",
|
||||
[System.Management.Automation.Host.ChoiceDescription[]]@(
|
||||
@{Label="&Yes"; Help="Run frpc"},
|
||||
@{Label="&No"; Help="Close"}
|
||||
),
|
||||
0
|
||||
)
|
||||
if ($runNow -eq 0) {
|
||||
Start-Process "$dir\frpc.exe"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
{\rtf1\ansi\ansicpg1252\deff0\deflang1033\deftab720{\fonttbl{\f0\fnil\fcharset0 Arial;}{\f1\fmodern\fcharset0 Courier New;}}
|
||||
{\colortbl\red0\green0\blue0;\red255\green255\blue255;}
|
||||
\viewkind4\uc1\pard\qc\b\fs28 frpc - frp Client\par
|
||||
\b0\fs20 Version 0.62.0\par
|
||||
\pard\sa200\sl240\slmult1\fs20\par
|
||||
\pard\sa200\sl240\slmult1\b\fs24 License Agreement\b0\fs20\par
|
||||
\pard\sa200\sl240\slmult1\par
|
||||
\pard\sa200\sl240\slmult1\fs20 This is a legal agreement between you (the "Licensee") and the frp project contributors ("Licensor"). By installing or using frpc, you agree to the following terms and conditions.\par
|
||||
\pard\sa200\sl240\slmult1\par
|
||||
\pard\sa200\sl240\slmult1\b 1. Grant of License\b0\par
|
||||
\pard\sa200\sl240\slmult1 The frpc software is licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. You may obtain a copy of the License at:\par
|
||||
\pard\sa200\sl240\slmult1 http://www.apache.org/licenses/LICENSE-2.0\par
|
||||
\pard\sa200\sl240\slmult1\par
|
||||
\pard\sa200\sl240\slmult1\b 2. Distribution\b0\par
|
||||
\pard\sa200\sl240\slmult1 You may reproduce and distribute copies of the work or derivative works thereof in any medium, with or without modifications, and in source or object form, provided that you meet the following conditions:\par
|
||||
\pard\sa200\sl240\slmult1 - You must give any other recipients of the work or derivative works a copy of this License\par
|
||||
\pard\sa200\sl240\slmult1 - You must cause any modified files to carry prominent notices stating that you changed the files\par
|
||||
\pard\sa200\sl240\slmult1 - You must retain all copyright, patent, trademark, and attribution notices\par
|
||||
\pard\sa200\sl240\slmult1\par
|
||||
\pard\sa200\sl240\slmult1\b 3. Disclaimer of Warranty\b0\par
|
||||
\pard\sa200\sl240\slmult1 Unless required by applicable law or agreed to in writing, the software is provided on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\par
|
||||
\pard\sa200\sl240\slmult1\par
|
||||
\pard\sa200\sl240\slmult1\b 4. Limitation of Liability\b0\par
|
||||
\pard\sa200\sl240\slmult1 In no event and under no legal theory shall the authors or copyright holders be liable for any damages arising from the use of the software.\par
|
||||
\pard\sa200\sl240\slmult1\par
|
||||
\pard\sa200\sl240\slmult1\b 5. Termination\b0\par
|
||||
\pard\sa200\sl240\slmult1 This license automatically terminates if you violate any of its terms. Upon termination, you must destroy all copies of the software.\par
|
||||
\pard\sa200\sl240\slmult1\par
|
||||
\pard\sa200\sl240\slmult1\b 6. Governing Law\b0\par
|
||||
\pard\sa200\sl240\slmult1 This license shall be governed by the laws applicable to the Licensor's jurisdiction.\par
|
||||
\pard\sa200\sl240\slmult1\par
|
||||
\pard\sa200\sl240\slmult1 By clicking "I Agree" or installing the software, you acknowledge that you have read this agreement, understand it, and agree to be bound by its terms.\par
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
frpc - frp Client (version 0.62.0)
|
||||
=====================================
|
||||
Copyright (c) frp project contributors.
|
||||
Licensed under the Apache License, Version 2.0.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
--------------------
|
||||
|
||||
1. Grant of License
|
||||
frpc is licensed under the Apache License, Version 2.0 (the "License").
|
||||
You may not use this file except in compliance with the License.
|
||||
A copy of the License is available at:
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
2. Distribution
|
||||
You may reproduce and distribute copies of the work or derivative works
|
||||
in any medium, with or without modifications, and in source or object
|
||||
form, provided that you meet the following conditions:
|
||||
- You must give any other recipients a copy of this License
|
||||
- You must cause any modified files to carry prominent notices
|
||||
- You must retain all copyright, patent, trademark notices
|
||||
|
||||
3. Disclaimer of Warranty
|
||||
Unless required by applicable law, the software is provided "AS IS",
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied.
|
||||
|
||||
4. Limitation of Liability
|
||||
In no event shall the authors be liable for any damages arising from
|
||||
the use of this software.
|
||||
|
||||
5. Termination
|
||||
This license automatically terminates if you violate its terms.
|
||||
|
||||
By installing this software, you accept these terms.
|
||||
Reference in New Issue
Block a user