fix
This commit is contained in:
1 file changed
+122
-289
+122
-289
@@ -208,6 +208,57 @@ jobs:
|
|||||||
-Pattern "sso.gandc.ru|will-redirect|allowTrustedOrSsoNavigation"
|
-Pattern "sso.gandc.ru|will-redirect|allowTrustedOrSsoNavigation"
|
||||||
|
|
||||||
|
|
||||||
|
- name: Force LiveKit ICE policy to all
|
||||||
|
shell: powershell
|
||||||
|
run: |
|
||||||
|
$ErrorActionPreference = "Stop"
|
||||||
|
|
||||||
|
$Path = "fluxer-src\fluxer_app\pkgs\livekit-client\src\room\RTCEngine.ts"
|
||||||
|
|
||||||
|
if (-not (Test-Path $Path)) {
|
||||||
|
throw "LiveKit RTCEngine.ts not found at $Path"
|
||||||
|
}
|
||||||
|
|
||||||
|
$Content = Get-Content $Path -Raw
|
||||||
|
|
||||||
|
$Old = "rtcConfig.iceTransportPolicy = 'relay';"
|
||||||
|
$New = "rtcConfig.iceTransportPolicy = 'all';"
|
||||||
|
|
||||||
|
$Count = (
|
||||||
|
[regex]::Matches(
|
||||||
|
$Content,
|
||||||
|
[regex]::Escape($Old)
|
||||||
|
)
|
||||||
|
).Count
|
||||||
|
|
||||||
|
if ($Count -ne 1) {
|
||||||
|
throw "Expected exactly one relay ICE policy assignment, found $Count"
|
||||||
|
}
|
||||||
|
|
||||||
|
$Content = $Content.Replace(
|
||||||
|
$Old,
|
||||||
|
$New
|
||||||
|
)
|
||||||
|
|
||||||
|
Set-Content `
|
||||||
|
-Path $Path `
|
||||||
|
-Value $Content `
|
||||||
|
-NoNewline `
|
||||||
|
-Encoding utf8
|
||||||
|
|
||||||
|
$Result = Get-Content $Path -Raw
|
||||||
|
|
||||||
|
if ($Result -notmatch "rtcConfig\.iceTransportPolicy = 'all';") {
|
||||||
|
throw "LiveKit ICE policy patch verification failed"
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "Forced LiveKit iceTransportPolicy=all"
|
||||||
|
|
||||||
|
Select-String `
|
||||||
|
-Path $Path `
|
||||||
|
-Pattern "iceTransportPolicy"
|
||||||
|
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
shell: powershell
|
shell: powershell
|
||||||
run: |
|
run: |
|
||||||
@@ -218,135 +269,6 @@ jobs:
|
|||||||
pnpm install --frozen-lockfile
|
pnpm install --frozen-lockfile
|
||||||
|
|
||||||
|
|
||||||
- name: Force LiveKit ICE policy to all
|
|
||||||
shell: powershell
|
|
||||||
run: |
|
|
||||||
$ErrorActionPreference = "Stop"
|
|
||||||
|
|
||||||
Set-Location "fluxer-src\fluxer_desktop"
|
|
||||||
|
|
||||||
$LiveKitPath = Join-Path `
|
|
||||||
(Get-Location) `
|
|
||||||
"node_modules\livekit-client"
|
|
||||||
|
|
||||||
if (-not (Test-Path $LiveKitPath)) {
|
|
||||||
$Entry = (
|
|
||||||
node -e "process.stdout.write(require.resolve('livekit-client'))"
|
|
||||||
).Trim()
|
|
||||||
|
|
||||||
if (-not $Entry) {
|
|
||||||
throw "Unable to resolve livekit-client"
|
|
||||||
}
|
|
||||||
|
|
||||||
$Dir = Split-Path $Entry -Parent
|
|
||||||
|
|
||||||
while ($Dir) {
|
|
||||||
$PackageJson = Join-Path $Dir "package.json"
|
|
||||||
|
|
||||||
if (Test-Path $PackageJson) {
|
|
||||||
$PackageInfo = Get-Content `
|
|
||||||
$PackageJson `
|
|
||||||
-Raw |
|
|
||||||
ConvertFrom-Json
|
|
||||||
|
|
||||||
if ($PackageInfo.name -eq "livekit-client") {
|
|
||||||
$LiveKitPath = $Dir
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$Parent = Split-Path $Dir -Parent
|
|
||||||
|
|
||||||
if (
|
|
||||||
-not $Parent -or
|
|
||||||
$Parent -eq $Dir
|
|
||||||
) {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
$Dir = $Parent
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (-not (Test-Path $LiveKitPath)) {
|
|
||||||
throw "livekit-client package directory not found"
|
|
||||||
}
|
|
||||||
|
|
||||||
$LiveKitPath = (
|
|
||||||
Resolve-Path $LiveKitPath
|
|
||||||
).Path
|
|
||||||
|
|
||||||
Write-Host "LiveKit package: $LiveKitPath"
|
|
||||||
|
|
||||||
$PackageJson = Join-Path `
|
|
||||||
$LiveKitPath `
|
|
||||||
"package.json"
|
|
||||||
|
|
||||||
if (Test-Path $PackageJson) {
|
|
||||||
$PackageInfo = Get-Content `
|
|
||||||
$PackageJson `
|
|
||||||
-Raw |
|
|
||||||
ConvertFrom-Json
|
|
||||||
|
|
||||||
Write-Host `
|
|
||||||
"livekit-client version: $($PackageInfo.version)"
|
|
||||||
}
|
|
||||||
|
|
||||||
$Pattern = "(iceTransportPolicy\s*=\s*['""])(relay)(['""])"
|
|
||||||
$TotalReplacements = 0
|
|
||||||
|
|
||||||
$Files = Get-ChildItem `
|
|
||||||
-Path $LiveKitPath `
|
|
||||||
-Recurse `
|
|
||||||
-File |
|
|
||||||
Where-Object {
|
|
||||||
$_.Extension -in @(
|
|
||||||
".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
|
- name: Build Fluxer Desktop
|
||||||
shell: powershell
|
shell: powershell
|
||||||
env:
|
env:
|
||||||
@@ -819,6 +741,77 @@ jobs:
|
|||||||
fluxer-src/fluxer_desktop/src/main/Window.ts
|
fluxer-src/fluxer_desktop/src/main/Window.ts
|
||||||
|
|
||||||
|
|
||||||
|
- name: Force LiveKit ICE policy to all
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euxo pipefail
|
||||||
|
|
||||||
|
python3 <<'PY'
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
path = Path(
|
||||||
|
"fluxer-src/fluxer_app/pkgs/"
|
||||||
|
"livekit-client/src/room/RTCEngine.ts"
|
||||||
|
)
|
||||||
|
|
||||||
|
if not path.is_file():
|
||||||
|
raise SystemExit(
|
||||||
|
f"LiveKit RTCEngine.ts not found: {path}"
|
||||||
|
)
|
||||||
|
|
||||||
|
data = path.read_text(
|
||||||
|
encoding="utf-8"
|
||||||
|
)
|
||||||
|
|
||||||
|
old = (
|
||||||
|
"rtcConfig.iceTransportPolicy = "
|
||||||
|
"'relay';"
|
||||||
|
)
|
||||||
|
new = (
|
||||||
|
"rtcConfig.iceTransportPolicy = "
|
||||||
|
"'all';"
|
||||||
|
)
|
||||||
|
|
||||||
|
count = data.count(old)
|
||||||
|
|
||||||
|
if count != 1:
|
||||||
|
raise SystemExit(
|
||||||
|
"Expected exactly one relay ICE "
|
||||||
|
f"policy assignment, found {count}"
|
||||||
|
)
|
||||||
|
|
||||||
|
data = data.replace(
|
||||||
|
old,
|
||||||
|
new,
|
||||||
|
1,
|
||||||
|
)
|
||||||
|
|
||||||
|
path.write_text(
|
||||||
|
data,
|
||||||
|
encoding="utf-8",
|
||||||
|
)
|
||||||
|
|
||||||
|
result = path.read_text(
|
||||||
|
encoding="utf-8"
|
||||||
|
)
|
||||||
|
|
||||||
|
if new not in result:
|
||||||
|
raise SystemExit(
|
||||||
|
"LiveKit ICE policy patch "
|
||||||
|
"verification failed"
|
||||||
|
)
|
||||||
|
|
||||||
|
print(
|
||||||
|
"Forced LiveKit "
|
||||||
|
"iceTransportPolicy=all"
|
||||||
|
)
|
||||||
|
PY
|
||||||
|
|
||||||
|
grep -n \
|
||||||
|
"iceTransportPolicy" \
|
||||||
|
fluxer-src/fluxer_app/pkgs/livekit-client/src/room/RTCEngine.ts
|
||||||
|
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
@@ -829,166 +822,6 @@ jobs:
|
|||||||
pnpm install --frozen-lockfile
|
pnpm install --frozen-lockfile
|
||||||
|
|
||||||
|
|
||||||
- name: Force LiveKit ICE policy to all
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
set -euxo pipefail
|
|
||||||
|
|
||||||
cd fluxer-src/fluxer_desktop
|
|
||||||
|
|
||||||
LIVEKIT_DIR="node_modules/livekit-client"
|
|
||||||
|
|
||||||
if [ ! -d "${LIVEKIT_DIR}" ]; then
|
|
||||||
LIVEKIT_ENTRY="$(
|
|
||||||
node -e \
|
|
||||||
"process.stdout.write(require.resolve('livekit-client'))"
|
|
||||||
)"
|
|
||||||
|
|
||||||
export LIVEKIT_ENTRY
|
|
||||||
|
|
||||||
LIVEKIT_DIR="$(
|
|
||||||
python3 <<'PY'
|
|
||||||
from pathlib import Path
|
|
||||||
import json
|
|
||||||
import os
|
|
||||||
|
|
||||||
entry = Path(
|
|
||||||
os.environ["LIVEKIT_ENTRY"]
|
|
||||||
).resolve()
|
|
||||||
|
|
||||||
for directory in [
|
|
||||||
entry.parent,
|
|
||||||
*entry.parents,
|
|
||||||
]:
|
|
||||||
package_json = (
|
|
||||||
directory / "package.json"
|
|
||||||
)
|
|
||||||
|
|
||||||
if not package_json.is_file():
|
|
||||||
continue
|
|
||||||
|
|
||||||
try:
|
|
||||||
package = json.loads(
|
|
||||||
package_json.read_text(
|
|
||||||
encoding="utf-8"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
except Exception:
|
|
||||||
continue
|
|
||||||
|
|
||||||
if (
|
|
||||||
package.get("name")
|
|
||||||
== "livekit-client"
|
|
||||||
):
|
|
||||||
print(directory)
|
|
||||||
break
|
|
||||||
else:
|
|
||||||
raise SystemExit(
|
|
||||||
"Unable to locate "
|
|
||||||
"livekit-client package directory"
|
|
||||||
)
|
|
||||||
PY
|
|
||||||
)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
LIVEKIT_DIR="$(
|
|
||||||
readlink -f "${LIVEKIT_DIR}"
|
|
||||||
)"
|
|
||||||
|
|
||||||
test -d "${LIVEKIT_DIR}"
|
|
||||||
|
|
||||||
export LIVEKIT_DIR
|
|
||||||
|
|
||||||
python3 <<'PY'
|
|
||||||
from pathlib import Path
|
|
||||||
import json
|
|
||||||
import os
|
|
||||||
import re
|
|
||||||
|
|
||||||
package = Path(
|
|
||||||
os.environ["LIVEKIT_DIR"]
|
|
||||||
)
|
|
||||||
|
|
||||||
print(
|
|
||||||
f"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",
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
pattern = re.compile(
|
|
||||||
r"(iceTransportPolicy\s*=\s*['\"])"
|
|
||||||
r"relay"
|
|
||||||
r"(['\"])"
|
|
||||||
)
|
|
||||||
|
|
||||||
total_replacements = 0
|
|
||||||
|
|
||||||
for path in package.rglob("*"):
|
|
||||||
if (
|
|
||||||
not path.is_file()
|
|
||||||
or path.suffix
|
|
||||||
not in {
|
|
||||||
".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
|
- name: Build Fluxer Desktop
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
|
|||||||
Reference in new issue
Block a user