This commit is contained in:
parent
6b6ebb7cbf
commit
b44e199d1d
@ -481,21 +481,9 @@ module.exports = (app, client) => {
|
|||||||
parser(),
|
parser(),
|
||||||
pick({ filter: 'hits.hits' }),
|
pick({ filter: 'hits.hits' }),
|
||||||
streamArray(),
|
streamArray(),
|
||||||
data => data.value._source
|
data => ({ instance: data.value._source.instance, comment: data.value._source.blocks.find(block => block.domain === clean(req.params.instance)).comment })
|
||||||
])
|
])
|
||||||
pipeline.on('data', data => {
|
result.pipe(pipeline).pipe(res, { end: true })
|
||||||
block_count++
|
|
||||||
instancescomment.push({
|
|
||||||
instance: data.instance, comment: data.blocks.find(block => block.domain === clean(req.params.instance)).comment
|
|
||||||
})
|
|
||||||
})
|
|
||||||
pipeline.on('end', () => {
|
|
||||||
res.json({
|
|
||||||
block_count,
|
|
||||||
instances: instancescomment
|
|
||||||
})
|
|
||||||
})
|
|
||||||
result.pipe(pipeline)
|
|
||||||
} else {
|
} else {
|
||||||
res.status(404).end()
|
res.status(404).end()
|
||||||
}
|
}
|
||||||
|
@ -38,8 +38,8 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
loading()
|
loading()
|
||||||
fetch('/api/block_count/' + content).then(async function (result) {
|
fetch('/api/block_count/' + content).then(async function (result) {
|
||||||
var res = await result.json()
|
var res = await result.json()
|
||||||
if (res && res.block_count >= 0) {
|
if (Array.isArray(res) && res?.length >= 0) {
|
||||||
document.getElementById('blockcount').innerText = res.block_count
|
document.getElementById('blockcount').innerText = res.length
|
||||||
document.getElementById('blockinstance').innerText = 'ing ' + content
|
document.getElementById('blockinstance').innerText = 'ing ' + content
|
||||||
document.getElementById('blocktook').innerText = ''
|
document.getElementById('blocktook').innerText = ''
|
||||||
var list = document.getElementById('blocklist'),
|
var list = document.getElementById('blocklist'),
|
||||||
@ -50,7 +50,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
while (list.hasChildNodes()) {
|
while (list.hasChildNodes()) {
|
||||||
list.removeChild(list.firstChild)
|
list.removeChild(list.firstChild)
|
||||||
}
|
}
|
||||||
res.instances.map(function (instance, index) {
|
res.map(function (instance, index) {
|
||||||
var li = document.createElement('li'),
|
var li = document.createElement('li'),
|
||||||
text = document.createTextNode((index + 1) + '. '),
|
text = document.createTextNode((index + 1) + '. '),
|
||||||
link = '<a href="/' + (new URLSearchParams(window.location.search).has('matrix') ? '?matrix' : '') + '#' + instance.instance + '" onclick="window.location.href=this.href; window.location.reload(false);">' + instance.instance + '</a>',
|
link = '<a href="/' + (new URLSearchParams(window.location.search).has('matrix') ? '?matrix' : '') + '#' + instance.instance + '" onclick="window.location.href=this.href; window.location.reload(false);">' + instance.instance + '</a>',
|
||||||
|
Loading…
Reference in New Issue
Block a user