Guest User

Untitled

a guest
Nov 17th, 2018
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. # Original
  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 "/index.rb" do
  20. run TDiary::Application.new(:index)
  21. end
  22.  
  23. map "/update.rb" do
  24. use Rack::Auth::Basic do |user, pass|
  25. if File.exist?('.htpasswd')
  26. require 'webrick/httpauth/htpasswd'
  27. htpasswd = WEBrick::HTTPAuth::Htpasswd.new('.htpasswd')
  28. crypted = htpasswd.get_passwd(nil, user, false)
  29. crypted == pass.crypt(crypted) if crypted
  30. else
  31. user == 'user' && pass == 'password'
  32. end
  33. end
  34.  
  35. run TDiary::Application.new(:update)
  36. end
Add Comment
Please, Sign In to add comment