]> git.openstreetmap.org Git - rails.git/blobdiff - app/views/site/_potlatch2.html.erb
Implement automatic OAuth setup for Potlatch 2
[rails.git] / app / views / site / _potlatch2.html.erb
index 705b9139c28b2c2373dbefb356f8575ffc99b6cd..5b072476396e9fa9be3aa308d26ab315edd5e3bf 100644 (file)
@@ -3,6 +3,9 @@
 </div>
 
 <%= javascript_include_tag 'swfobject.js' %>
+
+<% token = @user.access_token(POTLATCH2_KEY) %>
+
 <script type="text/javascript" defer="defer">
   var brokenContentSize = $("content").offsetWidth == 0;
   var fo = new SWFObject("/potlatch2/potlatch2.swf?d="+Math.round(Math.random()*1000), "potlatch", "100%", "100%", "9", "#FFFFFF");
     if (lat) { fo.addVariable("lat",lat); }
     if (lon) { fo.addVariable("lon",lon); }
     fo.addVariable("zoom",zoom);
-    fo.addVariable("api","/api/<%= API_VERSION %>/");
-    fo.addVariable("policy","/api/crossdomain.xml");
+    fo.addVariable("api","http://<%= SERVER_URL %>/api/<%= API_VERSION %>/");
+    fo.addVariable("policy","http://<%= SERVER_URL %>/api/crossdomain.xml");
     fo.addVariable("connection","XML");
+    fo.addVariable("oauth_token","<%= token.token %>");
+    fo.addVariable("oauth_token_secret","<%= token.secret %>");
+    fo.addVariable("oauth_consumer_key","<%= token.client_application.key %>");
+    fo.addVariable("oauth_consumer_secret","<%= token.client_application.secret %>");
     fo.write("map");
   }