summaryrefslogtreecommitdiff
path: root/app/controllers/status_controller.rb
blob: 1b726bc30d88f2da2e6af6e2741f1555b5576813 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
class StatusController < ApplicationController
  def show
    if params[:check]
      if params[:check].downcase == "minecraft"
        if port_open?("redstoner.com", 25565)
          send_file "app/assets/images/on.png", :type => "image/png", :disposition => "inline"
        else
          send_file "app/assets/images/off.png", :type => "image/png", :disposition => "inline"
        end
      elsif params[:check].downcase == "teamspeak"
        if port_open?("redstoner.com", 9987)
          send_file "app/assets/images/on.png", :type => "image/png", :disposition => "inline"
        else
          send_file "app/assets/images/off.png", :type => "image/png", :disposition => "inline"
        end
      else
        render :text => "invalid params"
      end
    end
  end
end