Fix electron SSL

This commit is contained in:
LukeGus
2025-09-28 18:02:42 -05:00
parent 5e0008ee9d
commit 67ab3e50ff

View File

@@ -290,15 +290,11 @@ ipcMain.handle("save-server-config", (event, config) => {
ipcMain.handle("test-server-connection", async (event, serverUrl) => { ipcMain.handle("test-server-connection", async (event, serverUrl) => {
try { try {
let fetch;
try {
fetch = globalThis.fetch || require("node-fetch");
} catch (e) {
const https = require("https"); const https = require("https");
const http = require("http"); const http = require("http");
const { URL } = require("url"); const { URL } = require("url");
fetch = (url, options = {}) => { const fetch = (url, options = {}) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const urlObj = new URL(url); const urlObj = new URL(url);
const isHttps = urlObj.protocol === "https:"; const isHttps = urlObj.protocol === "https:";
@@ -346,7 +342,6 @@ ipcMain.handle("test-server-connection", async (event, serverUrl) => {
req.end(); req.end();
}); });
}; };
}
const normalizedServerUrl = serverUrl.replace(/\/$/, ""); const normalizedServerUrl = serverUrl.replace(/\/$/, "");