This commit is contained in:
sylor_huang@126.com 2020-06-17 16:15:01 +08:00
parent 2416e80407
commit cfc797395a
2 changed files with 11 additions and 1 deletions

View File

@ -30,7 +30,7 @@ class MirrorsController < ApplicationController
elsif !shell_clone && Dir.exist?("#{path}/#{image_repo_name}")
system("rm -rf #{path}/#{image_repo_name}")
new_shell_clone = system("cd #{path} && git clone #{image_url}")
Rails.logger.info("shell_clone cd #{path} && git clone #{image_url}: #{new_shell_clone} -- for again")
Rails.logger.info("new_shell_clone cd #{path} && git clone #{image_url}: #{new_shell_clone} -- for again")
if new_shell_clone
render json: {status: 0, message: "re_clone_success"}
else
@ -99,6 +99,15 @@ class MirrorsController < ApplicationController
end
def delete_repo
path = params[:path]
image_repo_name = params[:repo_name]
if Dir.exist?("#{path}/#{image_repo_name}")
system("rm -rf #{path}/#{image_repo_name}")
end
render json: {status: 1, message: "delete_sucess"}
end
private
def check_token

View File

@ -2,4 +2,5 @@ Rails.application.routes.draw do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
get "mirrors/clone", to: "mirrors#clone"
get "mirrors/push", to: "mirrors#push"
get "mirrors/delete_repo", to: "mirrors#delete_repo"
end