Merge branch 'standalone_develop' into trustie_server
This commit is contained in:
commit
e6b3634b40
|
@ -217,6 +217,21 @@ class RepositoriesController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def replace_file
|
||||||
|
#删除
|
||||||
|
delete_interactor = Gitea::DeleteFileInteractor.call(current_user.gitea_token, @owner.login, params[:delete_file].merge(identifier: @project.identifier))
|
||||||
|
return render_error(delete_interactor.error) unless delete_interactor.success?
|
||||||
|
#新建
|
||||||
|
interactor = Gitea::CreateFileInteractor.call(current_user.gitea_token, @owner.login, content_params)
|
||||||
|
if interactor.success?
|
||||||
|
@file = interactor.result
|
||||||
|
render_result(0, "替换成功")
|
||||||
|
else
|
||||||
|
render_error(interactor.error)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
def delete_file
|
def delete_file
|
||||||
interactor = Gitea::DeleteFileInteractor.call(current_user.gitea_token, @owner.login, params.merge(identifier: @project.identifier))
|
interactor = Gitea::DeleteFileInteractor.call(current_user.gitea_token, @owner.login, params.merge(identifier: @project.identifier))
|
||||||
if interactor.success?
|
if interactor.success?
|
||||||
|
|
|
@ -10,6 +10,7 @@ module CustomRegexp
|
||||||
IP = /^((\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])\.){3}(\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])$/
|
IP = /^((\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])\.){3}(\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])$/
|
||||||
|
|
||||||
URL_REGEX = /\A(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]+-?)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]+-?)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?\z/i
|
URL_REGEX = /\A(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]+-?)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]+-?)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?\z/i
|
||||||
REPOSITORY_NAME_REGEX = /^[a-zA-Z0-9][a-zA-Z0-9\-\_\.]+[a-zA-Z0-9]$/ #只含有数字、字母、下划线不能以下划线开头和结尾
|
# REPOSITORY_NAME_REGEX = /^[a-zA-Z0-9][a-zA-Z0-9\-\_\.]+[a-zA-Z0-9]$/ #只含有数字、字母、下划线不能以下划线开头和结尾
|
||||||
|
REPOSITORY_NAME_REGEX = /^[a-zA-Z0-9\-\_\.]+[a-zA-Z0-9]$/ #只含有数字、字母、下划线不能以下划线开头和结尾
|
||||||
MD_REGEX = /^.+(\.[m|M][d|D])$/
|
MD_REGEX = /^.+(\.[m|M][d|D])$/
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
user = $redis_cache.hgetall("v2-owner-common:#{contributor["name"]}-#{contributor["email"]}")
|
user = $redis_cache.hgetall("v2-owner-common:#{contributor["name"] || contributor["login"]}-#{contributor["email"]}")
|
||||||
if user.blank?
|
if user.blank?
|
||||||
json.contributions contributor["commits"]
|
json.contributions contributor["commits"] || contributor["contributions"]
|
||||||
json.login nil
|
json.login nil
|
||||||
json.type nil
|
json.type nil
|
||||||
json.name contributor["name"].downcase
|
json.name (contributor["name"] || contributor["login"]).to_s.downcase
|
||||||
json.email contributor["email"]
|
json.email contributor["email"]
|
||||||
json.image_url User::Avatar.get_letter_avatar_url(contributor["name"])
|
json.image_url User::Avatar.get_letter_avatar_url(contributor["name"] || contributor["login"])
|
||||||
json.contribution_perc User.new(login: contributor["name"], mail: contributor["email"]).simple_contribution_perc(project, contributor["contribution_perc"])
|
json.contribution_perc User.new(login: (contributor["name"] || contributor["login"]), mail: contributor["email"]).simple_contribution_perc(project, contributor["contribution_perc"])
|
||||||
else
|
else
|
||||||
json.contributions contributor["commits"]
|
json.contributions contributor["commits"] || contributor["contributions"]
|
||||||
json.id user["id"]
|
json.id user["id"]
|
||||||
json.login user["login"]
|
json.login user["login"]
|
||||||
json.email user["email"]
|
json.email user["email"]
|
||||||
json.type user["type"]
|
json.type user["type"]
|
||||||
json.name user["name"].downcase
|
json.name (user["name"] || contributor["name"] || contributor["login"]).to_s.downcase
|
||||||
json.image_url user["avatar_url"]
|
json.image_url user["avatar_url"]
|
||||||
db_user = User.find_by_id(user["id"])
|
db_user = User.find_by_id(user["id"])
|
||||||
json.contribution_perc db_user.simple_contribution_perc(project, contributor["contribution_perc"]) if db_user.present?
|
json.contribution_perc db_user.simple_contribution_perc(project, contributor["contribution_perc"]) if db_user.present?
|
||||||
|
|
|
@ -526,6 +526,7 @@ Rails.application.routes.draw do
|
||||||
get :tags
|
get :tags
|
||||||
get :contributors
|
get :contributors
|
||||||
post :create_file
|
post :create_file
|
||||||
|
post :replace_file
|
||||||
put :update_file
|
put :update_file
|
||||||
delete :delete_file
|
delete :delete_file
|
||||||
post :repo_hook
|
post :repo_hook
|
||||||
|
|
Loading…
Reference in New Issue