blob: d59eadc03d8c29160ab2d7f444890be227f3766c (
plain)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
 | require 'sinatra'
require 'sinatra/json'
require './fancy_bear/fancy_bear'
class App < Sinatra::Base
  configure :production, :development do
    enable :logging
  end
  get '/' do
    erb :index
  end
  get '/sign-up' do
    erb :sign_up
  end
  post '/sign-up' do
    #
  end
  
  get '/auth-begin' do
    contextio = FancyBear::ContextIO::Auth.new
    
    redirect_url = contextio.connect("#{request['REQUEST_URI']}auth-callback")
    
    redirect to(redirect_url)
  end
  
  get '/auth-callback' do
    erb :auth_callback
  end
  
  get '/initialise-labels' do
    contextio = FancyBear::ContextIO::Label.new('sellevate.hack@gmail.com')
    contextio.create_defaults
    
    redirect to('/')
  end
  
  get '/messages.json' do
    contextio = FancyBear::ContextIO::Message.new('sellevate.hack@gmail.com')
    json contextio.all
  end
end
 |