Merge pull request #61 from catspeed-cc/dev-uptime-status

Merge: dev-uptime-status into development
This commit is contained in:
MooCat 2024-10-21 22:32:57 -04:00 committed by GitHub
commit ce96413f8e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 45 additions and 0 deletions

1
.gitignore vendored
View file

@ -1,3 +1,4 @@
1
*~
/docs/
/dev/

View file

@ -77,6 +77,7 @@
- add redis patch
- add proxy patch
- sig helper reconnect patch
- uptime status patch (mooleshacat)
- token monitor patch (mooleshacat)
**User features**
@ -168,6 +169,11 @@ This branch has the token monitor patch from myself (mooleshacat) which will che
This patch is a temporary workaround until inv_sig_helper itself can get the tokens for us. unixfox (invidious dev) raised this idea to techmetx11 (inv_sig_helper dev) and they are working on an implementation that will eventually make this patch useless. This is OK, as it is only a patch and that setup would be better performance wise than my current implementations. You can read about it here https://github.com/iv-org/inv_sig_helper/issues/10
## uptime status patch
This fork has the uptime patch made by myself (mooleshacat) which if enabled in the config, will show the uptime on the page. Please note, if everyone can see your uptime, so could a theoretical attacker. This may or may not be a good idea, you be the judge.
## Documentation
The full documentation can be accessed online at https://docs.invidious.io/

View file

@ -238,6 +238,14 @@ http_proxy:
# Features
# -----------------------------
##
## Enable/Disable showing the uptime on the main page.
##
## Accepted values: true, false
## Default: false
##
#uptime_enabled: true
##
## Enable/Disable the "Popular" tab on the main page.
##

View file

@ -16,6 +16,7 @@
require "digest/md5"
require "file_utils"
require "process"
# Require kemal, kilt, then our own overrides
require "kemal"

View file

@ -102,6 +102,7 @@ class Config
# Subscribe to channels using PubSubHubbub (requires domain, hmac_key)
property use_pubsub_feeds : Bool | Int32 = false
property popular_enabled : Bool = true
property uptime_enabled : Bool = false
property captcha_enabled : Bool = true
property login_enabled : Bool = true
property registration_enabled : Bool = true

View file

@ -0,0 +1,23 @@
class Invidious::Uptime
def self.get_uptime
str_uptime = "error"
if CONFIG.uptime_enabled
# get the uptime
uptime_cmd = "/usr/bin/uptime"
uptime_args = "-p"
process = Process.new(uptime_cmd, [uptime_args], output: Process::Redirect::Pipe)
str_uptime = process.output.gets_to_end
else
str_uptime = ""
end
return str_uptime
end
end

File diff suppressed because one or more lines are too long