Add better image proxy and change branding

This commit is contained in:
Leafy :3 2025-02-06 21:26:18 +01:00
parent cc1dbe62cc
commit a59d47ab23
5 changed files with 77 additions and 18 deletions

View file

@ -1,4 +1,4 @@
## akkoma
## puppyoma
*a smallish microblogging platform, aka the cooler pleroma*
@ -6,9 +6,9 @@
## About
This is a fork of Pleroma, which is a microblogging server software that can federate (= exchange messages with) other servers that support ActivityPub. What that means is that you can host a server for yourself or your friends and stay in control of your online identity, but still exchange messages with people on larger servers. Akkoma will federate with all servers that implement ActivityPub, like Friendica, GNU Social, Hubzilla, Mastodon, Misskey, Peertube, and Pixelfed.
This is a fork of Pleroma, which is a microblogging server software that can federate (= exchange messages with) other servers that support ActivityPub. What that means is that you can host a server for yourself or your friends and stay in control of your online identity, but still exchange messages with people on larger servers. Puppyoma will federate with all servers that implement ActivityPub, like Friendica, GNU Social, Hubzilla, Mastodon, Misskey, Peertube, and Pixelfed.
Akkoma is written in Elixir and uses PostgreSQL for data storage.
Puppyoma is written in Elixir and uses PostgreSQL for data storage.
For clients it supports the [Mastodon client API](https://docs.joinmastodon.org/api/guidelines/) with Pleroma extensions (see the API section on <https://docs.akkoma.dev/stable/>).
@ -16,13 +16,13 @@ For clients it supports the [Mastodon client API](https://docs.joinmastodon.org/
## Differences with Pleroma
Akkoma is a faster-paced fork, it has a varied and potentially experimental feature set tailored specifically to the corner of the fediverse inhabited by the project
Puppyoma is a faster-paced fork, it has a varied and potentially experimental feature set tailored specifically to the corner of the fediverse inhabited by the project
creator and contributors.
This should not be considered a one-for-one match with pleroma; it is more opinionated in many ways, and has a smaller community (which is good or
bad depending on your view)
For example, Akkoma has:
For example, Puppyoma has:
- Custom Emoji reactions (compatible with misskey)
- Misskey-flavoured markdown support
- Elasticsearch and Meilisearch support for search
@ -31,17 +31,17 @@ For example, Akkoma has:
- A multitude of heavy modifications to the Pleroma Frontend (Pleroma-FE)
- The "bubble" concept, in which instance administrators can choose closely-related instances to make a "community of communities", so to say
And takes a more opinionated stance on issues like Domain blocks, which are enforced far more on Akkoma.
And takes a more opinionated stance on issues like Domain blocks, which are enforced far more on Puppyoma.
Take a look at the Changelog if you want a full list of recent changes, everything since 3.0 has been Akkoma.
Take a look at the Changelog if you want a full list of recent changes, everything since 3.0 has been Puppyoma.
## Installation
### OTP releases (Recommended)
If you are running Linux (glibc or musl) on x86, the recommended way to install Akkoma is by using OTP releases. OTP releases are as close as you can get to binary releases with Erlang/Elixir. The release is self-contained, and provides everything needed to boot it. The installation instructions are available [here](https://docs.akkoma.dev/stable/installation/otp_en/).
If you are running Linux (glibc or musl) on x86, the recommended way to install Puppyoma is by using OTP releases. OTP releases are as close as you can get to binary releases with Erlang/Elixir. The release is self-contained, and provides everything needed to boot it. The installation instructions are available [here](https://docs.akkoma.dev/stable/installation/otp_en/).
### From Source
If your platform is not supported, or you just want to be able to edit the source code easily, you may install Akkoma from source.
If your platform is not supported, or you just want to be able to edit the source code easily, you may install Puppyoma from source.
- [Alpine Linux](https://docs.akkoma.dev/stable/installation/alpine_linux_en/)
- [Arch Linux](https://docs.akkoma.dev/stable/installation/arch_linux_en/)
@ -58,7 +58,7 @@ Docker installation is supported via [this setup](https://docs.akkoma.dev/stable
Akkoma is packaged for [YunoHost](https://yunohost.org) and can be found and installed from the [YunoHost app catalogue](https://yunohost.org/#/apps).
### Compilation Troubleshooting
If you ever encounter compilation issues during the updating of Akkoma, you can try these commands and see if they fix things:
If you ever encounter compilation issues during the updating of Puppyoma, you can try these commands and see if they fix things:
- `mix deps.clean --all`
- `mix local.rebar`

View file

@ -0,0 +1,53 @@
defmodule Pleroma.Web.PuppyMediaProxy.PuppyProxyController do
use Pleroma.Web, :controller
require Logger
@max_body_length 25 * 1024 * 1024
@valid_mime_types ["image/", "video/", "audio/"]
def get(conn, %{"url" => url}) do
with {:ok, %Tesla.Env{status: status, body: body, headers: headers}} <- fetch_media(url),
{:ok, content_type} <- get_content_type(headers),
:ok <- validate_mime_type(content_type) do
conn
|> put_resp_content_type(content_type)
|> put_resp_header("cache-control", "public, max-age=1209600")
|> send_resp(status, body)
else
{:error, :invalid_mime_type} ->
conn
|> put_status(:forbidden)
|> json(%{error: "Invalid media type"})
error ->
Logger.error("Media proxy error: #{inspect(error)}")
conn
|> put_status(:bad_request)
|> json(%{error: "Failed to fetch media"})
end
end
defp fetch_media(url) do
Tesla.get(url, [
{:timeout, 10_000},
{:max_body_length, @max_body_length}
])
end
defp get_content_type(headers) do
case List.keyfind(headers, "content-type", 0) do
{_, content_type} -> {:ok, content_type}
nil -> {:error, :no_content_type}
end
end
defp validate_mime_type(content_type) do
if Enum.any?(@valid_mime_types, &String.starts_with?(content_type, &1)) do
:ok
else
{:error, :invalid_mime_type}
end
end
end

View file

@ -883,6 +883,12 @@ defmodule Pleroma.Web.Router do
get("/:sig/:url/:filename", MediaProxy.MediaProxyController, :remote)
end
scope "/api", Pleroma.Web do
pipe_through(:api)
get("/proxy", PuppyMediaProxy.PuppyProxyController, :get)
end
if Pleroma.Config.get(:env) == :dev do
scope "/dev" do
pipe_through([:mailbox_preview])

12
mix.exs
View file

@ -16,11 +16,11 @@ defmodule Pleroma.Mixfile do
test_coverage: [tool: ExCoveralls],
preferred_cli_env: ["coveralls.html": :test],
# Docs
name: "Akkoma",
homepage_url: "https://akkoma.dev/",
source_url: "https://akkoma.dev/AkkomaGang/akkoma",
name: "Puppyoma",
homepage_url: "https://yiffing.dev/puppyoma",
source_url: "https://git.yiffing.dev/Leafus/puppyoma",
docs: [
source_url_pattern: "https://akkoma.dev/AkkomaGang/akkoma/blob/develop/%{path}#L%{line}",
source_url_pattern: "https://git.yiffing.dev/Leafus/puppyoma/blob/develop/%{path}#L%{line}",
logo: "priv/static/images/logo.png",
extras: ["README.md", "CHANGELOG.md"] ++ Path.wildcard("docs/**/*.md"),
groups_for_extras: [
@ -333,8 +333,8 @@ defmodule Pleroma.Mixfile do
# Pleroma: A lightweight social networking server
# Copyright © 2017-#{year} Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
# Akkoma: Magically expressive social media
# Copyright © 2022-#{year} Akkoma Authors <https://akkoma.dev/>
# Puppyoma: This will bark at you
# Copyright © 2022-#{year} Puppyoma Authors <https://yiffing.dev/puppyoma/>
# SPDX-License-Identifier: AGPL-3.0-only
] |> String.replace("\n", "\\n")

View file

@ -1,10 +1,10 @@
<html>
<head>
<title>Akkoma</title>
<title>Puppyoma</title>
<!--server-generated-meta-->
</head>
<body>
<h3>Welcome to Akkoma!</h3>
<h3>Welcome to Puppyoma!</h3>
<p>If you're seeing this page, your server works!</p>
<p>In order to get a frontend to show here, you'll need to set up <code>:pleroma, :frontends, primary</code> and install your frontend of choice, in most cases this will just be:</p>
<pre>