Fix electron SSL
This commit is contained in:
@@ -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(/\/$/, "");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user