ソースを参照

Allow additionnal schemes in the config

tags/v0.9.9
Haelwenn (lanodan) Monnier 6年前
コミット
d5091c3175
この署名に対応する既知のキーがデータベースに存在しません GPGキーID: D5B7A8E43C997DEE
2個のファイルの変更7行の追加1行の削除
  1. +2
    -0
      config/config.exs
  2. +5
    -1
      lib/pleroma/formatter.ex

+ 2
- 0
config/config.exs ファイルの表示

@@ -16,6 +16,8 @@ config :pleroma, Pleroma.Upload,

config :pleroma, :emoji, shortcode_globs: ["/emoji/custom/**/*.png"]

config :pleroma, :uri_schemes, additionnal_schemes: []

# Configures the endpoint
config :pleroma, Pleroma.Web.Endpoint,
url: [host: "localhost"],


+ 5
- 1
lib/pleroma/formatter.ex ファイルの表示

@@ -199,10 +199,14 @@ defmodule Pleroma.Formatter do

@doc "changes scheme:... urls to html links"
def add_links({subs, text}) do
additionnal_schemes =
Application.get_env(:pleroma, :uri_schemes, [])
|> Keyword.get(:additionnal_schemes, [])

links =
text
|> String.split([" ", "\t", "<br>"])
|> Enum.filter(fn word -> String.starts_with?(word, @uri_schemes) end)
|> Enum.filter(fn word -> String.starts_with?(word, @uri_schemes ++ additionnal_schemes) end)
|> Enum.filter(fn word -> Regex.match?(@link_regex, word) end)
|> Enum.map(fn url -> {Ecto.UUID.generate(), url} end)
|> Enum.sort_by(fn {_, url} -> -String.length(url) end)


読み込み中…
キャンセル
保存