added config variable

This commit is contained in:
mooleshacat 2024-10-21 22:20:20 -04:00
parent e2d9e1aaf7
commit cc4b3bf888
No known key found for this signature in database
GPG Key ID: 89DDFF5BD326A1B9
4 changed files with 25 additions and 9 deletions

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

@ -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

@ -1,15 +1,20 @@
class Invidious::Uptime
def self.get_uptime
str_uptime = "error"
# 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
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

File diff suppressed because one or more lines are too long