@@ -99,51 +99,6 @@ async function addImagesToNote(images, note, content) {
99
99
return rewrittenContent ;
100
100
}
101
101
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
-
147
102
async function openNote ( req ) {
148
103
if ( utils . isElectron ( ) ) {
149
104
messagingService . sendMessageToAllClients ( {
@@ -171,7 +126,6 @@ async function handshake() {
171
126
172
127
module . exports = {
173
128
createNote,
174
- createImage,
175
129
addClipping,
176
130
openNote,
177
131
handshake
0 commit comments