Files
danbooru/app/views/layouts/default.html.erb
evazion a160a3acce users: add stricter username rules.
Add stricter username rules:

* Only allow usernames to contain basic letters, numbers, CJK characters, underscores, dashes and periods.
* Don't allow names to start or end with punctuation.
* Don't allow names to have multiple underscores in a row.
* Don't allow active users to have names that look like deleted users (e.g. "user_1234").
* Don't allow emoji or any other Unicode characters except for Chinese, Japanese, and Korean
  characters. CJK characters are currently grandfathered in but will be disallowed in the future.

Users with an invalid name will be shown a permanent sitewide banner until they change their name.
2022-03-05 01:08:53 -06:00

135 lines
5.6 KiB
Plaintext

<!doctype html>
<html lang="en">
<head>
<%= NewRelic::Agent.browser_timing_header rescue "" %>
<meta charset="utf-8">
<title><%= page_title %></title>
<link rel="icon" href="/favicon.ico" sizes="16x16" type="image/x-icon">
<link rel="icon" href="/favicon.svg" sizes="any" type="image/svg+xml">
<%= render_meta_links @current_item if @current_item.respond_to?(:paginate) %>
<%= tag.link rel: "canonical", href: canonical_url %>
<%= tag.link rel: "search", type: "application/opensearchdescription+xml", href: opensearch_url(format: :xml, version: 2), title: "Search posts" %>
<%= csrf_meta_tag %>
<% unless CurrentUser.enable_desktop_mode? %>
<meta name="viewport" content="width=device-width,initial-scale=1">
<% end %>
<% if CurrentUser.user.blacklisted_tags.present? %>
<meta name="blacklisted-tags" content="<%= CurrentUser.user.blacklisted_tags.gsub(/(?:\r|\n)+/, ",") %>">
<% end %>
<%= tag.meta name: "autocomplete-tag-prefixes", content: AutocompleteService::TAG_PREFIXES.to_json %>
<%# XXX hack to only load Ruffle on Flash posts %>
<% if controller_name == "posts" && action_name == "show" && @post&.is_flash? %>
<%= javascript_pack_tag "application", "alpine", "flash", defer: false %>
<% else %>
<%= javascript_pack_tag "application", "alpine", defer: false %>
<% end %>
<%= stylesheet_pack_tag "application" %>
<% if CurrentUser.user.custom_style.present? && params.fetch(:css, "true").truthy? %>
<%= stylesheet_link_tag custom_style_users_path(md5: Digest::MD5.hexdigest(CurrentUser.user.custom_style)) %>
<% end %>
<% if current_page?(root_url) %>
<%= json_ld_website_data %>
<% end %>
<%= tag.meta name: "description", content: meta_description %>
<%= tag.meta property: "og:type", content: "website" %>
<%= tag.meta property: "og:site_name", content: Danbooru.config.app_name %>
<%= tag.meta property: "og:title", content: page_title %>
<%= tag.meta property: "og:description", content: meta_description %>
<%= tag.meta property: "og:url", content: request.original_url %>
<% if Danbooru.config.twitter_username.present? %>
<%= tag.meta name: "twitter:site", content: "@#{Danbooru.config.twitter_username}" %>
<% end %>
<%= tag.meta name: "twitter:title", content: page_title %>
<%= tag.meta name: "twitter:description", content: meta_description %>
<%= tag.meta name: "git-hash", content: Rails.application.config.x.git_hash %>
<%= tag.meta name: "theme-color", content: "hsl(213, 100%, 50%)" %>
<%= yield :html_header %>
<%= raw Danbooru.config.custom_html_header_content %>
</head>
<%= tag.body **body_attributes(CurrentUser.user, params, @current_item, @exception) do %>
<%= render "news_updates/listing" %>
<header id="top" class="mb-4">
<%= link_to Danbooru.config.app_name, root_path, id: "app-name-header", class: "font-bold font-header leading-normal" %>
<div id="maintoggle" class="mobile-only">
<a href="#"><%= menu_icon(id: "maintoggle-on") %></a>
<a href="#"><%= close_icon(id: "maintoggle-off", style: "display: none;") %></a>
</div>
<nav id="nav">
<%= render "layouts/main_links" %>
<% if content_for(:secondary_links).present? %>
<menu id="subnav-menu">
<%= yield :secondary_links %>
</menu>
<% end %>
</nav>
</header>
<div id="page" class="flex-1">
<%= render "users/verification_notice" %>
<% if Danbooru.config.is_promotion? && cookies[:hide_winter_sale_notice].blank? %>
<div class="notice notice-info notice-small flex text-center items-center justify-center gap-2" id="promotion-notice">
<% file = %w[provgift.png kemogift.png padoru.gif ablobgift.gif].sample %>
<%= tag.img src: "/images/#{file}", width: 32, height: 32 %>
<span>
<%= link_to "Danbooru Winter Sale", forum_topic_path(Danbooru.config.winter_sale_forum_topic_id) %> ends <%= time_ago_in_words_tagged(Danbooru.config.winter_sale_end_date) %>!
<br>
<%= link_to "Get 25% off Gold & Platinum", new_user_upgrade_path %>
</span>
<span>(<%= link_to "hide", "#", id: "hide-promotion-notice" %>)</span>
</div>
<% elsif !CurrentUser.is_anonymous? && !CurrentUser.is_gold? && !CurrentUser.user.is_banned? && cookies[:hide_upgrade_account_notice].blank? && params[:action] != "upgrade_information" %>
<%= render "users/upgrade_notice" %>
<% end %>
<%= render "users/ban_notice" %>
<% if params[:controller] != "dmails" && has_unread_dmails?(CurrentUser.user) %>
<%= render "users/dmail_notice" %>
<% end %>
<% if !CurrentUser.user.is_anonymous? && CurrentUser.user.name_invalid? %>
<div class="notice notice-error notice-large" id="invalid-name-notice">
<h2>Action required </h2>
<div>You must <%= link_to "change your username", new_user_name_change_request_path %> to continue using <%= Danbooru.config.canonical_app_name %>.</div>
</div>
<% end %>
<div class="notice notice-info" id="notice" style="<%= "display: none;" unless flash[:notice] %>">
<span class="prose"><%= format_text(flash[:notice], inline: true) %>.</span>
<a href="#" id="close-notice-link">close</a>
</div>
<%= yield :layout %>
</div>
<div id="tooltips">
<%# Order matters here; items at the bottom of the list appear on top of earlier items %>
<div id="post-tooltips"></div>
<div id="comment-votes-tooltips"></div>
<div id="post-votes-tooltips"></div>
<div id="post-favorites-tooltips"></div>
<div id="user-tooltips"></div>
<div id="popup-menus"></div>
</div>
<%= render "static/footer" %>
<% end %>
</html>