[Misc] Revert april fools stuff

This commit is contained in:
Earlopain 2024-04-03 14:39:09 +02:00
parent c1aa5f95b1
commit 3f3fd0ab4f
No known key found for this signature in database
GPG Key ID: 48860312319ADF61
7 changed files with 4 additions and 62 deletions

View File

@ -49,12 +49,6 @@ class StaticController < ApplicationController
redirect_back fallback_location: posts_path
end
def dont_fool_me
cookies[:dont_fool_me] = { value: "1", expires: 1.week }
flash[:notice] = "òwō"
redirect_back fallback_location: posts_path
end
def discord
unless CurrentUser.can_discord?
raise User::PrivilegeError.new("You must have an account for at least one week in order to join the Discord server.")

View File

@ -44,58 +44,14 @@ module ApplicationHelper
end
def format_text(text, **options)
something_funny = options[:fool] && fool?
options = options.except(:fool)
# preserve the currrent inline behaviour
if options[:inline]
dtext_ragel(text, **options)
else
result = %(<div class="styled-dtext">#{dtext_ragel(text, **options)}</div>)
if something_funny
raw uwuify(result)
else
raw result
end
raw %(<div class="styled-dtext">#{dtext_ragel(text, **options)}</div>)
end
end
def fool?
return false if Danbooru.config.app_name == "e926"
return false if cookies[:dont_fool_me]
Time.use_zone(Time.find_zone("UTC")) do
target = Date.new(2024, 4, 1)
start = target.beginning_of_day - 12.hours
stop = target.end_of_day + 6.hours
Time.now.between?(start, stop)
end
end
FACE_CHANCE = 0.25
FACE = [" (・`ω´・) ", " ;;w;; ", " owo ", " UwU ", " >w< ", " ^w^ "].freeze
def uwuify(html_input)
fragment = Nokogiri::HTML5.fragment(html_input)
fragment.traverse do |x|
if x.text?
text = x.content.tr("rlRL", "wwWW")
text = text.gsub(/(n)([aeiou])/i, '\1y\2')
text = text.gsub("ove", "uv")
text = text.gsub(/(\.+)/) do
if Random.rand < FACE_CHANCE
FACE.sample
else
$1
end
end
x.content = text
end
end
fragment.to_html
end
def custom_form_for(object, *args, &)
options = args.extract_options!
simple_form_for(object, *(args << options.merge(builder: CustomFormBuilder)), &)

View File

@ -21,7 +21,7 @@
<h6><%= link_to "In response to blip ##{blip.response_to}", blip_path(id: blip.response_to) %> </h6>
<% end %>
<div class="body dtext-container">
<%= format_text(blip.body, allow_color: blip.creator.is_privileged?, fool: true) %>
<%= format_text(blip.body, allow_color: blip.creator.is_privileged?) %>
</div>
<%= render "application/update_notice", record: blip %>
<%= render "application/warned_notice", record: blip %>

View File

@ -20,7 +20,7 @@
</div>
<div class="content">
<div class="body dtext-container">
<%= format_text(comment.body, allow_color: comment.creator.is_privileged?, fool: true) %>
<%= format_text(comment.body, allow_color: comment.creator.is_privileged?) %>
</div>
<%= render "application/update_notice", record: comment %>
<%= render "application/warned_notice", record: comment %>

View File

@ -20,7 +20,7 @@
</div>
<div class="content">
<div class="dtext-container">
<%= format_text(parse_embedded_tag_request_text(forum_post.body), allow_color: forum_post.creator.is_privileged?, fool: true) %>
<%= format_text(parse_embedded_tag_request_text(forum_post.body), allow_color: forum_post.creator.is_privileged?) %>
</div>
<%= render "application/update_notice", record: forum_post %>
<%= render "application/warned_notice", record: forum_post %>

View File

@ -7,13 +7,6 @@
<h3 class="redtext" id="no_save_warning">Your device does not allow the site to save theme settings.</h3>
</noscript>
<% if fool? %>
<p>
Click <%= link_to "here", dont_fool_me_static_path %> to kill the joke early.
</p>
<% end %>
<div class="simple_form">
<div class="input">
<label for="theme_name">Theme</label>

View File

@ -444,7 +444,6 @@ Rails.application.routes.draw do
post "/static/discord" => "static#discord", as: "discord_post"
get "/static/toggle_mobile_mode" => "static#disable_mobile_mode", as: "disable_mobile_mode"
get "/static/theme" => "static#theme", as: "theme"
get "/static/dont_fool_me" => "static#dont_fool_me", as: "dont_fool_me_static"
get "/meta_searches/tags" => "meta_searches#tags", :as => "meta_searches_tags"
root :to => "static#home"