-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.rb
More file actions
42 lines (35 loc) · 975 Bytes
/
app.rb
File metadata and controls
42 lines (35 loc) · 975 Bytes
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
#
# notmuch-sinatra
# A Ruby / Sinatra / AngularJS GUI for notmuch
# v0.0.1
#
require 'sinatra'
require 'rerun'
get '/' do
File.read "#{Dir.pwd}/index.html"
end
get '/notmuch/search' do
content_type :json
# search = params.keys.join (" AND ")
p params['query'].inspect
IO.popen('notmuch --config=/home/till/.notmuch-config search --format=json '+params['query'])
end
get '/notmuch/show' do
content_type :json
search = params.keys.join (" AND ")
IO.popen('notmuch --config=/home/till/.notmuch-config show --format=json '+search)
end
get '/notmuch/address' do
content_type :json
search = params.keys.join (" AND ")
IO.popen('notmuch --config=/home/till/.notmuch-config addresss --format=json '+search)
end
get '/notmuch/count' do
content_type :json
search = params.keys.join (" AND ")
IO.popen('notmuch --config=/home/till/.notmuch-config count --format=json '+search)
end
not_found do
content_type :json
halt 404, { error: 'URL not found' }.to_json
end