()
| 26 | ]) |
| 27 | |
| 28 | export function initProtocol() { |
| 29 | protocol.handle("local-file", (req) => { |
| 30 | const url = req.url.replace("local-file:///", process.platform === "win32" ? "file:///" : "file://") |
| 31 | return net.fetch(url) |
| 32 | }) |
| 33 | |
| 34 | protocol.handle("img", (req) => { |
| 35 | // Remove 'img://' |
| 36 | const url = req.url.substring(6) |
| 37 | const assetPath = path.join(process.env.VITE_PUBLIC, "image", url) |
| 38 | return net.fetch(`file://${assetPath}`) |
| 39 | }) |
| 40 | } |