mirror of
https://github.com/iv-org/invidious.git
synced 2025-04-20 07:35:53 -04:00
added config variable
This commit is contained in:
parent
e2d9e1aaf7
commit
cc4b3bf888
@ -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.
|
||||
##
|
||||
|
@ -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
|
||||
|
@ -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
Loading…
x
Reference in New Issue
Block a user