projects
/
oweals
/
peertube.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f285faa
)
Server: adapt magnet uri search
author
Chocobozzz
<florian.bigard@gmail.com>
Fri, 11 Nov 2016 14:24:36 +0000
(15:24 +0100)
committer
Chocobozzz
<florian.bigard@gmail.com>
Wed, 16 Nov 2016 19:29:26 +0000
(20:29 +0100)
server/models/video.js
patch
|
blob
|
history
diff --git
a/server/models/video.js
b/server/models/video.js
index 19136ba2544fc96897e51f4fdcd0f2ab3f2918fd..4f2be5c964ab3566e23f2ee6ccfa1c6f78416c3b 100644
(file)
--- a/
server/models/video.js
+++ b/
server/models/video.js
@@
-299,7
+299,12
@@
function load (id, callback) {
function search (value, field, start, count, sort, callback) {
const query = {}
// Make an exact search with the magnet
- if (field === 'magnetUri' || field === 'tags') {
+ if (field === 'magnetUri') {
+ const infoHash = magnetUtil.decode(value).infoHash
+ query.magnet = {
+ infoHash
+ }
+ } else if (field === 'tags') {
query[field] = value
} else {
query[field] = new RegExp(value, 'i')