feat: 文传易匿名临时文件传输站初始版本
- 后端 .NET 8 + FreeSql + 阿里云 OSS,支持共享/私密/标签三种文件模式 - 前端 Vue3 + Vite + TDesign,上传/取件/管理三页 - 取件码/二维码/海报合成(含保存二维码为图片) - deploy/ 部署文档与一键 FTP 发布脚本 - appsettings.json 含真实凭据,已 gitignore 不入库
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
# FTP 上传脚本 (UTF-8 BOM) - 健壮版
|
||||
$FtpHost="116.198.221.125"
|
||||
$FtpPort=21
|
||||
$FtpUser="wenchuanyi"
|
||||
$FtpPass="r7P^f*v7rFts"
|
||||
$RemoteRoot="/"
|
||||
$Stage = Join-Path $env:TEMP "wcy_publish_staging"
|
||||
|
||||
function New-FtpReq([string]$path,[string]$method){
|
||||
$uri="ftp://${FtpHost}:${FtpPort}/"+$path.TrimStart('/')
|
||||
$r=[System.Net.FtpWebRequest]::Create($uri)
|
||||
$r.Method=$method
|
||||
$r.Credentials=New-Object System.Net.NetworkCredential($FtpUser,$FtpPass)
|
||||
$r.UsePassive=$true
|
||||
$r.UseBinary=$true
|
||||
$r.KeepAlive=$false
|
||||
$r.Timeout=120000
|
||||
return $r
|
||||
}
|
||||
function MkDir([string]$p){
|
||||
$r=New-FtpReq $p ([System.Net.WebRequestMethods+Ftp]::MakeDirectory)
|
||||
try{ $null=$r.GetResponse() }catch{}
|
||||
}
|
||||
function Exist([string]$p){
|
||||
$r=New-FtpReq $p ([System.Net.WebRequestMethods+Ftp]::GetDateTimestamp)
|
||||
try{ $null=$r.GetResponse(); return $true }catch{ return $false }
|
||||
}
|
||||
function UpFile([string]$lp,[string]$rp){
|
||||
$r=New-FtpReq $rp ([System.Net.WebRequestMethods+Ftp]::UploadFile)
|
||||
$b=[System.IO.File]::ReadAllBytes($lp)
|
||||
$r.ContentLength=$b.Length
|
||||
$s=$r.GetRequestStream()
|
||||
try{ $s.Write($b,0,$b.Length) }finally{ $s.Close() }
|
||||
$resp=$r.GetResponse()
|
||||
try{ $resp.Close() }catch{}
|
||||
}
|
||||
function UpDir([string]$ld,[string]$rd){
|
||||
foreach($d in Get-ChildItem $ld -Directory){
|
||||
$c="$rd/$($d.Name)"
|
||||
if(-not (Exist $c)){ MkDir $c }
|
||||
UpDir $d.FullName $c
|
||||
}
|
||||
foreach($f in Get-ChildItem $ld -File){
|
||||
$rf="$rd/$($f.Name)"
|
||||
try{
|
||||
if(-not (Exist $rf)){ UpFile $f.FullName $rf; Write-Host "UP $rf" }
|
||||
else { Write-Host "SKIP(exists) $rf" }
|
||||
}catch{
|
||||
Write-Host "RETRY $rf"
|
||||
try{ UpFile $f.FullName $rf; Write-Host "OK $rf" }catch{ Write-Host "FAIL $rf : $_" }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(-not (Test-Path $Stage)){ Write-Host "STAGING_MISSING"; exit 1 }
|
||||
if(-not (Exist $RemoteRoot)){ MkDir $RemoteRoot }
|
||||
UpDir $Stage $RemoteRoot
|
||||
Write-Host "FTP_UPLOAD_DONE"
|
||||
Remove-Item $Stage -Recurse -Force
|
||||
Reference in New Issue
Block a user