Add 'since' to '/api/v1/auth/notifications'

This commit is contained in:
Omar Roth 2019-04-28 18:14:16 -05:00
parent ef309bd8d0
commit 54d250bde4
3 changed files with 69 additions and 25 deletions

View file

@ -9,6 +9,34 @@ struct InvidiousChannel
end
struct ChannelVideo
def to_json(locale, config, kemal_config, json : JSON::Builder)
json.object do
json.field "title", self.title
json.field "videoId", self.id
json.field "videoThumbnails" do
generate_thumbnails(json, self.id, config, Kemal.config)
end
json.field "lengthSeconds", self.length_seconds
json.field "author", self.author
json.field "authorId", self.ucid
json.field "authorUrl", "/channel/#{self.ucid}"
json.field "published", self.published.to_unix
json.field "publishedText", translate(locale, "`x` ago", recode_date(self.published, locale))
end
end
def to_json(locale, config, kemal_config, json : JSON::Builder | Nil = nil)
if json
to_json(locale, config, kemal_config, json)
else
JSON.build do |json|
to_json(locale, config, kemal_config, json)
end
end
end
db_mapping({
id: String,
title: String,

View file

@ -262,8 +262,10 @@ struct Video
generate_storyboards(json, self.storyboards, config, kemal_config)
end
json.field "description", html_to_content(self.description).last
json.field "descriptionHtml", html_to_content(self.description).first
description_html, description = html_to_content(self.description)
json.field "description", description
json.field "descriptionHtml", description_html
json.field "published", self.published.to_unix
json.field "publishedText", translate(locale, "`x` ago", recode_date(self.published, locale))
json.field "keywords", self.keywords