mirror of
https://github.com/leanote/desktop-app.git
synced 2025-10-19 10:07:12 +00:00
leanote协议完成
This commit is contained in:
38
node_modules/evt.js
generated
vendored
38
node_modules/evt.js
generated
vendored
@@ -11,6 +11,9 @@ if(!fs.existsSync(dataBasePath)) {
|
||||
*/
|
||||
// dataBasePath = '';
|
||||
|
||||
|
||||
var protocol = require('remote').require('protocol');
|
||||
|
||||
var Evt = {
|
||||
defaultUrl: 'https://leanote.com',
|
||||
|
||||
@@ -37,10 +40,45 @@ var Evt = {
|
||||
localUrl: 'http://127.0.0.1:8912',
|
||||
dataBasePath: '',
|
||||
|
||||
// 是否有这个方法, 就代表是否可以用(含callback)
|
||||
// https://github.com/atom/electron/commit/7d97bb6fe0a6feef886d927ea894bcb2f3521577
|
||||
// 老版本没有这个问题
|
||||
canUseProtocol: function () {
|
||||
// return false;
|
||||
return protocol.registerFileProtocol;
|
||||
},
|
||||
|
||||
getImageLocalUrlPrefix: function () {
|
||||
if (this.canUseProtocol()) {
|
||||
return 'leanote://file/getImage';
|
||||
}
|
||||
return this.localUrl + '/api/file/getImage';
|
||||
},
|
||||
|
||||
getAttachLocalUrlPrefix: function () {
|
||||
if (this.canUseProtocol()) {
|
||||
return 'leanote://file/getAttach';
|
||||
}
|
||||
return this.localUrl + '/api/file/getAttach';
|
||||
},
|
||||
|
||||
getAllAttachsLocalUrlPrefix: function () {
|
||||
if (this.canUseProtocol()) {
|
||||
return 'leanote://file/getAllAttachs';
|
||||
}
|
||||
return this.localUrl + '/api/file/getAllAttachs';
|
||||
},
|
||||
|
||||
getImageLocalUrl: function(fileId) {
|
||||
if (this.canUseProtocol()) {
|
||||
return 'leanote://file/getImage?fileId=' + fileId;
|
||||
}
|
||||
return this.localUrl + '/api/file/getImage?fileId=' + fileId;
|
||||
},
|
||||
getAttachLocalUrl: function(fileId) {
|
||||
if (this.canUseProtocol()) {
|
||||
return 'leanote://file/getAttach?fileId=' + fileId;
|
||||
}
|
||||
return this.localUrl + '/api/file/getAttach?fileId=' + fileId;
|
||||
},
|
||||
getAllAttachLocalUrl: function(noteId) {
|
||||
|
Reference in New Issue
Block a user