Fast indexing (#58)
* Made method to getting singular media details; Renamed other related method * Takes a fun and flirty digression to remove abstractions around yt-dlp since I'm 100% committed to using it exclusively * Removed commented test code * Lays the groundwork for fast indexing * Added module for working with youtube RSS feed * Added methods to kick off indexing workers from RSS response * Improve short detection (#59) * Made media attribute-related yt-dlp calls return a struct * Added shorts attribute to media items * Added ability to discern a short from yt-dlp response * Updated search to use new shorts attribute * Fast index UI (#63) * Added fast_index field and adds it to source form * Added fast indexing to source changeset operations * Added fast indexing worker and updated other modules to start using it * Handled fast index worker on source update * Add support modals (#65) * Added fast indexing upgrade modal * Improved modal on smaller screens * Updated links to work again * Added donation modal * Reverted source fast index to 15 minutes * Removed unneeded HTML attributes from old alpine approach
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
<.modal id="donate-modal" allow_close={true}>
|
||||
<section x-data="{ inputValue: '' }">
|
||||
<h3 class="text-2xl text-white">Donate</h3>
|
||||
<p class="text-sm">Thank you for your support :)</p>
|
||||
<p class="mt-4">
|
||||
If you find the project valuable and want to support its development, a
|
||||
<.inline_link href="https://www.paypal.me/kieraneglin">donation</.inline_link>
|
||||
would be greatly appreciated.
|
||||
</p>
|
||||
<p class="mt-4">
|
||||
Plus, $5 USD from any donation over $10 USD will be donated to
|
||||
<.inline_link href="https://www.eff.org/">The Electronic Frontier Foundation</.inline_link>
|
||||
who defend your online liberties and backed
|
||||
<.inline_code>youtube-dl</.inline_code>
|
||||
when Google took them down<.inline_link href="https://github.com/github/dmca/blob/9a85e0f021f7967af80e186b890776a50443f06c/2020/11/2020-11-16-RIAA-reversal-effletter.pdf">
|
||||
<.icon name="hero-arrow-top-right-on-square" class="h-3 w-3" />
|
||||
</.inline_link>.
|
||||
</p>
|
||||
|
||||
<.link href="https://www.paypal.me/kieraneglin" target="_blank">
|
||||
<.button color="bg-primary" class="w-full mt-8">
|
||||
Donate
|
||||
</.button>
|
||||
</.link>
|
||||
</section>
|
||||
</.modal>
|
||||
@@ -1,31 +1,58 @@
|
||||
<aside
|
||||
x-bind:class="sidebarVisible ? 'translate-x-0' : '-translate-x-full'"
|
||||
class={[
|
||||
"-translate-x-full absolute left-0 top-0 z-9999 flex h-screen w-60 flex-col overflow-y-hidden",
|
||||
"-translate-x-full absolute left-0 top-0 z-9999 flex h-screen w-60 flex-col overflow-y-hidden justify-between",
|
||||
"bg-black duration-300 ease-linear shadow-lg sm:shadow-none dark:bg-boxdark lg:static lg:translate-x-0"
|
||||
]}
|
||||
@click.outside="sidebarVisible = false"
|
||||
>
|
||||
<div class="flex items-center justify-between gap-2 px-6 py-5.5 lg:py-6.5">
|
||||
<a href="/" class="flex items-center">
|
||||
<img src={~p"/images/logo.png?cachebust=2024-02-29"} alt="Pinchflat" class="w-9 h-9" />
|
||||
<h2 class="text-xl font-bold text-white pl-2">Pinchflat</h2>
|
||||
</a>
|
||||
<section>
|
||||
<div class="flex items-center justify-between gap-2 px-6 py-5.5 lg:py-6.5">
|
||||
<a href="/" class="flex items-center">
|
||||
<img src={~p"/images/logo.png?cachebust=2024-02-29"} alt="Pinchflat" class="w-9 h-9" />
|
||||
<h2 class="text-xl font-bold text-white pl-2">Pinchflat</h2>
|
||||
</a>
|
||||
|
||||
<button class="block lg:hidden" @click.stop="sidebarVisible = !sidebarVisible">
|
||||
<.icon name="hero-arrow-left" class="fill-current" />
|
||||
</button>
|
||||
</div>
|
||||
<div class="no-scrollbar flex flex-col overflow-y-auto duration-300 ease-linear">
|
||||
<nav class="mt-5 px-4 py-4 lg:mt-9 lg:px-6">
|
||||
<div>
|
||||
<button class="block lg:hidden" @click.stop="sidebarVisible = !sidebarVisible">
|
||||
<.icon name="hero-arrow-left" class="fill-current" />
|
||||
</button>
|
||||
</div>
|
||||
<div class="no-scrollbar flex flex-col overflow-y-auto duration-300 ease-linear">
|
||||
<nav class="mt-5 px-4 py-4 lg:mt-9 lg:px-6">
|
||||
<h3 class="mb-4 ml-4 text-sm font-medium text-bodydark2">MENU</h3>
|
||||
<ul class="mb-6 flex flex-col gap-1.5">
|
||||
<.sidebar_item icon="hero-home" text="Home" navigate={~p"/"} />
|
||||
<.sidebar_item icon="hero-tv" text="Sources" navigate={~p"/sources"} />
|
||||
<.sidebar_item icon="hero-adjustments-vertical" text="Media Profiles" navigate={~p"/media_profiles"} />
|
||||
</ul>
|
||||
</div>
|
||||
<div class="flex flex-col justify-between">
|
||||
<ul class="mb-6 flex flex-col gap-1.5">
|
||||
<.sidebar_item icon="hero-home" text="Home" href={~p"/"} />
|
||||
<.sidebar_item icon="hero-tv" text="Sources" href={~p"/sources"} />
|
||||
<.sidebar_item icon="hero-adjustments-vertical" text="Media Profiles" href={~p"/media_profiles"} />
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
</section>
|
||||
<section>
|
||||
<nav class="mt-5 px-4 py-4 lg:mt-9 lg:px-6">
|
||||
<ul class="mb-6 flex flex-col gap-1.5">
|
||||
<.sidebar_item
|
||||
icon="hero-code-bracket"
|
||||
text="Github"
|
||||
target="_blank"
|
||||
href="https://github.com/kieraneglin/pinchflat"
|
||||
/>
|
||||
<li>
|
||||
<span
|
||||
class={[
|
||||
"font-medium text-bodydark1",
|
||||
"group relative flex items-center gap-2.5 rounded-sm px-4 py-2 duration-300 ease-in-out",
|
||||
"duration-300 ease-in-out cursor-pointer",
|
||||
"hover:bg-graydark dark:hover:bg-meta-4"
|
||||
]}
|
||||
phx-click={show_modal("donate-modal")}
|
||||
>
|
||||
<.icon name="hero-currency-dollar" /> Donate
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</section>
|
||||
</aside>
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
defmodule Pinchflat.UpgradeButtonLive do
|
||||
use PinchflatWeb, :live_view
|
||||
|
||||
def render(assigns) do
|
||||
~H"""
|
||||
<form phx-change="check_matching_text">
|
||||
<.input type="text" name="unlock-pro-textbox" value="" />
|
||||
</form>
|
||||
|
||||
<.button
|
||||
class="w-full mt-4"
|
||||
type="button"
|
||||
disabled={@button_disabled}
|
||||
phx-click={hide_modal("upgrade-modal")}
|
||||
x-on:click="setTimeout(() => { proEnabled = true }, 200)"
|
||||
>
|
||||
Unlock Pro
|
||||
</.button>
|
||||
"""
|
||||
end
|
||||
|
||||
def mount(_params, _session, socket) do
|
||||
{:ok, assign(socket, :button_disabled, true)}
|
||||
end
|
||||
|
||||
def handle_event("check_matching_text", %{"unlock-pro-textbox" => text}, socket) do
|
||||
normalized_text =
|
||||
text
|
||||
|> String.trim()
|
||||
|> String.downcase()
|
||||
|
||||
if normalized_text == "got it!" do
|
||||
Settings.set!(:pro_enabled, true)
|
||||
|
||||
{:noreply, update(socket, :button_disabled, fn _ -> false end)}
|
||||
else
|
||||
{:noreply, update(socket, :button_disabled, fn _ -> true end)}
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,28 @@
|
||||
<.modal id="upgrade-modal" allow_close={false}>
|
||||
<section>
|
||||
<h3 class="text-2xl text-white">Pro Mode</h3>
|
||||
<p class="text-sm">Don't worry - Pinchflat is completely free :)</p>
|
||||
<p class="mt-4">
|
||||
If you find the project valuable and want to support its development, a
|
||||
<.inline_link href="https://www.paypal.me/kieraneglin">donation</.inline_link>
|
||||
would be greatly appreciated.
|
||||
</p>
|
||||
<p class="mt-4">
|
||||
Plus, $5 USD from any donation over $10 USD will be donated to
|
||||
<.inline_link href="https://www.eff.org/">The Electronic Frontier Foundation</.inline_link>
|
||||
who defend your online liberties and backed
|
||||
<.inline_code>youtube-dl</.inline_code>
|
||||
when Google took them down<.inline_link href="https://github.com/github/dmca/blob/9a85e0f021f7967af80e186b890776a50443f06c/2020/11/2020-11-16-RIAA-reversal-effletter.pdf">
|
||||
<.icon name="hero-arrow-top-right-on-square" class="h-3 w-3" />
|
||||
</.inline_link>. <strong>You do not need to donate to unlock Pro</strong>. It's just a way to say thanks!
|
||||
</p>
|
||||
|
||||
<p class="mt-4">
|
||||
To unlock Pro, simply type
|
||||
<.inline_code>got it!</.inline_code>
|
||||
into the text box and press the button.
|
||||
</p>
|
||||
|
||||
<%= live_render(@conn, Pinchflat.UpgradeButtonLive) %>
|
||||
</section>
|
||||
</.modal>
|
||||
@@ -12,7 +12,15 @@
|
||||
<script defer phx-track-static type="text/javascript" src={~p"/assets/app.js"}>
|
||||
</script>
|
||||
</head>
|
||||
<body x-data="{ sidebarVisible: false }" class="dark text-bodydark bg-boxdark-2">
|
||||
<body
|
||||
x-data={"{ sidebarVisible: false, proEnabled: #{Settings.get!(:pro_enabled)} }"}
|
||||
class="dark text-bodydark bg-boxdark-2"
|
||||
>
|
||||
<%= @inner_content %>
|
||||
|
||||
<.donate_modal conn={@conn} />
|
||||
<template x-if="!proEnabled">
|
||||
<.upgrade_modal conn={@conn} />
|
||||
</template>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user