mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
feat: adding local file protocol
This commit is contained in:
parent
1ef8e3fce3
commit
1fb1c9e81a
10 changed files with 42 additions and 54 deletions
|
@ -2,6 +2,7 @@ import { app, BrowserWindow, net, protocol } from "electron";
|
|||
import updater from "electron-updater";
|
||||
import i18n from "i18next";
|
||||
import path from "node:path";
|
||||
import url from "node:url";
|
||||
import { electronApp, optimizer } from "@electron-toolkit/utils";
|
||||
import { DownloadManager, logger, WindowManager } from "@main/services";
|
||||
import { dataSource } from "@main/data-source";
|
||||
|
@ -51,9 +52,10 @@ if (process.defaultApp) {
|
|||
app.whenReady().then(async () => {
|
||||
electronApp.setAppUserModelId("site.hydralauncher.hydra");
|
||||
|
||||
protocol.handle("hydra", (request) =>
|
||||
net.fetch("file://" + request.url.slice("hydra://".length))
|
||||
);
|
||||
protocol.handle("local", (request) => {
|
||||
const filePath = request.url.slice("local://".length);
|
||||
return net.fetch(url.pathToFileURL(filePath).toString());
|
||||
});
|
||||
|
||||
await dataSource.initialize();
|
||||
await dataSource.runMigrations();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue