download index
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
ale 2024-09-23 01:48:53 +02:00
parent bfd205d568
commit 14741055e5
2 changed files with 19 additions and 21 deletions

View File

@ -54,9 +54,10 @@
Total scanned <span id="instances">0</span> instances with <span id="peers">0</span> peers - <span
id="created">0</span> created - <span id="updated">0</span>
updated<br />
matrix <a id="matrix" href="/?matrix">off</a> - download json <a id="download" download target="_blank">index</a> -
matrix <a id="matrix" href="/?matrix">off</a> - download json <a id="download" download
target="_blank">index</a> -
by <a href="https://about.manalejandro.com" target="_blank">ale</a>
&copy;2024
<s>&copy;</s>2024
</footer>
<div id="modal">
<div class="modal-content">

View File

@ -17,7 +17,7 @@ document.addEventListener('DOMContentLoaded', function () {
document.getElementById('instance').addEventListener('keyup', function (event) {
if (event.key && !event.ctrlKey && !event.altKey && !event.shiftKey) {
if ((event.key.length === 1 && /[a-z0-9.\-*:]/i.test(event.key)) || (event.key === 'Backspace' && event.target.value !== '')) {
keypress(event, event.target.value)
keypress(event.target.value)
} else {
event.preventDefault()
event.stopPropagation()
@ -112,26 +112,23 @@ document.addEventListener('DOMContentLoaded', function () {
document.getElementById('download').addEventListener('click', function (event) {
loading()
ac = new AbortController()
try {
fetch('/api/donwload_index', { signal: ac.signal }).then(async function (result) {
var res = await result.blob(),
a = document.createElement('a')
a.download = 'fediblock-index.json.gz'
a.href = URL.createObjectURL(res)
a.type = 'application/x-gzip'
a.target = '_blank'
a.dispatchEvent(new MouseEvent('click'))
document.getElementById('loader-content').style.display = 'none'
}).catch(function (err) {
console.error(err)
document.getElementById('loader-content').style.display = 'none'
})
} catch (e) {
console.error(e)
fetch('/api/donwload_index', { signal: ac.signal }).then(async function (result) {
var res = await result.blob(),
a = document.createElement('a')
a.download = 'fediblock-index.json.gz'
a.href = URL.createObjectURL(res)
a.type = 'application/x-gzip'
a.target = '_blank'
a.dispatchEvent(new MouseEvent('click'))
document.getElementById('loader-content').style.display = 'none'
}
}).catch(function (err) {
console.error(err)
document.getElementById('loader-content').style.display = 'none'
})
event.preventDefault()
event.stopPropagation()
})
function keypress(event, content) {
function keypress(content) {
loading()
if (timeout) {
clearTimeout(timeout)