diff --git a/config/routes.rb b/config/routes.rb index fa6172096..045835622 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -12,7 +12,7 @@ root to: 'sessions#redirect_to_foodcoop', as: nil - scope '/:foodcoop', foodcoop: /__FOODCOOPS__/ do + scope '/:foodcoop', constraints: {foodcoop: /__FOODCOOPS__/} do use_doorkeeper # Root path diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 4d42deb2b..c400b6486 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -13,6 +13,12 @@ fi FOODSOFT_FOODCOOPS_REGEX=`echo $FOODSOFT_FOODCOOPS | sed 's/ /|/g'` sed -i "s/__FOODCOOPS__/$FOODSOFT_FOODCOOPS_REGEX/g" config/routes.rb +for plugin in $(ls plugins); do + if [ -f "plugins/$plugin/config/routes.rb" ]; then + sed -i "s/__FOODCOOPS__/$FOODSOFT_FOODCOOPS_REGEX/g" plugins/$plugin/config/routes.rb + fi +done + if [ -e app_config.defaults.yml ] ; then cat app_config.defaults.yml > config/app_config.yml diff --git a/plugins/current_orders/config/routes.rb b/plugins/current_orders/config/routes.rb index aeb2b014e..f4c71f3ba 100644 --- a/plugins/current_orders/config/routes.rb +++ b/plugins/current_orders/config/routes.rb @@ -1,5 +1,5 @@ Rails.application.routes.draw do - scope '/:foodcoop' do + scope '/:foodcoop', constraints: {foodcoop: /__FOODCOOPS__/} do namespace :current_orders do resources :ordergroups, only: %i[index show] do collection do diff --git a/plugins/discourse/config/routes.rb b/plugins/discourse/config/routes.rb index 05848c1bd..606a71b04 100644 --- a/plugins/discourse/config/routes.rb +++ b/plugins/discourse/config/routes.rb @@ -1,5 +1,5 @@ Rails.application.routes.draw do - scope '/:foodcoop' do + scope '/:foodcoop', constraints: {foodcoop: /__FOODCOOPS__/} do get '/discourse/callback' => 'discourse_login#callback' get '/discourse/initiate' => 'discourse_login#initiate' get '/discourse/sso' => 'discourse_sso#sso' diff --git a/plugins/documents/config/routes.rb b/plugins/documents/config/routes.rb index c2f970a21..ac71d3a9f 100644 --- a/plugins/documents/config/routes.rb +++ b/plugins/documents/config/routes.rb @@ -1,5 +1,5 @@ Rails.application.routes.draw do - scope '/:foodcoop' do + scope '/:foodcoop', constraints: {foodcoop: /__FOODCOOPS__/} do resources :documents do get :move get :new diff --git a/plugins/links/config/routes.rb b/plugins/links/config/routes.rb index 55d55872d..f82768336 100644 --- a/plugins/links/config/routes.rb +++ b/plugins/links/config/routes.rb @@ -1,5 +1,5 @@ Rails.application.routes.draw do - scope '/:foodcoop' do + scope '/:foodcoop', constraints: {foodcoop: /__FOODCOOPS__/} do resources :links, only: [:show] namespace :admin do diff --git a/plugins/messages/config/routes.rb b/plugins/messages/config/routes.rb index 6d276428d..852c367f5 100644 --- a/plugins/messages/config/routes.rb +++ b/plugins/messages/config/routes.rb @@ -1,5 +1,5 @@ Rails.application.routes.draw do - scope '/:foodcoop' do + scope '/:foodcoop', constraints: {foodcoop: /__FOODCOOPS__/} do resources :messages, only: %i[index show new create] do member do get :thread diff --git a/plugins/polls/config/routes.rb b/plugins/polls/config/routes.rb index ace61b0eb..c25dca4be 100644 --- a/plugins/polls/config/routes.rb +++ b/plugins/polls/config/routes.rb @@ -1,5 +1,5 @@ Rails.application.routes.draw do - scope '/:foodcoop' do + scope '/:foodcoop', constraints: {foodcoop: /__FOODCOOPS__/} do resources :polls do member do get :vote diff --git a/plugins/printer/config/routes.rb b/plugins/printer/config/routes.rb index 33096d5d7..ba89fe449 100644 --- a/plugins/printer/config/routes.rb +++ b/plugins/printer/config/routes.rb @@ -1,5 +1,5 @@ Rails.application.routes.draw do - scope '/:foodcoop' do + scope '/:foodcoop', constraints: {foodcoop: /__FOODCOOPS__/} do namespace :api do namespace :v1 do resources :printer, only: [:show] diff --git a/plugins/wiki/config/routes.rb b/plugins/wiki/config/routes.rb index ad713366a..901680c9d 100644 --- a/plugins/wiki/config/routes.rb +++ b/plugins/wiki/config/routes.rb @@ -1,5 +1,5 @@ Rails.application.routes.draw do - scope '/:foodcoop' do + scope '/:foodcoop', constraints: {foodcoop: /__FOODCOOPS__/} do resources :pages do get :all, on: :collection get :version, on: :member