diff options
| author | Omar Roth <omarroth@hotmail.com> | 2019-04-20 12:41:51 -0500 |
|---|---|---|
| committer | Omar Roth <omarroth@hotmail.com> | 2019-04-20 12:41:51 -0500 |
| commit | 30e567e8b63052d657f03e709be2662cafec62af (patch) | |
| tree | fd221d4e102f1a5dfa03961da56a3468c4f095cf /src | |
| parent | ddd74549fe31dfc89d5d4a7c289b40aec90301ad (diff) | |
| download | invidious-30e567e8b63052d657f03e709be2662cafec62af.tar.gz invidious-30e567e8b63052d657f03e709be2662cafec62af.tar.bz2 invidious-30e567e8b63052d657f03e709be2662cafec62af.zip | |
Fix published time for /api/v1/auth/notifications
Diffstat (limited to 'src')
| -rw-r--r-- | src/invidious.cr | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/invidious.cr b/src/invidious.cr index 66ed4512..fb8ebbe4 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -2649,8 +2649,9 @@ post "/feed/webhook/:token" do |env| # Deliver notifications to `/api/v1/auth/notifications` payload = { - "key" => video.id, - "topic" => video.ucid, + "topic" => video.ucid, + "videoId" => video.id, + "published" => published.to_unix, }.to_json PG_DB.exec("NOTIFY notifications, E'#{payload}'") @@ -4134,9 +4135,12 @@ get "/api/v1/auth/notifications" do |env| PG.connect_listen(PG_URL, "notifications") do |event| notification = JSON.parse(event.payload) topic = notification["topic"].as_s - key = notification["key"].as_s + video_id = notification["videoId"].as_s + published = notification["published"].as_i64 - response = JSON.parse(get_video(key, PG_DB, proxies).to_json(locale, config, Kemal.config, decrypt_function)) + video = get_video(video_id, PG_DB, proxies) + video.published = Time.unix(published) + response = JSON.parse(video.to_json(locale, config, Kemal.config, decrypt_function)) if fields_text = env.params.query["fields"]? begin |
