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

View File

@@ -22,11 +22,9 @@ $(function() {
var isMacP = isMac();
$('.tool-close, .tool-close-blur').click(function() {
// mac下关闭才是隐藏
onCloseNotStopServerForMac(function() {
onClose(function() {
gui.win.hide();
});
// gui.win.showInactive();
});
// 从login.html -> note.html过来就没有reopen事件了?

View File

@@ -6,12 +6,6 @@ var basePath = app.getPath('appData') + '/leanote'; // /Users/life/Library/Appli
Evt.setDataBasePath(basePath);
var protocol = require('remote').require('protocol');
if(!/login.html/.test(location.href)) {
// 启动服务器, 图片
var Server = require('server');
Server.start();
}
// 数据库初始化
var db = require('db');
// db.init();
@@ -35,7 +29,6 @@ var NoteService = Service.noteService;
var NotebookService = Service.notebookService;
var TagService = Service.tagService;
var WebService = require('web');
var ServerService = require('server');
var FileService = require('file');
var EvtService = require('evt');
var CommonService = require('common');

View File

@@ -1524,9 +1524,7 @@ function switchAccount() {
// 当没有用户时, 切换之
function switchToLoginWhenNoUser() {
Server.close(function () {
toLogin();
});
toLogin();
}
// 没有一处调用
@@ -1763,25 +1761,6 @@ var Notify = {
var onClose = function(afterFunc) {
console.log('on close');
try {
// 先把服务/协议关掉
Server.close(function () {
SyncService.stop();
// 先保存之前改变的
Note.curChangedSaveIt();
// 保存状态
State.saveCurState(function() {
afterFunc && afterFunc();
});
});
} catch(e) {
console.error(e);
afterFunc && afterFunc();
}
}
// 如果是mac, 当关闭窗口时不要stop server
var onCloseNotStopServerForMac = function(afterFunc) {
function o () {
SyncService.stop();
// 先保存之前改变的
Note.curChangedSaveIt();
@@ -1789,17 +1768,6 @@ var onCloseNotStopServerForMac = function(afterFunc) {
State.saveCurState(function() {
afterFunc && afterFunc();
});
}
try {
if (isMac()) {
o();
}
else {
// 先把服务/协议关掉
Server.close(function () {
o();
});
}
} catch(e) {
console.error(e);
afterFunc && afterFunc();

View File

@@ -103,7 +103,7 @@ define(function() {
var me = this;
// http://127.0.0.1:8912/api/file/getImage?fileId=5581029f6289dc3301000000
// 找到图片
var reg = new RegExp(Api.evtService.localUrl + '/api/file/getImage\\?fileId=([0-9a-zA-Z]{24})', 'g');
var reg = new RegExp('leanote://file/getImage\\?fileId=([0-9a-zA-Z]{24})', 'g');
// console.log(Api.evtService.localUrl + '/api/file/getImage\\?fileId=([0-9a-zA-Z]{24})');
var matches = content.match(reg);
// content = content.replace(reg, Evt.leanoteUrl + '/api/file/getImage');