now only allowing images to be the taget of an img source

pull/2/head
Michael Ochmann 3 years ago
parent 6683223a49
commit c64887c3f7
  1. 8
      src/Ation.js

@ -1,6 +1,7 @@
"use strict";
const {app, protocol} = require("electron");
const url = require("url");
const path = require("path");
const WindowManager = require("./WindowManager");
@ -14,8 +15,11 @@ class Ation {
app.whenReady().then(async () => {
protocol.registerFileProtocol("slideimg", (request, callback) => {
const path = request.url.replace(/^slideimg:\/\//, "");
callback(path);
const uri = request.url.replace(/^slideimg:\/\//, "");
const extension = path.extname(uri).replace(/^\./, "");
if (["png", "jpg", "jpeg", "svg", "bmp", "gif", "tiff"].includes(extension.toLowerCase()))
callback(uri);
});
});
}

Loading…
Cancel
Save