Skip to content
This repository has been archived by the owner on Jan 11, 2025. It is now read-only.

Commit

Permalink
Shut down the feed, #8
Browse files Browse the repository at this point in the history
  • Loading branch information
ronilaukkarinen committed Jan 9, 2025
1 parent 4b6ba25 commit 402e2df
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
// Set version
$version = '1.0.3';

// Set enabled status
$enabled = false;

// Require composer
require __DIR__ . '/vendor/autoload.php';

Expand Down Expand Up @@ -816,6 +819,11 @@
</header>

<div id="statuses">
<?php if ( ! $enabled ) : ?>
<div style="text-align: center; padding: 20px; display: flex; align-items: center; justify-content: center; height: calc(100vh - 200px);">
<p>The feed is shut down. <a href="https://github.com/ronilaukkarinen/fedionfire/issues/8" style="text-decoration: underline;">Read more</a></p>
</div>
<?php endif; ?>
<div id="anchor"></div>
</div>

Expand Down Expand Up @@ -1114,7 +1122,9 @@ function beginStreaming(filter, lang) {
document.getElementById("filter-now").innerHTML += '<span class="text-neutral">(' + lang + ')</span>';
}

beginStreaming(filter, lang);
<?php if ( $enabled ) : ?>
beginStreaming(filter, lang);
<?php endif; ?>
});

// Filter on type without enter, add with push state to URL
Expand Down Expand Up @@ -1249,8 +1259,9 @@ function beginStreaming(filter, lang) {
document.getElementById("filter-now").focus();
});

// Add error handling to EventSource
// Add enabled check to rate limit error handler
evtSource.onerror = function(event) {
<?php if ( $enabled ) : ?>
// Check if connection is closed or failed
if (event.target.readyState !== EventSource.OPEN) {
const popup = document.getElementById('rate-limit-popup');
Expand All @@ -1268,6 +1279,7 @@ function beginStreaming(filter, lang) {
beginStreaming(filter, lang);
}, 30000);
}
<?php endif; ?>
};

</script>
Expand Down

0 comments on commit 402e2df

Please sign in to comment.