Merge server and rails_3_1
This commit is contained in:
1 parent
d2c2e174ac
commit
86443661e9
42 files changed
+274
-190
No files matched your search
@@ -0,0 +1,42 @@
|
||||
class CentralServerExchangeApp < Sinatra::Base
|
||||
|
||||
before do
|
||||
@site = Site.first
|
||||
end
|
||||
|
||||
|
||||
post "/site/set_registered" do
|
||||
begin
|
||||
private_key = OpenSSL::PKey::RSA.new(@site.private_key)
|
||||
roaming_id = private_key.private_decrypt(request.params['roaming_id'])
|
||||
@site.update_attributes(:roaming_id => roaming_id)
|
||||
body 'true'
|
||||
rescue
|
||||
body 'false'
|
||||
end
|
||||
end
|
||||
|
||||
get '/site/public_key' do
|
||||
begin
|
||||
if @site.public_key.nil?
|
||||
@site.generate_keys
|
||||
@site.save
|
||||
end
|
||||
body @site.public_key
|
||||
rescue
|
||||
body 'false'
|
||||
end
|
||||
end
|
||||
|
||||
post '/purchase/design' do
|
||||
begin
|
||||
private_key = OpenSSL::PKey::RSA.new(@site.private_key)
|
||||
design = PDesign.new.from_json(private_key.private_decrypt(request.params['purchase']))
|
||||
design.save
|
||||
body 'true'
|
||||
rescue
|
||||
body 'false'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -1,22 +0,0 @@
|
||||
require 'mongo'
|
||||
|
||||
module PrototypeR4
|
||||
module GridIO
|
||||
|
||||
def self.included(base)
|
||||
base.class_eval do
|
||||
|
||||
def size
|
||||
(file_length / chunk_size) + (file_length % chunk_size > 0 ? 1 : 0)
|
||||
end
|
||||
|
||||
def each(&block)
|
||||
size.times { block.call(read(chunk_size)) }
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
module LayoutSupport
|
||||
|
||||
def layout
|
||||
Layout.find_by_name(self.layout_name)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,9 @@
|
||||
-----BEGIN PUBLIC KEY-----
|
||||
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0ymPDAHpTOtg0xs1D8Uz
|
||||
8k6Vyzb4NeTZ2R/5KkG0HxQr6aseuzJPs6BO1/txTBrKgjsDH1r6HfTIQTtKf+dI
|
||||
xKAzhwf913iofUmWCjDuOJw9yPd1LtY97xPTVI8UdZqztIbgKfGTNt81bV8/Q/0Z
|
||||
Cr9E0PeP4AZbspuFwiDXe0ZfqfTfJDSLQDTUi1BgJgSydzpn1fqAVnxLY87Kq4sc
|
||||
2SIdALGrmxDOquir0zTDrs6BTCi2lPp2gbAqxkfDvM+QQ6bdgQ5RaVLCMPi9r+c1
|
||||
/TkWKAdIPKPZspE6vmoPz7sl/3lKmrUiDCv/TXXeBb1hb2Z62+3fE0zEZ9SBII/+
|
||||
YwIDAQAB
|
||||
-----END PUBLIC KEY-----
|
||||
@@ -0,0 +1,13 @@
|
||||
# encoding: utf-8
|
||||
|
||||
namespace :site do
|
||||
|
||||
task :build => :environment do
|
||||
|
||||
Site.delete_all
|
||||
|
||||
Site.create( :school => 'The Best School', :department => 'Awesome', :valid_locales => [ 'en', 'zh_tw' ], :in_use_locales => [ 'zh_tw', 'en' ])
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
Reference in new issue
Block a user