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

View File

@@ -37,7 +37,7 @@ if(process.platform != 'darwin') {
<div class="drag"></div> <div class="drag"></div>
<div> <div>
<h1 id="logo"> <h1 id="logo">
<a onclick="openExternal('http://leanote.com')" id="loadingLogo" title="leanote"> <a onclick="openExternal('https://leanote.com')" id="loadingLogo" title="leanote">
<img src="public/images/logo/leanote_icon_blue.png"> <img src="public/images/logo/leanote_icon_blue.png">
</a> </a>
<span class="lang customServer">Self-hosted Service</span> <span class="lang customServer">Self-hosted Service</span>
@@ -75,7 +75,7 @@ if(process.platform != 'darwin') {
<form> <form>
<div class="formContainer"> <div class="formContainer">
<div class="form-group form-group-1 host-group" id="hostGroup"> <div class="form-group form-group-1 host-group" id="hostGroup">
<input type="text" placeholder="Host, http://leanote.com" class="form-control lang-placeholder" id="host" name="host"> <input type="text" placeholder="Host, https://leanote.com" class="form-control lang-placeholder" id="host" name="host">
</div> </div>
<div class="form-group form-group-1"> <div class="form-group form-group-1">
@@ -91,8 +91,8 @@ if(process.platform != 'darwin') {
</div> </div>
<div class="clearfix btns"> <div class="clearfix btns">
<a onclick="openExternal('http://leanote.com/findPassword')" class="pull-right m-t-xs"><small class="lang">Forget password?</small></a> <a onclick="openExternal('https://leanote.com/findPassword')" class="pull-right m-t-xs"><small class="lang">Forget password?</small></a>
<a onclick="openExternal('http://leanote.com/register')" class="pull-right m-t-xs" style="margin-right: 10px"><small class="lang">Sign up</small></a> <a onclick="openExternal('https://leanote.com/register')" class="pull-right m-t-xs" style="margin-right: 10px"><small class="lang">Sign up</small></a>
</div> </div>
</form> </form>
</div> </div>

8
node_modules/evt.js generated vendored
View File

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

12
node_modules/note.js generated vendored
View File

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

View File

@@ -218,7 +218,7 @@
"Sync now": "立即同步", "Sync now": "立即同步",
"Custom server": "配置服务", "Custom server": "配置服务",
"Host, http://leanote.com": "服务地址, 如 http://leanote.com", "Host, https://leanote.com": "服务地址, 如 https://leanote.com",
"Username or Email": "用户名或邮箱", "Username or Email": "用户名或邮箱",
"Password": "密码", "Password": "密码",
"Sign up": "注册", "Sign up": "注册",

View File

@@ -218,7 +218,7 @@
"Sync now": "立即同步", "Sync now": "立即同步",
"Custom server": "配置服務", "Custom server": "配置服務",
"Host, http://leanote.com": "服務地址, 如 http://leanote.com", "Host, https://leanote.com": "服務地址, 如 https://leanote.com",
"Username or Email": "用戶名或郵箱", "Username or Email": "用戶名或郵箱",
"Password": "密碼", "Password": "密碼",
"Sign up": "註冊", "Sign up": "註冊",