From d7400b4d3428865434b080b4658657cc99cfa59e Mon Sep 17 00:00:00 2001 From: Z Date: Mon, 2 Mar 2020 17:02:31 +0800 Subject: [PATCH] =?UTF-8?q?/jump=20=E7=99=BB=E9=99=86=E5=90=8E=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/jump_controller.rb | 8 ++++++++ config/routes.rb | 2 ++ 2 files changed, 10 insertions(+) create mode 100644 app/controllers/jump_controller.rb diff --git a/app/controllers/jump_controller.rb b/app/controllers/jump_controller.rb new file mode 100644 index 000000000..37061c98e --- /dev/null +++ b/app/controllers/jump_controller.rb @@ -0,0 +1,8 @@ + +class JumpController < ApplicationController + before_action :authenticate_user! + + def index + redirect_to("//#{params[:destin]}/#{params[:path]}") + end +end diff --git a/config/routes.rb b/config/routes.rb index e43e201a5..4264947dc 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -451,6 +451,8 @@ Rails.application.routes.draw do get '/about/more', to: 'about#more' get '/terms', to: 'about#terms' + get '/jump/:destin/(*path)', to: 'jump#index', :constraints => { :destin => /[0-z\.]+/ } + match '/', via: [:post, :put, :patch, :delete], to: 'application#raise_not_found', format: false match '*unmatched_route', via: :all, to: 'application#raise_not_found', format: false end