Added column and UI for apprise server
This commit is contained in:
parent
f84727b97e
commit
a1444b69db
6 changed files with 37 additions and 10 deletions
|
|
@ -9,7 +9,8 @@ defmodule Pinchflat.Settings.Setting do
|
|||
@allowed_fields [
|
||||
:onboarding,
|
||||
:pro_enabled,
|
||||
:yt_dlp_version
|
||||
:yt_dlp_version,
|
||||
:apprise_server
|
||||
]
|
||||
|
||||
@required_fields ~w(
|
||||
|
|
@ -21,6 +22,7 @@ defmodule Pinchflat.Settings.Setting do
|
|||
field :onboarding, :boolean, default: true
|
||||
field :pro_enabled, :boolean, default: false
|
||||
field :yt_dlp_version, :string
|
||||
field :apprise_server, :string
|
||||
end
|
||||
|
||||
@doc false
|
||||
|
|
|
|||
|
|
@ -247,6 +247,7 @@ defmodule PinchflatWeb.CoreComponents do
|
|||
attr :label_suffix, :string, default: nil
|
||||
attr :value, :any
|
||||
attr :help, :string, default: nil
|
||||
attr :html_help, :boolean, default: false
|
||||
|
||||
attr :type, :string,
|
||||
default: "text",
|
||||
|
|
@ -298,7 +299,7 @@ defmodule PinchflatWeb.CoreComponents do
|
|||
<%= @label %>
|
||||
<span :if={@label_suffix} class="text-xs text-bodydark"><%= @label_suffix %></span>
|
||||
</label>
|
||||
<.help :if={@help}><%= @help %></.help>
|
||||
<.help :if={@help}><%= if @html_help, do: Phoenix.HTML.raw(@help), else: @help %></.help>
|
||||
<.error :for={msg <- @errors}><%= msg %></.error>
|
||||
</div>
|
||||
"""
|
||||
|
|
@ -325,7 +326,7 @@ defmodule PinchflatWeb.CoreComponents do
|
|||
</label>
|
||||
</div>
|
||||
</section>
|
||||
<.help :if={@help}><%= @help %></.help>
|
||||
<.help :if={@help}><%= if @html_help, do: Phoenix.HTML.raw(@help), else: @help %></.help>
|
||||
<.error :for={msg <- @errors}><%= msg %></.error>
|
||||
</div>
|
||||
"""
|
||||
|
|
@ -356,7 +357,7 @@ defmodule PinchflatWeb.CoreComponents do
|
|||
>
|
||||
</div>
|
||||
</div>
|
||||
<.help :if={@help}><%= @help %></.help>
|
||||
<.help :if={@help}><%= if @html_help, do: Phoenix.HTML.raw(@help), else: @help %></.help>
|
||||
<.error :for={msg <- @errors}><%= msg %></.error>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -387,7 +388,7 @@ defmodule PinchflatWeb.CoreComponents do
|
|||
</select>
|
||||
<%= render_slot(@inner_block) %>
|
||||
</div>
|
||||
<.help :if={@help}><%= @help %></.help>
|
||||
<.help :if={@help}><%= if @html_help, do: Phoenix.HTML.raw(@help), else: @help %></.help>
|
||||
<.error :for={msg <- @errors}><%= msg %></.error>
|
||||
</div>
|
||||
"""
|
||||
|
|
@ -411,7 +412,7 @@ defmodule PinchflatWeb.CoreComponents do
|
|||
]}
|
||||
{@rest}
|
||||
><%= Phoenix.HTML.Form.normalize_value("textarea", @value) %></textarea>
|
||||
<.help :if={@help}><%= @help %></.help>
|
||||
<.help :if={@help}><%= if @html_help, do: Phoenix.HTML.raw(@help), else: @help %></.help>
|
||||
<.error :for={msg <- @errors}><%= msg %></.error>
|
||||
</div>
|
||||
"""
|
||||
|
|
@ -438,7 +439,7 @@ defmodule PinchflatWeb.CoreComponents do
|
|||
]}
|
||||
{@rest}
|
||||
/>
|
||||
<.help :if={@help}><%= @help %></.help>
|
||||
<.help :if={@help}><%= if @html_help, do: Phoenix.HTML.raw(@help), else: @help %></.help>
|
||||
<.error :for={msg <- @errors}><%= msg %></.error>
|
||||
</div>
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ defmodule PinchflatWeb.Settings.SettingController do
|
|||
setting = Settings.record()
|
||||
|
||||
case Settings.update_setting(setting, setting_params) do
|
||||
{:ok, setting} ->
|
||||
{:ok, _} ->
|
||||
conn
|
||||
|> put_flash(:info, "Settings updated successfully.")
|
||||
|> redirect(to: ~p"/settings")
|
||||
|
|
|
|||
|
|
@ -10,4 +10,11 @@ defmodule PinchflatWeb.Settings.SettingHTML do
|
|||
attr :action, :string, required: true
|
||||
|
||||
def setting_form(assigns)
|
||||
|
||||
def apprise_server_help do
|
||||
url = "https://github.com/caronc/apprise/wiki/URLBasics"
|
||||
classes = "underline decoration-bodydark decoration-1 hover:decoration-white"
|
||||
|
||||
~s(Server endpoint for Apprise notifications when new media is found. See <a href="#{url}" class="#{classes}" target="_blank">Apprise docs</a> for more information)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -4,10 +4,18 @@
|
|||
</.error>
|
||||
|
||||
<h3 class="mt-8 text-2xl text-black dark:text-white">
|
||||
TODO TEXT
|
||||
Notification Settings
|
||||
</h3>
|
||||
|
||||
<.input field={f[:pro_enabled]} type="toggle" label="Pro Enabled" help="Just for testing" />
|
||||
<.input
|
||||
field={f[:apprise_server]}
|
||||
type="text"
|
||||
label="Apprise Server"
|
||||
help={apprise_server_help()}
|
||||
html_help={true}
|
||||
inputclass="font-mono text-sm"
|
||||
placeholder="https://discordapp.com/api/webhooks/{WebhookID}/{WebhookToken}"
|
||||
/>
|
||||
|
||||
<.button class="my-10 sm:mb-7.5 w-full sm:w-auto" rounding="rounded-lg">Save Settings</.button>
|
||||
</.simple_form>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
defmodule Pinchflat.Repo.Migrations.AddAppriseServersToSettings do
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
alter table(:settings) do
|
||||
add :apprise_server, :string
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Reference in a new issue