diff --git a/database/db.js b/database/db.js
index 6ea2401..10ece1d 100644
--- a/database/db.js
+++ b/database/db.js
@@ -1165,4 +1165,18 @@ db.updateNote = function(id, content, tag_id) {
});
}
+db.getNote = function(id) {
+ var sql = "SELECT content FROM `notes` WHERE `id` = '"+ id +"' LIMIT 0, 1";
+ console.log(sql);
+ return new Promise(function(resolve, reject) {
+ client.query(sql, (err, result) => {
+ if (err) {
+ reject(err);
+ } else {
+ resolve(result.length > 0 ? result[0].content : "content not exist!");
+ }
+ });
+ });
+}
+
module.exports = db;
diff --git a/public/scripts/controllers/note-controller.js b/public/scripts/controllers/note-controller.js
index dfe9966..06315a9 100644
--- a/public/scripts/controllers/note-controller.js
+++ b/public/scripts/controllers/note-controller.js
@@ -285,6 +285,10 @@ app.controller('noteCtr', ['$scope', '$state', '$stateParams', '$filter', '$wind
}
}
+ $scope.share = function (noteId) {
+ dataService.clipboard(`https://mybookmark.cn/api/notes/?shareNote=${noteId}`);
+ }
+
function updateSelectTag(tagId) {
$scope.tags.forEach((tag) => {
tag.clicked = false;
diff --git a/public/views/note.html b/public/views/note.html
index 47a624d..7059389 100644
--- a/public/views/note.html
+++ b/public/views/note.html
@@ -52,6 +52,7 @@
+
diff --git a/routes/api.js b/routes/api.js
index a1171a0..f7e6df1 100644
--- a/routes/api.js
+++ b/routes/api.js
@@ -1433,10 +1433,16 @@ api.get('/notes', function(req, res) {
return;
}
var params = req.query;
- params.user_id = req.session.user.id;
- db.getNotes(params)
- .then((data) => res.json(data))
- .catch((err) => console.log('notes', err));
+ if (params.shareNote) {
+ db.getNote(params.shareNote)
+ .then((data) => res.send(`
${data}