Added 'enabled' boolean to sources

This commit is contained in:
Kieran Eglin 2024-11-20 12:45:31 -08:00
parent bf93bb63cd
commit d0cf2c7c8a
No known key found for this signature in database
GPG key ID: 193984967FCF432D
4 changed files with 12 additions and 0 deletions

View file

@ -15,6 +15,7 @@ defmodule Pinchflat.Sources.Source do
alias Pinchflat.Metadata.SourceMetadata alias Pinchflat.Metadata.SourceMetadata
@allowed_fields ~w( @allowed_fields ~w(
enabled
collection_name collection_name
collection_id collection_id
collection_type collection_type
@ -64,6 +65,7 @@ defmodule Pinchflat.Sources.Source do
)a )a
schema "sources" do schema "sources" do
field :enabled, :boolean, default: true
# This is _not_ used as the primary key or internally in the database # This is _not_ used as the primary key or internally in the database
# relations. This is only used to prevent an enumeration attack on the streaming # relations. This is only used to prevent an enumeration attack on the streaming
# and RSS feed endpoints since those _must_ be public (ie: no basic auth) # and RSS feed endpoints since those _must_ be public (ie: no basic auth)

View file

@ -7,6 +7,7 @@ defmodule PinchflatWeb.Sources.IndexTableLive do
alias Pinchflat.Sources.Source alias Pinchflat.Sources.Source
alias Pinchflat.Media.MediaItem alias Pinchflat.Media.MediaItem
# TODO: test
def render(assigns) do def render(assigns) do
~H""" ~H"""
<.table rows={@sources} table_class="text-black dark:text-white"> <.table rows={@sources} table_class="text-black dark:text-white">

Binary file not shown.

Before

Width:  |  Height:  |  Size: 449 KiB

After

Width:  |  Height:  |  Size: 434 KiB

View file

@ -0,0 +1,9 @@
defmodule Pinchflat.Repo.Migrations.AddEnabledToSources do
use Ecto.Migration
def change do
alter table(:sources) do
add :enabled, :boolean, default: true, null: false
end
end
end