leanote 强制使用https

This commit is contained in:
life
2015-10-17 11:22:11 +08:00
parent 7bf6930c89
commit c09b76fd0b
5 changed files with 20 additions and 12 deletions

8
node_modules/evt.js generated vendored
View File

@@ -12,9 +12,9 @@ if(!fs.existsSync(dataBasePath)) {
// dataBasePath = '';
var Evt = {
defaultUrl: 'http://leanote.com',
defaultUrl: 'https://leanote.com',
leanoteUrl: 'http://leanote.com',
leanoteUrl: 'https://leanote.com',
// leanoteUrl: 'http://localhost:9000',
setHost: function(host) {
@@ -23,6 +23,10 @@ var Evt = {
} else {
this.leanoteUrl = host;
}
// leanote服务强制https
if (this.leanoteUrl === 'http://leanote.com') {
this.leanoteUrl = 'https://leanote.com';
}
},
getHost: function() {

12
node_modules/note.js generated vendored
View File

@@ -432,18 +432,21 @@ var Note = {
if(!content) {
return content;
}
// https, http都行
var url = Evt.leanoteUrl.replace('https', 'https*');
// http://leanote.com/file/outputImage?fileId=54f9079f38f4115c0200001b
var reg0 = new RegExp(Evt.leanoteUrl + '/file/outputImage', 'g');
var reg0 = new RegExp(url + '/file/outputImage', 'g');
content = content.replace(reg0, Evt.localUrl + '/api/file/getImage');
var reg = new RegExp(Evt.leanoteUrl + '/api/file/getImage', 'g');
var reg = new RegExp(url + '/api/file/getImage', 'g');
content = content.replace(reg, Evt.localUrl + '/api/file/getImage');
var reg2 = new RegExp(Evt.leanoteUrl + '/api/file/getAttach', 'g');
var reg2 = new RegExp(url + '/api/file/getAttach', 'g');
content = content.replace(reg2, Evt.localUrl + '/api/file/getAttach');
// api/file/getAllAttachs?noteId=xxxxxxxxx, 这里的noteId是服务器上的noteId啊
var reg3 = new RegExp(Evt.leanoteUrl + '/api/file/getAllAttachs', 'g');
var reg3 = new RegExp(url + '/api/file/getAllAttachs', 'g');
content = content.replace(reg3, Evt.localUrl + '/api/file/getAllAttachs');
return content;
@@ -454,6 +457,7 @@ var Note = {
if(!content) {
return content;
}
// console.log(Evt.localUrl + '/api/file/getImage');
// console.log(content);
var reg = new RegExp(Evt.localUrl + '/api/file/getImage', 'g');