Deployment via RackUp (static stuff needs to be under public/ for X-Sendfile).
This commit is contained in:
parent
42a8917f5c
commit
29333b0a1d
|
@ -7,7 +7,8 @@ Markaby::Builder.set(:indent, 2)
|
||||||
|
|
||||||
Camping.goes :Anne
|
Camping.goes :Anne
|
||||||
|
|
||||||
IMAGE_DIR = Pathname.new(__FILE__).dirname + "images"
|
PUBLIC_DIR = Pathname.new(__FILE__).dirname + "public"
|
||||||
|
IMAGE_DIR = PUBLIC_DIR + "images"
|
||||||
|
|
||||||
module Anne
|
module Anne
|
||||||
|
|
||||||
|
@ -117,7 +118,8 @@ module Anne::Controllers
|
||||||
def get(file)
|
def get(file)
|
||||||
unless file =~ /\.\./
|
unless file =~ /\.\./
|
||||||
headers["Content-Type"] = "image/png"
|
headers["Content-Type"] = "image/png"
|
||||||
headers["X-Sendfile"] = (IMAGE_DIR + file).to_s
|
headers["X-Sendfile"] =
|
||||||
|
(IMAGE_DIR.relative_path_from(PUBLIC_DIR) + file).to_s
|
||||||
else
|
else
|
||||||
@status = 403
|
@status = 403
|
||||||
"You're not allowed to retrieve #{file}!"
|
"You're not allowed to retrieve #{file}!"
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
#!/usr/bin/env rackup1.8
|
||||||
|
|
||||||
|
$LOAD_PATH.unshift "/home/paul/Projects/anne-survey/lib"
|
||||||
|
|
||||||
|
require "anne-survey"
|
||||||
|
|
||||||
|
Camping::Models::Base.establish_connection( :adapter => 'sqlite3',
|
||||||
|
:database => '/home/paul/.camping.db',
|
||||||
|
:timeout => 10000 )
|
||||||
|
|
||||||
|
run Anne
|
Binary file not shown.
After Width: | Height: | Size: 4.7 KiB |
Reference in New Issue