mirror of
https://github.com/leanote/desktop-app.git
synced 2025-10-17 00:15:12 +00:00
同步笔记成功, 还要处理
1. 笔记冲突 2. 同步图片 3. 增量同步
This commit is contained in:
41
node_modules/api.js
generated
vendored
41
node_modules/api.js
generated
vendored
@@ -59,7 +59,7 @@ var Api = {
|
||||
});
|
||||
},
|
||||
// get图片
|
||||
getImage: function(callback) {
|
||||
getImageTest: function(callback) {
|
||||
needle.get('http://localhost:9000/images/logo.png', function(err, resp) {
|
||||
// log(resp.body);
|
||||
/*
|
||||
@@ -106,6 +106,43 @@ var Api = {
|
||||
callback && callback(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
// 获取笔记内容, 获取之后保存到笔记中
|
||||
getNoteContent: function(noteId, callback) {
|
||||
var me = this;
|
||||
var url = this.getUrl('note/getNoteContent', {noteId: noteId});
|
||||
log(url);
|
||||
needle.get(url, function(error, response) {
|
||||
var ret = response.body;
|
||||
log('--------')
|
||||
log(ret);
|
||||
if(Common.isOk(ret)) { // {Content: 'xx', NoteId: 'xxx'}
|
||||
// Note.updateNoteContentForce(noteId, ret.Content, function() {
|
||||
callback && callback(ret);
|
||||
// });
|
||||
} else {
|
||||
callback && callback(false);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// TODO
|
||||
// get图片, 获取内容后, 得到所有图片链接, 异步去获取图片, 并修改图片链接,
|
||||
// 将https://leanote.com/api/resource/getImage?imageId=xx
|
||||
// 转成app://leanote/public/files, 内部可以是个服务器吗? 请求内部的controller
|
||||
getImage: function(fileId, callback) {
|
||||
needle.get('http://localhost:9000/images/logo.png', function(err, resp) {
|
||||
// log(resp.body);
|
||||
/*
|
||||
{ 'accept-ranges': 'bytes',
|
||||
'content-disposition': 'inline; filename="logo.png"',
|
||||
'content-length': '8583',
|
||||
'content-type': 'image/png',
|
||||
date: 'Mon, 19 Jan 2015 15:01:47 GMT',
|
||||
*/
|
||||
// log(resp.headers);
|
||||
fs.writeFile('/Users/life/Desktop/aa.png', resp.body);
|
||||
});
|
||||
},
|
||||
};
|
||||
module.exports = Api;
|
Reference in New Issue
Block a user