]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/api_controller.rb
Potlatch whichways and getway. These aren't really Rails, they're just SQL grafted...
[rails.git] / app / controllers / api_controller.rb
index 976c8bd03c683d06b9187db02942367aab6f33f8..7451a91b9b347bc113731f553eb437fcac380196 100644 (file)
@@ -3,11 +3,18 @@ class ApiController < ApplicationController
   before_filter :authorize
   after_filter :compress_output
 
+  helper :user
+  model :user
+
+  def authorize_web
+    @current_user = User.find_by_token(session[:token])
+  end
+  
   # The maximum area you're allowed to request, in square degrees
   MAX_REQUEST_AREA = 0.25
 
   def map
-    response.headers["Content-Type"] = 'application/xml'
+    response.headers["Content-Type"] = 'text/xml'
     # Figure out the bbox
     bbox = params['bbox']
     unless bbox and bbox.count(',') == 3
@@ -68,7 +75,7 @@ class ApiController < ApplicationController
     # get missing nodes if there are any
     nodes += Node.find(missing_nodes) if missing_nodes.length > 0
 
-    doc = OSM::API.get_xml_doc
+    doc = OSM::API.new.get_xml_doc
 
     # get ways
     # find which ways are needed