Skip to content

Commit 97219aa

Browse files
committed
removed unused clipper image API (migrated to clippings)
1 parent e825abf commit 97219aa

File tree

3 files changed

+2
-49
lines changed

3 files changed

+2
-49
lines changed

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"dayjs": "1.8.15",
3232
"debug": "4.1.1",
3333
"ejs": "2.6.2",
34-
"electron-context-menu": "^0.13.0",
34+
"electron-context-menu": "0.13.0",
3535
"electron-debug": "3.0.1",
3636
"electron-dl": "1.14.0",
3737
"electron-find": "1.0.6",
@@ -56,7 +56,7 @@
5656
"node-abi": "2.9.0",
5757
"open": "6.4.0",
5858
"pngjs": "3.4.0",
59-
"portscanner": "^2.2.0",
59+
"portscanner": "2.2.0",
6060
"rand-token": "0.4.0",
6161
"rcedit": "2.0.0",
6262
"rimraf": "2.6.3",

src/routes/api/clipper.js

-46
Original file line numberDiff line numberDiff line change
@@ -99,51 +99,6 @@ async function addImagesToNote(images, note, content) {
9999
return rewrittenContent;
100100
}
101101

102-
async function createImage(req) {
103-
let {dataUrl, title, imageUrl, pageUrl} = req.body;
104-
105-
if (!dataUrl) {
106-
// this is image inlined into the src attribute so there isn't any source image URL
107-
dataUrl = imageUrl;
108-
imageUrl = null;
109-
}
110-
111-
if (!dataUrl.startsWith("data:image/")) {
112-
const message = "Unrecognized prefix: " + dataUrl.substr(0, Math.min(dataUrl.length, 100));
113-
log.info(message);
114-
115-
return [400, message];
116-
}
117-
118-
if (!title && imageUrl) {
119-
title = path.basename(imageUrl);
120-
}
121-
122-
if (!title) {
123-
title = "clipped image";
124-
}
125-
126-
const buffer = Buffer.from(dataUrl.split(",")[1], 'base64');
127-
128-
const todayNote = await dateNoteService.getDateNote(dateUtils.localNowDate());
129-
130-
const {note} = await imageService.saveImage(buffer, title, todayNote.noteId, true);
131-
132-
await note.setLabel('clipType', 'image');
133-
134-
if (imageUrl) {
135-
await note.setLabel('imageUrl', imageUrl);
136-
}
137-
138-
if (pageUrl) {
139-
await note.setLabel('pageUrl', pageUrl);
140-
}
141-
142-
return {
143-
noteId: note.noteId
144-
};
145-
}
146-
147102
async function openNote(req) {
148103
if (utils.isElectron()) {
149104
messagingService.sendMessageToAllClients({
@@ -171,7 +126,6 @@ async function handshake() {
171126

172127
module.exports = {
173128
createNote,
174-
createImage,
175129
addClipping,
176130
openNote,
177131
handshake

src/routes/routes.js

-1
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,6 @@ function register(app) {
232232
route(GET, '/api/clipper/handshake', clipperMiddleware, clipperRoute.handshake, apiResultHandler);
233233
route(POST, '/api/clipper/clippings', clipperMiddleware, clipperRoute.addClipping, apiResultHandler);
234234
route(POST, '/api/clipper/notes', clipperMiddleware, clipperRoute.createNote, apiResultHandler);
235-
route(POST, '/api/clipper/image', clipperMiddleware, clipperRoute.createImage, apiResultHandler);
236235
route(POST, '/api/clipper/open/:noteId', clipperMiddleware, clipperRoute.openNote, apiResultHandler);
237236

238237
app.use('', router);

0 commit comments

Comments
 (0)