Compare commits
3
Commits
1.0.7
..
2c0b5286a7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2c0b5286a7
|
||
|
|
59ac403063
|
||
|
|
6c7a87994e
|
@@ -218,6 +218,100 @@ jobs:
|
||||
pnpm install --frozen-lockfile
|
||||
|
||||
|
||||
- name: Force LiveKit ICE policy to all
|
||||
shell: powershell
|
||||
run: |
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
Set-Location fluxer-src
|
||||
|
||||
$PnpmRoot = "node_modules\.pnpm"
|
||||
|
||||
if (-not (Test-Path $PnpmRoot)) {
|
||||
throw "pnpm node_modules directory not found"
|
||||
}
|
||||
|
||||
$LiveKitPackages = Get-ChildItem `
|
||||
-Path $PnpmRoot `
|
||||
-Directory `
|
||||
-Filter "livekit-client@*" |
|
||||
ForEach-Object {
|
||||
Join-Path $_.FullName "node_modules\livekit-client"
|
||||
} |
|
||||
Where-Object {
|
||||
Test-Path $_
|
||||
}
|
||||
|
||||
if (-not $LiveKitPackages) {
|
||||
throw "livekit-client package not found"
|
||||
}
|
||||
|
||||
$Pattern = "(iceTransportPolicy\s*=\s*['""])(relay)(['""])"
|
||||
$TotalReplacements = 0
|
||||
|
||||
foreach ($PackagePath in $LiveKitPackages) {
|
||||
Write-Host "Patching LiveKit package: $PackagePath"
|
||||
|
||||
$PackageJson = Join-Path $PackagePath "package.json"
|
||||
|
||||
if (Test-Path $PackageJson) {
|
||||
$PackageInfo = Get-Content $PackageJson -Raw |
|
||||
ConvertFrom-Json
|
||||
|
||||
Write-Host "livekit-client version: $($PackageInfo.version)"
|
||||
}
|
||||
|
||||
$Files = Get-ChildItem `
|
||||
-Path $PackagePath `
|
||||
-Recurse `
|
||||
-File |
|
||||
Where-Object {
|
||||
$_.Extension -in @(
|
||||
".ts",
|
||||
".js",
|
||||
".mjs",
|
||||
".cjs"
|
||||
)
|
||||
}
|
||||
|
||||
foreach ($File in $Files) {
|
||||
$Content = Get-Content $File.FullName -Raw
|
||||
$Count = [regex]::Matches(
|
||||
$Content,
|
||||
$Pattern
|
||||
).Count
|
||||
|
||||
if ($Count -eq 0) {
|
||||
continue
|
||||
}
|
||||
|
||||
$PatchedContent = [regex]::Replace(
|
||||
$Content,
|
||||
$Pattern,
|
||||
'$1all$3'
|
||||
)
|
||||
|
||||
Set-Content `
|
||||
-Path $File.FullName `
|
||||
-Value $PatchedContent `
|
||||
-NoNewline `
|
||||
-Encoding utf8
|
||||
|
||||
$TotalReplacements += $Count
|
||||
|
||||
Write-Host `
|
||||
"Patched $Count occurrence(s): $($File.FullName)"
|
||||
}
|
||||
}
|
||||
|
||||
if ($TotalReplacements -lt 1) {
|
||||
throw "LiveKit relay ICE policy assignment was not found"
|
||||
}
|
||||
|
||||
Write-Host `
|
||||
"Forced iceTransportPolicy=all in $TotalReplacements occurrence(s)"
|
||||
|
||||
|
||||
- name: Build Fluxer Desktop
|
||||
shell: powershell
|
||||
env:
|
||||
@@ -700,6 +794,122 @@ jobs:
|
||||
pnpm install --frozen-lockfile
|
||||
|
||||
|
||||
- name: Force LiveKit ICE policy to all
|
||||
shell: bash
|
||||
run: |
|
||||
set -euxo pipefail
|
||||
|
||||
cd fluxer-src
|
||||
|
||||
python3 <<'PY'
|
||||
from pathlib import Path
|
||||
import json
|
||||
import re
|
||||
|
||||
pnpm_root = Path("node_modules/.pnpm")
|
||||
|
||||
if not pnpm_root.is_dir():
|
||||
raise SystemExit(
|
||||
"pnpm node_modules directory not found"
|
||||
)
|
||||
|
||||
packages = sorted(
|
||||
path / "node_modules/livekit-client"
|
||||
for path in pnpm_root.glob(
|
||||
"livekit-client@*"
|
||||
)
|
||||
if (
|
||||
path / "node_modules/livekit-client"
|
||||
).is_dir()
|
||||
)
|
||||
|
||||
if not packages:
|
||||
raise SystemExit(
|
||||
"livekit-client package not found"
|
||||
)
|
||||
|
||||
pattern = re.compile(
|
||||
r"(iceTransportPolicy\s*=\s*['\"])"
|
||||
r"relay"
|
||||
r"(['\"])"
|
||||
)
|
||||
|
||||
total_replacements = 0
|
||||
|
||||
for package in packages:
|
||||
print(
|
||||
f"Patching LiveKit package: {package}"
|
||||
)
|
||||
|
||||
package_json = (
|
||||
package / "package.json"
|
||||
)
|
||||
|
||||
if package_json.is_file():
|
||||
package_info = json.loads(
|
||||
package_json.read_text(
|
||||
encoding="utf-8"
|
||||
)
|
||||
)
|
||||
|
||||
print(
|
||||
"livekit-client version:",
|
||||
package_info.get(
|
||||
"version",
|
||||
"unknown",
|
||||
),
|
||||
)
|
||||
|
||||
for path in package.rglob("*"):
|
||||
if (
|
||||
not path.is_file()
|
||||
or path.suffix
|
||||
not in {
|
||||
".ts",
|
||||
".js",
|
||||
".mjs",
|
||||
".cjs",
|
||||
}
|
||||
):
|
||||
continue
|
||||
|
||||
data = path.read_text(
|
||||
encoding="utf-8"
|
||||
)
|
||||
|
||||
patched, count = pattern.subn(
|
||||
r"\1all\2",
|
||||
data,
|
||||
)
|
||||
|
||||
if count == 0:
|
||||
continue
|
||||
|
||||
path.write_text(
|
||||
patched,
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
total_replacements += count
|
||||
|
||||
print(
|
||||
f"Patched {count} occurrence(s): "
|
||||
f"{path}"
|
||||
)
|
||||
|
||||
if total_replacements < 1:
|
||||
raise SystemExit(
|
||||
"LiveKit relay ICE policy "
|
||||
"assignment was not found"
|
||||
)
|
||||
|
||||
print(
|
||||
"Forced iceTransportPolicy=all "
|
||||
f"in {total_replacements} occurrence(s)"
|
||||
)
|
||||
PY
|
||||
|
||||
|
||||
- name: Build Fluxer Desktop
|
||||
shell: bash
|
||||
env:
|
||||
|
||||
Reference in new issue
Block a user