leanote protocol移到main进程, 所有图片的操作通过db_client进行操作

This commit is contained in:
life
2015-12-18 13:10:40 +08:00
parent 31b1eba870
commit 13873a64c0
19 changed files with 580 additions and 468 deletions

30
node_modules/evt.js generated vendored
View File

@@ -11,8 +11,6 @@ if(!fs.existsSync(dataBasePath)) {
*/
// dataBasePath = '';
var protocol = require('remote').require('protocol');
var Evt = {
defaultUrl: 'https://leanote.com',
@@ -43,42 +41,28 @@ var Evt = {
// https://github.com/atom/electron/commit/7d97bb6fe0a6feef886d927ea894bcb2f3521577
// 老版本没有这个问题
canUseProtocol: function () {
return true;
// return false;
return protocol.registerFileProtocol;
// return protocol.registerFileProtocol;
},
getImageLocalUrlPrefix: function () {
if (this.canUseProtocol()) {
return 'leanote://file/getImage';
}
return this.localUrl + '/api/file/getImage';
return 'leanote://file/getImage';
},
getAttachLocalUrlPrefix: function () {
if (this.canUseProtocol()) {
return 'leanote://file/getAttach';
}
return this.localUrl + '/api/file/getAttach';
return 'leanote://file/getAttach';
},
getAllAttachsLocalUrlPrefix: function () {
if (this.canUseProtocol()) {
return 'leanote://file/getAllAttachs';
}
return this.localUrl + '/api/file/getAllAttachs';
return 'leanote://file/getAllAttachs';
},
getImageLocalUrl: function(fileId) {
if (this.canUseProtocol()) {
return 'leanote://file/getImage?fileId=' + fileId;
}
return this.localUrl + '/api/file/getImage?fileId=' + fileId;
return 'leanote://file/getImage?fileId=' + fileId;
},
getAttachLocalUrl: function(fileId) {
if (this.canUseProtocol()) {
return 'leanote://file/getAttach?fileId=' + fileId;
}
return this.localUrl + '/api/file/getAttach?fileId=' + fileId;
return 'leanote://file/getAttach?fileId=' + fileId;
},
getAllAttachLocalUrl: function(noteId) {
return this.localUrl + '/api/file/getAllAttachs?noteId=' + noteId;