开始着手开发浏览器书签导出
This commit is contained in:
parent
cdb005306b
commit
d1ecfe57e9
|
|
@ -19,6 +19,7 @@
|
||||||
"multer": "^1.3.0",
|
"multer": "^1.3.0",
|
||||||
"mysql": "^2.11.1",
|
"mysql": "^2.11.1",
|
||||||
"node-readability": "^2.2.0",
|
"node-readability": "^2.2.0",
|
||||||
|
"path": "^0.12.7",
|
||||||
"request": "^2.81.0",
|
"request": "^2.81.0",
|
||||||
"supervisor": "^0.11.0",
|
"supervisor": "^0.11.0",
|
||||||
"webshot": "^0.18.0"
|
"webshot": "^0.18.0"
|
||||||
|
|
|
||||||
|
|
@ -204,6 +204,12 @@ app.controller('settingsCtr', ['$scope', '$stateParams', '$filter', '$state', '$
|
||||||
$window.open(url, '_blank');
|
$window.open(url, '_blank');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$scope.exportBookmark = function() {
|
||||||
|
toastr.warning('功能正在开发中,敬请期待......', '提示');
|
||||||
|
return;
|
||||||
|
$window.open("api/download?fileName=lcq-20170304213023.html");
|
||||||
|
}
|
||||||
|
|
||||||
function updateShowStyle(showStyle) {
|
function updateShowStyle(showStyle) {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
if (showStyle) {
|
if (showStyle) {
|
||||||
|
|
|
||||||
|
|
@ -444,6 +444,19 @@ app.factory('bookmarkService', ['$http', '$q', function($http, $q) {
|
||||||
});
|
});
|
||||||
return def.promise;
|
return def.promise;
|
||||||
},
|
},
|
||||||
|
download: function(params) {
|
||||||
|
var def = $q.defer();
|
||||||
|
$http.get('/api/download/', {
|
||||||
|
params: params
|
||||||
|
})
|
||||||
|
.success(function(data) {
|
||||||
|
def.resolve(data);
|
||||||
|
})
|
||||||
|
.error(function(data) {
|
||||||
|
def.reject('download error');
|
||||||
|
});
|
||||||
|
return def.promise;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
return service;
|
return service;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
</a>
|
</a>
|
||||||
<a class="item" ng-class="{active:form[1]}" ng-click="changeForm(1)">我的信息
|
<a class="item" ng-class="{active:form[1]}" ng-click="changeForm(1)">我的信息
|
||||||
</a>
|
</a>
|
||||||
<a class="item" ng-class="{active:form[2]}" ng-click="changeForm(2)">上传书签
|
<a class="item" ng-class="{active:form[2]}" ng-click="changeForm(2)">上传或导出书签
|
||||||
</a>
|
</a>
|
||||||
<a class="item" ng-class="{active:form[3]}" ng-click="changeForm(3)">网站说明
|
<a class="item" ng-class="{active:form[3]}" ng-click="changeForm(3)">网站说明
|
||||||
</a>
|
</a>
|
||||||
|
|
@ -44,12 +44,6 @@
|
||||||
<label>导航</label>
|
<label>导航</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="field" ng-click="updateDefaultShowStyle('costomTag')">
|
|
||||||
<div class="ui radio checkbox js-radio-default-costomTag">
|
|
||||||
<input type="radio" name="default-show-style">
|
|
||||||
<label>标签</label>
|
|
||||||
</div>
|
|
||||||
</div> -->
|
|
||||||
<div class="field" ng-click="updateDefaultShowStyle('table')">
|
<div class="field" ng-click="updateDefaultShowStyle('table')">
|
||||||
<div class="ui radio checkbox js-radio-default-table">
|
<div class="ui radio checkbox js-radio-default-table">
|
||||||
<input type="radio" name="default-show-style">
|
<input type="radio" name="default-show-style">
|
||||||
|
|
@ -118,9 +112,10 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<form class="ui form" ng-show="form[2]">
|
<form class="ui form" ng-show="form[2]">
|
||||||
|
<h2 class="ui dividing header">上传浏览器书签到系统</h2>
|
||||||
<div id="fileuploader" style="min-width:100px">点我上传</div>
|
<div id="fileuploader" style="min-width:100px">点我上传</div>
|
||||||
<h2 class="ui dividing header">注意事项</h2>
|
|
||||||
<div class="ui container js-p-info">
|
<div class="ui container js-p-info">
|
||||||
|
<p>注意事项</p>
|
||||||
<p>1、导入的方法是将浏览器里面收藏的网站导出HTML文件。然后将导出的HTML文件点击上面的<code>Upload</code>按钮上传到服务器。目前只测试过谷歌浏览器跟IE浏览器的书签导入。但是因为浏览器的标签是可以支持互相导入的,我觉得应该是没问题的。如果不成功,可以先将其他浏览器的书签导入谷歌浏览器再导出。</p>
|
<p>1、导入的方法是将浏览器里面收藏的网站导出HTML文件。然后将导出的HTML文件点击上面的<code>Upload</code>按钮上传到服务器。目前只测试过谷歌浏览器跟IE浏览器的书签导入。但是因为浏览器的标签是可以支持互相导入的,我觉得应该是没问题的。如果不成功,可以先将其他浏览器的书签导入谷歌浏览器再导出。</p>
|
||||||
<p>2、谷歌浏览器书签导出文件方法:<a href="http://jingyan.baidu.com/article/0bc808fc2d3b841bd485b9fb.html" target="_blank">chrome浏览器书签导出</a>
|
<p>2、谷歌浏览器书签导出文件方法:<a href="http://jingyan.baidu.com/article/0bc808fc2d3b841bd485b9fb.html" target="_blank">chrome浏览器书签导出</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
@ -129,6 +124,8 @@
|
||||||
<p>4、导入的文件不能超过10M</p>
|
<p>4、导入的文件不能超过10M</p>
|
||||||
<p>5、如果重复导入,新的会覆盖旧的信息。</p>
|
<p>5、如果重复导入,新的会覆盖旧的信息。</p>
|
||||||
</div>
|
</div>
|
||||||
|
<h2 class="ui dividing header">导出为浏览器书签</h2>
|
||||||
|
<button class="fluid ui button" ng-click="exportBookmark()">导出书签</button>
|
||||||
</form>
|
</form>
|
||||||
<div class="ui container js-p-info" ng-show="form[3]">
|
<div class="ui container js-p-info" ng-show="form[3]">
|
||||||
<h3 class="ui dividing header">为什么要做个网络书签</h3>
|
<h3 class="ui dividing header">为什么要做个网络书签</h3>
|
||||||
|
|
@ -201,10 +198,6 @@
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="ui container js-p-info" ng-show="form[5]">
|
<div class="ui container js-p-info" ng-show="form[5]">
|
||||||
<!-- <h3 class="ui dividing header">更新日志</h3> -->
|
|
||||||
<!-- <div class="ui active inverted dimmer" ng-class="{active:loadingLogs, disabled: !loadingLogs}">
|
|
||||||
<div class="ui text loader">正在从Github获取提交日志。。。</div>
|
|
||||||
</div> -->
|
|
||||||
<div class="ui message" ng-repeat="updateLog in updateLogs">
|
<div class="ui message" ng-repeat="updateLog in updateLogs">
|
||||||
<div class="header">{{ updateLog.date }}</div>
|
<div class="header">{{ updateLog.date }}</div>
|
||||||
<ul class="list" style="cursor: default;">
|
<ul class="list" style="cursor: default;">
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ var webshot = require('webshot');
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var request = require('request');
|
var request = require('request');
|
||||||
var cheerio = require('cheerio');
|
var cheerio = require('cheerio');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
var storage = multer.diskStorage({
|
var storage = multer.diskStorage({
|
||||||
destination: function(req, file, cb) {
|
destination: function(req, file, cb) {
|
||||||
|
|
@ -1443,6 +1444,20 @@ api.post('/updateNote', function(req, res) {
|
||||||
}); // oops!
|
}); // oops!
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 实现文件下载
|
||||||
|
api.get('/download', function(req, res) {
|
||||||
|
var fileName = req.query.fileName;
|
||||||
|
var filePath = path.join(path.resolve(__dirname, '..'), 'uploads', fileName);
|
||||||
|
console.log('download fileName = ', fileName, ', download filePath = ' + filePath);
|
||||||
|
res.download(filePath, function(err) {
|
||||||
|
if (err) {
|
||||||
|
console.log(err);
|
||||||
|
} else {
|
||||||
|
console.log('download filePath[ ' + filePath + ' ]success!');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
function md5(str) {
|
function md5(str) {
|
||||||
return crypto.createHash('md5').update(str).digest('hex');
|
return crypto.createHash('md5').update(str).digest('hex');
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue