embed favicon on backend and make it configurable

This commit is contained in:
Henry Jameson 2023-10-29 18:58:57 +02:00
parent e3ea311cd5
commit 337d047c4d
3 changed files with 12 additions and 2 deletions

View file

@ -185,6 +185,7 @@ config :pleroma, :instance,
short_description: "", short_description: "",
background_image: "/images/city.jpg", background_image: "/images/city.jpg",
instance_thumbnail: "/instance/thumbnail.jpeg", instance_thumbnail: "/instance/thumbnail.jpeg",
favicon: "/favicon.png",
limit: 5_000, limit: 5_000,
description_limit: 5_000, description_limit: 5_000,
remote_limit: 100_000, remote_limit: 100_000,

View file

@ -987,6 +987,13 @@ config :pleroma, :config_description, [
"The instance thumbnail can be any image that represents your instance and is used by some apps or services when they display information about your instance.", "The instance thumbnail can be any image that represents your instance and is used by some apps or services when they display information about your instance.",
suggestions: ["/instance/thumbnail.jpeg"] suggestions: ["/instance/thumbnail.jpeg"]
}, },
%{
key: :favicon,
type: {:string, :image},
description:
"Favicon of the instance",
suggestions: ["/favicon.png"]
},
%{ %{
key: :show_reactions, key: :show_reactions,
type: :boolean, type: :boolean,

View file

@ -38,10 +38,11 @@ defmodule Pleroma.Web.Fallback.RedirectController do
tags = build_tags(conn, params) tags = build_tags(conn, params)
preloads = preload_data(conn, params) preloads = preload_data(conn, params)
title = "<title>#{Pleroma.Config.get([:instance, :name])}</title>" title = "<title>#{Pleroma.Config.get([:instance, :name])}</title>"
favicon = "<link rel='icon' href='#{Pleroma.Config.get([:instance, :favicon])}'>"
response = response =
index_content index_content
|> String.replace("<!--server-generated-meta-->", tags <> preloads <> title) |> String.replace("<!--server-generated-meta-->", tags <> preloads <> title <> favicon)
conn conn
|> put_resp_content_type("text/html") |> put_resp_content_type("text/html")
@ -56,10 +57,11 @@ defmodule Pleroma.Web.Fallback.RedirectController do
{:ok, index_content} = File.read(index_file_path()) {:ok, index_content} = File.read(index_file_path())
preloads = preload_data(conn, params) preloads = preload_data(conn, params)
title = "<title>#{Pleroma.Config.get([:instance, :name])}</title>" title = "<title>#{Pleroma.Config.get([:instance, :name])}</title>"
favicon = "<link rel='icon' href='#{Pleroma.Config.get([:instance, :favicon])}'>"
response = response =
index_content index_content
|> String.replace("<!--server-generated-meta-->", preloads <> title) |> String.replace("<!--server-generated-meta-->", preloads <> title <> favicon)
conn conn
|> put_resp_content_type("text/html") |> put_resp_content_type("text/html")