Sha256: 80a12c0c0791032831c1f9aafdc08db96cbb9ae1171d0dca1d786ba6fe2416a7

Contents?: true

Size: 1.39 KB

Versions: 1

Compression:

Stored size: 1.39 KB

Contents

# -*- coding: utf-8 -*-
require "sinatra"
require "sinatra/contrib"
require "sinatra-websocket"
require "thin"
require "json"

require "./server"
require "./wsserver"

get "/" do
  File.read("index.html")
end

get "/css/:name.css" do
  content_type "text/css", :charset => "utf-8"
  puts "css/#{params[:name]}.css"
  File.read "css/#{params[:name]}.css"
end

get "/js/:name.js" do
  content_type "text/javascript", :charset => "utf-8"
  puts "js/#{params[:name]}.js"
  File.read "js/#{params[:name]}.js"
end

get "/config/*.*" do |file, ext|
  content_type "text/json", :charset => "utf-8"
  puts "#{file}.#{ext}"
  File.read "config/#{file}.#{ext}"
end

get "/open_dialog" do
  dialog_html = <<'EOS'
  <!DOCTYPE html>
  <html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Message Dialog</title>
    <style type="text/css">
    <!--
    body {
      color: #000000;
      background-color: #ffffff;
      overflow: hidden;
      font-size: 12px;
    }
    -->    
    </style>
    </head>
EOS
  dialog_html += "<body>" + params["msg"] + "</body></html>"
end

map "/search" do
  run Search
end

map "/wsserver" do
  res = catch(:halt) do
    run WsServer
  end
  puts res
end

configure do
  set :DoNotReverseLookup, true
  set :logging, false
  set :default_encoding, "utf-8"
  set :server, :thin

  #  Thread.start {
  #  }

end

#\ --port 53492

run Sinatra::Application

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
browser_app_base-0.0.8 lib/template/config.ru