From f5912d511deafa4245881502f2a71734f67c9337 Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Mon, 20 Jun 2016 08:31:32 +0800 Subject: [PATCH 1/2] fix activemaps_path url bug (#559) * fix activemaps_path url bug * annoying doc updates * skip policy scope if redirecting an explore page * lol that would have been dumb --- app/controllers/maps_controller.rb | 10 ++++++++-- doc/production/first-deploy.md | 15 +++++++++++---- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/app/controllers/maps_controller.rb b/app/controllers/maps_controller.rb index e52b1833..0e59f72d 100644 --- a/app/controllers/maps_controller.rb +++ b/app/controllers/maps_controller.rb @@ -39,7 +39,10 @@ class MapsController < ApplicationController # GET /explore/mine def mymaps - return redirect_to activemaps_url if !authenticated? + if !authenticated? + skip_policy_scope + return redirect_to explore_active_path + end page = params[:page].present? ? params[:page] : 1 @maps = policy_scope( @@ -54,7 +57,10 @@ class MapsController < ApplicationController # GET /explore/shared def sharedmaps - return redirect_to activemaps_url if !authenticated? + if !authenticated? + skip_policy_scope + return redirect_to explore_active_path + end page = params[:page].present? ? params[:page] : 1 @maps = policy_scope( diff --git a/doc/production/first-deploy.md b/doc/production/first-deploy.md index 302ed25f..630ac7ce 100644 --- a/doc/production/first-deploy.md +++ b/doc/production/first-deploy.md @@ -47,10 +47,17 @@ Run this in the metamaps directory, still as metamaps: + # fill in DB_* values, and realtime server at least. Change the + # SECRET_KEY_BASE to something new. Ctrl+X to save/exit from nano. cp .example-env .env - nano .env # fill in DB_* values, and realtime server at least. Ctrl+X to save/exit. + nano .env + + # Set up environment variables in your current session + source .env export RAILS_ENV=production - rake db:setup #create, load schema, seed + + # create, load schema, seed + rake db:setup Now set up nginx - config stored on Linode, including relevant environment variables. @@ -61,8 +68,8 @@ Get an SSL certificate and encrypt it for the realtime video. passenger-config restart-app /home/metamaps/metamaps -If this command fails, it may be helpful for debugging to run a test server to -see what problems show up: +If this command fails, it may be helpful for debugging to run a test +server to see what problems show up: RAILS_ENV=production rails server From 720f67cee746c90ec9273960810e9926e033bdb5 Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Wed, 3 Aug 2016 08:54:10 +0800 Subject: [PATCH 2/2] move metacode loading earlier, and add a query string to work around amazon aws CORS issues --- app/assets/javascripts/src/Metamaps.js.erb | 1 + app/views/layouts/_foot.html.erb | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/src/Metamaps.js.erb b/app/assets/javascripts/src/Metamaps.js.erb index a2fd8a21..839d701e 100644 --- a/app/assets/javascripts/src/Metamaps.js.erb +++ b/app/assets/javascripts/src/Metamaps.js.erb @@ -20,6 +20,7 @@ Metamaps.Erb['icons/wildcard.png'] = '<%= asset_path('icons/wildcard.png') %>' Metamaps.Erb['topic_description_signifier.png'] = '<%= asset_path('topic_description_signifier.png') %>' Metamaps.Erb['topic_link_signifier.png'] = '<%= asset_path('topic_link_signifier.png') %>' Metamaps.Erb['synapse16.png'] = '<%= asset_path('synapse16.png') %>' +Metamaps.Metacodes = <%= Metacode.all.to_json.gsub(%r[(icon.*?)(\"},)], '\1?purple=stupid\2').html_safe %> Metamaps.Settings = { embed: false, // indicates that the app is on a page that is optimized for embedding in iFrames on other web pages diff --git a/app/views/layouts/_foot.html.erb b/app/views/layouts/_foot.html.erb index 6900fa23..b24cbe05 100644 --- a/app/views/layouts/_foot.html.erb +++ b/app/views/layouts/_foot.html.erb @@ -7,7 +7,6 @@ <% else %> Metamaps.Active.Mapper = null; <% end %> - Metamaps.Metacodes = <%= Metacode.all.to_json.html_safe %>; Metamaps.Loading = { loader: new CanvasLoader('loading'),