summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOmar Roth <omarroth@hotmail.com>2019-03-01 19:39:10 -0600
committerOmar Roth <omarroth@hotmail.com>2019-03-01 19:39:10 -0600
commit057e69fe703a151574137bf2aa9518d90e640bfe (patch)
tree921889387c396f503bfa8ed42b2b6281c4a4cd26
parent4be82c5ca618a27b8729c4c1406c549651b6d37a (diff)
downloadinvidious-057e69fe703a151574137bf2aa9518d90e640bfe.tar.gz
invidious-057e69fe703a151574137bf2aa9518d90e640bfe.tar.bz2
invidious-057e69fe703a151574137bf2aa9518d90e640bfe.zip
Update User-Agent and statistics schema
-rw-r--r--src/invidious.cr14
-rw-r--r--src/invidious/comments.cr2
2 files changed, 11 insertions, 5 deletions
diff --git a/src/invidious.cr b/src/invidious.cr
index 44dd4183..7222e264 100644
--- a/src/invidious.cr
+++ b/src/invidious.cr
@@ -136,11 +136,17 @@ if config.statistics_enabled
},
"openRegistrations" => config.registration_enabled,
"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),
- "activeMonth" => PG_DB.query_one("SELECT count(*) FROM users WHERE CURRENT_TIMESTAMP - updated < '1 month'", as: Int64),
+ {
+ "users" => {
+ "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
diff --git a/src/invidious/comments.cr b/src/invidious/comments.cr
index 8ac3b156..6707e1f1 100644
--- a/src/invidious/comments.cr
+++ b/src/invidious/comments.cr
@@ -252,7 +252,7 @@ end
def fetch_reddit_comments(id)
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)"
search_results = client.get("/search.json?q=#{query}", headers)