Guest User

Untitled

a guest
Nov 17th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. # Modified
  2. $:.unshift( File::dirname( __FILE__ ).untaint )
  3. require 'tdiary/application'
  4.  
  5. use Rack::Reloader
  6.  
  7. map '/assets' do
  8. environment = Sprockets::Environment.new
  9. ['js', 'theme', '../tdiary-contrib/js', '../tdiary-theme'].each do |path|
  10. environment.append_path path
  11. end
  12. run environment
  13. end
  14.  
  15. map "/" do
  16. run TDiary::Application.new(:index)
  17. end
  18.  
  19. map "/public" do
  20. require 'rack/file'
  21. run Rack::File.new(File.expand_path(File.join(File.dirname(__FILE__), 'public')))
  22. end
  23.  
  24. map "/index.rb" do
  25. run TDiary::Application.new(:index)
  26. end
  27.  
  28. map "/update.rb" do
  29. use Rack::Auth::Basic do |user, pass|
  30. if File.exist?('.htpasswd')
  31. require 'webrick/httpauth/htpasswd'
  32. htpasswd = WEBrick::HTTPAuth::Htpasswd.new('.htpasswd')
  33. crypted = htpasswd.get_passwd(nil, user, false)
  34. crypted == pass.crypt(crypted) if crypted
  35. else
  36. user == 'user' && pass == 'password'
  37. end
  38. end
  39.  
  40. run TDiary::Application.new(:update)
  41. end
Add Comment
Please, Sign In to add comment