Explorar o código

Reorder to match

Manav Rathi hai 1 ano
pai
achega
f1e530dfa1
Modificáronse 1 ficheiros con 18 adicións e 18 borrados
  1. 18 18
      desktop/src/main/init.ts

+ 18 - 18
desktop/src/main/init.ts

@@ -11,18 +11,7 @@ export function handleDownloads(mainWindow: BrowserWindow) {
     });
 }
 
-export function handleExternalLinks(mainWindow: BrowserWindow) {
-    mainWindow.webContents.setWindowOpenHandler(({ url }) => {
-        if (!url.startsWith(rendererURL)) {
-            shell.openExternal(url);
-            return { action: "deny" };
-        } else {
-            return { action: "allow" };
-        }
-    });
-}
-
-export function getUniqueSavePath(filename: string, directory: string): string {
+function getUniqueSavePath(filename: string, directory: string): string {
     let uniqueFileSavePath = path.join(directory, filename);
     const { name: filenameWithoutExtension, ext: extension } =
         path.parse(filename);
@@ -42,12 +31,15 @@ export function getUniqueSavePath(filename: string, directory: string): string {
     return uniqueFileSavePath;
 }
 
-function lowerCaseHeaders(responseHeaders: Record<string, string[]>) {
-    const headers: Record<string, string[]> = {};
-    for (const key of Object.keys(responseHeaders)) {
-        headers[key.toLowerCase()] = responseHeaders[key];
-    }
-    return headers;
+export function handleExternalLinks(mainWindow: BrowserWindow) {
+    mainWindow.webContents.setWindowOpenHandler(({ url }) => {
+        if (!url.startsWith(rendererURL)) {
+            shell.openExternal(url);
+            return { action: "deny" };
+        } else {
+            return { action: "allow" };
+        }
+    });
 }
 
 export function addAllowOriginHeader(mainWindow: BrowserWindow) {
@@ -61,3 +53,11 @@ export function addAllowOriginHeader(mainWindow: BrowserWindow) {
         },
     );
 }
+
+function lowerCaseHeaders(responseHeaders: Record<string, string[]>) {
+    const headers: Record<string, string[]> = {};
+    for (const key of Object.keys(responseHeaders)) {
+        headers[key.toLowerCase()] = responseHeaders[key];
+    }
+    return headers;
+}