mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-08-14.git
synced 2024-08-15 00:53:20 +00:00
Update User-Agent and statistics schema
This commit is contained in:
parent
4be82c5ca6
commit
057e69fe70
2 changed files with 11 additions and 5 deletions
|
@ -136,11 +136,17 @@ if config.statistics_enabled
|
||||||
},
|
},
|
||||||
"openRegistrations" => config.registration_enabled,
|
"openRegistrations" => config.registration_enabled,
|
||||||
"usage" => {
|
"usage" => {
|
||||||
"total" => PG_DB.query_one("SELECT count(*) FROM users", as: Int64),
|
{
|
||||||
"activeHalfyear" => PG_DB.query_one("SELECT count(*) FROM users WHERE CURRENT_TIMESTAMP - updated < '6 months'", as: Int64),
|
"users" => {
|
||||||
"activeMonth" => PG_DB.query_one("SELECT count(*) FROM users WHERE CURRENT_TIMESTAMP - updated < '1 month'", as: Int64),
|
"total" => PG_DB.query_one("SELECT count(*) FROM users", as: Int64),
|
||||||
|
"activeHalfyear" => PG_DB.query_one("SELECT count(*) FROM users WHERE CURRENT_TIMESTAMP - updated < '6 months'", as: Int64),
|
||||||
|
"activeMonth" => PG_DB.query_one("SELECT count(*) FROM users WHERE CURRENT_TIMESTAMP - updated < '1 month'", as: Int64),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"metadata" => {
|
||||||
|
"updatedAt" => Time.now.to_unix,
|
||||||
},
|
},
|
||||||
"updatedAt" => Time.now.to_unix,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sleep 1.minute
|
sleep 1.minute
|
||||||
|
|
|
@ -252,7 +252,7 @@ end
|
||||||
|
|
||||||
def fetch_reddit_comments(id)
|
def fetch_reddit_comments(id)
|
||||||
client = make_client(REDDIT_URL)
|
client = make_client(REDDIT_URL)
|
||||||
headers = HTTP::Headers{"User-Agent" => "web:invidio.us:v0.14.1 (by /u/omarroth)"}
|
headers = HTTP::Headers{"User-Agent" => "web:invidious:v#{CURRENT_VERSION} (by /u/omarroth)"}
|
||||||
|
|
||||||
query = "(url:3D#{id}%20OR%20url:#{id})%20(site:youtube.com%20OR%20site:youtu.be)"
|
query = "(url:3D#{id}%20OR%20url:#{id})%20(site:youtube.com%20OR%20site:youtu.be)"
|
||||||
search_results = client.get("/search.json?q=#{query}", headers)
|
search_results = client.get("/search.json?q=#{query}", headers)
|
||||||
|
|
Loading…
Reference in a new issue