From 6e092026d29eccc3e3adf02be138fddec2354027 Mon Sep 17 00:00:00 2001 From: Omar Roth Date: Thu, 20 Sep 2018 11:03:58 -0500 Subject: [PATCH] Fix for Reddit timezone --- src/invidious.cr | 2 +- src/invidious/comments.cr | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/invidious.cr b/src/invidious.cr index 789ce332f..b151a0907 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -2055,7 +2055,7 @@ get "/api/v1/comments/:id" do |env| end elsif source == "reddit" client = make_client(REDDIT_URL) - headers = HTTP::Headers{"User-Agent" => "web:invidio.us:v0.2.0 (by /u/omarroth)"} + headers = HTTP::Headers{"User-Agent" => "web:invidio.us:v0.6.0 (by /u/omarroth)"} begin comments, reddit_thread = get_reddit_comments(id, client, headers) content_html = template_reddit_comments(comments) diff --git a/src/invidious/comments.cr b/src/invidious/comments.cr index 028fdeb8d..44fb291ac 100644 --- a/src/invidious/comments.cr +++ b/src/invidious/comments.cr @@ -17,12 +17,12 @@ class RedditComment end JSON.mapping({ - author: String, - body_html: String, - replies: RedditThing | String, - score: Int32, - depth: Int32, - created: { + author: String, + body_html: String, + replies: RedditThing | String, + score: Int32, + depth: Int32, + created_utc: { type: Time, converter: RedditComment::TimeConverter, }, @@ -159,7 +159,7 @@ def template_reddit_comments(root) [ - ] #{score} #{author} - - #{recode_date(child.created)} ago + - #{recode_date(child.created_utc)} ago

#{body_html}