-This FreeVideo server opens from its access link
To show the link, run
-freevideo status on the server.
请使用访问链接打开这台 FreeVideo 服务器
-在服务器上运行 freevideo status 即可查看链接。
diff --git a/.gitignore b/.gitignore index c09426eb..72a6a098 100644 --- a/.gitignore +++ b/.gitignore @@ -37,6 +37,8 @@ vendor/ downloads/ prepared/ kernel-cache/ +# Dedicated compiler scratch files, also under engine in portable installations. +tmp/ wheels/ machine.json prepared-cache.json @@ -61,3 +63,4 @@ engine-gpu-*.lock # Optional local prompt models, runtime binaries and private rewrite caches. /optional/ *.gguf +/out/ diff --git a/freevideo.ps1 b/freevideo.ps1 index ecaa21f5..f112fbf4 100644 --- a/freevideo.ps1 +++ b/freevideo.ps1 @@ -92,8 +92,6 @@ try { -EngineRoot $freevideoRoot -LogPath $bootstrapLog -GithubSources $routes ` -ProxyRoutes $proxyRoutes -OfficialOnly:$officialOnly $env:UV_PYTHON_INSTALL_DIR = Join-Path $bootstrapRoot 'python' - $env:UV_HTTP_TIMEOUT = '20' - $env:UV_HTTP_RETRIES = '1' $env:UV_NO_CONFIG = '1' $installed = $false $pythonRoutes = @($routes | ForEach-Object { "$_/astral-sh/python-build-standalone/releases/download" }) @@ -101,18 +99,40 @@ try { $pythonRoutes = @($freevideoSavedEnvironment['UV_PYTHON_INSTALL_MIRROR']) + $pythonRoutes } $attempt = 0 - foreach ($route in $pythonRoutes) { - foreach ($proxyRoute in $proxyRoutes) { - if ($installed) { break } - $attempt++ - $env:UV_PYTHON_INSTALL_MIRROR = $route - Write-Progress -Activity 'FreeVideo bootstrap' -Status ('Install isolated Python ' + $versions.python) - $pythonExit = Invoke-FreeVideoBootstrapCommand -Executable $uv ` - -Arguments @('python', 'install', '--no-bin', '--no-registry', '--no-progress', '--color', 'never', $versions.python) ` - -LogPath $bootstrapLog -Label ("Install Python $($versions.python), attempt $attempt ($proxyRoute connection)") ` - -Direct:($proxyRoute -eq 'direct') - if ($pythonExit -eq 0) { $installed = $true; break } - Write-Host "Python install source $attempt returned exit code $pythonExit. Details retained in $bootstrapLog" + $allNetworkFailures = $true + # Keep these defaults and the notice in sync with network.py (CPU tests). + $pythonRetryProfiles = @( + @{Mode='fast'; UV_HTTP_TIMEOUT='20'; UV_HTTP_RETRIES='1'}, + @{Mode='patient'; UV_HTTP_TIMEOUT='120'; UV_HTTP_RETRIES='5'} + ) + foreach ($profile in $pythonRetryProfiles) { + if ($installed) { break } + if ($profile.Mode -eq 'patient') { + if (-not $allNetworkFailures) { break } + Write-Host 'The network is slow. Downloading again; this may take a while.' + } + foreach ($name in @('UV_HTTP_TIMEOUT', 'UV_HTTP_RETRIES')) { + $value = $freevideoSavedEnvironment[$name] + if ($null -eq $value) { $value = $profile[$name] } + [Environment]::SetEnvironmentVariable($name, $value, 'Process') + } + foreach ($route in $pythonRoutes) { + foreach ($proxyRoute in $proxyRoutes) { + if ($installed) { break } + $attempt++ + $env:UV_PYTHON_INSTALL_MIRROR = $route + Write-Progress -Activity 'FreeVideo bootstrap' -Status ('Install isolated Python ' + $versions.python) + $pythonOutput = '' + $pythonLabel = "Install Python $($versions.python), attempt $attempt ($proxyRoute connection)" + if ($profile.Mode -eq 'patient') { $pythonLabel += ", $($profile.Mode)" } + $pythonExit = Invoke-FreeVideoBootstrapCommand -Executable $uv ` + -Arguments @('python', 'install', '--no-bin', '--no-registry', '--no-progress', '--color', 'never', $versions.python) ` + -LogPath $bootstrapLog -Label $pythonLabel ` + -Direct:($proxyRoute -eq 'direct') -OutputTail ([ref]$pythonOutput) + if ($pythonExit -eq 0) { $installed = $true; break } + if (-not (Test-FreeVideoSlowDownloadFailure $pythonOutput)) { $allNetworkFailures = $false } + Write-Host "Python install source $attempt returned exit code $pythonExit. Details retained in $bootstrapLog" + } } } if (-not $installed) { throw "Python installation failed (uv exit $pythonExit). Check your network or connection mode in Downloads. See $bootstrapLog and retry." } @@ -123,6 +143,11 @@ try { Write-Progress -Activity 'FreeVideo bootstrap' -Completed } } + # Restore only our download defaults before Python determines user overrides. + # A null saved value removes the variable from the child environment. + foreach ($name in @('UV_HTTP_TIMEOUT', 'UV_HTTP_RETRIES')) { + [Environment]::SetEnvironmentVariable($name, $freevideoSavedEnvironment[$name], 'Process') + } & $freevideoPython @freevideoPythonPrefix -B -X utf8 -m freevideo_engine.managed @freevideoArguments $freevideoExit = $LASTEXITCODE } catch { diff --git a/freevideo_engine/__init__.py b/freevideo_engine/__init__.py index 2beccf77..1d6a451c 100644 --- a/freevideo_engine/__init__.py +++ b/freevideo_engine/__init__.py @@ -15,5 +15,7 @@ _build_version = _io_path(_build_version) from .long_paths import start_process as _start_process _start_process() + from .triton_compat import own_temporary_environment as _temporary_environment + _temporary_environment() if _build_version.is_file(): __version__ = _build_version.read_text(encoding='utf-8').strip() diff --git a/freevideo_engine/access_proxy.py b/freevideo_engine/access_proxy.py index 4f70e422..c382951a 100644 --- a/freevideo_engine/access_proxy.py +++ b/freevideo_engine/access_proxy.py @@ -1,6 +1,6 @@ """Token-protected access to a ComfyUI that listens on this computer only. -`freevideo server --listen ADDRESS` runs this in front of ComfyUI. The access +The launcher's LAN switch or `freevideo server --listen ADDRESS` runs this in front of ComfyUI. The access link carries the token once; the page then keeps it in a cookie, and API clients send it as a bearer token. Everything else gets 401, so ComfyUI is never reachable from other computers without it, and not at all when this @@ -27,9 +27,9 @@
To show the link, run
-freevideo status on the server.
在服务器上运行 freevideo status 即可查看链接。