mirror of
https://github.com/vrcx-team/VRCX.git
synced 2026-04-06 00:32:02 +02:00
* init * SQLite changes * Move html folder, edit build scripts * AppApi interface * Build flags * AppApi inheritance * Finishing touches * Merge upstream changes * Test CI * Fix class inits * Rename AppApi * Merge upstream changes * Fix SQLiteLegacy on Linux, Add Linux interop, build tools * Linux specific localisation strings * Make it run * Bring back most of Linux functionality * Clean up * Fix TTS voices * Fix UI var * Changes * Electron minimise to tray * Remove separate toggle for WlxOverlay * Fixes * Touchups * Move csproj * Window zoom, Desktop Notifications, VR check on Linux * Fix desktop notifications, VR check spam * Fix building on Linux * Clean up * Fix WebApi headers * Rewrite VRCX updater * Clean up * Linux updater * Add Linux to build action * init * SQLite changes * Move html folder, edit build scripts * AppApi interface * Build flags * AppApi inheritance * Finishing touches * Merge upstream changes * Test CI * Fix class inits * Rename AppApi * Merge upstream changes * Fix SQLiteLegacy on Linux, Add Linux interop, build tools * Linux specific localisation strings * Make it run * Bring back most of Linux functionality * Clean up * Fix TTS voices * Changes * Electron minimise to tray * Remove separate toggle for WlxOverlay * Fixes * Touchups * Move csproj * Window zoom, Desktop Notifications, VR check on Linux * Fix desktop notifications, VR check spam * Fix building on Linux * Clean up * Fix WebApi headers * Rewrite VRCX updater * Clean up * Linux updater * Add Linux to build action * Test updater * Rebase and handle merge conflicts * Fix Linux updater * Fix Linux app restart * Fix friend order * Handle AppImageInstaller, show an install message on Linux * Updates to the AppImage installer * Fix Linux updater, fix set version, check for .NET, copy wine prefix * Handle random errors * Rotate tall prints * try fix Linux restart bug * Final --------- Co-authored-by: rs189 <35667100+rs189@users.noreply.github.com>
91 lines
3.2 KiB
C#
91 lines
3.2 KiB
C#
using System;
|
|
using System.IO;
|
|
using CefSharp;
|
|
using CefSharp.SchemeHandler;
|
|
using CefSharp.WinForms;
|
|
using NLog;
|
|
|
|
namespace VRCX
|
|
{
|
|
public class CefService
|
|
{
|
|
public static readonly CefService Instance;
|
|
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
|
|
|
static CefService()
|
|
{
|
|
Instance = new CefService();
|
|
}
|
|
|
|
internal void Init()
|
|
{
|
|
var userDataDir = Path.Combine(Program.AppDataDirectory, "userdata");
|
|
var cefSettings = new CefSettings
|
|
{
|
|
RootCachePath = userDataDir,
|
|
CachePath = Path.Combine(userDataDir, "cache"),
|
|
LogSeverity = LogSeverity.Disable,
|
|
WindowlessRenderingEnabled = true,
|
|
PersistSessionCookies = true,
|
|
UserAgent = Program.Version,
|
|
BrowserSubprocessPath = Environment.ProcessPath,
|
|
BackgroundColor = 0xFF101010
|
|
};
|
|
|
|
cefSettings.RegisterScheme(new CefCustomScheme
|
|
{
|
|
SchemeName = "file",
|
|
DomainName = "vrcx",
|
|
SchemeHandlerFactory = new FolderSchemeHandlerFactory(
|
|
Path.Combine(Program.BaseDirectory, "html"),
|
|
"file",
|
|
defaultPage: "index.html"
|
|
),
|
|
IsLocal = true
|
|
});
|
|
|
|
// cefSettings.CefCommandLineArgs.Add("allow-universal-access-from-files");
|
|
// cefSettings.CefCommandLineArgs.Add("ignore-certificate-errors");
|
|
// cefSettings.CefCommandLineArgs.Add("disable-plugins");
|
|
cefSettings.CefCommandLineArgs.Add("disable-spell-checking");
|
|
cefSettings.CefCommandLineArgs.Add("disable-pdf-extension");
|
|
cefSettings.CefCommandLineArgs["autoplay-policy"] = "no-user-gesture-required";
|
|
cefSettings.CefCommandLineArgs.Add("disable-web-security");
|
|
cefSettings.CefCommandLineArgs.Add("disk-cache-size", "2147483647");
|
|
cefSettings.CefCommandLineArgs.Add("unsafely-disable-devtools-self-xss-warnings");
|
|
|
|
if (WebApi.ProxySet)
|
|
{
|
|
cefSettings.CefCommandLineArgs["proxy-server"] = WebApi.ProxyUrl;
|
|
}
|
|
|
|
if (VRCXStorage.Instance.Get("VRCX_DisableGpuAcceleration") == "true")
|
|
{
|
|
cefSettings.CefCommandLineArgs.Add("disable-gpu");
|
|
}
|
|
|
|
if (Program.LaunchDebug)
|
|
{
|
|
// chrome://inspect/#devices
|
|
// Discover network targets, Configure...
|
|
// Add Remote Target: localhost:8089
|
|
logger.Info("Debug mode enabled");
|
|
cefSettings.RemoteDebuggingPort = 8089;
|
|
cefSettings.CefCommandLineArgs["remote-allow-origins"] = "*";
|
|
}
|
|
|
|
CefSharpSettings.ShutdownOnExit = false;
|
|
CefSharpSettings.ConcurrentTaskExecution = true;
|
|
|
|
if (Cef.Initialize(cefSettings, false) == false)
|
|
{
|
|
throw new Exception("Cef.Initialize()");
|
|
}
|
|
}
|
|
|
|
internal void Exit()
|
|
{
|
|
Cef.Shutdown();
|
|
}
|
|
}
|
|
} |