diff --git a/assets/css/common/measurements.css b/assets/css/common/measurements.css
index 84164156..251897d6 100644
--- a/assets/css/common/measurements.css
+++ b/assets/css/common/measurements.css
@@ -57,6 +57,7 @@ $font-family-monospace: "Droid Sans Mono", monospace;
--media-full-container-width: 100%;
--media-featured-width: 358px;
--media-header-height: 2rem;
+ --media-small-header-height: 1rem;
--badge-small-size: 1.1rem;
--badge-normal-size: 2rem;
@@ -72,6 +73,7 @@ $font-family-monospace: "Droid Sans Mono", monospace;
--font-size: 14px;
--font-tiny-size: 12px;
+ --font-micro-size: 10px;
--font-header-size: 16px;
--font-icon-size: 2rem;
--font-h1-size: 1.75rem;
diff --git a/assets/css/elements/media.css b/assets/css/elements/media.css
index 46637746..756b5e27 100644
--- a/assets/css/elements/media.css
+++ b/assets/css/elements/media.css
@@ -103,15 +103,42 @@
.image-container a {
display: flex;
max-height: 100%;
+ width: 100%;
+ height: auto;
}
/* For some reason tall images don't center properly within the container
without this hack. I blame CSS. */
-.image-container a > img {
+.image-container a img {
max-height: 100%;
margin: auto;
}
+.image-container picture {
+ display: inline-flex;
+ justify-content: center;
+ align-self: center;
+ width: 100%;
+ height: 100%;
+}
+
+.media__standalone {
+ position: relative;
+}
+
+.thumb_tiny .media-box__overlay {
+ width: 100%;
+ max-width: 100%;
+ padding: 0 var(--padding-tiny);
+ line-height: var(--media-small-header-height);
+ font-size: var(--font-micro-size);
+}
+
+.post-image-container, .post-image-container img {
+ width: var(--media-tiny-container-width);
+ height: var(--media-tiny-container-width);
+}
+
.media-box__image {
max-width: 100%;
height: auto;
diff --git a/assets/static/favicon.ico b/assets/static/favicon.ico
index 3d11304a..e5fd9a1c 100644
Binary files a/assets/static/favicon.ico and b/assets/static/favicon.ico differ
diff --git a/assets/static/favicon.svg b/assets/static/favicon.svg
index 78295ddd..ace26822 100644
--- a/assets/static/favicon.svg
+++ b/assets/static/favicon.svg
@@ -1,2 +1,2 @@
-
-
+
+
diff --git a/assets/static/images/no_avatar.svg b/assets/static/images/no_avatar.svg
index 3ab29555..20db14aa 100644
--- a/assets/static/images/no_avatar.svg
+++ b/assets/static/images/no_avatar.svg
@@ -1,2 +1,2 @@
-
-
+
+
diff --git a/assets/static/images/tagblocked.svg b/assets/static/images/tagblocked.svg
index ad17669b..9f8728ac 100644
--- a/assets/static/images/tagblocked.svg
+++ b/assets/static/images/tagblocked.svg
@@ -1,3 +1,2 @@
-
-
-
+
+
diff --git a/config/avatar.json b/config/avatar.json
deleted file mode 100644
index 577db737..00000000
--- a/config/avatar.json
+++ /dev/null
@@ -1,265 +0,0 @@
-{
- "header": ""
-}
diff --git a/config/footer.json b/config/footer.json
index d875df97..9088a25b 100644
--- a/config/footer.json
+++ b/config/footer.json
@@ -40,7 +40,7 @@
"Help & Information": [
{
"title": "Changelog",
- "url": "https://github.com/derpibooru/philomena/commits/master",
+ "url": "https://github.com/philomena-dev/philomena/commits/master",
"bold": true,
"target": "_blank"
},
@@ -88,11 +88,6 @@
{
"title": "About",
"url": "/pages/about"
- },
- {
- "title": "Twitter",
- "url": "https://twitter.com/Derpibooru",
- "target": "_blank"
}
]
}
diff --git a/config/runtime.exs b/config/runtime.exs
index ae8f6abd..88c7204c 100644
--- a/config/runtime.exs
+++ b/config/runtime.exs
@@ -42,7 +42,6 @@ app_dir = System.get_env("APP_DIR", File.cwd!())
json_config =
%{
aggregation: "aggregation.json",
- avatar: "avatar.json",
footer: "footer.json",
quick_tag_table: "quick_tag_table.json",
tag: "tag.json"
diff --git a/lib/philomena/artist_links/artist_link.ex b/lib/philomena/artist_links/artist_link.ex
index b8878951..9e2d0d07 100644
--- a/lib/philomena/artist_links/artist_link.ex
+++ b/lib/philomena/artist_links/artist_link.ex
@@ -2,6 +2,8 @@ defmodule Philomena.ArtistLinks.ArtistLink do
use Ecto.Schema
import Ecto.Changeset
+ import PhilomenaWeb.Gettext
+
alias Philomena.Users.User
alias Philomena.Tags.Tag
@@ -103,7 +105,7 @@ defmodule Philomena.ArtistLinks.ArtistLink do
defp put_verification_code(changeset) do
code = :crypto.strong_rand_bytes(5) |> Base.encode16()
- change(changeset, verification_code: "DERPI-LINKVALIDATION-#{code}")
+ change(changeset, verification_code: "#{gettext("PHILOMENA-LINKVALIDATION")}-#{code}")
end
defp put_next_check_at(changeset) do
diff --git a/lib/philomena/commissions/commission.ex b/lib/philomena/commissions/commission.ex
index d1948457..d8afead4 100644
--- a/lib/philomena/commissions/commission.ex
+++ b/lib/philomena/commissions/commission.ex
@@ -2,6 +2,8 @@ defmodule Philomena.Commissions.Commission do
use Ecto.Schema
import Ecto.Changeset
+ import PhilomenaWeb.Gettext
+
alias Philomena.Commissions.Item
alias Philomena.Images.Image
alias Philomena.Users.User
@@ -54,19 +56,19 @@ defmodule Philomena.Commissions.Commission do
def categories do
[
- Anthro: "Anthro",
- "Canon Characters": "Canon Characters",
- Comics: "Comics",
- "Fetish Art": "Fetish Art",
- "Human and EqG": "Human and EqG",
- NSFW: "NSFW",
- "Original Characters": "Original Characters",
- "Original Species": "Original Species",
- Pony: "Pony",
- Requests: "Requests",
- Safe: "Safe",
- Shipping: "Shipping",
- "Violence and Gore": "Violence and Gore"
+ {dgettext("commissions", "Anthro"), "Anthro"},
+ {dgettext("commissions", "Canon Characters"), "Canon Characters"},
+ {dgettext("commissions", "Comics"), "Comics"},
+ {dgettext("commissions", "Fetish Art"), "Fetish Art"},
+ {dgettext("commissions", "Human and Human-like"), "Human and Human-like"},
+ {dgettext("commissions", "NSFW"), "NSFW"},
+ {dgettext("commissions", "Original Characters"), "Original Characters"},
+ {dgettext("commissions", "Original Species"), "Original Species"},
+ {dgettext("commissions", "Non-Humanoid"), "Non-Humanoid"},
+ {dgettext("commissions", "Requests"), "Requests"},
+ {dgettext("commissions", "Safe"), "Safe"},
+ {dgettext("commissions", "Shipping"), "Shipping"},
+ {dgettext("commissions", "Violence and Gore"), "Violence and Gore"}
]
end
diff --git a/lib/philomena/dnp_entries/dnp_entry.ex b/lib/philomena/dnp_entries/dnp_entry.ex
index e59ab21e..40822a6c 100644
--- a/lib/philomena/dnp_entries/dnp_entry.ex
+++ b/lib/philomena/dnp_entries/dnp_entry.ex
@@ -2,6 +2,8 @@ defmodule Philomena.DnpEntries.DnpEntry do
use Ecto.Schema
import Ecto.Changeset
+ import PhilomenaWeb.Gettext
+
alias Philomena.Tags.Tag
alias Philomena.Users.User
@@ -71,11 +73,11 @@ defmodule Philomena.DnpEntries.DnpEntry do
{"Uploader Credit Change",
"I would like the uploader credit for already existing uploads of my art to be assigned to me"},
{"Certain Type/Location Only",
- "I only want to allow art of a certain type or from a certain location to be uploaded to Derpibooru"},
+ "I only want to allow art of a certain type or from a certain location to be uploaded to #{gettext("Philomena Site")}"},
{"With Permission Only",
- "I only want people with my permission to be allowed to upload my art to Derpibooru"},
+ "I only want people with my permission to be allowed to upload my art to #{gettext("Philomena Site")}"},
{"Artist Upload Only",
- "I want to be the only person allowed to upload my art to Derpibooru"},
+ "I want to be the only person allowed to upload my art to #{gettext("Philomena Site")}"},
{"Other", "I would like a DNP entry under other conditions"}
]
end
diff --git a/lib/philomena/users/user.ex b/lib/philomena/users/user.ex
index b02f9a19..ef1b5eff 100644
--- a/lib/philomena/users/user.ex
+++ b/lib/philomena/users/user.ex
@@ -2,6 +2,8 @@ defmodule Philomena.Users.User do
alias Philomena.Users.Password
alias Philomena.Slug
+ import PhilomenaWeb.Gettext
+
use Ecto.Schema
import Ecto.Changeset
@@ -523,11 +525,11 @@ defmodule Philomena.Users.User do
provisioning_uri = %URI{
scheme: "otpauth",
host: "totp",
- path: "/Derpibooru:" <> user.email,
+ path: "/#{gettext("PhilomenaSite")}:" <> user.email,
query:
URI.encode_query(%{
secret: secret,
- issuer: "Derpibooru"
+ issuer: gettext("PhilomenaSite")
})
}
diff --git a/lib/philomena_web/templates/activity/_comment_strip.html.slime b/lib/philomena_web/templates/activity/_comment_strip.html.slime
index cbf36c8b..9e073e47 100644
--- a/lib/philomena_web/templates/activity/_comment_strip.html.slime
+++ b/lib/philomena_web/templates/activity/_comment_strip.html.slime
@@ -1,7 +1,7 @@
-.block__content.block--borderless.block--alternating.flex
- .flex__shrink.spacing--right
+.block__content.block--borderless.block--alternating.flex.flex--normal-gap
+ .flex__grow.media__standalone
= render PhilomenaWeb.ImageView, "_image_container.html", image: @comment.image, size: :thumb_tiny, conn: @conn
- .flex__grow
+ .flex.flex--small-gap.flex--wrap
a href="/#{@comment.image.id}#comment_#{@comment.id}"
| #
=> @comment.image.id
diff --git a/lib/philomena_web/templates/advert/_box.html.slime b/lib/philomena_web/templates/advert/_box.html.slime
index 652401c9..77a2e77b 100644
--- a/lib/philomena_web/templates/advert/_box.html.slime
+++ b/lib/philomena_web/templates/advert/_box.html.slime
@@ -1,6 +1,8 @@
.block#imagespns
.spnstxt
- ' Interested in advertising on Derpibooru?
+ ' Interested in advertising on
+ = site_name()
+ | ?
=> link "Click here", to: "/pages/advertising"
' for information!
@@ -9,6 +11,7 @@
p
strong
- ' Derpibooru costs over $25 a day to operate -
+ = site_name()
+ ' costs over $25 a day to operate -
= link "help support us financially", to: "/pages/donations"
' !
diff --git a/lib/philomena_web/templates/api/rss/watched/index.html.eex b/lib/philomena_web/templates/api/rss/watched/index.html.eex
index de471d21..cf70bb69 100644
--- a/lib/philomena_web/templates/api/rss/watched/index.html.eex
+++ b/lib/philomena_web/templates/api/rss/watched/index.html.eex
@@ -1,8 +1,8 @@
- Derpibooru Watchlist
- Your watched tags feed from Derpibooru
+ <%= site_name() %> Watchlist
+ Your watched tags feed from <%= site_name() %>
<%= Routes.api_rss_watched_url(@conn, :index) %>
<%= last_build_date() %>
diff --git a/lib/philomena_web/templates/communication/_body.html.slime b/lib/philomena_web/templates/communication/_body.html.slime
index d9c69ff0..1c1f0274 100644
--- a/lib/philomena_web/templates/communication/_body.html.slime
+++ b/lib/philomena_web/templates/communication/_body.html.slime
@@ -2,7 +2,7 @@
- avatar = cond do
- not is_nil(assigns[:image]) ->
- .post-image-container
+ .post-image-container.media__standalone
= render PhilomenaWeb.ImageView, "_image_container.html", image: @image, size: :thumb_tiny, conn: @conn
- anon ->
= render PhilomenaWeb.UserAttributionView, "_anon_user_avatar.html", object: @object, conn: @conn
diff --git a/lib/philomena_web/templates/error/show.html.slime b/lib/philomena_web/templates/error/show.html.slime
index 46d40238..53a6a285 100644
--- a/lib/philomena_web/templates/error/show.html.slime
+++ b/lib/philomena_web/templates/error/show.html.slime
@@ -7,7 +7,8 @@ html lang="en"
title
=> @status
- | - Philomena
+ ' -
+ = site_name()
link rel="stylesheet" href=stylesheet_path(@conn, nil)
link rel="stylesheet" href=light_stylesheet_path(@conn) media="(prefers-color-scheme: light)"
link rel="icon" href="/favicon.ico" type="image/x-icon"
@@ -17,7 +18,7 @@ html lang="en"
.minimal__message
h1.minimal__message__header
i.fa.fw.favicon-home>
- ' Philomena
+ = site_name()
h3 = @short_msg
p = @long_msg
diff --git a/lib/philomena_web/templates/image/_image_container.html.slime b/lib/philomena_web/templates/image/_image_container.html.slime
index 2b84f6a5..ee16d628 100644
--- a/lib/philomena_web/templates/image/_image_container.html.slime
+++ b/lib/philomena_web/templates/image/_image_container.html.slime
@@ -21,7 +21,8 @@
- {:hidpi, small_url, medium_url, hover_text} ->
.media-box__overlay.js-spoiler-info-overlay
a href=link title=hover_text
- img.media-box__image src=small_url srcset="#{small_url} 1x, #{medium_url} 2x" alt=hover_text
+ picture
+ img.media-box__image src=small_url srcset="#{small_url} 1x, #{medium_url} 2x" alt=hover_text
- {:image, small_url, hover_text} ->
.media-box__overlay.js-spoiler-info-overlay
@@ -29,7 +30,8 @@
| WebM
a href=link title=hover_text
- img.media-box__image src=small_url alt=hover_text
+ picture
+ img.media-box__image src=small_url alt=hover_text
- {:video, webm, mp4, hover_text} ->
.media-box__overlay.js-spoiler-info-overlay
@@ -42,7 +44,8 @@
- {:filtered_image, hover_text} ->
.media-box__overlay.js-spoiler-info-overlay
a href=link title=hover_text
- img.media-box__image alt=hover_text
+ picture
+ img.media-box__image alt=hover_text
- {:filtered_video, hover_text} ->
.media-box__overlay.js-spoiler-info-overlay
diff --git a/lib/philomena_web/templates/image/_options.html.slime b/lib/philomena_web/templates/image/_options.html.slime
index d7cbc741..c835e072 100644
--- a/lib/philomena_web/templates/image/_options.html.slime
+++ b/lib/philomena_web/templates/image/_options.html.slime
@@ -32,7 +32,8 @@
.block__tab.hidden data-tab="sharing"
#embed_options
- source_link = if image_has_sources(@image), do: " - [url=#{image_first_source(@image)}]Original source[/url]", else: " (Original source unknown at time of posting)"
- h5 Derpibooru
+ h5
+ = site_name()
p
strong> Small thumbnail
input.input#embed_small_thumbnail_tag type="text" value=">>#{@image.id}s" cols="10" readonly="readonly"
@@ -59,7 +60,7 @@
| Copy
br
textarea.input.input--wide.input--separate-top#bbcode_embed_full_tag rows="2" cols="100" readonly="readonly"
- = "[img]#{thumb_url(@image, false, :full)}[/img]\n[url=#{Routes.image_url(@conn, :show, @image)}]View on Derpibooru[/url]#{source_link}"
+ = "[img]#{thumb_url(@image, false, :full)}[/img]\n[url=#{Routes.image_url(@conn, :show, @image)}]View on #{site_name()}[/url]#{source_link}"
p
strong> Thumbnailed BBcode
a href="#" data-click-copy="#bbcode_embed_thumbnail_tag"
@@ -67,7 +68,7 @@
| Copy
br
textarea.input.input--wide.input--separate-top#bbcode_embed_thumbnail_tag rows="2" cols="100" readonly="readonly"
- = "[img]#{thumb_url(@image, false, :medium)}[/img]\n[url=#{Routes.image_url(@conn, :show, @image)}]View on Derpibooru[/url]#{source_link}"
+ = "[img]#{thumb_url(@image, false, :medium)}[/img]\n[url=#{Routes.image_url(@conn, :show, @image)}]View on #{site_name()}[/url]#{source_link}"
= if display_mod_tools? do
.block__tab.hidden data-tab="replace"
diff --git a/lib/philomena_web/templates/layout/_header.html.slime b/lib/philomena_web/templates/layout/_header.html.slime
index 61c931d6..fc7a1a38 100644
--- a/lib/philomena_web/templates/layout/_header.html.slime
+++ b/lib/philomena_web/templates/layout/_header.html.slime
@@ -4,7 +4,7 @@ header
i.fa.fa-bars
a.header__logo.header__link href="/"
i.fab.fa-phoenix-framework>
- span.hidden--mobile Philomena
+ span.hidden--mobile = site_name()
a.header__link.hidden--mobile href="/images/new" title="Upload"
i.fa.fa-upload
= form_for @conn, Routes.search_path(@conn, :index), [method: "get", class: "header__search", enforce_utf8: false], fn f ->
diff --git a/lib/philomena_web/templates/layout/_opengraph.html.slime b/lib/philomena_web/templates/layout/_opengraph.html.slime
index 30ae6555..f7fac763 100644
--- a/lib/philomena_web/templates/layout/_opengraph.html.slime
+++ b/lib/philomena_web/templates/layout/_opengraph.html.slime
@@ -5,7 +5,7 @@ meta name="format-detection" content="telephone=no"
= if opengraph?(@conn) do
- image = @conn.assigns.image
- filtered = not image.thumbnails_generated
- - description = "##{image.id} - #{Philomena.Images.tag_list(image)} - Derpibooru"
+ - description = "##{image.id} - #{Philomena.Images.tag_list(image)} - #{site_name()}"
- thumb_large = ImageView.thumb_urls(image, false)[:large]
- thumb_rendered = ImageView.thumb_url(image, false, :rendered)
@@ -42,4 +42,4 @@ meta name="format-detection" content="telephone=no"
meta property="og:type" content="website"
- else
- meta name="description" content="Derpibooru is a linear imagebooru which lets you share, find and discover new art and media surrounding the show My Little Pony: Friendship is Magic"
+ meta name="description" content=gettext("%{site_name} is a linear imagebooru which lets you share, find and discover new art and media.", site_name: site_name())
diff --git a/lib/philomena_web/templates/layout/app.html.slime b/lib/philomena_web/templates/layout/app.html.slime
index b1ea8082..e529f4f5 100644
--- a/lib/philomena_web/templates/layout/app.html.slime
+++ b/lib/philomena_web/templates/layout/app.html.slime
@@ -7,9 +7,10 @@ html lang="en"
title
= if assigns[:title] do
=> assigns[:title]
- ' - Derpibooru
+ ' -
+ =< site_name()
- else
- ' Derpibooru
+ =<> site_name()
link rel="stylesheet" href=Routes.static_path(@conn, "/css/application.css")
link rel="stylesheet" href=stylesheet_path(@conn, @current_user)
= if is_nil(@current_user) do
diff --git a/lib/philomena_web/templates/layout/two_factor.html.slime b/lib/philomena_web/templates/layout/two_factor.html.slime
index 5b31f3f3..22975ef0 100644
--- a/lib/philomena_web/templates/layout/two_factor.html.slime
+++ b/lib/philomena_web/templates/layout/two_factor.html.slime
@@ -5,7 +5,9 @@ html lang="en"
meta http-equiv="X-UA-Compatible" content="IE=edge"
= viewport_meta_tag(@conn)
- title Two Factor Authentication - Derpibooru
+ title
+ ' Two Factor Authentication -
+ = site_name()
link rel="stylesheet" href=stylesheet_path(@conn, nil)
link rel="stylesheet" href=light_stylesheet_path(@conn) media="(prefers-color-scheme: light)"
link rel="icon" href="/favicon.ico" type="image/x-icon"
diff --git a/lib/philomena_web/templates/profile/artist_link/_form.html.slime b/lib/philomena_web/templates/profile/artist_link/_form.html.slime
index 1e89b13a..78c3acfb 100644
--- a/lib/philomena_web/templates/profile/artist_link/_form.html.slime
+++ b/lib/philomena_web/templates/profile/artist_link/_form.html.slime
@@ -15,7 +15,9 @@
.field
label for="uri"
- ' URL of your art webpage (may be your Derpibooru profile page if you have no other sources)
+ ' URL of your art webpage (may be your
+ = site_name()
+ ' profile page if you have no other sources)
= url_input f, :uri, class: "input input--wide", placeholder: "https://www.deviantart.com/your-name", required: true
= error_tag f, :uri
diff --git a/lib/philomena_web/templates/profile/artist_link/index.html.slime b/lib/philomena_web/templates/profile/artist_link/index.html.slime
index 15f2999b..d85ac540 100644
--- a/lib/philomena_web/templates/profile/artist_link/index.html.slime
+++ b/lib/philomena_web/templates/profile/artist_link/index.html.slime
@@ -3,7 +3,9 @@ p
a.button href=Routes.profile_artist_link_path(@conn, :new, @user)
' Request a link
p
- ' Artist links associate your account on Derpibooru with tags about content you create and with accounts on sites elsewhere. This allows users to easily identify artists and staff to act more rapidly on takedown requests.
+ ' Artist links associate your account on
+ = site_name()
+ ' with tags about content you create and with accounts on sites elsewhere. This allows users to easily identify artists and staff to act more rapidly on takedown requests.
table.table
thead
diff --git a/lib/philomena_web/views/api/json/oembed_view.ex b/lib/philomena_web/views/api/json/oembed_view.ex
index 19501e40..916db53e 100644
--- a/lib/philomena_web/views/api/json/oembed_view.ex
+++ b/lib/philomena_web/views/api/json/oembed_view.ex
@@ -11,16 +11,16 @@ defmodule PhilomenaWeb.Api.Json.OembedView do
%{
version: "1.0",
type: "photo",
- title: "##{image.id} - #{tag_list(image)} - Derpibooru",
+ title: "##{image.id} - #{tag_list(image)} - #{gettext("Philomena Site")}",
author_url: image_first_source(image),
author_name: artist_tags(image.tags),
- provider_name: "Derpibooru",
+ provider_name: gettext("Philomena Site"),
provider_url: PhilomenaWeb.Endpoint.url(),
cache_age: 7200,
- derpibooru_id: image.id,
- derpibooru_score: image.score,
- derpibooru_comments: image.comments_count,
- derpibooru_tags: Enum.map(image.tags, & &1.name)
+ philomena_id: image.id,
+ philomena_score: image.score,
+ philomena_comments: image.comments_count,
+ philomena_tags: Enum.map(image.tags, & &1.name)
}
end
diff --git a/lib/philomena_web/views/app_view.ex b/lib/philomena_web/views/app_view.ex
index 1b0febd5..eadfa406 100644
--- a/lib/philomena_web/views/app_view.ex
+++ b/lib/philomena_web/views/app_view.ex
@@ -1,6 +1,8 @@
defmodule PhilomenaWeb.AppView do
use Phoenix.HTML
+ import PhilomenaWeb.Gettext
+
@time_strings %{
seconds: "less than a minute",
minute: "about a minute",
@@ -254,4 +256,6 @@ defmodule PhilomenaWeb.AppView do
def get_flash(%{assigns: %{flash: nil}}, _key), do: %{}
def get_flash(%{assigns: %{flash: flash}}, key), do: Phoenix.Flash.get(flash, key)
def get_flash(_, _key), do: %{}
+
+ def site_name, do: gettext("Philomena Site")
end
diff --git a/lib/philomena_web/views/avatar_generator_view.ex b/lib/philomena_web/views/avatar_generator_view.ex
deleted file mode 100644
index 1953dce5..00000000
--- a/lib/philomena_web/views/avatar_generator_view.ex
+++ /dev/null
@@ -1,103 +0,0 @@
-defmodule PhilomenaWeb.AvatarGeneratorView do
- use PhilomenaWeb, :view
- import Bitwise
-
- alias Philomena.Config
-
- def generated_avatar(displayed_name) do
- config = config()
-
- # Generate 8 pseudorandom numbers
- seed = :erlang.crc32(displayed_name)
-
- {rand, _acc} =
- Enum.map_reduce(1..8, seed, fn _elem, acc ->
- value = xorshift32(acc)
- {value, value}
- end)
-
- # Set species
- {species, rand} = at(species(config), rand)
-
- # Set the ranges for the colors we are going to make
- color_range = 128
- color_brightness = 72
-
- {body_r, body_g, body_b, rand} = rgb(0..color_range, color_brightness, rand)
- {hair_r, hair_g, hair_b, rand} = rgb(0..color_range, color_brightness, rand)
- {style_hr, _rand} = at(all_species(hair_shapes(config), species), rand)
-
- # Creates bounded hex color strings
- color_bd = format("~2.16.0B~2.16.0B~2.16.0B", [body_r, body_g, body_b])
- color_hr = format("~2.16.0B~2.16.0B~2.16.0B", [hair_r, hair_g, hair_b])
-
- # Make a character
- avatar_svg(config, color_bd, color_hr, species, style_hr)
- end
-
- # Build the final SVG for the character.
- #
- # Inputs to raw/1 are not user-generated.
- # sobelow_skip ["XSS.Raw"]
- defp avatar_svg(config, color_bd, color_hr, species, style_hr) do
- [
- header(config),
- background(config),
- for_species(tail_shapes(config), species)["shape"] |> String.replace("HAIR_FILL", color_hr),
- for_species(body_shapes(config), species)["shape"] |> String.replace("BODY_FILL", color_bd),
- style_hr["shape"] |> String.replace("HAIR_FILL", color_hr),
- all_species(extra_shapes(config), species)
- |> Enum.map(&String.replace(&1["shape"], "BODY_FILL", color_bd)),
- footer(config)
- ]
- |> List.flatten()
- |> Enum.map(&raw/1)
- end
-
- # https://en.wikipedia.org/wiki/Xorshift
- # 32-bit xorshift deterministic PRNG
- defp xorshift32(state) do
- state = state &&& 0xFFFF_FFFF
- state = bxor(state, state <<< 13)
- state = bxor(state, state >>> 17)
-
- bxor(state, state <<< 5)
- end
-
- # Generate pseudorandom, clamped RGB values with a specified
- # brightness and random source
- defp rgb(range, brightness, rand) do
- {r, rand} = at(range, rand)
- {g, rand} = at(range, rand)
- {b, rand} = at(range, rand)
-
- {r + brightness, g + brightness, b + brightness, rand}
- end
-
- # Pick an element from an enumerable at the specified position,
- # wrapping around as appropriate.
- defp at(list, [position | rest]) do
- length = Enum.count(list)
- position = rem(position, length)
-
- {Enum.at(list, position), rest}
- end
-
- defp for_species(styles, species), do: hd(all_species(styles, species))
-
- defp all_species(styles, species),
- do: Enum.filter(styles, &Enum.member?(&1["species"], species))
-
- defp format(format_string, args), do: to_string(:io_lib.format(format_string, args))
-
- defp species(%{"species" => species}), do: species
- defp header(%{"header" => header}), do: header
- defp background(%{"background" => background}), do: background
- defp tail_shapes(%{"tail_shapes" => tail_shapes}), do: tail_shapes
- defp body_shapes(%{"body_shapes" => body_shapes}), do: body_shapes
- defp hair_shapes(%{"hair_shapes" => hair_shapes}), do: hair_shapes
- defp extra_shapes(%{"extra_shapes" => extra_shapes}), do: extra_shapes
- defp footer(%{"footer" => footer}), do: footer
-
- defp config, do: Config.get(:avatar)
-end
diff --git a/lib/philomena_web/views/report_view.ex b/lib/philomena_web/views/report_view.ex
index 27f6f5a2..7ffae693 100644
--- a/lib/philomena_web/views/report_view.ex
+++ b/lib/philomena_web/views/report_view.ex
@@ -13,19 +13,19 @@ defmodule PhilomenaWeb.ReportView do
def report_categories do
[
- "Rule #0: Namecalling, trolling, discrimination": "Rule #0",
- "Rule #1: DNP, content theft, pay content, trace/bad edit": "Rule #1",
- "Rule #2: Bad tagging/sourcing": "Rule #2",
- "Rule #3: Image not MLP-related/obligatory pony": "Rule #3",
- "Rule #4: Whining about filterable content": "Rule #4",
- "Rule #5: Underage+human/anthro-looking porn": "Rule #5",
- "Rule #6: Spam, off-topic, or general site abuse": "Rule #6",
- "Rule #7: Above topic rating (NOT swear words)": "Rule #7",
- "Rule #8: Privacy violation": "Rule #8",
- "Rule #9: Commissions": "Rule #9",
- "Rule #n: Spirit of the rules": "Rule #n",
- "Other (please explain)": "Other",
- "Takedown request": "Takedown request"
+ {dgettext("rules", "Rule #0: Namecalling, trolling, discrimination"), "Rule #0"},
+ {dgettext("rules", "Rule #1: DNP, content theft, pay content, trace/bad edit"), "Rule #1"},
+ {dgettext("rules", "Rule #2: Bad tagging/sourcing"), "Rule #2"},
+ {dgettext("rules", "Rule #3: Image not related to the topic of the site"), "Rule #3"},
+ {dgettext("rules", "Rule #4: Complaining about filterable content"), "Rule #4"},
+ {dgettext("rules", "Rule #5: Illegal/forbidden content / underage porn"), "Rule #5"},
+ {dgettext("rules", "Rule #6: Spam, off-topic, or general site abuse"), "Rule #6"},
+ {dgettext("rules", "Rule #7: Above topic rating (NOT swear words)"), "Rule #7"},
+ {dgettext("rules", "Rule #8: Privacy violation"), "Rule #8"},
+ {dgettext("rules", "Rule #9: Commissions"), "Rule #9"},
+ {dgettext("rules", "Rule #n: Spirit of the rules"), "Rule #n"},
+ {dgettext("rules", "Other (please explain)"), "Other"},
+ {dgettext("rules", "Takedown request"), "Takedown request"}
]
end
diff --git a/lib/philomena_web/views/user_attribution_view.ex b/lib/philomena_web/views/user_attribution_view.ex
index 24ae18f7..dfefd332 100644
--- a/lib/philomena_web/views/user_attribution_view.ex
+++ b/lib/philomena_web/views/user_attribution_view.ex
@@ -2,7 +2,6 @@ defmodule PhilomenaWeb.UserAttributionView do
use PhilomenaWeb, :view
alias Philomena.Attribution
- alias PhilomenaWeb.AvatarGeneratorView
def anonymous?(object) do
Attribution.anonymous?(object)
@@ -36,15 +35,15 @@ defmodule PhilomenaWeb.UserAttributionView do
case not is_nil(object.user) and reveal_anon? do
true -> "#{object.user.name} (##{hash}, hidden)"
- false -> "Background Pony ##{hash}"
+ false -> "#{gettext("Anonymous")} ##{hash}"
end
end
- def anonymous_avatar(name, class \\ "avatar--small") do
+ def anonymous_avatar(_name, class \\ "avatar--small") do
class = Enum.join(["image-constrained", class], " ")
content_tag :div, class: class do
- AvatarGeneratorView.generated_avatar(name)
+ raw("
")
end
end
@@ -72,16 +71,11 @@ defmodule PhilomenaWeb.UserAttributionView do
avatar_url_root() <> "/" <> avatar
end
- def anonymous_avatar_url(name) do
- svg =
- name
- |> AvatarGeneratorView.generated_avatar()
- |> Enum.map_join(&safe_to_string/1)
+ def anonymous_avatar_url(_), do: "/images/no_avatar.svg"
- "data:image/svg+xml;base64," <> Base.encode64(svg)
- end
+ def user_icon(%{secondary_role: sr}) when sr in ["Site Developer", "Devops"],
+ do: "fa-screwdriver-wrench"
- def user_icon(%{secondary_role: sr}) when sr in ["Site Developer", "Devops"], do: "fa-screwdriver-wrench"
def user_icon(%{secondary_role: sr}) when sr in ["Public Relations"], do: "fa-bullhorn"
def user_icon(%{hide_default_role: true}), do: nil
def user_icon(%{role: role}) when role in ["admin", "moderator"], do: "fa-gavel"
diff --git a/priv/gettext/commissions.pot b/priv/gettext/commissions.pot
new file mode 100644
index 00000000..be959699
--- /dev/null
+++ b/priv/gettext/commissions.pot
@@ -0,0 +1,41 @@
+## Strings used in the commission listing feature.
+## See default.pot for more documentation.
+
+msgid "Anthro"
+msgstr ""
+
+msgid "Canon Characters"
+msgstr ""
+
+msgid "Comics"
+msgstr ""
+
+msgid "Fetish Art"
+msgstr ""
+
+msgid "Human and Human-like"
+msgstr ""
+
+msgid "NSFW"
+msgstr ""
+
+msgid "Original Characters"
+msgstr ""
+
+msgid "Original Species"
+msgstr ""
+
+msgid "Non-Humanoid"
+msgstr ""
+
+msgid "Requests"
+msgstr ""
+
+msgid "Safe"
+msgstr ""
+
+msgid "Shipping"
+msgstr ""
+
+msgid "Violence and Gore"
+msgstr ""
diff --git a/priv/gettext/default.pot b/priv/gettext/default.pot
new file mode 100644
index 00000000..6ce0eb55
--- /dev/null
+++ b/priv/gettext/default.pot
@@ -0,0 +1,29 @@
+## This file is for language string definitions, NOT translations.
+## Do not put translations into this .pot file. Edit the .po file of
+## the relevant language instead.
+## For example, the English file is: priv/gettext/en/LC_MESSAGES/default.po
+
+## Site name, appears throughout all the pages and in the header.
+## Example: msgstr "My New Booru"
+msgid "Philomena Site"
+msgstr ""
+
+## Site name but written without any spaces, special characters,
+## and in English. Used as issuer name and path for TOTP stuff.
+## Example: msgstr "MyNewBooru"
+msgid "PhilomenaSite"
+msgstr ""
+
+## Name for anon users.
+## Example: msgstr "Background Pony"
+msgid "Anonymous"
+msgstr ""
+
+## Description of the site. Used in the meta tag.
+msgid "%{site_name} is a linear imagebooru which lets you share, find and discover new art and media."
+msgstr ""
+
+## Used to generate artist link validation text for artists to put on their page.
+## Should be in English (not translated to other languages), and reflect overall site branding.
+msgid "PHILOMENA-LINKVALIDATION"
+msgstr ""
diff --git a/priv/gettext/en/LC_MESSAGES/commissions.po b/priv/gettext/en/LC_MESSAGES/commissions.po
new file mode 100644
index 00000000..be959699
--- /dev/null
+++ b/priv/gettext/en/LC_MESSAGES/commissions.po
@@ -0,0 +1,41 @@
+## Strings used in the commission listing feature.
+## See default.pot for more documentation.
+
+msgid "Anthro"
+msgstr ""
+
+msgid "Canon Characters"
+msgstr ""
+
+msgid "Comics"
+msgstr ""
+
+msgid "Fetish Art"
+msgstr ""
+
+msgid "Human and Human-like"
+msgstr ""
+
+msgid "NSFW"
+msgstr ""
+
+msgid "Original Characters"
+msgstr ""
+
+msgid "Original Species"
+msgstr ""
+
+msgid "Non-Humanoid"
+msgstr ""
+
+msgid "Requests"
+msgstr ""
+
+msgid "Safe"
+msgstr ""
+
+msgid "Shipping"
+msgstr ""
+
+msgid "Violence and Gore"
+msgstr ""
diff --git a/priv/gettext/en/LC_MESSAGES/default.po b/priv/gettext/en/LC_MESSAGES/default.po
new file mode 100644
index 00000000..65adb187
--- /dev/null
+++ b/priv/gettext/en/LC_MESSAGES/default.po
@@ -0,0 +1,24 @@
+## Site name, appears throughout all the pages and in the header.
+## Example: msgstr "My New Booru"
+msgid "Philomena Site"
+msgstr ""
+
+## Site name but written without any spaces, special characters,
+## and in English. Used as issuer name and path for TOTP stuff.
+## Example: msgstr "MyNewBooru"
+msgid "PhilomenaSite"
+msgstr ""
+
+## Name for anon users.
+## Example: msgstr "Background Pony"
+msgid "Anonymous"
+msgstr ""
+
+## Description of the site. Used in the meta tag.
+msgid "%{site_name} is a linear imagebooru which lets you share, find and discover new art and media."
+msgstr ""
+
+## Used to generate artist link validation text for artists to put on their page.
+## Should be in English (not translated to other languages), and reflect overall site branding.
+msgid "PHILOMENA-LINKVALIDATION"
+msgstr ""
diff --git a/priv/gettext/en/LC_MESSAGES/rules.po b/priv/gettext/en/LC_MESSAGES/rules.po
new file mode 100644
index 00000000..0e7412ab
--- /dev/null
+++ b/priv/gettext/en/LC_MESSAGES/rules.po
@@ -0,0 +1,39 @@
+## See default.pot for more documentation.
+msgid "Rule #0: Namecalling, trolling, discrimination"
+msgstr ""
+
+msgid "Rule #1: DNP, content theft, pay content, trace/bad edit"
+msgstr ""
+
+msgid "Rule #2: Bad tagging/sourcing"
+msgstr ""
+
+msgid "Rule #3: Image not related to the topic of the site"
+msgstr ""
+
+msgid "Rule #4: Complaining about filterable content"
+msgstr ""
+
+msgid "Rule #5: Illegal/forbidden content / underage porn"
+msgstr ""
+
+msgid "Rule #6: Spam, off-topic, or general site abuse"
+msgstr ""
+
+msgid "Rule #7: Above topic rating (NOT swear words)"
+msgstr ""
+
+msgid "Rule #8: Privacy violation"
+msgstr ""
+
+msgid "Rule #9: Commissions"
+msgstr ""
+
+msgid "Rule #n: Spirit of the rules"
+msgstr ""
+
+msgid "Other (please explain)"
+msgstr ""
+
+msgid "Takedown request"
+msgstr ""
diff --git a/priv/gettext/rules.pot b/priv/gettext/rules.pot
new file mode 100644
index 00000000..4c70c706
--- /dev/null
+++ b/priv/gettext/rules.pot
@@ -0,0 +1,41 @@
+## Strings used in the reporting feature and site rule pages.
+## See default.pot for more documentation.
+
+msgid "Rule #0: Namecalling, trolling, discrimination"
+msgstr ""
+
+msgid "Rule #1: DNP, content theft, pay content, trace/bad edit"
+msgstr ""
+
+msgid "Rule #2: Bad tagging/sourcing"
+msgstr ""
+
+msgid "Rule #3: Image not related to the topic of the site"
+msgstr ""
+
+msgid "Rule #4: Complaining about filterable content"
+msgstr ""
+
+msgid "Rule #5: Illegal/forbidden content / underage porn"
+msgstr ""
+
+msgid "Rule #6: Spam, off-topic, or general site abuse"
+msgstr ""
+
+msgid "Rule #7: Above topic rating (NOT swear words)"
+msgstr ""
+
+msgid "Rule #8: Privacy violation"
+msgstr ""
+
+msgid "Rule #9: Commissions"
+msgstr ""
+
+msgid "Rule #n: Spirit of the rules"
+msgstr ""
+
+msgid "Other (please explain)"
+msgstr ""
+
+msgid "Takedown request"
+msgstr ""