mirror of
https://github.com/leanote/desktop-app.git
synced 2025-10-14 07:00:53 +00:00
leanote protocol移到main进程, 所有图片的操作通过db_client进行操作
This commit is contained in:
@@ -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事件了?
|
||||
|
@@ -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');
|
||||
|
@@ -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();
|
||||
|
@@ -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');
|
||||
|
Reference in New Issue
Block a user