diff --git a/package.json b/package.json index 07131bd69..410aa40f8 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "dayjs": "1.8.15", "debug": "4.1.1", "ejs": "2.6.2", - "electron-context-menu": "^0.13.0", + "electron-context-menu": "0.13.0", "electron-debug": "3.0.1", "electron-dl": "1.14.0", "electron-find": "1.0.6", @@ -56,7 +56,7 @@ "node-abi": "2.9.0", "open": "6.4.0", "pngjs": "3.4.0", - "portscanner": "^2.2.0", + "portscanner": "2.2.0", "rand-token": "0.4.0", "rcedit": "2.0.0", "rimraf": "2.6.3", diff --git a/src/routes/api/clipper.js b/src/routes/api/clipper.js index 9a88cdf0e..8b6060c4d 100644 --- a/src/routes/api/clipper.js +++ b/src/routes/api/clipper.js @@ -99,51 +99,6 @@ async function addImagesToNote(images, note, content) { return rewrittenContent; } -async function createImage(req) { - let {dataUrl, title, imageUrl, pageUrl} = req.body; - - if (!dataUrl) { - // this is image inlined into the src attribute so there isn't any source image URL - dataUrl = imageUrl; - imageUrl = null; - } - - if (!dataUrl.startsWith("data:image/")) { - const message = "Unrecognized prefix: " + dataUrl.substr(0, Math.min(dataUrl.length, 100)); - log.info(message); - - return [400, message]; - } - - if (!title && imageUrl) { - title = path.basename(imageUrl); - } - - if (!title) { - title = "clipped image"; - } - - const buffer = Buffer.from(dataUrl.split(",")[1], 'base64'); - - const todayNote = await dateNoteService.getDateNote(dateUtils.localNowDate()); - - const {note} = await imageService.saveImage(buffer, title, todayNote.noteId, true); - - await note.setLabel('clipType', 'image'); - - if (imageUrl) { - await note.setLabel('imageUrl', imageUrl); - } - - if (pageUrl) { - await note.setLabel('pageUrl', pageUrl); - } - - return { - noteId: note.noteId - }; -} - async function openNote(req) { if (utils.isElectron()) { messagingService.sendMessageToAllClients({ @@ -171,7 +126,6 @@ async function handshake() { module.exports = { createNote, - createImage, addClipping, openNote, handshake diff --git a/src/routes/routes.js b/src/routes/routes.js index 702dc53d6..dce51be9c 100644 --- a/src/routes/routes.js +++ b/src/routes/routes.js @@ -232,7 +232,6 @@ function register(app) { route(GET, '/api/clipper/handshake', clipperMiddleware, clipperRoute.handshake, apiResultHandler); route(POST, '/api/clipper/clippings', clipperMiddleware, clipperRoute.addClipping, apiResultHandler); route(POST, '/api/clipper/notes', clipperMiddleware, clipperRoute.createNote, apiResultHandler); - route(POST, '/api/clipper/image', clipperMiddleware, clipperRoute.createImage, apiResultHandler); route(POST, '/api/clipper/open/:noteId', clipperMiddleware, clipperRoute.openNote, apiResultHandler); app.use('', router);