Compare commits
2
Commits
6c7a87994e
...
2c0b5286a7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2c0b5286a7
|
||
|
|
59ac403063
|
+210
-91
@@ -207,45 +207,6 @@ jobs:
|
|||||||
-Path $WindowPath `
|
-Path $WindowPath `
|
||||||
-Pattern "sso.gandc.ru|will-redirect|allowTrustedOrSsoNavigation"
|
-Pattern "sso.gandc.ru|will-redirect|allowTrustedOrSsoNavigation"
|
||||||
|
|
||||||
$WindowContent = Get-Content $WindowPath -Raw
|
|
||||||
|
|
||||||
if ($WindowContent -match "'local-network-access'") {
|
|
||||||
throw "Local network permissions are already present in Window.ts"
|
|
||||||
}
|
|
||||||
|
|
||||||
$PermissionPattern = "'clipboard-sanitized-write',\r?\n\]\);"
|
|
||||||
|
|
||||||
$PermissionReplacement = @(
|
|
||||||
"'clipboard-sanitized-write',"
|
|
||||||
"`t'local-network-access',"
|
|
||||||
"`t'local-network',"
|
|
||||||
"`t'loopback-network',"
|
|
||||||
"]);"
|
|
||||||
) -join "`n"
|
|
||||||
|
|
||||||
$PatchedWindowContent = [regex]::Replace(
|
|
||||||
$WindowContent,
|
|
||||||
$PermissionPattern,
|
|
||||||
$PermissionReplacement,
|
|
||||||
1
|
|
||||||
)
|
|
||||||
|
|
||||||
if ($PatchedWindowContent -eq $WindowContent) {
|
|
||||||
throw "Unable to patch trustedRendererPermissionTypes"
|
|
||||||
}
|
|
||||||
|
|
||||||
Set-Content `
|
|
||||||
-Path $WindowPath `
|
|
||||||
-Value $PatchedWindowContent `
|
|
||||||
-NoNewline `
|
|
||||||
-Encoding utf8
|
|
||||||
|
|
||||||
Write-Host "Local network permissions patch applied"
|
|
||||||
|
|
||||||
Select-String `
|
|
||||||
-Path $WindowPath `
|
|
||||||
-Pattern "local-network-access|local-network|loopback-network"
|
|
||||||
|
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
shell: powershell
|
shell: powershell
|
||||||
@@ -257,6 +218,100 @@ 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
|
||||||
|
|
||||||
|
$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
|
- name: Build Fluxer Desktop
|
||||||
shell: powershell
|
shell: powershell
|
||||||
env:
|
env:
|
||||||
@@ -728,58 +783,6 @@ jobs:
|
|||||||
-E 'sso\.gandc\.ru|will-redirect|allowTrustedOrSsoNavigation' \
|
-E 'sso\.gandc\.ru|will-redirect|allowTrustedOrSsoNavigation' \
|
||||||
fluxer-src/fluxer_desktop/src/main/Window.ts
|
fluxer-src/fluxer_desktop/src/main/Window.ts
|
||||||
|
|
||||||
python3 <<'PY'
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
path = Path(
|
|
||||||
"fluxer-src/fluxer_desktop/src/main/Window.ts"
|
|
||||||
)
|
|
||||||
|
|
||||||
data = path.read_text(
|
|
||||||
encoding="utf-8"
|
|
||||||
)
|
|
||||||
|
|
||||||
if "'local-network-access'" in data:
|
|
||||||
raise SystemExit(
|
|
||||||
"Local network permissions are already present in Window.ts"
|
|
||||||
)
|
|
||||||
|
|
||||||
old = (
|
|
||||||
"\t'clipboard-sanitized-write',\n"
|
|
||||||
"]);"
|
|
||||||
)
|
|
||||||
|
|
||||||
new = (
|
|
||||||
"\t'clipboard-sanitized-write',\n"
|
|
||||||
"\t'local-network-access',\n"
|
|
||||||
"\t'local-network',\n"
|
|
||||||
"\t'loopback-network',\n"
|
|
||||||
"]);"
|
|
||||||
)
|
|
||||||
|
|
||||||
if data.count(old) != 1:
|
|
||||||
raise SystemExit(
|
|
||||||
"Unable to locate trustedRendererPermissionTypes"
|
|
||||||
)
|
|
||||||
|
|
||||||
data = data.replace(
|
|
||||||
old,
|
|
||||||
new,
|
|
||||||
1,
|
|
||||||
)
|
|
||||||
|
|
||||||
path.write_text(
|
|
||||||
data,
|
|
||||||
encoding="utf-8",
|
|
||||||
)
|
|
||||||
|
|
||||||
print("Local network permissions patch applied")
|
|
||||||
PY
|
|
||||||
|
|
||||||
grep -n \
|
|
||||||
-E "local-network-access|local-network|loopback-network" \
|
|
||||||
fluxer-src/fluxer_desktop/src/main/Window.ts
|
|
||||||
|
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -791,6 +794,122 @@ 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
|
||||||
|
|
||||||
|
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
|
- name: Build Fluxer Desktop
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
|
|||||||
Reference in new issue
Block a user