lib/ass.rb in ass-0.0.17 vs lib/ass.rb in ass-0.0.18
- old
+ new
@@ -211,11 +211,12 @@
not_found do
erb :not_found
end
error do
- @error = params['captures'].first.inspect
+ @error = "";
+ @error = params['captures'].first.inspect if "#{$mode}".strip == 'development'
end
post '/v1/send' do
app = params[:app]
message = CGI::escape(params[:message] || "")
@@ -226,11 +227,11 @@
# Net::HTTP.post_form(url, post_args1)
# rescue =>err
# puts "#{err.class} ##{err}"
# end
system "curl http://localhost:#{$port}/v1/apps/#{app}/push/#{message}/#{pid}"
- redirect '/' if (params[:app] and params[:message])
+ redirect '/v1/admin/push' if (params[:app] and params[:message])
end
get "/v1/admin/:db" do
protected!
db = params[:db] || 'token'
@@ -240,16 +241,17 @@
@o = []
$apps.each_with_index { |app, index|
@o << Token.where(:app => app).order(:id).reverse.paginate(page, 20)
}
erb :token
- end
- if (db == 'push') then
+ elsif (db == 'push') then
@p = []
$apps.each_with_index { |app, index|
@p << Push.where(:app => app).order(:id).reverse.paginate(page, 20)
}
erb :push
+ else
+ erb :not_found
end
end
$apps.each { |app|
\ No newline at end of file