From 43df8346850cac1655b5c3ce6362424608e2f707 Mon Sep 17 00:00:00 2001 From: 4cuck <40539855+4cuck@users.noreply.github.com> Date: Sun, 2 Jun 2024 02:19:42 +0200 Subject: [PATCH] update rip info and hide version by default --- server/static/table_toggle.js | 60 +++++++++++++++--------------- server/templates/about.html.j2 | 2 +- server/templates/instances.html.j2 | 6 +-- server/templates/rip.html.j2 | 5 +++ 4 files changed, 39 insertions(+), 34 deletions(-) diff --git a/server/static/table_toggle.js b/server/static/table_toggle.js index 355a336..81566eb 100644 --- a/server/static/table_toggle.js +++ b/server/static/table_toggle.js @@ -7,7 +7,7 @@ toggleColumnCheckboxes.forEach(checkbox => { checkbox.addEventListener('change', function () { const columnName = checkbox.getAttribute('data-name'); let checked = checkbox.checked; - toggleColumn(columnName,checked); + toggleColumn(columnName, checked); saveSettings(); }); }); @@ -18,65 +18,65 @@ function saveSettings() { const columnName = checkbox.getAttribute('data-name'); let checked = checkbox.checked; data[columnName] = checked; - }); - setCookie(COOKIE_NAME, JSON.stringify(data),30); + }); + setCookie(COOKIE_NAME, JSON.stringify(data), 30); } // Function to toggle the visibility of a column based on its name or id -function toggleColumn(name,checked) { +function toggleColumn(name, checked) { const cellsTd = dataTable.querySelectorAll(`td[data-name="${name}"]`); - + cellsTd.forEach(cell => { cell.style.display = checked ? '' : 'none'; }); const cells = dataTable.querySelectorAll(`th[data-name="${name}"]`); - + cells.forEach(cell => { cell.style.display = checked ? '' : 'none'; }); } const COOKIE_NAME = "table_settings"; -document.addEventListener("DOMContentLoaded", function(event) { - let val = getCookie(COOKIE_NAME); - if (val) { - let res = JSON.parse( val ); - console.log(res); - for (const [key, value] of Object.entries(res)) { - console.log(key, value); - toggleColumn(key,value); +document.addEventListener("DOMContentLoaded", function (event) { + let val = getCookie(COOKIE_NAME); + if (val) { + let res = JSON.parse(val); + console.log(res); + for (const [key, value] of Object.entries(res)) { + console.log(key, value); + toggleColumn(key, value); + toggleColumnCheckboxes.forEach(checkbox => { + if (checkbox.getAttribute('data-name') == key) { + checkbox.checked = value; + } + }); + } + } else { toggleColumnCheckboxes.forEach(checkbox => { - if (checkbox.getAttribute('data-name') == key) { - checkbox.checked = value; - } + const columnName = checkbox.getAttribute('data-name'); + let checked = checkbox.checked; + toggleColumn(columnName, checked); }); } - } else { - toggleColumnCheckboxes.forEach(checkbox => { - const columnName = checkbox.getAttribute('data-name'); - let checked = checkbox.checked; - toggleColumn(columnName,checked); - }); - } }); -function setCookie(name,value,days) { +function setCookie(name, value, days) { var expires = ""; if (days) { var date = new Date(); - date.setTime(date.getTime() + (days*24*60*60*1000)); + date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); expires = "; expires=" + date.toUTCString(); } - document.cookie = name + "=" + (value || "") + expires + "; path=/"; + document.cookie = name + "=" + (value || "") + expires + "; path=/"; } function getCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); - for(var i=0;i < ca.length;i++) { + for (var i = 0; i < ca.length; i++) { var c = ca[i]; - while (c.charAt(0)==' ') c = c.substring(1,c.length); - if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); + while (c.charAt(0) == ' ') c = c.substring(1, c.length); + if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length); } return null; } \ No newline at end of file diff --git a/server/templates/about.html.j2 b/server/templates/about.html.j2 index d58af21..d35f923 100644 --- a/server/templates/about.html.j2 +++ b/server/templates/about.html.j2 @@ -30,7 +30,7 @@
Country for the host country reported in the instance wiki.Healthy stands for hosts which are reachable and pass a content check.Average Time is the response time average over the last {{ping_avg_interval_h}} hours. This is
not a network ping.Please use the API for bots. Please do NOT use these instances for +
Please do NOT use these instances for scraping, host nitter yourself.
Last Updated {{last_updated}} UTC.
Customize the visible columns down below.
@@ -155,7 +155,7 @@See here for setting up Nitter if you feel brave enough and don't fear the command line.
+ +Through he thankless work of some there is a tiny amount of instances left. These will be slow and can not expose + RSS to prevent the huge volume bot attacks. The latter one also makes captchas and other anti-botting methods a + requirement.