mirror of
https://github.com/iv-org/invidious.git
synced 2025-04-18 06:35:49 -04:00
Merge pull request #68 from catspeed-cc/dev-server-load
Merge: dev-server-load into development
This commit is contained in:
commit
7511b94ab6
@ -78,6 +78,7 @@
|
||||
- add proxy patch
|
||||
- sig helper reconnect patch
|
||||
- uptime status patch (mooleshacat)
|
||||
- loadavg status patch (mooleshacat)
|
||||
- token monitor patch (mooleshacat)
|
||||
|
||||
**User features**
|
||||
@ -169,9 +170,9 @@ 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 notes
|
||||
## uptime & loadavg status patch notes
|
||||
|
||||
This branch has the uptime patch from 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.
|
||||
This branch has the uptime & loadavg patch from myself (mooleshacat) which if enabled in the config, will show the uptime and/or loadavg on the page. Please note, if everyone can see your uptime or loadavg, so could a theoretical attacker. This may or may not be a good idea, you be the judge.
|
||||
|
||||
|
||||
## Documentation
|
||||
|
@ -246,6 +246,14 @@ http_proxy:
|
||||
##
|
||||
#uptime_enabled: true
|
||||
|
||||
##
|
||||
## Enable/Disable showing the load avg on the main page.
|
||||
##
|
||||
## Accepted values: true, false
|
||||
## Default: false
|
||||
##
|
||||
#loadavg_enabled: true
|
||||
|
||||
##
|
||||
## Enable/Disable the "Popular" tab on the main page.
|
||||
##
|
||||
|
@ -103,6 +103,7 @@ class Config
|
||||
property use_pubsub_feeds : Bool | Int32 = false
|
||||
property popular_enabled : Bool = true
|
||||
property uptime_enabled : Bool = false
|
||||
property loadavg_enabled : Bool = false
|
||||
property captcha_enabled : Bool = true
|
||||
property login_enabled : Bool = true
|
||||
property registration_enabled : Bool = true
|
||||
|
19
src/invidious/helpers/loadavg.cr
Normal file
19
src/invidious/helpers/loadavg.cr
Normal file
@ -0,0 +1,19 @@
|
||||
class Invidious::Loadavg
|
||||
|
||||
def self.get_loadavg
|
||||
|
||||
str_loadavg = "error"
|
||||
|
||||
if CONFIG.loadavg_enabled
|
||||
|
||||
str_loadavg = `/usr/bin/cat /proc/loadavg | awk -F'[ ]' '{print $1" "$2" "$3}'`
|
||||
|
||||
else
|
||||
str_loadavg = ""
|
||||
end
|
||||
|
||||
return str_loadavg
|
||||
|
||||
end
|
||||
|
||||
end
|
@ -2,6 +2,7 @@
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
dark_mode = env.get("preferences").as(Preferences).dark_mode
|
||||
uptime_enabled = CONFIG.uptime_enabled
|
||||
loadavg_enabled = CONFIG.loadavg_enabled
|
||||
%>
|
||||
<!DOCTYPE html>
|
||||
<html lang="<%= locale %>">
|
||||
@ -38,6 +39,9 @@
|
||||
<% if uptime_enabled %>
|
||||
<tr><td style="text-align: center; vertical-align: middle;"><font style="font-size: 10px;color:#c3c3c3;">server <%= Invidious::Uptime.get_uptime %></font></td></tr>
|
||||
<% end %>
|
||||
<% if loadavg_enabled %>
|
||||
<tr><td style="text-align: center; vertical-align: middle;"><font style="font-size: 10px;color:#c3c3c3;">server load <%= Invidious::Loadavg.get_loadavg %></font></td></tr>
|
||||
<% end %>
|
||||
</table>
|
||||
</div>
|
||||
<div class="pure-u-1 pure-u-md-12-24 searchbar">
|
||||
|
Loading…
x
Reference in New Issue
Block a user