issue #9
This commit is contained in:
parent
90a86133db
commit
30c13a1cfb
@ -97,15 +97,24 @@ export default (router, tpl) => {
|
||||
router.get(/^\/admin\/test(\/)?$/, auth, async (req, res) => {
|
||||
let ret;
|
||||
if(Object.keys(req.url.qs).length > 0) {
|
||||
const tag = req.url.qs.tag;
|
||||
|
||||
const rows = await sql("tags")
|
||||
.select("items.id", "items.username", "tags.tag")
|
||||
.leftJoin("tags_assign", "tags_assign.tag_id", "tags.id")
|
||||
.leftJoin("items", "items.id", "tags_assign.item_id")
|
||||
.where("tags.tag", "like", '%'+tag+'%');
|
||||
|
||||
ret = search(rows, tag);
|
||||
let tag = req.url.qs.tag;
|
||||
let rows;
|
||||
|
||||
if(tag.startsWith('src:')) {
|
||||
tag = tag.substring(4);
|
||||
ret = await sql('items')
|
||||
.where('src', 'ilike', '%'+tag+'%')
|
||||
.limit(500);
|
||||
}
|
||||
else {
|
||||
rows = await sql("tags")
|
||||
.select("items.id", "items.username", "tags.tag")
|
||||
.leftJoin("tags_assign", "tags_assign.tag_id", "tags.id")
|
||||
.leftJoin("items", "items.id", "tags_assign.item_id")
|
||||
.where("tags.tag", "like", '%'+tag+'%')
|
||||
.limit(500);
|
||||
ret = search(rows, tag);
|
||||
}
|
||||
}
|
||||
|
||||
res.reply({
|
||||
|
@ -17,7 +17,7 @@
|
||||
<tr>
|
||||
<td style="width: 128px;"><a href="/{{ line.id }}" target="_blank"><img src="/t/{{ line.id }}.webp" /></a></td>
|
||||
<td style="text-align: center;"><a href="/{{ line.id }}" target="_blank">{{ line.id }}</a></td>
|
||||
<td style="text-align: center;"><a href="/admin/test?tag={{ line.tag.replace(/\s/g, "+") }}">{{ line.tag }}</a></td>
|
||||
<td style="text-align: center;"><a href="/admin/test?tag={{ line.tag?.replace(/\s/g, "+") }}">{{ line.tag }}</a></td>
|
||||
<td style="text-align: center;">{{ line.username }}</td>
|
||||
<td style="text-align: center;">{{ line.score }}</td>
|
||||
</tr>
|
||||
|
Loading…
Reference in New Issue
Block a user