LOTS of stuff
This commit is contained in:
@@ -1,54 +1,6 @@
|
||||
module UsersHelper
|
||||
require "open-uri"
|
||||
|
||||
def avatar_url(user_id, size)
|
||||
u = User.find_by_id(user_id)
|
||||
u.nil? ? ign = :char : ign = u.ign
|
||||
return "https://minotar.net/helm/#{CGI.escape(ign)}/#{CGI.escape(size.to_s)}"
|
||||
end
|
||||
|
||||
def uses_mc_password?(ign, password)
|
||||
query = {
|
||||
user: ign,
|
||||
password: password,
|
||||
version: 9999 #just something high so it won't fail with "Old version"
|
||||
}.to_query
|
||||
begin
|
||||
#check if this user is an idiot and uses their mc password.
|
||||
mclogin = open("https://login.minecraft.net/?#{query}", :read_timeout => 1).read
|
||||
rescue
|
||||
puts "---"
|
||||
puts "ERROR: failed to check mc password for '#{ign}'. Login servers down?"
|
||||
puts "---"
|
||||
end
|
||||
!!mclogin.downcase.include?(ign.downcase)
|
||||
end
|
||||
|
||||
def haspaid?(ign)
|
||||
query = {user: ign}.to_query
|
||||
begin
|
||||
response = open("https://minecraft.net/haspaid.jsp?#{query}", :read_timeout => 1).read
|
||||
rescue
|
||||
puts "---"
|
||||
puts "ERROR: failed to check for premium account for '#{ign}'. Minecraft servers down?"
|
||||
puts "---"
|
||||
response = "true"
|
||||
end
|
||||
!(response.casecmp("false") == 0)
|
||||
end
|
||||
|
||||
def correct_case?(ign)
|
||||
begin
|
||||
http = Net::HTTP.start("skins.minecraft.net")
|
||||
skin = http.get("/MinecraftSkins/#{CGI.escape(ign)}.png")
|
||||
http.finish
|
||||
rescue
|
||||
puts "---"
|
||||
puts "ERROR: failed to get skin status code for '#{ign}'. Skin servers down?"
|
||||
puts "---"
|
||||
end
|
||||
skin.code != "404"
|
||||
end
|
||||
|
||||
def get_youtube(yt_name)
|
||||
yt = {channel: yt_name}
|
||||
@@ -67,10 +19,4 @@ require "open-uri"
|
||||
yt
|
||||
end
|
||||
|
||||
def link_user(user, html_options = {})
|
||||
html_options[:class] = "role #{user.role.name} #{html_options[:class]}"
|
||||
link_to(user.name, user, html_options)
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user