2019-12-04 01:50:23 +01:00
|
|
|
defmodule PhilomenaWeb.Api.Rss.WatchedController do
|
2019-12-01 00:11:24 +01:00
|
|
|
use PhilomenaWeb, :controller
|
|
|
|
|
2019-12-24 22:14:42 +01:00
|
|
|
alias PhilomenaWeb.ImageLoader
|
2020-08-23 21:47:42 +02:00
|
|
|
alias Philomena.Images.Image
|
|
|
|
alias Philomena.Elasticsearch
|
|
|
|
|
|
|
|
import Ecto.Query
|
2019-12-01 00:11:24 +01:00
|
|
|
|
|
|
|
def index(conn, _params) do
|
2019-12-24 22:14:42 +01:00
|
|
|
{:ok, {images, _tags}} = ImageLoader.search_string(conn, "my:watched")
|
2023-05-29 13:06:41 +02:00
|
|
|
images = Elasticsearch.search_records(images, preload(Image, [:sources, tags: :aliases]))
|
2019-12-01 00:11:24 +01:00
|
|
|
|
2020-01-10 18:43:56 +01:00
|
|
|
# NB: this is RSS, but using the RSS format causes Phoenix not to
|
|
|
|
# escape HTML
|
2022-10-31 13:44:01 +01:00
|
|
|
conn
|
|
|
|
|> put_resp_header("content-type", "application/rss+xml")
|
|
|
|
|> render("index.html", layout: false, images: images)
|
2019-12-01 00:11:24 +01:00
|
|
|
end
|
2019-12-24 22:14:42 +01:00
|
|
|
end
|