Compare commits
No commits in common. "9104458dd90db4dd24051f1c6f2d6e066640e487" and "3b7ef1bad894216c6ffd03919b4674242d258276" have entirely different histories.
9104458dd9
...
3b7ef1bad8
7 changed files with 1 additions and 67 deletions
|
@ -151,7 +151,6 @@
|
||||||
config :mime, :types, %{
|
config :mime, :types, %{
|
||||||
"application/xml" => ["xml"],
|
"application/xml" => ["xml"],
|
||||||
"application/xrd+xml" => ["xrd+xml"],
|
"application/xrd+xml" => ["xrd+xml"],
|
||||||
"application/opensearchdescription+xml" => ["xml"],
|
|
||||||
"application/jrd+json" => ["jrd+json"],
|
"application/jrd+json" => ["jrd+json"],
|
||||||
"application/activity+json" => ["activity+json"],
|
"application/activity+json" => ["activity+json"],
|
||||||
"application/ld+json" => ["activity+json"]
|
"application/ld+json" => ["activity+json"]
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
# Pleroma: A lightweight social networking server
|
|
||||||
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
|
||||||
|
|
||||||
defmodule Pleroma.Web.OpenSearchController do
|
|
||||||
use Pleroma.Web, :controller
|
|
||||||
|
|
||||||
plug(:skip_auth when action == :show)
|
|
||||||
|
|
||||||
@doc "GET /opensearch.xml"
|
|
||||||
def show(conn, _params) do
|
|
||||||
conn
|
|
||||||
|> put_resp_content_type("application/opensearchdescription+xml")
|
|
||||||
|> render("opensearch.xml")
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -156,10 +156,6 @@ defmodule Pleroma.Web.Router do
|
||||||
plug(Pleroma.Web.Plugs.StaticFEPlug)
|
plug(Pleroma.Web.Plugs.StaticFEPlug)
|
||||||
end
|
end
|
||||||
|
|
||||||
pipeline :accepts_opensearch do
|
|
||||||
plug(:accepts, ["xml"])
|
|
||||||
end
|
|
||||||
|
|
||||||
scope "/api/v1/pleroma", Pleroma.Web.TwitterAPI do
|
scope "/api/v1/pleroma", Pleroma.Web.TwitterAPI do
|
||||||
pipe_through(:pleroma_api)
|
pipe_through(:pleroma_api)
|
||||||
|
|
||||||
|
@ -869,12 +865,6 @@ defmodule Pleroma.Web.Router do
|
||||||
get("/web/manifest.json", MastoFEController, :manifest)
|
get("/web/manifest.json", MastoFEController, :manifest)
|
||||||
end
|
end
|
||||||
|
|
||||||
scope "/", Pleroma.Web do
|
|
||||||
pipe_through(:accepts_opensearch)
|
|
||||||
|
|
||||||
get("/opensearch.xml", OpenSearchController, :show)
|
|
||||||
end
|
|
||||||
|
|
||||||
scope "/", Pleroma.Web do
|
scope "/", Pleroma.Web do
|
||||||
pipe_through(:mastodon_html)
|
pipe_through(:mastodon_html)
|
||||||
|
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
|
|
||||||
<ShortName><%= Config.get([:instance, :name]) %></ShortName>
|
|
||||||
<Description>Search through <%= Config.get([:instance, :name]) %></Description>
|
|
||||||
<InputEncoding>UTF-8</InputEncoding>
|
|
||||||
<Image width="16" height="16" type="image/x-icon"><%= Endpoint.url() %>/favicon.ico</Image>
|
|
||||||
<Image type="image/png"><%= Endpoint.url() %>/favicon.png</Image>
|
|
||||||
<Url type="text/html" method="get" template="<%= Endpoint.url() %>/search?query={searchTerms}"/>
|
|
||||||
</OpenSearchDescription>
|
|
|
@ -1,9 +0,0 @@
|
||||||
# Pleroma: A lightweight social networking server
|
|
||||||
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
|
||||||
|
|
||||||
defmodule Pleroma.Web.OpenSearchView do
|
|
||||||
use Pleroma.Web, :view
|
|
||||||
alias Pleroma.Config
|
|
||||||
alias Pleroma.Web.Endpoint
|
|
||||||
end
|
|
2
mix.exs
2
mix.exs
|
@ -4,7 +4,7 @@ defmodule Pleroma.Mixfile do
|
||||||
def project do
|
def project do
|
||||||
[
|
[
|
||||||
app: :pleroma,
|
app: :pleroma,
|
||||||
version: version("3.10.3-bnakkoma"),
|
version: version("3.10.3-akkoma+bnakkoma"),
|
||||||
elixir: "~> 1.14",
|
elixir: "~> 1.14",
|
||||||
elixirc_paths: elixirc_paths(Mix.env()),
|
elixirc_paths: elixirc_paths(Mix.env()),
|
||||||
compilers: Mix.compilers(),
|
compilers: Mix.compilers(),
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
# Pleroma: A lightweight social networking server
|
|
||||||
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
|
||||||
|
|
||||||
defmodule Pleroma.Web.OpenSearchControllerTest do
|
|
||||||
use Pleroma.Web.ConnCase, async: false
|
|
||||||
alias Pleroma.Config
|
|
||||||
alias Pleroma.Web.Endpoint
|
|
||||||
|
|
||||||
test "opensearch.xml", %{conn: conn} do
|
|
||||||
resp =
|
|
||||||
conn
|
|
||||||
|> put_req_header("accept", "application/opensearchdescription+xml")
|
|
||||||
|> get("/opensearch.xml")
|
|
||||||
|> response(200)
|
|
||||||
|
|
||||||
assert resp =~ "<ShortName>#{Config.get([:instance, :name])}</ShortName>"
|
|
||||||
assert resp =~ "<Description>Search through #{Config.get([:instance, :name])}</Description>"
|
|
||||||
assert resp =~ "template=\"#{Endpoint.url()}/search?query={searchTerms}\""
|
|
||||||
end
|
|
||||||
end
|
|
Loading…
Reference in a new issue