Compare commits
8 Commits
v2024.8.14
...
v2024.8.28
| Author | SHA1 | Date | |
|---|---|---|---|
| c85e9cb5f1 | |||
| 4837dd44c9 | |||
| e3f42c28d0 | |||
| 4a11d47692 | |||
| 612c760755 | |||
| 14b8ecbe44 | |||
| a6c61ccd0d | |||
| 80209240d2 |
@@ -151,7 +151,8 @@ If you change this setting and it works well for you, please leave a comment on
|
|||||||
| `LOG_LEVEL` | No | `debug` | Can be set to `info` but `debug` is strongly recommended |
|
| `LOG_LEVEL` | No | `debug` | Can be set to `info` but `debug` is strongly recommended |
|
||||||
| `BASIC_AUTH_USERNAME` | No | | See [authentication docs](https://github.com/kieraneglin/pinchflat/wiki/Username-and-Password) |
|
| `BASIC_AUTH_USERNAME` | No | | See [authentication docs](https://github.com/kieraneglin/pinchflat/wiki/Username-and-Password) |
|
||||||
| `BASIC_AUTH_PASSWORD` | No | | See [authentication docs](https://github.com/kieraneglin/pinchflat/wiki/Username-and-Password) |
|
| `BASIC_AUTH_PASSWORD` | No | | See [authentication docs](https://github.com/kieraneglin/pinchflat/wiki/Username-and-Password) |
|
||||||
| `EXPOSE_FEED_ENDPOINTS` | No | | See [RSS feed docs](https://github.com/kieraneglin/pinchflat/wiki/Podcast-RSS-Feeds) |
|
| `EXPOSE_FEED_ENDPOINTS` | No | `false` | See [RSS feed docs](https://github.com/kieraneglin/pinchflat/wiki/Podcast-RSS-Feeds) |
|
||||||
|
| `ENABLE_IPV6` | No | `false` | Setting to _any_ non-blank value will enable IPv6 |
|
||||||
| `JOURNAL_MODE` | No | `wal` | Set to `delete` if your config directory is stored on a network share (not recommended) |
|
| `JOURNAL_MODE` | No | `wal` | Set to `delete` if your config directory is stored on a network share (not recommended) |
|
||||||
| `TZ_DATA_DIR` | No | `/etc/elixir_tzdata_data` | The container path where the timezone database is stored |
|
| `TZ_DATA_DIR` | No | `/etc/elixir_tzdata_data` | The container path where the timezone database is stored |
|
||||||
| `BASE_ROUTE_PATH` | No | `/` | The base path for route generation. Useful when running behind certain reverse proxies |
|
| `BASE_ROUTE_PATH` | No | `/` | The base path for route generation. Useful when running behind certain reverse proxies |
|
||||||
|
|||||||
+3
-2
@@ -41,7 +41,8 @@ config :pinchflat, PinchflatWeb.Endpoint,
|
|||||||
adapter: Phoenix.Endpoint.Cowboy2Adapter,
|
adapter: Phoenix.Endpoint.Cowboy2Adapter,
|
||||||
render_errors: [
|
render_errors: [
|
||||||
formats: [html: PinchflatWeb.ErrorHTML, json: PinchflatWeb.ErrorJSON],
|
formats: [html: PinchflatWeb.ErrorHTML, json: PinchflatWeb.ErrorJSON],
|
||||||
layout: false
|
root_layout: {PinchflatWeb.Layouts, :root},
|
||||||
|
layout: {PinchflatWeb.Layouts, :app}
|
||||||
],
|
],
|
||||||
pubsub_server: Pinchflat.PubSub,
|
pubsub_server: Pinchflat.PubSub,
|
||||||
live_view: [signing_salt: "/t5878kO"]
|
live_view: [signing_salt: "/t5878kO"]
|
||||||
@@ -91,7 +92,7 @@ config :tailwind,
|
|||||||
]
|
]
|
||||||
|
|
||||||
# Configures Elixir's Logger
|
# Configures Elixir's Logger
|
||||||
config :logger, :console,
|
config :logger, :default_formatter,
|
||||||
format: "$date $time $metadata[$level] | $message\n",
|
format: "$date $time $metadata[$level] | $message\n",
|
||||||
metadata: [:request_id]
|
metadata: [:request_id]
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -67,7 +67,7 @@ config :pinchflat, PinchflatWeb.Endpoint,
|
|||||||
config :pinchflat, dev_routes: true
|
config :pinchflat, dev_routes: true
|
||||||
|
|
||||||
# Do not include metadata nor timestamps in development logs
|
# Do not include metadata nor timestamps in development logs
|
||||||
config :logger, :console, format: "[$level] $message\n"
|
config :logger, :default_formatter, format: "[$level] $message\n"
|
||||||
|
|
||||||
# Set a higher stacktrace during development. Avoid configuring such
|
# Set a higher stacktrace during development. Avoid configuring such
|
||||||
# in production as building large stacktraces may be expensive.
|
# in production as building large stacktraces may be expensive.
|
||||||
|
|||||||
+2
-1
@@ -66,6 +66,7 @@ if config_env() == :prod do
|
|||||||
journal_mode = String.to_existing_atom(System.get_env("JOURNAL_MODE", "wal"))
|
journal_mode = String.to_existing_atom(System.get_env("JOURNAL_MODE", "wal"))
|
||||||
# For running PF in a subdirectory via a reverse proxy
|
# For running PF in a subdirectory via a reverse proxy
|
||||||
base_route_path = System.get_env("BASE_ROUTE_PATH", "/")
|
base_route_path = System.get_env("BASE_ROUTE_PATH", "/")
|
||||||
|
enable_ipv6 = String.length(System.get_env("ENABLE_IPV6", "")) > 0
|
||||||
|
|
||||||
config :logger, level: String.to_existing_atom(System.get_env("LOG_LEVEL", "debug"))
|
config :logger, level: String.to_existing_atom(System.get_env("LOG_LEVEL", "debug"))
|
||||||
|
|
||||||
@@ -120,7 +121,7 @@ if config_env() == :prod do
|
|||||||
# Set it to {0, 0, 0, 0, 0, 0, 0, 1} for local network only access.
|
# Set it to {0, 0, 0, 0, 0, 0, 0, 1} for local network only access.
|
||||||
# See the documentation on https://hexdocs.pm/plug_cowboy/Plug.Cowboy.html
|
# See the documentation on https://hexdocs.pm/plug_cowboy/Plug.Cowboy.html
|
||||||
# for details about using IPv6 vs IPv4 and loopback vs public addresses.
|
# for details about using IPv6 vs IPv4 and loopback vs public addresses.
|
||||||
ip: {0, 0, 0, 0},
|
ip: if(enable_ipv6, do: {0, 0, 0, 0, 0, 0, 0, 0}, else: {0, 0, 0, 0}),
|
||||||
port: String.to_integer(System.get_env("PORT") || "4000")
|
port: String.to_integer(System.get_env("PORT") || "4000")
|
||||||
],
|
],
|
||||||
url: [path: base_route_path],
|
url: [path: base_route_path],
|
||||||
|
|||||||
@@ -27,10 +27,10 @@ RUN apt-get update -y && \
|
|||||||
# Hex and Rebar
|
# Hex and Rebar
|
||||||
mix local.hex --force && \
|
mix local.hex --force && \
|
||||||
mix local.rebar --force && \
|
mix local.rebar --force && \
|
||||||
# FFmpeg
|
# FFmpeg (latest build that doesn't cause an illegal instruction error for some users - see #347)
|
||||||
export FFMPEG_DOWNLOAD=$(case ${TARGETPLATFORM:-linux/amd64} in \
|
export FFMPEG_DOWNLOAD=$(case ${TARGETPLATFORM:-linux/amd64} in \
|
||||||
"linux/amd64") echo "https://github.com/yt-dlp/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-linux64-gpl.tar.xz" ;; \
|
"linux/amd64") echo "https://github.com/yt-dlp/FFmpeg-Builds/releases/download/autobuild-2024-07-30-14-10/ffmpeg-N-116468-g0e09f6d690-linux64-gpl.tar.xz" ;; \
|
||||||
"linux/arm64") echo "https://github.com/yt-dlp/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-linuxarm64-gpl.tar.xz" ;; \
|
"linux/arm64") echo "https://github.com/yt-dlp/FFmpeg-Builds/releases/download/autobuild-2024-07-30-14-10/ffmpeg-N-116468-g0e09f6d690-linuxarm64-gpl.tar.xz" ;; \
|
||||||
*) echo "" ;; esac) && \
|
*) echo "" ;; esac) && \
|
||||||
curl -L ${FFMPEG_DOWNLOAD} --output /tmp/ffmpeg.tar.xz && \
|
curl -L ${FFMPEG_DOWNLOAD} --output /tmp/ffmpeg.tar.xz && \
|
||||||
tar -xf /tmp/ffmpeg.tar.xz --strip-components=2 --no-anchored -C /usr/local/bin/ "ffmpeg" && \
|
tar -xf /tmp/ffmpeg.tar.xz --strip-components=2 --no-anchored -C /usr/local/bin/ "ffmpeg" && \
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ defmodule Pinchflat.YtDlp.Media do
|
|||||||
NOTE: playlist_index is really only useful for playlists that will never change their order.
|
NOTE: playlist_index is really only useful for playlists that will never change their order.
|
||||||
"""
|
"""
|
||||||
def indexing_output_template do
|
def indexing_output_template do
|
||||||
"%(.{id,title,was_live,webpage_url,description,aspect_ratio,duration,upload_date,timestamp,playlist_index})j"
|
"%(.{id,title,live_status,webpage_url,description,aspect_ratio,duration,upload_date,timestamp,playlist_index})j"
|
||||||
end
|
end
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
@@ -104,7 +104,7 @@ defmodule Pinchflat.YtDlp.Media do
|
|||||||
title: response["title"],
|
title: response["title"],
|
||||||
description: response["description"],
|
description: response["description"],
|
||||||
original_url: response["webpage_url"],
|
original_url: response["webpage_url"],
|
||||||
livestream: !!response["was_live"],
|
livestream: !!response["live_status"] && response["live_status"] != "not_live",
|
||||||
duration_seconds: response["duration"] && round(response["duration"]),
|
duration_seconds: response["duration"] && round(response["duration"]),
|
||||||
short_form_content: response["webpage_url"] && short_form_content?(response),
|
short_form_content: response["webpage_url"] && short_form_content?(response),
|
||||||
uploaded_at: response["upload_date"] && parse_uploaded_at(response),
|
uploaded_at: response["upload_date"] && parse_uploaded_at(response),
|
||||||
|
|||||||
@@ -1,14 +1,7 @@
|
|||||||
defmodule PinchflatWeb.ErrorHTML do
|
defmodule PinchflatWeb.ErrorHTML do
|
||||||
use PinchflatWeb, :html
|
use PinchflatWeb, :html
|
||||||
|
|
||||||
# If you want to customize your error pages,
|
embed_templates "error_html/*"
|
||||||
# uncomment the embed_templates/1 call below
|
|
||||||
# and add pages to the error directory:
|
|
||||||
#
|
|
||||||
# * lib/pinchflat_web/controllers/error_html/404.html.heex
|
|
||||||
# * lib/pinchflat_web/controllers/error_html/500.html.heex
|
|
||||||
#
|
|
||||||
# embed_templates "error_html/*"
|
|
||||||
|
|
||||||
# The default is to render a plain text page based on
|
# The default is to render a plain text page based on
|
||||||
# the template name. For example, "404.html" becomes
|
# the template name. For example, "404.html" becomes
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
<section>
|
||||||
|
<h2 class="text-title-md2 font-bold text-white">404 (not found)</h2>
|
||||||
|
</section>
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<section>
|
||||||
|
<h2 class="text-title-md2 font-bold text-white">Internal Server Error</h2>
|
||||||
|
<p class="text-body-md text-white mt-2">
|
||||||
|
This shouldn't happen! Please make a
|
||||||
|
<.inline_link href="https://github.com/kieraneglin/pinchflat/issues/new/choose">GitHub issue</.inline_link>
|
||||||
|
with the following information:
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<ul class="list-disc ml-8 mb-8">
|
||||||
|
<li>What you were doing when you saw this page</li>
|
||||||
|
<li>
|
||||||
|
Your system details and logs from
|
||||||
|
<.inline_link href={~p"/app_info"}>app info</.inline_link>
|
||||||
|
</li>
|
||||||
|
<li>All the information in the textarea below (use select all + copy)</li>
|
||||||
|
</ul>
|
||||||
|
<textarea class="w-full min-h-96 font-mono inline-block rounded-lg" readonly>
|
||||||
|
**Status**:
|
||||||
|
`<%= if Map.has_key?(assigns, :status), do: @status, else: "" %>`
|
||||||
|
|
||||||
|
**Reason**:
|
||||||
|
`<%= if Map.has_key?(assigns, :reason), do: inspect(@reason), else: "" %>`
|
||||||
|
|
||||||
|
**Stacktrace**:
|
||||||
|
```
|
||||||
|
<%= if Map.has_key?(assigns, :stack), do: Exception.format_stacktrace(@stack), else: "" %>
|
||||||
|
```
|
||||||
|
</textarea>
|
||||||
|
</section>
|
||||||
@@ -4,7 +4,7 @@ defmodule Pinchflat.MixProject do
|
|||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
app: :pinchflat,
|
app: :pinchflat,
|
||||||
version: "2024.8.14",
|
version: "2024.8.28",
|
||||||
elixir: "~> 1.17",
|
elixir: "~> 1.17",
|
||||||
elixirc_paths: elixirc_paths(Mix.env()),
|
elixirc_paths: elixirc_paths(Mix.env()),
|
||||||
start_permanent: Mix.env() == :prod,
|
start_permanent: Mix.env() == :prod,
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ defmodule Pinchflat.FastIndexing.FastIndexingHelpersTest do
|
|||||||
id: "video2",
|
id: "video2",
|
||||||
title: "Video 2",
|
title: "Video 2",
|
||||||
webpage_url: "https://example.com/shorts/video2",
|
webpage_url: "https://example.com/shorts/video2",
|
||||||
was_live: true,
|
live_status: "is_live",
|
||||||
description: "desc2",
|
description: "desc2",
|
||||||
aspect_ratio: 1.67,
|
aspect_ratio: 1.67,
|
||||||
duration: 345.67,
|
duration: 345.67,
|
||||||
|
|||||||
@@ -43,11 +43,12 @@ defmodule Pinchflat.Metadata.MetadataParserTest do
|
|||||||
test "it extracts the livestream flag", %{metadata: metadata} do
|
test "it extracts the livestream flag", %{metadata: metadata} do
|
||||||
result = Parser.parse_for_media_item(metadata)
|
result = Parser.parse_for_media_item(metadata)
|
||||||
|
|
||||||
assert result.livestream == metadata["was_live"]
|
assert metadata["live_status"] == "not_live"
|
||||||
|
refute result.livestream
|
||||||
end
|
end
|
||||||
|
|
||||||
test "the livestream flag defaults to false", %{metadata: metadata} do
|
test "the livestream flag defaults to false", %{metadata: metadata} do
|
||||||
metadata = Map.put(metadata, "was_live", nil)
|
metadata = Map.put(metadata, "live_status", nil)
|
||||||
|
|
||||||
result = Parser.parse_for_media_item(metadata)
|
result = Parser.parse_for_media_item(metadata)
|
||||||
|
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ defmodule Pinchflat.SlowIndexing.SlowIndexingHelpersTest do
|
|||||||
Phoenix.json_library().encode!(%{
|
Phoenix.json_library().encode!(%{
|
||||||
id: "video3",
|
id: "video3",
|
||||||
title: "Video 3",
|
title: "Video 3",
|
||||||
was_live: false,
|
live_status: "not_live",
|
||||||
description: "desc3",
|
description: "desc3",
|
||||||
# Only focusing on these because these are passed to functions that
|
# Only focusing on these because these are passed to functions that
|
||||||
# could fail if they're not present
|
# could fail if they're not present
|
||||||
@@ -289,7 +289,7 @@ defmodule Pinchflat.SlowIndexing.SlowIndexingHelpersTest do
|
|||||||
id: "video2",
|
id: "video2",
|
||||||
title: "Video 2",
|
title: "Video 2",
|
||||||
webpage_url: "https://example.com/shorts/video2",
|
webpage_url: "https://example.com/shorts/video2",
|
||||||
was_live: true,
|
live_status: "is_live",
|
||||||
description: "desc2",
|
description: "desc2",
|
||||||
aspect_ratio: 1.67,
|
aspect_ratio: 1.67,
|
||||||
duration: 345.67,
|
duration: 345.67,
|
||||||
|
|||||||
@@ -138,7 +138,9 @@ defmodule Pinchflat.YtDlp.MediaTest do
|
|||||||
|
|
||||||
describe "indexing_output_template/0" do
|
describe "indexing_output_template/0" do
|
||||||
test "contains all the greatest hits" do
|
test "contains all the greatest hits" do
|
||||||
attrs = ~w(id title was_live webpage_url description aspect_ratio duration upload_date timestamp playlist_index)a
|
attrs =
|
||||||
|
~w(id title live_status webpage_url description aspect_ratio duration upload_date timestamp playlist_index)a
|
||||||
|
|
||||||
formatted_attrs = "%(.{#{Enum.join(attrs, ",")}})j"
|
formatted_attrs = "%(.{#{Enum.join(attrs, ",")}})j"
|
||||||
|
|
||||||
assert formatted_attrs == Media.indexing_output_template()
|
assert formatted_attrs == Media.indexing_output_template()
|
||||||
@@ -152,7 +154,7 @@ defmodule Pinchflat.YtDlp.MediaTest do
|
|||||||
"title" => "Trying to Wheelie Without the Rear Brake",
|
"title" => "Trying to Wheelie Without the Rear Brake",
|
||||||
"description" => "I'm not sure what I expected.",
|
"description" => "I'm not sure what I expected.",
|
||||||
"webpage_url" => "https://www.youtube.com/watch?v=TiZPUDkDYbk",
|
"webpage_url" => "https://www.youtube.com/watch?v=TiZPUDkDYbk",
|
||||||
"was_live" => false,
|
"live_status" => "not_live",
|
||||||
"aspect_ratio" => 1.0,
|
"aspect_ratio" => 1.0,
|
||||||
"duration" => 60,
|
"duration" => 60,
|
||||||
"upload_date" => "20210101",
|
"upload_date" => "20210101",
|
||||||
@@ -239,7 +241,7 @@ defmodule Pinchflat.YtDlp.MediaTest do
|
|||||||
assert %Media{duration_seconds: nil} = Media.response_to_struct(response)
|
assert %Media{duration_seconds: nil} = Media.response_to_struct(response)
|
||||||
end
|
end
|
||||||
|
|
||||||
test "sets livestream to false if the was_live field isn't present" do
|
test "sets livestream to false if the live_status field isn't present" do
|
||||||
response = %{
|
response = %{
|
||||||
"webpage_url" => "https://www.youtube.com/watch?v=TiZPUDkDYbk",
|
"webpage_url" => "https://www.youtube.com/watch?v=TiZPUDkDYbk",
|
||||||
"aspect_ratio" => 1.0,
|
"aspect_ratio" => 1.0,
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ defmodule PinchflatWeb.ErrorHTMLTest do
|
|||||||
import Phoenix.Template
|
import Phoenix.Template
|
||||||
|
|
||||||
test "renders 404.html" do
|
test "renders 404.html" do
|
||||||
assert render_to_string(PinchflatWeb.ErrorHTML, "404", "html", []) == "Not Found"
|
assert render_to_string(PinchflatWeb.ErrorHTML, "404", "html", []) =~ "404 (not found)"
|
||||||
end
|
end
|
||||||
|
|
||||||
test "renders 500.html" do
|
test "renders 500.html" do
|
||||||
assert render_to_string(PinchflatWeb.ErrorHTML, "500", "html", []) == "Internal Server Error"
|
assert render_to_string(PinchflatWeb.ErrorHTML, "500", "html", []) =~ "Internal Server Error"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ defmodule Pinchflat.MediaFixtures do
|
|||||||
id: "video1",
|
id: "video1",
|
||||||
title: "Video 1",
|
title: "Video 1",
|
||||||
webpage_url: "https://example.com/video1",
|
webpage_url: "https://example.com/video1",
|
||||||
was_live: false,
|
live_status: "not_live",
|
||||||
description: "desc1",
|
description: "desc1",
|
||||||
aspect_ratio: 1.67,
|
aspect_ratio: 1.67,
|
||||||
duration: 123.45,
|
duration: 123.45,
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ defmodule Pinchflat.SourcesFixtures do
|
|||||||
id: "video1",
|
id: "video1",
|
||||||
title: "Video 1",
|
title: "Video 1",
|
||||||
webpage_url: "https://example.com/video1",
|
webpage_url: "https://example.com/video1",
|
||||||
was_live: false,
|
live_status: "not_live",
|
||||||
description: "desc1",
|
description: "desc1",
|
||||||
aspect_ratio: 1.67,
|
aspect_ratio: 1.67,
|
||||||
duration: 12.34,
|
duration: 12.34,
|
||||||
@@ -91,7 +91,7 @@ defmodule Pinchflat.SourcesFixtures do
|
|||||||
id: "video2",
|
id: "video2",
|
||||||
title: "Video 2",
|
title: "Video 2",
|
||||||
webpage_url: "https://example.com/video2",
|
webpage_url: "https://example.com/video2",
|
||||||
was_live: true,
|
live_status: "is_live",
|
||||||
description: "desc2",
|
description: "desc2",
|
||||||
aspect_ratio: 1.67,
|
aspect_ratio: 1.67,
|
||||||
duration: 345.67,
|
duration: 345.67,
|
||||||
@@ -101,7 +101,7 @@ defmodule Pinchflat.SourcesFixtures do
|
|||||||
id: "video3",
|
id: "video3",
|
||||||
title: "Video 3",
|
title: "Video 3",
|
||||||
webpage_url: "https://example.com/video3",
|
webpage_url: "https://example.com/video3",
|
||||||
was_live: false,
|
live_status: "not_live",
|
||||||
description: "desc3",
|
description: "desc3",
|
||||||
aspect_ratio: 1.0,
|
aspect_ratio: 1.0,
|
||||||
duration: 678.90,
|
duration: 678.90,
|
||||||
|
|||||||
Reference in New Issue
Block a user