From b3d48068097239d5c49ab26095ad9a4b620438e6 Mon Sep 17 00:00:00 2001 From: levende Date: Thu, 5 Feb 2026 15:04:44 +0200 Subject: [PATCH] fix: browser and ffmpeg download issues (#3) --- Shared/Engine/FFmpeg.cs | 6 ++++-- Shared/PlaywrightCore/Chromium.cs | 6 +++--- Shared/PlaywrightCore/Firefox.cs | 6 +++--- Shared/PlaywrightCore/PlaywrightBase.cs | 12 +++++++----- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/Shared/Engine/FFmpeg.cs b/Shared/Engine/FFmpeg.cs index b25357f..e633c71 100644 --- a/Shared/Engine/FFmpeg.cs +++ b/Shared/Engine/FFmpeg.cs @@ -8,6 +8,8 @@ namespace Shared.Engine /// public static class FFmpeg { + private const string baseDownloadUrl = "https://github.com/lampac-talks/lampac/releases/download/ffmpeg"; + #region InitializationAsync static bool disableInstall = false; @@ -39,7 +41,7 @@ namespace Shared.Engine if (File.Exists($"data/{fileName}.exe")) continue; - if (!await Http.DownloadFile($"https://github.com/immisterio/ffmpeg/releases/download/ffmpeg2/{fileName}-win{arh}-gpl.exe", $"data/{fileName}.exe")) + if (!await Http.DownloadFile($"{baseDownloadUrl}/{fileName}-win{arh}-gpl.exe", $"data/{fileName}.exe")) File.Delete($"data/{fileName}.exe"); } @@ -76,7 +78,7 @@ namespace Shared.Engine if (File.Exists($"data/{fileName}")) continue; - if (!await Http.DownloadFile($"https://github.com/immisterio/ffmpeg/releases/download/ffmpeg2/{fileName}-linux{arh}-gpl", $"data/{fileName}")) + if (!await Http.DownloadFile($"{baseDownloadUrl}/{fileName}-linux{arh}-gpl", $"data/{fileName}")) { File.Delete($"data/{fileName}"); continue; diff --git a/Shared/PlaywrightCore/Chromium.cs b/Shared/PlaywrightCore/Chromium.cs index cd687c4..d761283 100644 --- a/Shared/PlaywrightCore/Chromium.cs +++ b/Shared/PlaywrightCore/Chromium.cs @@ -63,7 +63,7 @@ namespace Shared.PlaywrightCore case Architecture.X64: case Architecture.Arm64: { - string uri = $"https://github.com/immisterio/playwright/releases/download/chrome/chrome-win-{RuntimeInformation.ProcessArchitecture.ToString().ToLower()}.zip"; + string uri = $"{baseDownloadUrl}/chrome-win-{RuntimeInformation.ProcessArchitecture.ToString().ToLower()}.zip"; bool res = await DownloadFile(uri, ".playwright/chrome.zip"); if (!res) { @@ -89,7 +89,7 @@ namespace Shared.PlaywrightCore case Architecture.X64: case Architecture.Arm64: { - string uri = $"https://github.com/immisterio/playwright/releases/download/chrome/chrome-mac-{RuntimeInformation.ProcessArchitecture.ToString().ToLower()}.zip"; + string uri = $"{PlaywrightBase.baseDownloadUrl}/chrome-mac-{RuntimeInformation.ProcessArchitecture.ToString().ToLower()}.zip"; bool res = await DownloadFile(uri, ".playwright/chrome.zip"); if (!res) { @@ -114,7 +114,7 @@ namespace Shared.PlaywrightCore case Architecture.X86: case Architecture.X64: { - string uri = $"https://github.com/immisterio/playwright/releases/download/chrome/chrome-linux-{RuntimeInformation.ProcessArchitecture.ToString().ToLower()}.zip"; + string uri = $"{PlaywrightBase.baseDownloadUrl}/chrome-linux-{RuntimeInformation.ProcessArchitecture.ToString().ToLower()}.zip"; bool res = await DownloadFile(uri, ".playwright/chrome.zip"); if (!res) { diff --git a/Shared/PlaywrightCore/Firefox.cs b/Shared/PlaywrightCore/Firefox.cs index 68119bb..866190b 100644 --- a/Shared/PlaywrightCore/Firefox.cs +++ b/Shared/PlaywrightCore/Firefox.cs @@ -45,7 +45,7 @@ namespace Shared.PlaywrightCore case Architecture.X64: { string camoufox = RuntimeInformation.ProcessArchitecture == Architecture.X64 ? "x86_64" : "i686"; - string uri = $"https://github.com/immisterio/playwright/releases/download/chrome/camoufox-135.0.1-beta.23-win.{camoufox}.zip"; + string uri = $"{baseDownloadUrl}/camoufox-135.0.1-beta.23-win.{camoufox}.zip"; bool res = await DownloadFile(uri, ".playwright/firefox/release.zip", "firefox/"); if (!res) { @@ -69,7 +69,7 @@ namespace Shared.PlaywrightCore case Architecture.Arm64: { string camoufox = RuntimeInformation.ProcessArchitecture == Architecture.X64 ? "x86_64" : "arm64"; - string uri = $"https://github.com/immisterio/playwright/releases/download/chrome/camoufox-135.0.1-beta.23-mac.{camoufox}.zip"; + string uri = $"{baseDownloadUrl}/camoufox-135.0.1-beta.23-mac.{camoufox}.zip"; bool res = await DownloadFile(uri, ".playwright/camoufox.zip"); if (!res) { @@ -109,7 +109,7 @@ namespace Shared.PlaywrightCore if (camoufox != null) { - string uri = $"https://github.com/immisterio/playwright/releases/download/chrome/camoufox-135.0.1-beta.23-lin.{camoufox}.zip"; + string uri = $"{baseDownloadUrl}/camoufox-135.0.1-beta.23-lin.{camoufox}.zip"; bool res = await DownloadFile(uri, ".playwright/camoufox.zip", "firefox/"); if (!res) { diff --git a/Shared/PlaywrightCore/PlaywrightBase.cs b/Shared/PlaywrightCore/PlaywrightBase.cs index 85cdfcf..daeb04c 100644 --- a/Shared/PlaywrightCore/PlaywrightBase.cs +++ b/Shared/PlaywrightCore/PlaywrightBase.cs @@ -21,6 +21,8 @@ namespace Shared.PlaywrightCore public class PlaywrightBase { + protected const string baseDownloadUrl = "https://github.com/lampac-talks/lampac/releases/download/browsers"; + static DateTime _nextClearDb = default; public TaskCompletionSource completionSource { get; private set; } = new TaskCompletionSource(); @@ -55,7 +57,7 @@ namespace Shared.PlaywrightCore if (!File.Exists(".playwright/package/index.js")) { - bool res = await DownloadFile("https://github.com/immisterio/playwright/releases/download/chrome/package.zip", ".playwright/package.zip"); + bool res = await DownloadFile($"{baseDownloadUrl}/package.zip", ".playwright/package.zip"); if (!res) { Console.WriteLine("Playwright: error download package.zip"); @@ -72,7 +74,7 @@ namespace Shared.PlaywrightCore case Architecture.Arm64: { string arc = RuntimeInformation.ProcessArchitecture.ToString().ToLower(); - bool res = await DownloadFile($"https://github.com/immisterio/playwright/releases/download/chrome/node-win-{arc}.exe", $".playwright\\node\\win32_{arc}\\node.exe"); + bool res = await DownloadFile($"{baseDownloadUrl}/node-win-{arc}.exe", $".playwright\\node\\win32_{arc}\\node.exe"); if (!res) { Console.WriteLine($"Playwright: error download node-win-{arc}.exe"); @@ -93,7 +95,7 @@ namespace Shared.PlaywrightCore case Architecture.Arm64: { string arc = RuntimeInformation.ProcessArchitecture.ToString().ToLower(); - bool res = await DownloadFile($"https://github.com/immisterio/playwright/releases/download/chrome/node-mac-{arc}", $".playwright/node/mac-{arc}/node"); + bool res = await DownloadFile($"{baseDownloadUrl}/node-mac-{arc}", $".playwright/node/mac-{arc}/node"); if (!res) { Console.WriteLine($"Playwright: error download node-mac-{arc}"); @@ -118,7 +120,7 @@ namespace Shared.PlaywrightCore case Architecture.Arm64: { string arc = RuntimeInformation.ProcessArchitecture.ToString().ToLower(); - bool res = await DownloadFile($"https://github.com/immisterio/playwright/releases/download/chrome/node-linux-{arc}", $".playwright/node/linux-{arc}/node"); + bool res = await DownloadFile($"{baseDownloadUrl}/node-linux-{arc}", $".playwright/node/linux-{arc}/node"); if (!res) { Console.WriteLine($"Playwright: error download node-linux-{arc}"); @@ -131,7 +133,7 @@ namespace Shared.PlaywrightCore } case Architecture.Arm: { - bool res = await DownloadFile("https://github.com/immisterio/playwright/releases/download/chrome/node-linux-armv7l", ".playwright/node/linux-arm/node"); + bool res = await DownloadFile($"{baseDownloadUrl}/node-linux-armv7l", ".playwright/node/linux-arm/node"); if (!res) { Console.WriteLine("Playwright: error download node-linux-armv7l");