mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
removed unused clipper image API (migrated to clippings)
This commit is contained in:
parent
e825abf893
commit
97219aa12e
@ -31,7 +31,7 @@
|
|||||||
"dayjs": "1.8.15",
|
"dayjs": "1.8.15",
|
||||||
"debug": "4.1.1",
|
"debug": "4.1.1",
|
||||||
"ejs": "2.6.2",
|
"ejs": "2.6.2",
|
||||||
"electron-context-menu": "^0.13.0",
|
"electron-context-menu": "0.13.0",
|
||||||
"electron-debug": "3.0.1",
|
"electron-debug": "3.0.1",
|
||||||
"electron-dl": "1.14.0",
|
"electron-dl": "1.14.0",
|
||||||
"electron-find": "1.0.6",
|
"electron-find": "1.0.6",
|
||||||
@ -56,7 +56,7 @@
|
|||||||
"node-abi": "2.9.0",
|
"node-abi": "2.9.0",
|
||||||
"open": "6.4.0",
|
"open": "6.4.0",
|
||||||
"pngjs": "3.4.0",
|
"pngjs": "3.4.0",
|
||||||
"portscanner": "^2.2.0",
|
"portscanner": "2.2.0",
|
||||||
"rand-token": "0.4.0",
|
"rand-token": "0.4.0",
|
||||||
"rcedit": "2.0.0",
|
"rcedit": "2.0.0",
|
||||||
"rimraf": "2.6.3",
|
"rimraf": "2.6.3",
|
||||||
|
@ -99,51 +99,6 @@ async function addImagesToNote(images, note, content) {
|
|||||||
return rewrittenContent;
|
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) {
|
async function openNote(req) {
|
||||||
if (utils.isElectron()) {
|
if (utils.isElectron()) {
|
||||||
messagingService.sendMessageToAllClients({
|
messagingService.sendMessageToAllClients({
|
||||||
@ -171,7 +126,6 @@ async function handshake() {
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
createNote,
|
createNote,
|
||||||
createImage,
|
|
||||||
addClipping,
|
addClipping,
|
||||||
openNote,
|
openNote,
|
||||||
handshake
|
handshake
|
||||||
|
@ -232,7 +232,6 @@ function register(app) {
|
|||||||
route(GET, '/api/clipper/handshake', clipperMiddleware, clipperRoute.handshake, apiResultHandler);
|
route(GET, '/api/clipper/handshake', clipperMiddleware, clipperRoute.handshake, apiResultHandler);
|
||||||
route(POST, '/api/clipper/clippings', clipperMiddleware, clipperRoute.addClipping, apiResultHandler);
|
route(POST, '/api/clipper/clippings', clipperMiddleware, clipperRoute.addClipping, apiResultHandler);
|
||||||
route(POST, '/api/clipper/notes', clipperMiddleware, clipperRoute.createNote, 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);
|
route(POST, '/api/clipper/open/:noteId', clipperMiddleware, clipperRoute.openNote, apiResultHandler);
|
||||||
|
|
||||||
app.use('', router);
|
app.use('', router);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user