Merge pull request 'FIX 代码库二级页面改版以及其他bug' (#172) from develop into dev_trustie_server

This commit is contained in:
jasder 2021-10-09 16:15:12 +08:00
commit 3325ec842d
37 changed files with 1265 additions and 269 deletions

View File

@ -15,7 +15,7 @@ class IssuesController < ApplicationController
include TagChosenHelper
def index
@user_admin_or_member = current_user.present? && current_user.logged? && (current_user.admin || @project.member?(current_user))
@user_admin_or_member = current_user.present? && current_user.logged? && (current_user.admin || @project.member?(current_user) || @project.is_public?)
issues = @project.issues.issue_issue.issue_index_includes
issues = issues.where(is_private: false) unless @user_admin_or_member
@ -453,7 +453,7 @@ class IssuesController < ApplicationController
end
def operate_issue_permission
return render_forbidden("您没有权限进行此操作.") unless current_user.admin? || @project.member?(current_user)
return render_forbidden("您没有权限进行此操作.") unless current_user.present? && current_user.logged? && (current_user.admin? || @project.member?(current_user) || @project.is_public?)
end
def export_issues(issues)

View File

@ -23,9 +23,9 @@ class MainController < ApplicationController
# TODO: 这块之后需要整合者架构重新变化统一跳转到index后再路由分发
if params[:path] && params[:path]&.include?("h5educoderbuild") && params[:path].split("/").first == "h5educoderbuild"
render file: 'public/h5educoderbuild/index.html', :layout => false
render file: 'public/h5educoderbuild/index.html', :layout => false, :content_type=> 'text/html'
else
render file: 'public/react/build/index.html', :layout => false
render file: 'public/react/build/index.html', :layout => false, :content_type=> 'text/html'
end
end

View File

@ -4,7 +4,7 @@ class ProjectsController < ApplicationController
include ProjectsHelper
include Acceleratorable
before_action :require_login, except: %i[index branches group_type_list simple show fork_users praise_users watch_users recommend about menu_list]
before_action :require_login, except: %i[index branches branches_slice group_type_list simple show fork_users praise_users watch_users recommend about menu_list]
before_action :require_profile_completed, only: [:create, :migrate]
before_action :load_repository, except: %i[index group_type_list migrate create recommend]
before_action :authorizate_user_can_edit_project!, only: %i[update]
@ -86,6 +86,13 @@ class ProjectsController < ApplicationController
@branches = result.is_a?(Hash) && result.key?(:status) ? [] : result
end
def branches_slice
return @branches = [] unless @project.forge?
slice_result = Gitea::Repository::Branches::ListSliceService.call(@owner, @project.identifier)
@branches_slice = slice_result.is_a?(Hash) && slice_result.key?(:status) ? [] : slice_result
end
def group_type_list
project_statics = ProjectStatistic.first

View File

@ -1,4 +1,5 @@
class RepositoriesController < ApplicationController
include RepositoriesHelper
include ApplicationHelper
include OperateProjectAbilityAble
include Repository::LanguagesPercentagable
@ -54,16 +55,6 @@ class RepositoriesController < ApplicationController
@entries = Gitea::Repository::Entries::ListService.new(@owner, @project.identifier, ref: @ref).call
@entries = @entries.present? ? @entries.sort_by{ |hash| hash['type'] } : []
@path = Gitea.gitea_config[:domain]+"/#{@project.owner.login}/#{@project.identifier}/raw/branch/#{@ref}/"
# TODO
# 临时处理readme文件问题
result = Gitea::Repository::Readme::GetService.call(@owner.login, @project.identifier, @ref, @owner&.gitea_token)
@readme =
if result[:status] == :success
result[:body]
else
{}
end
end
end
@ -73,6 +64,7 @@ class RepositoriesController < ApplicationController
def sub_entries
file_path_uri = URI.parse(URI.encode(params[:filepath].to_s.strip))
@path = Gitea.gitea_config[:domain]+"/#{@project.owner.login}/#{@project.identifier}/raw/branch/#{@ref}/"
if @project.educoder?
if params[:type] === 'file'
@ -103,10 +95,21 @@ class RepositoriesController < ApplicationController
end
def commits
@hash_commit = Gitea::Repository::Commits::ListService.new(@owner.login, @project.identifier,
sha: params[:sha], page: params[:page], limit: params[:limit], token: current_user&.gitea_token).call
if params[:filepath].present?
file_path_uri = URI.parse(URI.encode(params[:filepath].to_s.strip))
@hash_commit = Gitea::Repository::Commits::FileListService.new(@owner.login, @project.identifier, file_path_uri,
sha: params[:sha], page: params[:page], limit: params[:limit], token: current_user&.gitea_token).call
else
@hash_commit = Gitea::Repository::Commits::ListService.new(@owner.login, @project.identifier,
sha: params[:sha], page: params[:page], limit: params[:limit], token: current_user&.gitea_token).call
end
end
def commits_slice
@hash_commit = Gitea::Repository::Commits::ListSliceService.call(@owner.login, @project.identifier,
sha: params[:sha], page: params[:page], limit: params[:limit], token: current_user&.gitea_token)
end
def commit
@sha = params[:sha]
@commit = Gitea::Repository::Commits::GetService.call(@owner.login, @repository.identifier, @sha, current_user&.gitea_token)
@ -120,7 +123,11 @@ class RepositoriesController < ApplicationController
end
def contributors
@contributors = Gitea::Repository::Contributors::GetService.call(@owner, @repository.identifier)
if params[:filepath].present?
@contributors = []
else
@contributors = Gitea::Repository::Contributors::GetService.call(@owner, @repository.identifier)
end
end
def edit
@ -183,10 +190,16 @@ class RepositoriesController < ApplicationController
end
def readme
result = Gitea::Repository::Readme::GetService.call(@owner.login, @repository.identifier, params[:ref], current_user&.gitea_token)
if params[:filepath].present?
result = Gitea::Repository::Readme::DirService.call(@owner.login, @repository.identifier, params[:filepath], params[:ref], current_user&.gitea_token)
else
result = Gitea::Repository::Readme::GetService.call(@owner.login, @repository.identifier, params[:ref], current_user&.gitea_token)
end
@readme = result[:status] === :success ? result[:body] : nil
render json: @readme
@readme['content'] = decode64_content(@readme, @owner, @repository, params[:ref])
render json: @readme.slice("type", "encoding", "size", "name", "path", "content", "sha")
rescue
render json: nil
end
def languages
@ -214,7 +227,7 @@ class RepositoriesController < ApplicationController
file_path = [domain, api_url, url].join
file_path = [file_path, "access_token=#{current_user&.gitea_token}"].join("&") if @repository.hidden?
redirect_to file_path
redirect_to URI.escape(file_path)
end
private
@ -237,8 +250,14 @@ class RepositoriesController < ApplicationController
# TODO 获取最新commit信息
def project_commits
Gitea::Repository::Commits::ListService.new(@project.owner.login, @project.identifier,
sha: get_ref, page: 1, limit: 1, token: current_user&.gitea_token).call
if params[:filepath].present?
file_path_uri = URI.parse(URI.encode(params[:filepath].to_s.strip))
Gitea::Repository::Commits::FileListService.new(@project.owner.login, @project.identifier, file_path_uri,
sha: get_ref, page: 1, limit: 1, token: current_user&.gitea_token).call
else
Gitea::Repository::Commits::ListService.new(@project.owner.login, @project.identifier,
sha: get_ref, page: 1, limit: 1, token: current_user&.gitea_token).call
end
end
def get_statistics

View File

@ -1,14 +1,14 @@
class VersionReleasesController < ApplicationController
before_action :load_repository
before_action :set_user
before_action :require_login, except: [:index]
before_action :find_version , only: [:edit, :update, :destroy]
before_action :require_login, except: [:index, :show]
before_action :check_release_authorize, except: [:index, :show]
before_action :find_version , only: [:show, :edit, :update, :destroy]
def index
version_releases = Gitea::Versions::ListService.new(@user.gitea_token, @user.try(:login), @repository.try(:identifier)).call
@version_releases = version_releases
@version_releases = kaminari_paginate(@repository.version_releases.order(created_at: :desc))
@user_permission = current_user.present? && (@repository.project.all_developers.include?(current_user) || current_user.admin?)
@forge_releases = @repository.version_releases.select(:id,:version_gid, :created_at).includes(:attachments)
@user_admin_permission = current_user.present? && (@repository.project.all_managers.include?(current_user) || current_user.admin?)
end
def new
@ -22,6 +22,10 @@ class VersionReleasesController < ApplicationController
end
end
def show
# @release = Gitea::Versions::GetService.call(current_user.gitea_token, @user&.login, @repository&.identifier, @version&.version_gid)
end
def create
if params[:name].nil?
normal_status(-1, "名称不能为空")
@ -37,13 +41,14 @@ class VersionReleasesController < ApplicationController
version_params = releases_params
version_release = VersionRelease.new(version_params.merge(user_id: current_user.id, repository_id: @repository.id))
if version_release.save!
git_version_release = Gitea::Versions::CreateService.new(@user.gitea_token, @user.try(:login), @repository.try(:identifier), version_params).call
git_version_release = Gitea::Versions::CreateService.new(current_user.gitea_token, @user.try(:login), @repository.try(:identifier), version_params).call
if git_version_release
update_params = {
tarball_url: git_version_release["tarball_url"],
zipball_url: git_version_release["zipball_url"],
url: git_version_release["url"],
version_gid: git_version_release["id"],
sha: git_version_release["sha"]
}
version_release.update_attributes!(update_params)
version_release.project_trends.create(user_id: current_user.id, project_id: @project.id, action_type: "create")
@ -81,7 +86,7 @@ class VersionReleasesController < ApplicationController
if @version.update_attributes!(version_params)
create_attachments(params[:attachment_ids], @version) if params[:attachment_ids].present?
git_version_release = Gitea::Versions::UpdateService.new(@user.gitea_token, @user.try(:login), @repository.try(:identifier), version_params, @version.try(:version_gid)).call
git_version_release = Gitea::Versions::UpdateService.new(current_user.gitea_token, @user.try(:login), @repository.try(:identifier), version_params, @version.try(:version_gid)).call
unless git_version_release
raise Error, "更新失败"
end
@ -102,7 +107,7 @@ class VersionReleasesController < ApplicationController
ActiveRecord::Base.transaction do
begin
if @version.destroy
git_version_release = Gitea::Versions::DeleteService.new(@user.gitea_token, @user.try(:login), @repository.try(:identifier), @version.try(:version_gid)).call
git_version_release = Gitea::Versions::DeleteService.new(current_user.gitea_token, @user.try(:login), @repository.try(:identifier), @version.try(:version_gid)).call
if git_version_release.status == 204
normal_status(0, "删除成功")
@ -157,4 +162,8 @@ class VersionReleasesController < ApplicationController
end
end
def check_release_authorize
return render_forbidden("您没有权限进行此操作.") unless current_user.admin? || @project.manager?(current_user)
end
end

View File

@ -274,6 +274,124 @@ await octokit.request('GET /api/yystopf/ceshi/detail.json')
}
```
## 仓库标签列表
仓库标签列表
> 示例:
```shell
curl -X GET http://localhost:3000/api/yystopf/csfjkkj/tags.json
```
```javascript
await octokit.request('GET /api/yystopf/csfjkkj/tags.json')
```
### HTTP 请求
`GET /api/:owner/:repo/tags.json`
### 请求参数:
参数 | 必选 | 默认 | 类型 | 字段说明
--------- | ------- | ------- | -------- | ----------
|owner |是| |string |用户登录名 |
|repo |是| |string |项目标识identifier |
|page |否| 1 | integer | 页码 |
|limit |否| 20| integer | 每页个数 |
### 返回字段说明:
参数 | 类型 | 字段说明
--------- | ----------- | -----------
|id |int |标签id |
|name |string|标签名称|
|zipball_url |string|标签zip包下载地址|
|tarball_url |string|标签tar包下载地址|
|tagger |object|打标签的人|
|time_ago |string|打标签的时间|
|created_at_unix|string|打标签的时间戳|
|message |string|标签信息|
|commit |object|标签最后一个commit|
|commit.sha |string|commit的id|
|commit.message |string|commit的提交信息|
|commit.time_ago|string|commit的提交时间|
|commit.created_at_unix|string|commit的提交时间戳|
|commit.committer|object|commit的提交者|
|commit.author|object|commit的作者|
> 返回的JSON示例:
```json
[
{
"name": "v2.0.0",
"id": "c7d0873ee41796d1a0e193063095ccf539a9bf31",
"zipball_url": "http://localhost:3000/api/yystopf/csfjkkj/archive/v2.0.0.zip",
"tarball_url": "http://localhost:3000/api/yystopf/csfjkkj/archive/v2.0.0.tar.gz",
"tagger": {
"id": 4,
"login": "testforge1",
"name": "testforge1",
"image_url": "system/lets/letter_avatars/2/T/19_237_174/120.png"
},
"time_ago": "1天前",
"created_at_unix": 1632376903,
"message": "jdfkls",
"commit": {
"sha": "08fe383f1e5ebe2e2a384a8ea3ee890a758c7cd7",
"message": "add\n",
"time_ago": "1天前",
"created_at_unix": 1632376186,
"committer": {
"id": 4,
"login": "testforge1",
"name": "testforge1",
"image_url": "system/lets/letter_avatars/2/T/19_237_174/120.png"
},
"author": {
"id": 4,
"login": "testforge1",
"name": "testforge1",
"image_url": "system/lets/letter_avatars/2/T/19_237_174/120.png"
}
}
},
{
"name": "v1.0.0",
"id": "12168ad39c3ef201a445a2db181a3e43d50e40dd",
"zipball_url": "http://localhost:3000/api/yystopf/csfjkkj/archive/v1.0.0.zip",
"tarball_url": "http://localhost:3000/api/yystopf/csfjkkj/archive/v1.0.0.tar.gz",
"tagger": {
"id": null,
"login": "viletyy",
"name": "viletyy",
"image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png"
},
"time_ago": "10天前",
"created_at_unix": 1631588042,
"message": "dfks",
"commit": {
"sha": "5291b5e45a377c1f7710cc6647259887ed7aaccf",
"message": "ADD file via upload\n",
"time_ago": "21天前",
"created_at_unix": 1630648417,
"committer": {
"id": null,
"login": "yystopf",
"name": "yystopf",
"image_url": "system/lets/letter_avatars/2/Y/241_125_89/120.png"
},
"author": {
"id": null,
"login": "yystopf",
"name": "yystopf",
"image_url": "system/lets/letter_avatars/2/Y/241_125_89/120.png"
}
}
}
]
```
## 编辑仓库信息
编辑仓库信息
@ -868,6 +986,128 @@ await octokit.request('GET /api/jasder/jasder_test/sub_entries.json')
Success Data.
</aside>
## 获取仓库README文件
获取仓库README文件
> 示例:
```shell
curl -X GET \
-d "ref=master" \
-d "filepath=lib" \
http://localhost:3000/api/yystopf/csfjkkj/readme.json
```
```javascript
await octokit.request('GET /api/yystopf/csfjkkj/readme.json')
```
### HTTP 请求
`GET /api/:owner/:repo/readme.json`
### 请求参数:
参数 | 必选 | 默认 | 类型 | 字段说明
--------- | ------- | ------- | -------- | ----------
|owner |是| |string |用户登录名 |
|repo |是| |string |项目标识identifier |
|ref |否| | string |分支名称、tag名称或是提交记录id默认为默认分支 |
|filepath |否| | string |子目录名称,默认为空 |
### 返回字段说明:
参数 | 类型 | 字段说明
--------- | ----------- | -----------
|type |string|文件类型, file:文件dir文件目录
|encoding |string |编码 |
|size |int|文件夹或文件大小 单位B
|name |string|文件夹或文件名称|
|path |string|文件夹或文件相对路径|
|content |string|文件内容
|sha |string|文件commitid
> 返回的JSON示例:
```json
{
"type": "file",
"encoding": "base64",
"size": 24,
"name": "README.md",
"path": "lib/README.md",
"content": "ZGZhc2RhZGpmIGRrZnNsCgpzZGZkZnMK",
"sha": "860962cd21c60b1a9e07d723080c87c32c18d44a"
}
```
<aside class="success">
Success Data.
</aside>
## 获取仓库贡献者
获取仓库贡献者
> 示例:
```shell
curl -X GET \
-d "ref=master" \
-d "filepath=lib" \
http://localhost:3000/api/yystopf/csfjkkj/contributors.json
```
```javascript
await octokit.request('GET /api/yystopf/csfjkkj/contributors.json')
```
### HTTP 请求
`GET /api/:owner/:repo/contributors.json`
### 请求参数:
参数 | 必选 | 默认 | 类型 | 字段说明
--------- | ------- | ------- | -------- | ----------
|owner |是| |string |用户登录名 |
|repo |是| |string |项目标识identifier |
|ref |否| | string |分支名称、tag名称或是提交记录id默认为整个仓库 |
|filepath |否| | string |子目录名称,默认为空 |
### 返回字段说明:
参数 | 类型 | 字段说明
--------- | ----------- | -----------
|total_count |integer|贡献者数量|
|contributions |integer|贡献数量|
|login |string |用户登录名 |
|type |string|用户类型 |
|name |string|用户昵称|
|image_url |string|用户头像|
> 返回的JSON示例:
```json
{
"contributors": [
{
"contributions": 5,
"login": "testforge2",
"type": "User",
"name": "testforge2",
"image_url": "system/lets/letter_avatars/2/T/236_177_85/120.png"
},
{
"contributions": 79,
"login": "yystopf",
"type": "User",
"name": "yystopf",
"image_url": "system/lets/letter_avatars/2/Y/241_125_89/120.png"
}
],
"total_count": 2
}
```
<aside class="success">
Success Data.
</aside>
## 获取仓库webhooks列表
获取仓库webhooks列表

View File

@ -434,6 +434,10 @@ module ApplicationHelper
User.find_by_login login
end
def find_user_by_login_and_mail(login, mail)
User.find_by(login: login, mail: mail)
end
def find_user_by_gitea_uid(gitea_uid)
User.find_by(gitea_uid: gitea_uid)
end

View File

@ -6,16 +6,16 @@ module RepositoriesHelper
def render_decode64_content(str)
return nil if str.blank?
Base64.decode64(str).force_encoding("UTF-8")
Base64.decode64(str).force_encoding("UTF-8").encode("UTF-8", invalid: :replace)
end
def download_type(str)
default_type = %w(xlsx xls ppt pptx pdf zip 7z rar exe pdb obj idb png jpg gif tif psd svg RData rdata doc docx mpp vsdx dot otf eot ttf woff woff2)
default_type = %w(xlsx xls ppt pptx pdf zip 7z rar exe pdb obj idb RData rdata doc docx mpp vsdx dot otf eot ttf woff woff2)
default_type.include?(str&.downcase)
end
def image_type?(str)
default_type = %w(png jpg gif tif psd svg gif bmp webp jpeg)
default_type = %w(png jpg gif tif psd svg bmp webp jpeg)
default_type.include?(str&.downcase)
end
@ -26,9 +26,13 @@ module RepositoriesHelper
end
def render_commit_author(author_json)
return nil if author_json.blank? || author_json["id"].blank?
# find_user_by_login author_json['name']
find_user_by_gitea_uid author_json['id']
return nil if author_json.blank? || (author_json["id"].blank? && author_json['name'].blank?)
if author_json["id"].present?
return find_user_by_gitea_uid author_json['id']
end
if author_json["id"].nil? && (author_json["name"].present? && author_json["email"].present?)
return find_user_by_login_and_mail(author_json['name'], author_json["email"])
end
end
def readme_render_decode64_content(str, path)
@ -79,12 +83,15 @@ module RepositoriesHelper
def decode64_content(entry, owner, repo, ref, path=nil)
if is_readme?(entry['type'], entry['name'])
content = Gitea::Repository::Entries::GetService.call(owner, repo.identifier, entry['path'], ref: ref)['content']
content = Gitea::Repository::Entries::GetService.call(owner, repo.identifier, URI.escape(entry['path']), ref: ref)['content']
readme_render_decode64_content(content, path)
else
file_type = File.extname(entry['name'].to_s)[1..-1]
if image_type?(file_type)
return entry['content'].nil? ? Gitea::Repository::Entries::GetService.call(owner, repo.identifier, URI.escape(entry['path']), ref: ref)['content'] : entry['content']
end
if download_type(file_type)
return entry['content'].nil? ? Gitea::Repository::Entries::GetService.call(owner, repo.identifier, entry['path'], ref: ref)['content'] : entry['content']
return entry['content']
end
render_decode64_content(entry['content'])
end

View File

@ -17,6 +17,7 @@
# created_at :datetime not null
# updated_at :datetime not null
# repository_id :integer
# sha :string(255)
#
# Indexes
#
@ -29,4 +30,9 @@ class VersionRelease < ApplicationRecord
has_many :project_trends, as: :trend, dependent: :destroy
scope :releases_size, ->{where(draft: false, prerelease: false).size}
has_many :attachments, as: :container, dependent: :destroy
def update_sha
git_release = Gitea::Versions::GetService.call(user.gitea_token, repository&.owner&.login, repository&.identifier, version_gid)
self.update(sha: git_release["sha"])
end
end

View File

@ -24,7 +24,7 @@ class Gitea::PullRequest::FilesService < Gitea::ClientService
def params
Hash.new.merge(token: token)
end
def url
"/repos/#{owner}/#{repo}/pulls/#{pull_number}/files".freeze
end

View File

@ -0,0 +1,22 @@
class Gitea::Repository::Branches::ListSliceService < Gitea::ClientService
attr_reader :user, :repo
def initialize(user, repo)
@user = user
@repo = repo
end
def call
response = get(url, params)
render_200_response(response)
end
private
def params
Hash.new.merge(token: user.gitea_token)
end
def url
"/repos/#{user.login}/#{repo}/branches/branches_slice".freeze
end
end

View File

@ -0,0 +1,43 @@
# Get a list of all commits from a repository
class Gitea::Repository::Commits::FileListService < Gitea::ClientService
attr_reader :owner, :repo_name, :filepath, :args
# sha: SHA or branch to start listing commits from (usually 'master')
# ex:
# Gitea::Repository::Commits::ListService.new(@project.owner.login, @project.identifier,
# sha: params[:sha], page: params[:page], limit: params[:limit], token: current_user&.gitea_token).call
def initialize(owner, repo_name, filepath, **args)
@owner = owner
@repo_name = repo_name
@filepath = filepath
@args = args
end
def call
response = get(url, params)
render_result(response)
end
private
def params
{sha: args[:sha] || 'master', page: args[:page] || PAGINATE_DEFAULT_PAGE, limit: args[:limit] || PAGINATE_DEFAULT_LIMIT, token: args[:token] || "" }
end
def url
"/repos/#{owner}/#{repo_name}/file_commits/#{filepath}".freeze
end
def render_result(response)
case response.status
when 200
result = {}
headers = response.headers.to_hash
body = JSON.parse(response.body)
total_count = headers["x-total"]
result.merge(total_count: total_count.to_i, body: body)
else
nil
# {status: -1, message: "#{body['message']}"}
end
end
end

View File

@ -0,0 +1,42 @@
# Get a list of all commits from a repository
class Gitea::Repository::Commits::ListSliceService < Gitea::ClientService
attr_reader :owner, :repo_name, :args
# sha: SHA or branch to start listing commits from (usually 'master')
# ex:
# Gitea::Repository::Commits::ListService.new(@project.owner.login, @project.identifier,
# sha: params[:sha], page: params[:page], limit: params[:limit], token: current_user&.gitea_token).call
def initialize(owner, repo_name, **args)
@owner = owner
@repo_name = repo_name
@args = args
end
def call
response = get(url, params)
render_result(response)
end
private
def params
{ sha: args[:sha] || 'master', page: args[:page] || PAGINATE_DEFAULT_PAGE, limit: args[:limit] || PAGINATE_DEFAULT_LIMIT, token: args[:token] || "" }
end
def url
"/repos/#{owner}/#{repo_name}/commits_slice".freeze
end
def render_result(response)
case response.status
when 200
result = {}
headers = response.headers.to_hash
body = JSON.parse(response.body)
total_count = headers["x-total"]
result.merge(total_count: total_count.to_i, body: body)
else
nil
# {status: -1, message: "#{body['message']}"}
end
end
end

View File

@ -0,0 +1,34 @@
class Gitea::Repository::Readme::DirService < Gitea::ClientService
attr_reader :owner, :repo, :ref, :dir, :token
def initialize(owner, repo, dir, ref='', token=nil)
@owner = owner
@repo = repo
@dir = dir
@ref = ref
@token = token
end
def call
response = get(url, params)
status, message, body = render_response(response)
json_format(status, message, body)
end
private
def params
Hash.new.merge(token: token, ref: ref)
end
def url
"/repos/#{owner}/#{repo}/readme/#{dir}".freeze
end
def json_format(status, message, body)
case status
when 200 then success(body)
when 404 then error(message, 404)
else error(message, status)
end
end
end

View File

@ -0,0 +1,37 @@
# Get a list of all commits from a repository
class Gitea::Versions::GetService < Gitea::ClientService
attr_reader :token, :user_name, :repo, :gid, :args
# sha: SHA or branch to start listing commits from (usually 'master')
def initialize(token, user_name, repo, gid, args={})
@token = token
@user_name = user_name
@repo = repo
@gid = gid
@args = args
end
def call
response = get(url, params)
render_result(response)
end
private
def params
args.merge(token: token)
end
def url
"/repos/#{@user_name}/#{@repo}/releases/#{@gid}".freeze
end
def render_result(response)
body = JSON.parse(response.body)
case response.status
when 200
body
else
{status: -1, message: "#{body['message']}"}
end
end
end

View File

@ -8,27 +8,25 @@ class Repositories::DetailService < ApplicationService
end
def call
if @repo.project.educoder?
return {
repo: {},
release: [],
branch: [],
tag: [],
contributor: [],
language: {},
readme: {}
}
else
return {
repo: repo_suitable,
release: release_suitable,
branch: branch_suitable,
tag: tag_suitable,
contributor: contributor_suitable,
language: language_suitable,
readme: readme_suitable
}
end
return {
repo: repo_suitable,
release: release_suitable,
branch: branch_suitable,
tag: tag_suitable,
contributor: contributor_suitable,
language: language_suitable
}
rescue
return {
repo: {},
release: [],
branch: [],
branch_type: [],
tag: [],
contributor: [],
language: {},
readme: {}
}
end
private
@ -43,7 +41,7 @@ class Repositories::DetailService < ApplicationService
def branch_suitable
branches = Gitea::Repository::Branches::ListService.call(@owner, @repo.identifier)
branches.is_a?(Hash) && branches[:status] == :error ? [] : branches
branches.is_a?(Hash) && branches.key?(:status) ? [] : branches
end
def tag_suitable
@ -60,9 +58,4 @@ class Repositories::DetailService < ApplicationService
result = Gitea::Repository::Languages::ListService.call(@owner.login, @repo.identifier, @user&.gitea_token)
result[:status] === :success ? hash_transform_precentagable(result[:body]) : nil
end
def readme_suitable
result = Gitea::Repository::Readme::GetService.call(@owner.login, @repo.identifier, @repo.default_branch, @owner.gitea_token)
result[:status] === :success ? result[:body] : nil
end
end

View File

@ -1,5 +1,9 @@
json.id organization.id
json.name organization.login
json.nickname organization.nickname.blank? ? organization.name : organization.nickname
json.description organization.description
json.avatar_url url_to_avatar(organization)
if organization.present?
json.id organization.id
json.name organization.login
json.nickname organization.nickname.blank? ? organization.name : organization.nickname
json.description organization.description
json.avatar_url url_to_avatar(organization)
else
nil
end

View File

@ -1,3 +1,6 @@
json.partial! "detail", team: @team, organization: @organization
json.is_admin @is_admin
json.is_member @is_member
json.is_member @is_member
json.organization do
json.partial! "organizations/organizations/simple", organization: @organization
end

View File

@ -11,7 +11,11 @@ json.array! @branches do |branch|
json.message branch['commit']['message']
json.timestamp render_unix_time(branch['commit']['timestamp'])
json.time_from_now time_from_now(branch['commit']['timestamp'])
json.author branch['commit']['author']
json.committer branch['commit']['committer']
json.author do
json.partial! 'repositories/commit_author', user: render_commit_author(branch['commit']['author']), name: branch['commit']['author']['name']
end
json.committer do
json.partial! 'repositories/commit_author', user: render_commit_author(branch['commit']['committer']), name: branch['commit']['committer']['name']
end
end
end

View File

@ -0,0 +1,24 @@
json.array! @branches_slice do |branch_slice|
json.branch_type branch_slice['branch_name']
json.list branch_slice['branches'].each do |branch|
json.name branch['name']
json.user_can_push branch['user_can_push']
json.user_can_merge branch['user_can_merge']
json.protected branch['protected']
json.http_url render_http_url(@project)
json.zip_url render_zip_url(@owner, @repository, branch['name'])
json.tar_url render_tar_url(@owner, @repository, branch['name'])
json.last_commit do
json.sha branch['commit']['id']
json.message branch['commit']['message']
json.timestamp render_unix_time(branch['commit']['timestamp'])
json.time_from_now time_from_now(branch['commit']['timestamp'])
json.author do
json.partial! 'repositories/commit_author', user: render_commit_author(branch['commit']['author']), name: branch['commit']['author']['name']
end
json.committer do
json.partial! 'repositories/commit_author', user: render_commit_author(branch['commit']['committer']), name: branch['commit']['committer']['name']
end
end
end
end

View File

@ -5,7 +5,8 @@ json.project_identifier @project.identifier
json.pr_time time_from_now(@pull_request.updated_at)
json.commits_count @pull_request.commits_count
json.files_count @pull_request.files_count
json.comments_count @pull_request.comments_count
json.comments_count @issue.journals.parent_journals.size
json.comments_total_count @issue.get_journals_size
json.pull_request do
json.extract! @pull_request, :id,:base, :head, :status,:fork_project_id, :is_original

View File

@ -26,9 +26,9 @@ if @project.forge?
end
json.author do
json.partial! 'commit_author', user: render_commit_author(commit['author']), name: commit['commit']['author']['name']
json.partial! 'commit_author', user: render_commit_author(commit['commit']['author']), name: commit['commit']['author']['name']
end
json.committer do
json.partial! 'commit_author', user: render_commit_author(commit['committer']), name: commit['commit']['committer']['name']
json.partial! 'commit_author', user: render_commit_author(commit['commit']['committer']), name: commit['commit']['committer']['name']
end
end

View File

@ -2,10 +2,12 @@ if user
json.id user.id
json.login user.login
json.name user.real_name
json.type user&.type
json.image_url url_to_avatar(user)
else
json.id nil
json.login name
json.name name
json.type nil
json.image_url User::Avatar.get_letter_avatar_url(name)
end

View File

@ -9,7 +9,7 @@ if @project.forge?
json.type entry['type']
json.size entry['size']
json.content decode64_content(entry, @owner, @repository, @ref)
json.content decode64_content(entry, @owner, @repository, @ref, @path)
json.target entry['target']
download_url =

View File

@ -9,3 +9,4 @@ json.parents @commit['parents'] do |parent|
json.sha parent['sha']
# json.url EduSetting.get('host_name') + commit_repository_path(@repo, parent['sha'])
end
json.branch @commit['branch']

View File

@ -7,25 +7,31 @@ else
json.array! @hash_commit[:body] do |commit|
commiter = commit['committer']
forge_user =
if commiter.present?
User.simple_select.find_by(gitea_uid: commiter['id'])
end
# forge_user =
# if commiter.present?
# User.simple_select.find_by(gitea_uid: commiter['id'])
# end
json.sha commit['sha']
json.message commit['commit']['message']
json.timestamp render_unix_time(commit['commit']['author']['date'])
json.time_from_now time_from_now(commit['commit']['author']['date'])
if forge_user
json.partial! 'author', user: forge_user
else
json.author do
json.id nil
json.login commit['commit']['author']['name']
json.type nil
json.name commit['commit']['author']['name']
json.image_url User::Avatar.get_letter_avatar_url(commit['commit']['author']['name'])
end
# if forge_user
# json.partial! 'author', user: forge_user
# else
# json.author do
# json.id nil
# json.login commit['commit']['author']['name']
# json.type nil
# json.name commit['commit']['author']['name']
# json.image_url User::Avatar.get_letter_avatar_url(commit['commit']['author']['name'])
# end
# end
json.author do
json.partial! 'commit_author', user: render_commit_author(commit['commit']['author']), name: commit['commit']['author']['name']
end
json.committer do
json.partial! 'commit_author', user: render_commit_author(commit['commit']['committer']), name: commit['commit']['committer']['name']
end
end
end

View File

@ -0,0 +1,38 @@
if @hash_commit.blank? #如果有状态值,则表示报错了
json.total_count 0
json.commits []
else
json.total_count @hash_commit[:total_count]
json.commit_dates do
json.array! @hash_commit[:body] do |commit_date|
json.commit_date commit_date["commit_date"]
json.commits do
json.array! commit_date["Commits"] do |commit|
commiter = commit['committer']
forge_user =
if commiter.present?
User.simple_select.find_by(gitea_uid: commiter['id'])
end
json.sha commit['sha']
json.message commit['commit']['message']
json.timestamp render_unix_time(commit['commit']['author']['date'])
json.time_from_now time_from_now(commit['commit']['author']['date'])
if forge_user
json.partial! 'author', user: forge_user
else
json.author do
json.id nil
json.login commit['commit']['author']['name']
json.type nil
json.name commit['commit']['author']['name']
json.image_url User::Avatar.get_letter_avatar_url(commit['commit']['author']['name'])
end
end
end
end
end
end
end

View File

@ -6,7 +6,7 @@ json.contributors @contributors.each do |contributor|
next
end
json.contributions contributor["contributions"]
json.gid contributor["id"]
# json.gid contributor["id"]
json.login user.login
json.type user&.type
json.name user.real_name

View File

@ -1,11 +1,6 @@
json.content @project.content
json.website @project.website
json.lesson_url @project.lesson_url
if @result[:readme].blank?
json.readme nil
else
json.readme @result[:readme].merge(content: readme_render_decode64_content(@result[:readme]["content"], nil))
end
json.identifier render_identifier(@project)
json.invite_code @project.invite_code
json.name @project.name
@ -95,6 +90,6 @@ json.contributors do
end
json.total_count total_count
end
json.languages @result[:language]
json.languages @result[:language].blank? ? nil : @result[:language]
json.partial! 'author', locals: { user: @project.owner }

View File

@ -61,5 +61,4 @@ if @project.forge?
end
end
json.readme @readme.merge(content: readme_render_decode64_content(@readme["content"], nil))
end

View File

@ -4,8 +4,23 @@ json.array! @tags do |tag|
json.id tag['id']
json.zipball_url render_zip_url(@owner, @repository, tag['name'])
json.tarball_url render_tar_url(@owner, @repository, tag['name'])
json.tagger do
json.partial! 'commit_author', user: render_commit_author(tag['tagger']), name: tag['tagger']['name']
end
json.time_ago time_from_now(tag['tagger']['date'].to_time)
json.created_at_unix tag['tagger']['date'].to_time.to_i
json.message tag['message']
json.commit do
json.sha tag['commit']['sha']
json.message tag['commit']['message']
json.time_ago time_from_now(tag['commit']['commiter']['date'].to_time)
json.created_at_unix tag['commit']['commiter']['date'].to_time.to_i
json.committer do
json.partial! 'commit_author', user: render_commit_author(tag['commit']['commiter']), name: tag['commit']['commiter']['name']
end
json.author do
json.partial! 'commit_author', user: render_commit_author(tag['commit']['author']), name: tag['commit']['author']['name']
end
end
end
end

View File

@ -0,0 +1,21 @@
json.version_id version.try(:id)
json.id version&.version_gid
json.tag_name version&.tag_name
json.target_commitish version&.target_commitish
json.name version&.name
json.sha version&.sha
json.body version&.body
json.url version&.url
json.tarball_url render_tar_url(@owner, @repository, version&.tag_name)
json.zipball_url render_zip_url(@owner, @repository, version&.tag_name)
json.draft version&.draft ? "草稿" : (version&.prerelease ? "预发行" : "稳定")
json.created_at format_time(version.created_at.to_s.to_time)
json.published_at format_time(version.created_at.to_s.to_time)
json.user_name user.present? ? user.try(:show_real_name) : ""
json.user_login user&.login
json.image_url user.present? ? url_to_avatar(user) : ""
json.attachments do
json.array! version.try(:attachments) do |attachment|
json.partial! "attachments/attachment_simple", locals: {attachment: attachment}
end
end

View File

@ -1,51 +1,17 @@
json.partial! "commons/success"
json.user_permission @user_permission
json.user_admin_permission @user_admin_permission
# json.releases @version_releases
json.releases do
json.array! @version_releases.to_a.each do |re|
if re.present?
user = User.select(:id, :gitea_uid, :login, :lastname,:firstname, :nickname).find_by_gitea_uid(re["author"]["id"])
version = @forge_releases.find_by(version_gid: re["id"])
if @user_permission && re["draft"]
json.version_id version.try(:id)
json.id re["id"]
json.tag_name re["tag_name"]
json.target_commitish re["target_commitish"]
json.name re["name"]
json.body re["body"]
json.url re["url"]
json.tarball_url render_tar_url(@owner, @repository, re["tag_name"])
json.zipball_url render_zip_url(@owner, @repository, re["tag_name"])
json.draft re["draft"] ? "草稿" : (re["prerelease"] ? "预发行" : "稳定")
json.created_at format_time(version.created_at.to_s.to_time)
json.published_at format_time(version.created_at.to_s.to_time)
json.user_name user.present? ? user.try(:show_real_name) : ""
json.image_url user.present? ? url_to_avatar(user) : ""
else
unless re["draft"]
json.version_id version.try(:id)
json.id re["id"]
json.tag_name re["tag_name"]
json.target_commitish re["target_commitish"]
json.name re["name"]
json.body re["body"]
json.url re["url"]
json.tarball_url render_tar_url(@owner, @repository, re["tag_name"])
json.zipball_url render_zip_url(@owner, @repository, re["tag_name"])
json.draft re["draft"] ? "草稿" : (re["prerelease"] ? "预发行" : "稳定")
json.created_at format_time(version.created_at.to_s.to_time)
json.published_at format_time(version.created_at.to_s.to_time)
json.user_name user.present? ? user.try(:show_real_name) : ""
json.image_url user.present? ? url_to_avatar(user) : ""
end
end
json.attachments do
json.array! version.try(:attachments) do |attachment|
json.partial! "attachments/attachment_simple", locals: {attachment: attachment}
end
json.array! @version_releases.each do |version|
version.update_sha if version.sha.nil?
if @user_permission && version&.draft
json.partial! "version_release", locals: {version: version, user: version&.user}
else
unless version&.draft
json.partial! "version_release", locals: {version: version, user: version&.user}
end
end
end
end
json.total_count @version_releases.total_count

View File

@ -0,0 +1,2 @@
json.partial! "version_release", locals: {version: @version, user: @version&.user}

View File

@ -416,6 +416,7 @@ Rails.application.routes.draw do
member do
get :menu_list
get :branches
get :branches_slice
get :simple
get :watchers, to: 'projects#watch_users'
get :stargazers, to: 'projects#praise_users'
@ -431,6 +432,7 @@ Rails.application.routes.draw do
get :entries
match :sub_entries, :via => [:get, :put]
get :commits
get :commits_slice
get :tags
get :contributors
post :create_file
@ -526,7 +528,7 @@ Rails.application.routes.draw do
resources :forks, only: [:create]
resources :project_trends, :path => :activity, only: [:index, :create]
resources :issue_tags, :path => :labels, only: [:create, :edit, :update, :destroy, :index]
resources :version_releases, :path => :releases, only: [:index,:new, :create, :edit, :update, :destroy]
resources :version_releases, :path => :releases, only: [:index,:new, :show, :create, :edit, :update, :destroy]
scope module: :ci do
scope do

View File

@ -0,0 +1,5 @@
class AddShaToVersionReleases < ActiveRecord::Migration[5.2]
def change
add_column :version_releases, :sha, :string
end
end

View File

@ -469,6 +469,9 @@
<li>
<a href="#ba8983357c" class="toc-h2 toc-link" data-title="仓库详情(新版)">仓库详情(新版)</a>
</li>
<li>
<a href="#46a7ce7681" class="toc-h2 toc-link" data-title="仓库标签列表">仓库标签列表</a>
</li>
<li>
<a href="#af9709123a" class="toc-h2 toc-link" data-title="编辑仓库信息">编辑仓库信息</a>
</li>
@ -499,6 +502,12 @@
<li>
<a href="#fcc64a694b" class="toc-h2 toc-link" data-title="获取仓库代码子目录或者文件">获取仓库代码子目录或者文件</a>
</li>
<li>
<a href="#readme" class="toc-h2 toc-link" data-title="获取仓库README文件">获取仓库README文件</a>
</li>
<li>
<a href="#28d27a81d5" class="toc-h2 toc-link" data-title="获取仓库贡献者">获取仓库贡献者</a>
</li>
<li>
<a href="#webhooks" class="toc-h2 toc-link" data-title="获取仓库webhooks列表">获取仓库webhooks列表</a>
</li>
@ -6179,16 +6188,16 @@ http://localhost:3000/api/ceshi1/ceshi_repo1/applied_transfer_projects/organizat
</span><span class="nl">"Shell"</span><span class="p">:</span><span class="w"> </span><span class="s2">"0.1%"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div><h2 id='af9709123a'>编辑仓库信息</h2>
<p>编辑仓库信息</p>
</span></code></pre></div><h2 id='46a7ce7681'>仓库标签列表</h2>
<p>仓库标签列表</p>
<blockquote>
<p>示例:</p>
</blockquote>
<div class="highlight"><pre class="highlight shell tab-shell"><code>curl <span class="nt">-X</span> GET http://localhost:3000/api/jasder/jasder_test/edit.json
</code></pre></div><div class="highlight"><pre class="highlight javascript tab-javascript"><code><span class="k">await</span> <span class="nx">octokit</span><span class="p">.</span><span class="nx">request</span><span class="p">(</span><span class="dl">'</span><span class="s1">GET /api/jasder/jasder_test/edit.json</span><span class="dl">'</span><span class="p">)</span>
<div class="highlight"><pre class="highlight shell tab-shell"><code>curl <span class="nt">-X</span> GET http://localhost:3000/api/yystopf/csfjkkj/tags.json
</code></pre></div><div class="highlight"><pre class="highlight javascript tab-javascript"><code><span class="k">await</span> <span class="nx">octokit</span><span class="p">.</span><span class="nx">request</span><span class="p">(</span><span class="dl">'</span><span class="s1">GET /api/yystopf/csfjkkj/tags.json</span><span class="dl">'</span><span class="p">)</span>
</code></pre></div><h3 id='http-4'>HTTP 请求</h3>
<p><code>GET /api/:owner/:repo/edit.json</code></p>
<p><code>GET /api/:owner/:repo/tags.json</code></p>
<h3 id='2eb6f47757-4'>请求参数:</h3>
<table><thead>
<tr>
@ -6213,6 +6222,20 @@ http://localhost:3000/api/ceshi1/ceshi_repo1/applied_transfer_projects/organizat
<td>string</td>
<td>项目标识identifier</td>
</tr>
<tr>
<td>page</td>
<td></td>
<td>1</td>
<td>integer</td>
<td>页码</td>
</tr>
<tr>
<td>limit</td>
<td></td>
<td>20</td>
<td>integer</td>
<td>每页个数</td>
</tr>
</tbody></table>
<h3 id='7447e4874e-4'>返回字段说明:</h3>
<table><thead>
@ -6223,6 +6246,197 @@ http://localhost:3000/api/ceshi1/ceshi_repo1/applied_transfer_projects/organizat
</tr>
</thead><tbody>
<tr>
<td>id</td>
<td>int</td>
<td>标签id</td>
</tr>
<tr>
<td>name</td>
<td>string</td>
<td>标签名称</td>
</tr>
<tr>
<td>zipball_url</td>
<td>string</td>
<td>标签zip包下载地址</td>
</tr>
<tr>
<td>tarball_url</td>
<td>string</td>
<td>标签tar包下载地址</td>
</tr>
<tr>
<td>tagger</td>
<td>object</td>
<td>打标签的人</td>
</tr>
<tr>
<td>time_ago</td>
<td>string</td>
<td>打标签的时间</td>
</tr>
<tr>
<td>created_at_unix</td>
<td>string</td>
<td>打标签的时间戳</td>
</tr>
<tr>
<td>message</td>
<td>string</td>
<td>标签信息</td>
</tr>
<tr>
<td>commit</td>
<td>object</td>
<td>标签最后一个commit</td>
</tr>
<tr>
<td>commit.sha</td>
<td>string</td>
<td>commit的id</td>
</tr>
<tr>
<td>commit.message</td>
<td>string</td>
<td>commit的提交信息</td>
</tr>
<tr>
<td>commit.time_ago</td>
<td>string</td>
<td>commit的提交时间</td>
</tr>
<tr>
<td>commit.created_at_unix</td>
<td>string</td>
<td>commit的提交时间戳</td>
</tr>
<tr>
<td>commit.committer</td>
<td>object</td>
<td>commit的提交者</td>
</tr>
<tr>
<td>commit.author</td>
<td>object</td>
<td>commit的作者</td>
</tr>
</tbody></table>
<blockquote>
<p>返回的JSON示例:</p>
</blockquote>
<div class="highlight"><pre class="highlight json tab-json"><code><span class="p">[</span><span class="w">
</span><span class="p">{</span><span class="w">
</span><span class="nl">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"v2.0.0"</span><span class="p">,</span><span class="w">
</span><span class="nl">"id"</span><span class="p">:</span><span class="w"> </span><span class="s2">"c7d0873ee41796d1a0e193063095ccf539a9bf31"</span><span class="p">,</span><span class="w">
</span><span class="nl">"zipball_url"</span><span class="p">:</span><span class="w"> </span><span class="s2">"http://localhost:3000/api/yystopf/csfjkkj/archive/v2.0.0.zip"</span><span class="p">,</span><span class="w">
</span><span class="nl">"tarball_url"</span><span class="p">:</span><span class="w"> </span><span class="s2">"http://localhost:3000/api/yystopf/csfjkkj/archive/v2.0.0.tar.gz"</span><span class="p">,</span><span class="w">
</span><span class="nl">"tagger"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"id"</span><span class="p">:</span><span class="w"> </span><span class="mi">4</span><span class="p">,</span><span class="w">
</span><span class="nl">"login"</span><span class="p">:</span><span class="w"> </span><span class="s2">"testforge1"</span><span class="p">,</span><span class="w">
</span><span class="nl">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"testforge1"</span><span class="p">,</span><span class="w">
</span><span class="nl">"image_url"</span><span class="p">:</span><span class="w"> </span><span class="s2">"system/lets/letter_avatars/2/T/19_237_174/120.png"</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="nl">"time_ago"</span><span class="p">:</span><span class="w"> </span><span class="s2">"1天前"</span><span class="p">,</span><span class="w">
</span><span class="nl">"created_at_unix"</span><span class="p">:</span><span class="w"> </span><span class="mi">1632376903</span><span class="p">,</span><span class="w">
</span><span class="nl">"message"</span><span class="p">:</span><span class="w"> </span><span class="s2">"jdfkls"</span><span class="p">,</span><span class="w">
</span><span class="nl">"commit"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"sha"</span><span class="p">:</span><span class="w"> </span><span class="s2">"08fe383f1e5ebe2e2a384a8ea3ee890a758c7cd7"</span><span class="p">,</span><span class="w">
</span><span class="nl">"message"</span><span class="p">:</span><span class="w"> </span><span class="s2">"add</span><span class="se">\n</span><span class="s2">"</span><span class="p">,</span><span class="w">
</span><span class="nl">"time_ago"</span><span class="p">:</span><span class="w"> </span><span class="s2">"1天前"</span><span class="p">,</span><span class="w">
</span><span class="nl">"created_at_unix"</span><span class="p">:</span><span class="w"> </span><span class="mi">1632376186</span><span class="p">,</span><span class="w">
</span><span class="nl">"committer"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"id"</span><span class="p">:</span><span class="w"> </span><span class="mi">4</span><span class="p">,</span><span class="w">
</span><span class="nl">"login"</span><span class="p">:</span><span class="w"> </span><span class="s2">"testforge1"</span><span class="p">,</span><span class="w">
</span><span class="nl">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"testforge1"</span><span class="p">,</span><span class="w">
</span><span class="nl">"image_url"</span><span class="p">:</span><span class="w"> </span><span class="s2">"system/lets/letter_avatars/2/T/19_237_174/120.png"</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="nl">"author"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"id"</span><span class="p">:</span><span class="w"> </span><span class="mi">4</span><span class="p">,</span><span class="w">
</span><span class="nl">"login"</span><span class="p">:</span><span class="w"> </span><span class="s2">"testforge1"</span><span class="p">,</span><span class="w">
</span><span class="nl">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"testforge1"</span><span class="p">,</span><span class="w">
</span><span class="nl">"image_url"</span><span class="p">:</span><span class="w"> </span><span class="s2">"system/lets/letter_avatars/2/T/19_237_174/120.png"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="p">{</span><span class="w">
</span><span class="nl">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"v1.0.0"</span><span class="p">,</span><span class="w">
</span><span class="nl">"id"</span><span class="p">:</span><span class="w"> </span><span class="s2">"12168ad39c3ef201a445a2db181a3e43d50e40dd"</span><span class="p">,</span><span class="w">
</span><span class="nl">"zipball_url"</span><span class="p">:</span><span class="w"> </span><span class="s2">"http://localhost:3000/api/yystopf/csfjkkj/archive/v1.0.0.zip"</span><span class="p">,</span><span class="w">
</span><span class="nl">"tarball_url"</span><span class="p">:</span><span class="w"> </span><span class="s2">"http://localhost:3000/api/yystopf/csfjkkj/archive/v1.0.0.tar.gz"</span><span class="p">,</span><span class="w">
</span><span class="nl">"tagger"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"id"</span><span class="p">:</span><span class="w"> </span><span class="kc">null</span><span class="p">,</span><span class="w">
</span><span class="nl">"login"</span><span class="p">:</span><span class="w"> </span><span class="s2">"viletyy"</span><span class="p">,</span><span class="w">
</span><span class="nl">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"viletyy"</span><span class="p">,</span><span class="w">
</span><span class="nl">"image_url"</span><span class="p">:</span><span class="w"> </span><span class="s2">"system/lets/letter_avatars/2/V/39_141_222/120.png"</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="nl">"time_ago"</span><span class="p">:</span><span class="w"> </span><span class="s2">"10天前"</span><span class="p">,</span><span class="w">
</span><span class="nl">"created_at_unix"</span><span class="p">:</span><span class="w"> </span><span class="mi">1631588042</span><span class="p">,</span><span class="w">
</span><span class="nl">"message"</span><span class="p">:</span><span class="w"> </span><span class="s2">"dfks"</span><span class="p">,</span><span class="w">
</span><span class="nl">"commit"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"sha"</span><span class="p">:</span><span class="w"> </span><span class="s2">"5291b5e45a377c1f7710cc6647259887ed7aaccf"</span><span class="p">,</span><span class="w">
</span><span class="nl">"message"</span><span class="p">:</span><span class="w"> </span><span class="s2">"ADD file via upload</span><span class="se">\n</span><span class="s2">"</span><span class="p">,</span><span class="w">
</span><span class="nl">"time_ago"</span><span class="p">:</span><span class="w"> </span><span class="s2">"21天前"</span><span class="p">,</span><span class="w">
</span><span class="nl">"created_at_unix"</span><span class="p">:</span><span class="w"> </span><span class="mi">1630648417</span><span class="p">,</span><span class="w">
</span><span class="nl">"committer"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"id"</span><span class="p">:</span><span class="w"> </span><span class="kc">null</span><span class="p">,</span><span class="w">
</span><span class="nl">"login"</span><span class="p">:</span><span class="w"> </span><span class="s2">"yystopf"</span><span class="p">,</span><span class="w">
</span><span class="nl">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"yystopf"</span><span class="p">,</span><span class="w">
</span><span class="nl">"image_url"</span><span class="p">:</span><span class="w"> </span><span class="s2">"system/lets/letter_avatars/2/Y/241_125_89/120.png"</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="nl">"author"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="nl">"id"</span><span class="p">:</span><span class="w"> </span><span class="kc">null</span><span class="p">,</span><span class="w">
</span><span class="nl">"login"</span><span class="p">:</span><span class="w"> </span><span class="s2">"yystopf"</span><span class="p">,</span><span class="w">
</span><span class="nl">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"yystopf"</span><span class="p">,</span><span class="w">
</span><span class="nl">"image_url"</span><span class="p">:</span><span class="w"> </span><span class="s2">"system/lets/letter_avatars/2/Y/241_125_89/120.png"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">]</span><span class="w">
</span></code></pre></div><h2 id='af9709123a'>编辑仓库信息</h2>
<p>编辑仓库信息</p>
<blockquote>
<p>示例:</p>
</blockquote>
<div class="highlight"><pre class="highlight shell tab-shell"><code>curl <span class="nt">-X</span> GET http://localhost:3000/api/jasder/jasder_test/edit.json
</code></pre></div><div class="highlight"><pre class="highlight javascript tab-javascript"><code><span class="k">await</span> <span class="nx">octokit</span><span class="p">.</span><span class="nx">request</span><span class="p">(</span><span class="dl">'</span><span class="s1">GET /api/jasder/jasder_test/edit.json</span><span class="dl">'</span><span class="p">)</span>
</code></pre></div><h3 id='http-5'>HTTP 请求</h3>
<p><code>GET /api/:owner/:repo/edit.json</code></p>
<h3 id='2eb6f47757-5'>请求参数:</h3>
<table><thead>
<tr>
<th>参数</th>
<th>必选</th>
<th>默认</th>
<th>类型</th>
<th>字段说明</th>
</tr>
</thead><tbody>
<tr>
<td>owner</td>
<td></td>
<td></td>
<td>string</td>
<td>用户登录名</td>
</tr>
<tr>
<td>repo</td>
<td></td>
<td></td>
<td>string</td>
<td>项目标识identifier</td>
</tr>
</tbody></table>
<h3 id='7447e4874e-5'>返回字段说明:</h3>
<table><thead>
<tr>
<th>参数</th>
<th>类型</th>
<th>字段说明</th>
</tr>
</thead><tbody>
<tr>
<td>identifier</td>
<td>string</td>
<td>仓库标识</td>
@ -6291,9 +6505,9 @@ http://localhost:3000/api/ceshi1/ceshi_repo1/applied_transfer_projects/organizat
<span class="nt">-d</span> <span class="s2">"private=true"</span> <span class="se">\</span>
http://localhost:3000/api/jasder/jasder_test.json
</code></pre></div><div class="highlight"><pre class="highlight javascript tab-javascript"><code><span class="k">await</span> <span class="nx">octokit</span><span class="p">.</span><span class="nx">request</span><span class="p">(</span><span class="dl">'</span><span class="s1">PATCH /api/jasder/jasder_test.json</span><span class="dl">'</span><span class="p">)</span>
</code></pre></div><h3 id='http-5'>HTTP 请求</h3>
</code></pre></div><h3 id='http-6'>HTTP 请求</h3>
<p><code>PATCH /api/:owner/:repo</code></p>
<h3 id='2eb6f47757-5'>请求参数:</h3>
<h3 id='2eb6f47757-6'>请求参数:</h3>
<table><thead>
<tr>
<th>参数</th>
@ -6353,7 +6567,7 @@ http://localhost:3000/api/jasder/jasder_test.json
<td>项目是否私有, true为私有false: 公开,默认为公开</td>
</tr>
</tbody></table>
<h3 id='7447e4874e-5'>返回字段说明:</h3>
<h3 id='7447e4874e-6'>返回字段说明:</h3>
<table><thead>
<tr>
<th>参数</th>
@ -6418,9 +6632,9 @@ http://localhost:3000/api/jasder/jasder_test.json
</blockquote>
<div class="highlight"><pre class="highlight shell tab-shell"><code>curl <span class="nt">-X</span> DELETE http://localhost:3000/api/jasder/jasder_test.json
</code></pre></div><div class="highlight"><pre class="highlight javascript tab-javascript"><code><span class="k">await</span> <span class="nx">octokit</span><span class="p">.</span><span class="nx">request</span><span class="p">(</span><span class="dl">'</span><span class="s1">DELETE /api/jasder/jasder_test.json</span><span class="dl">'</span><span class="p">)</span>
</code></pre></div><h3 id='http-6'>HTTP 请求</h3>
</code></pre></div><h3 id='http-7'>HTTP 请求</h3>
<p><code>PATCH /api/:owner/:repo</code></p>
<h3 id='2eb6f47757-6'>请求参数:</h3>
<h3 id='2eb6f47757-7'>请求参数:</h3>
<table><thead>
<tr>
<th>参数</th>
@ -6445,7 +6659,7 @@ http://localhost:3000/api/jasder/jasder_test.json
<td>项目标识identifier</td>
</tr>
</tbody></table>
<h3 id='7447e4874e-6'>返回字段说明:</h3>
<h3 id='7447e4874e-7'>返回字段说明:</h3>
<table><thead>
<tr>
<th>参数</th>
@ -6486,83 +6700,8 @@ http://localhost:3000/api/jasder/jasder_test.json
<span class="nt">-d</span> <span class="s2">"user_id=12"</span> <span class="se">\</span>
http://localhost:3000/api/jasder/jasder_test/collaborators.json
</code></pre></div><div class="highlight"><pre class="highlight javascript tab-javascript"><code><span class="k">await</span> <span class="nx">octokit</span><span class="p">.</span><span class="nx">request</span><span class="p">(</span><span class="dl">'</span><span class="s1">POST /api/jasder/jasder_test/collaborators.json</span><span class="dl">'</span><span class="p">)</span>
</code></pre></div><h3 id='http-7'>HTTP 请求</h3>
<p><code>POST /api/:owner/:repo/collaborators.json</code></p>
<h3 id='2eb6f47757-7'>请求参数:</h3>
<table><thead>
<tr>
<th>参数</th>
<th>必选</th>
<th>默认</th>
<th>类型</th>
<th>字段说明</th>
</tr>
</thead><tbody>
<tr>
<td>owner</td>
<td></td>
<td></td>
<td>string</td>
<td>用户登录名</td>
</tr>
<tr>
<td>repo</td>
<td></td>
<td></td>
<td>string</td>
<td>项目标识identifier</td>
</tr>
<tr>
<td>user_id</td>
<td></td>
<td>int</td>
<td></td>
<td>用户id</td>
</tr>
</tbody></table>
<h3 id='7447e4874e-7'>返回字段说明:</h3>
<table><thead>
<tr>
<th>参数</th>
<th>类型</th>
<th>字段说明</th>
</tr>
</thead><tbody>
<tr>
<td>status</td>
<td>int</td>
<td>返回状态, 0: 表示操作成功</td>
</tr>
<tr>
<td>message</td>
<td>string</td>
<td>返回信息说明</td>
</tr>
</tbody></table>
<blockquote>
<p>返回的JSON示例:</p>
</blockquote>
<div class="highlight"><pre class="highlight json tab-json"><code><span class="p">{</span><span class="w">
</span><span class="nl">"status"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
</span><span class="nl">"message"</span><span class="p">:</span><span class="w"> </span><span class="s2">"success"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div>
<aside class="warning">
只有平台管理员和项目管理员才能添加仓库成员.
</aside>
<h2 id='c25af9423c'>删除仓库成员</h2>
<p>仓库中删除成员操作</p>
<blockquote>
<p>示例:</p>
</blockquote>
<div class="highlight"><pre class="highlight shell tab-shell"><code>curl <span class="nt">-X</span> DELETE <span class="se">\</span>
<span class="nt">-d</span> <span class="s2">"user_id=12"</span> <span class="se">\</span>
http://localhost:3000/api/jasder/jasder_test/collaborators.json
</code></pre></div><div class="highlight"><pre class="highlight javascript tab-javascript"><code><span class="k">await</span> <span class="nx">octokit</span><span class="p">.</span><span class="nx">request</span><span class="p">(</span><span class="dl">'</span><span class="s1">DELETE /api/jasder/jasder_test/collaborators.json</span><span class="dl">'</span><span class="p">)</span>
</code></pre></div><h3 id='http-8'>HTTP 请求</h3>
<p><code>DELETE /api/:owner/:repo/collaborators.json</code></p>
<p><code>POST /api/:owner/:repo/collaborators.json</code></p>
<h3 id='2eb6f47757-8'>请求参数:</h3>
<table><thead>
<tr>
@ -6615,6 +6754,81 @@ http://localhost:3000/api/jasder/jasder_test/collaborators.json
</tr>
</tbody></table>
<blockquote>
<p>返回的JSON示例:</p>
</blockquote>
<div class="highlight"><pre class="highlight json tab-json"><code><span class="p">{</span><span class="w">
</span><span class="nl">"status"</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
</span><span class="nl">"message"</span><span class="p">:</span><span class="w"> </span><span class="s2">"success"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div>
<aside class="warning">
只有平台管理员和项目管理员才能添加仓库成员.
</aside>
<h2 id='c25af9423c'>删除仓库成员</h2>
<p>仓库中删除成员操作</p>
<blockquote>
<p>示例:</p>
</blockquote>
<div class="highlight"><pre class="highlight shell tab-shell"><code>curl <span class="nt">-X</span> DELETE <span class="se">\</span>
<span class="nt">-d</span> <span class="s2">"user_id=12"</span> <span class="se">\</span>
http://localhost:3000/api/jasder/jasder_test/collaborators.json
</code></pre></div><div class="highlight"><pre class="highlight javascript tab-javascript"><code><span class="k">await</span> <span class="nx">octokit</span><span class="p">.</span><span class="nx">request</span><span class="p">(</span><span class="dl">'</span><span class="s1">DELETE /api/jasder/jasder_test/collaborators.json</span><span class="dl">'</span><span class="p">)</span>
</code></pre></div><h3 id='http-9'>HTTP 请求</h3>
<p><code>DELETE /api/:owner/:repo/collaborators.json</code></p>
<h3 id='2eb6f47757-9'>请求参数:</h3>
<table><thead>
<tr>
<th>参数</th>
<th>必选</th>
<th>默认</th>
<th>类型</th>
<th>字段说明</th>
</tr>
</thead><tbody>
<tr>
<td>owner</td>
<td></td>
<td></td>
<td>string</td>
<td>用户登录名</td>
</tr>
<tr>
<td>repo</td>
<td></td>
<td></td>
<td>string</td>
<td>项目标识identifier</td>
</tr>
<tr>
<td>user_id</td>
<td></td>
<td>int</td>
<td></td>
<td>用户id</td>
</tr>
</tbody></table>
<h3 id='7447e4874e-9'>返回字段说明:</h3>
<table><thead>
<tr>
<th>参数</th>
<th>类型</th>
<th>字段说明</th>
</tr>
</thead><tbody>
<tr>
<td>status</td>
<td>int</td>
<td>返回状态, 0: 表示操作成功</td>
</tr>
<tr>
<td>message</td>
<td>string</td>
<td>返回信息说明</td>
</tr>
</tbody></table>
<blockquote>
<p>返回的JSON示例:</p>
</blockquote>
@ -6637,9 +6851,9 @@ http://localhost:3000/api/jasder/jasder_test/collaborators.json
<span class="nt">-d</span> <span class="s2">"role=Developer"</span> <span class="se">\</span>
http://localhost:3000/api/jasder/jasder_test/change_role.json
</code></pre></div><div class="highlight"><pre class="highlight javascript tab-javascript"><code><span class="k">await</span> <span class="nx">octokit</span><span class="p">.</span><span class="nx">request</span><span class="p">(</span><span class="dl">'</span><span class="s1">PUT /api/jasder/jasder_test/change_role.json</span><span class="dl">'</span><span class="p">)</span>
</code></pre></div><h3 id='http-9'>HTTP 请求</h3>
</code></pre></div><h3 id='http-10'>HTTP 请求</h3>
<p><code>PUT /api/:owner/:repo/change_role.json</code></p>
<h3 id='2eb6f47757-9'>请求参数:</h3>
<h3 id='2eb6f47757-10'>请求参数:</h3>
<table><thead>
<tr>
<th>参数</th>
@ -6678,7 +6892,7 @@ http://localhost:3000/api/jasder/jasder_test/change_role.json
<td>取值范围:&quot;Manager&quot;, &quot;Developer&quot;, &quot;Reporter&quot;;分别为项目管理人员(拥有所有操作权限)、项目开发人员(只拥有读写权限)、项目报告人员(只拥有读权限)</td>
</tr>
</tbody></table>
<h3 id='7447e4874e-9'>返回字段说明:</h3>
<h3 id='7447e4874e-10'>返回字段说明:</h3>
<table><thead>
<tr>
<th>参数</th>
@ -6720,9 +6934,9 @@ http://localhost:3000/api/jasder/jasder_test/change_role.json
<span class="nt">-d</span> <span class="s2">"limit=5"</span> <span class="se">\</span>
http://localhost:3000/api/jasder/jasder_test/collaborators.json
</code></pre></div><div class="highlight"><pre class="highlight javascript tab-javascript"><code><span class="k">await</span> <span class="nx">octokit</span><span class="p">.</span><span class="nx">request</span><span class="p">(</span><span class="dl">'</span><span class="s1">GET /api/jasder/jasder_test/collaborators.json</span><span class="dl">'</span><span class="p">)</span>
</code></pre></div><h3 id='http-10'>HTTP 请求</h3>
</code></pre></div><h3 id='http-11'>HTTP 请求</h3>
<p><code>GET /api/:owner/:repo/collaborators.json</code></p>
<h3 id='2eb6f47757-10'>请求参数:</h3>
<h3 id='2eb6f47757-11'>请求参数:</h3>
<table><thead>
<tr>
<th>参数</th>
@ -6761,7 +6975,7 @@ http://localhost:3000/api/jasder/jasder_test/collaborators.json
<td>每页多少条数据默认15条</td>
</tr>
</tbody></table>
<h3 id='7447e4874e-10'>返回字段说明:</h3>
<h3 id='7447e4874e-11'>返回字段说明:</h3>
<table><thead>
<tr>
<th>参数</th>
@ -6849,9 +7063,9 @@ http://localhost:3000/api/jasder/jasder_test/collaborators.json
<span class="nt">-d</span> <span class="s2">"ref=develop"</span> <span class="se">\</span>
http://localhost:3000/api/yystopf/ceshi/files.json
</code></pre></div><div class="highlight"><pre class="highlight javascript tab-javascript"><code><span class="k">await</span> <span class="nx">octokit</span><span class="p">.</span><span class="nx">request</span><span class="p">(</span><span class="dl">'</span><span class="s1">GET /api/yystopf/ceshi/files.json</span><span class="dl">'</span><span class="p">)</span>
</code></pre></div><h3 id='http-11'>HTTP 请求</h3>
</code></pre></div><h3 id='http-12'>HTTP 请求</h3>
<p><code>GET /api/:owner/:repo/files</code></p>
<h3 id='2eb6f47757-11'>请求参数:</h3>
<h3 id='2eb6f47757-12'>请求参数:</h3>
<table><thead>
<tr>
<th>参数</th>
@ -6890,7 +7104,7 @@ http://localhost:3000/api/yystopf/ceshi/files.json
<td>分支名,默认为仓库默认分支</td>
</tr>
</tbody></table>
<h3 id='7447e4874e-11'>返回字段说明:</h3>
<h3 id='7447e4874e-12'>返回字段说明:</h3>
<table><thead>
<tr>
<th>参数</th>
@ -6972,9 +7186,9 @@ http://localhost:3000/api/yystopf/ceshi/files.json
<span class="nt">-d</span> <span class="s2">"ref=develop"</span> <span class="se">\</span>
http://localhost:3000//api/jasder/jasder_test/entries.json
</code></pre></div><div class="highlight"><pre class="highlight javascript tab-javascript"><code><span class="k">await</span> <span class="nx">octokit</span><span class="p">.</span><span class="nx">request</span><span class="p">(</span><span class="dl">'</span><span class="s1">GET /api/jasder/jasder_test/entries.json</span><span class="dl">'</span><span class="p">)</span>
</code></pre></div><h3 id='http-12'>HTTP 请求</h3>
</code></pre></div><h3 id='http-13'>HTTP 请求</h3>
<p><code>GET /api/:owner/:repo/entries.json</code></p>
<h3 id='2eb6f47757-12'>请求参数:</h3>
<h3 id='2eb6f47757-13'>请求参数:</h3>
<table><thead>
<tr>
<th>参数</th>
@ -7006,7 +7220,7 @@ http://localhost:3000//api/jasder/jasder_test/entries.json
<td>分支名称、tag名称或是提交记录id默认为master分支</td>
</tr>
</tbody></table>
<h3 id='7447e4874e-12'>返回字段说明:</h3>
<h3 id='7447e4874e-13'>返回字段说明:</h3>
<table><thead>
<tr>
<th>参数</th>
@ -7120,9 +7334,9 @@ http://localhost:3000//api/jasder/jasder_test/entries.json
<span class="nt">-d</span> <span class="s2">"filepath=file"</span> <span class="se">\</span>
http://localhost:3000//api/jasder/jasder_test/sub_entries.json
</code></pre></div><div class="highlight"><pre class="highlight javascript tab-javascript"><code><span class="k">await</span> <span class="nx">octokit</span><span class="p">.</span><span class="nx">request</span><span class="p">(</span><span class="dl">'</span><span class="s1">GET /api/jasder/jasder_test/sub_entries.json</span><span class="dl">'</span><span class="p">)</span>
</code></pre></div><h3 id='http-13'>HTTP 请求</h3>
</code></pre></div><h3 id='http-14'>HTTP 请求</h3>
<p><code>GET /api/:owner/:repo/sub_entries.json</code></p>
<h3 id='2eb6f47757-13'>请求参数:</h3>
<h3 id='2eb6f47757-14'>请求参数:</h3>
<table><thead>
<tr>
<th>参数</th>
@ -7161,7 +7375,7 @@ http://localhost:3000//api/jasder/jasder_test/sub_entries.json
<td>分支名称、tag名称或是提交记录id默认为master分支</td>
</tr>
</tbody></table>
<h3 id='7447e4874e-13'>返回字段说明:</h3>
<h3 id='7447e4874e-14'>返回字段说明:</h3>
<table><thead>
<tr>
<th>参数</th>
@ -7247,6 +7461,237 @@ http://localhost:3000//api/jasder/jasder_test/sub_entries.json
<aside class="success">
Success Data.
</aside>
<h2 id='readme'>获取仓库README文件</h2>
<p>获取仓库README文件</p>
<blockquote>
<p>示例:</p>
</blockquote>
<div class="highlight"><pre class="highlight shell tab-shell"><code>curl <span class="nt">-X</span> GET <span class="se">\</span>
<span class="nt">-d</span> <span class="s2">"ref=master"</span> <span class="se">\</span>
<span class="nt">-d</span> <span class="s2">"filepath=lib"</span> <span class="se">\</span>
http://localhost:3000/api/yystopf/csfjkkj/readme.json
</code></pre></div><div class="highlight"><pre class="highlight javascript tab-javascript"><code><span class="k">await</span> <span class="nx">octokit</span><span class="p">.</span><span class="nx">request</span><span class="p">(</span><span class="dl">'</span><span class="s1">GET /api/yystopf/csfjkkj/readme.json</span><span class="dl">'</span><span class="p">)</span>
</code></pre></div><h3 id='http-15'>HTTP 请求</h3>
<p><code>GET /api/:owner/:repo/readme.json</code></p>
<h3 id='2eb6f47757-15'>请求参数:</h3>
<table><thead>
<tr>
<th>参数</th>
<th>必选</th>
<th>默认</th>
<th>类型</th>
<th>字段说明</th>
</tr>
</thead><tbody>
<tr>
<td>owner</td>
<td></td>
<td></td>
<td>string</td>
<td>用户登录名</td>
</tr>
<tr>
<td>repo</td>
<td></td>
<td></td>
<td>string</td>
<td>项目标识identifier</td>
</tr>
<tr>
<td>ref</td>
<td></td>
<td></td>
<td>string</td>
<td>分支名称、tag名称或是提交记录id默认为默认分支</td>
</tr>
<tr>
<td>filepath</td>
<td></td>
<td></td>
<td>string</td>
<td>子目录名称,默认为空</td>
</tr>
</tbody></table>
<h3 id='7447e4874e-15'>返回字段说明:</h3>
<table><thead>
<tr>
<th>参数</th>
<th>类型</th>
<th>字段说明</th>
</tr>
</thead><tbody>
<tr>
<td>type</td>
<td>string</td>
<td>文件类型, file:文件dir文件目录</td>
</tr>
<tr>
<td>encoding</td>
<td>string</td>
<td>编码</td>
</tr>
<tr>
<td>size</td>
<td>int</td>
<td>文件夹或文件大小 单位B</td>
</tr>
<tr>
<td>name</td>
<td>string</td>
<td>文件夹或文件名称</td>
</tr>
<tr>
<td>path</td>
<td>string</td>
<td>文件夹或文件相对路径</td>
</tr>
<tr>
<td>content</td>
<td>string</td>
<td>文件内容</td>
</tr>
<tr>
<td>sha</td>
<td>string</td>
<td>文件commitid</td>
</tr>
</tbody></table>
<blockquote>
<p>返回的JSON示例:</p>
</blockquote>
<div class="highlight"><pre class="highlight json tab-json"><code><span class="p">{</span><span class="w">
</span><span class="nl">"type"</span><span class="p">:</span><span class="w"> </span><span class="s2">"file"</span><span class="p">,</span><span class="w">
</span><span class="nl">"encoding"</span><span class="p">:</span><span class="w"> </span><span class="s2">"base64"</span><span class="p">,</span><span class="w">
</span><span class="nl">"size"</span><span class="p">:</span><span class="w"> </span><span class="mi">24</span><span class="p">,</span><span class="w">
</span><span class="nl">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"README.md"</span><span class="p">,</span><span class="w">
</span><span class="nl">"path"</span><span class="p">:</span><span class="w"> </span><span class="s2">"lib/README.md"</span><span class="p">,</span><span class="w">
</span><span class="nl">"content"</span><span class="p">:</span><span class="w"> </span><span class="s2">"ZGZhc2RhZGpmIGRrZnNsCgpzZGZkZnMK"</span><span class="p">,</span><span class="w">
</span><span class="nl">"sha"</span><span class="p">:</span><span class="w"> </span><span class="s2">"860962cd21c60b1a9e07d723080c87c32c18d44a"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div>
<aside class="success">
Success Data.
</aside>
<h2 id='28d27a81d5'>获取仓库贡献者</h2>
<p>获取仓库贡献者</p>
<blockquote>
<p>示例:</p>
</blockquote>
<div class="highlight"><pre class="highlight shell tab-shell"><code>curl <span class="nt">-X</span> GET <span class="se">\</span>
<span class="nt">-d</span> <span class="s2">"ref=master"</span> <span class="se">\</span>
<span class="nt">-d</span> <span class="s2">"filepath=lib"</span> <span class="se">\</span>
http://localhost:3000/api/yystopf/csfjkkj/contributors.json
</code></pre></div><div class="highlight"><pre class="highlight javascript tab-javascript"><code><span class="k">await</span> <span class="nx">octokit</span><span class="p">.</span><span class="nx">request</span><span class="p">(</span><span class="dl">'</span><span class="s1">GET /api/yystopf/csfjkkj/contributors.json</span><span class="dl">'</span><span class="p">)</span>
</code></pre></div><h3 id='http-16'>HTTP 请求</h3>
<p><code>GET /api/:owner/:repo/contributors.json</code></p>
<h3 id='2eb6f47757-16'>请求参数:</h3>
<table><thead>
<tr>
<th>参数</th>
<th>必选</th>
<th>默认</th>
<th>类型</th>
<th>字段说明</th>
</tr>
</thead><tbody>
<tr>
<td>owner</td>
<td></td>
<td></td>
<td>string</td>
<td>用户登录名</td>
</tr>
<tr>
<td>repo</td>
<td></td>
<td></td>
<td>string</td>
<td>项目标识identifier</td>
</tr>
<tr>
<td>ref</td>
<td></td>
<td></td>
<td>string</td>
<td>分支名称、tag名称或是提交记录id默认为整个仓库</td>
</tr>
<tr>
<td>filepath</td>
<td></td>
<td></td>
<td>string</td>
<td>子目录名称,默认为空</td>
</tr>
</tbody></table>
<h3 id='7447e4874e-16'>返回字段说明:</h3>
<table><thead>
<tr>
<th>参数</th>
<th>类型</th>
<th>字段说明</th>
</tr>
</thead><tbody>
<tr>
<td>total_count</td>
<td>integer</td>
<td>贡献者数量</td>
</tr>
<tr>
<td>contributions</td>
<td>integer</td>
<td>贡献数量</td>
</tr>
<tr>
<td>login</td>
<td>string</td>
<td>用户登录名</td>
</tr>
<tr>
<td>type</td>
<td>string</td>
<td>用户类型</td>
</tr>
<tr>
<td>name</td>
<td>string</td>
<td>用户昵称</td>
</tr>
<tr>
<td>image_url</td>
<td>string</td>
<td>用户头像</td>
</tr>
</tbody></table>
<blockquote>
<p>返回的JSON示例:</p>
</blockquote>
<div class="highlight"><pre class="highlight json tab-json"><code><span class="p">{</span><span class="w">
</span><span class="nl">"contributors"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="w">
</span><span class="p">{</span><span class="w">
</span><span class="nl">"contributions"</span><span class="p">:</span><span class="w"> </span><span class="mi">5</span><span class="p">,</span><span class="w">
</span><span class="nl">"login"</span><span class="p">:</span><span class="w"> </span><span class="s2">"testforge2"</span><span class="p">,</span><span class="w">
</span><span class="nl">"type"</span><span class="p">:</span><span class="w"> </span><span class="s2">"User"</span><span class="p">,</span><span class="w">
</span><span class="nl">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"testforge2"</span><span class="p">,</span><span class="w">
</span><span class="nl">"image_url"</span><span class="p">:</span><span class="w"> </span><span class="s2">"system/lets/letter_avatars/2/T/236_177_85/120.png"</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="p">{</span><span class="w">
</span><span class="nl">"contributions"</span><span class="p">:</span><span class="w"> </span><span class="mi">79</span><span class="p">,</span><span class="w">
</span><span class="nl">"login"</span><span class="p">:</span><span class="w"> </span><span class="s2">"yystopf"</span><span class="p">,</span><span class="w">
</span><span class="nl">"type"</span><span class="p">:</span><span class="w"> </span><span class="s2">"User"</span><span class="p">,</span><span class="w">
</span><span class="nl">"name"</span><span class="p">:</span><span class="w"> </span><span class="s2">"yystopf"</span><span class="p">,</span><span class="w">
</span><span class="nl">"image_url"</span><span class="p">:</span><span class="w"> </span><span class="s2">"system/lets/letter_avatars/2/Y/241_125_89/120.png"</span><span class="w">
</span><span class="p">}</span><span class="w">
</span><span class="p">],</span><span class="w">
</span><span class="nl">"total_count"</span><span class="p">:</span><span class="w"> </span><span class="mi">2</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div>
<aside class="success">
Success Data.
</aside>
<h2 id='webhooks'>获取仓库webhooks列表</h2>
<p>获取仓库webhooks列表</p>
@ -7256,9 +7701,9 @@ http://localhost:3000//api/jasder/jasder_test/sub_entries.json
<div class="highlight"><pre class="highlight shell tab-shell"><code>curl <span class="nt">-X</span> GET <span class="se">\</span>
http://localhost:3000/api/yystopf/ceshi/webhooks.json
</code></pre></div><div class="highlight"><pre class="highlight javascript tab-javascript"><code><span class="k">await</span> <span class="nx">octokit</span><span class="p">.</span><span class="nx">request</span><span class="p">(</span><span class="dl">'</span><span class="s1">GET /api/yystopf/ceshi/webhooks.json</span><span class="dl">'</span><span class="p">)</span>
</code></pre></div><h3 id='http-14'>HTTP 请求</h3>
</code></pre></div><h3 id='http-17'>HTTP 请求</h3>
<p><code>GET /api/:owner/:repo/webhooks.json</code></p>
<h3 id='2eb6f47757-14'>请求参数:</h3>
<h3 id='2eb6f47757-17'>请求参数:</h3>
<table><thead>
<tr>
<th>参数</th>
@ -7283,7 +7728,7 @@ http://localhost:3000/api/yystopf/ceshi/webhooks.json
<td>项目标识identifier</td>
</tr>
</tbody></table>
<h3 id='7447e4874e-14'>返回字段说明:</h3>
<h3 id='7447e4874e-17'>返回字段说明:</h3>
<table><thead>
<tr>
<th>参数</th>
@ -7385,9 +7830,9 @@ http://localhost:3000/api/yystopf/ceshi/webhooks.json
<div class="highlight"><pre class="highlight shell tab-shell"><code>curl <span class="nt">-X</span> GET <span class="se">\</span>
http://localhost:3000/api/yystopf/ceshi/webhooks/3/edit.json
</code></pre></div><div class="highlight"><pre class="highlight javascript tab-javascript"><code><span class="k">await</span> <span class="nx">octokit</span><span class="p">.</span><span class="nx">request</span><span class="p">(</span><span class="dl">'</span><span class="s1">GET /api/yystopf/ceshi/webhooks/3/edit.json</span><span class="dl">'</span><span class="p">)</span>
</code></pre></div><h3 id='http-15'>HTTP 请求</h3>
</code></pre></div><h3 id='http-18'>HTTP 请求</h3>
<p><code>GET /api/:owner/:repo/webhooks/:id/edit.json</code></p>
<h3 id='2eb6f47757-15'>请求参数:</h3>
<h3 id='2eb6f47757-18'>请求参数:</h3>
<table><thead>
<tr>
<th>参数</th>
@ -7419,7 +7864,7 @@ http://localhost:3000/api/yystopf/ceshi/webhooks/3/edit.json
<td>webhook ID</td>
</tr>
</tbody></table>
<h3 id='7447e4874e-15'>返回字段说明:</h3>
<h3 id='7447e4874e-18'>返回字段说明:</h3>
<table><thead>
<tr>
<th>参数</th>
@ -7620,9 +8065,9 @@ http://localhost:3000/api/yystopf/ceshi/webhooks/3/edit.json
<div class="highlight"><pre class="highlight shell tab-shell"><code>curl <span class="nt">-X</span> POST <span class="se">\</span>
http://localhost:3000/api/yystopf/ceshi/webhooks.json
</code></pre></div><div class="highlight"><pre class="highlight javascript tab-javascript"><code><span class="k">await</span> <span class="nx">octokit</span><span class="p">.</span><span class="nx">request</span><span class="p">(</span><span class="dl">'</span><span class="s1">POST /api/yystopf/ceshi/webhooks.json</span><span class="dl">'</span><span class="p">)</span>
</code></pre></div><h3 id='http-16'>HTTP 请求</h3>
</code></pre></div><h3 id='http-19'>HTTP 请求</h3>
<p><code>POST /api/:owner/:repo/webhooks.json</code></p>
<h3 id='2eb6f47757-16'>请求参数:</h3>
<h3 id='2eb6f47757-19'>请求参数:</h3>
<table><thead>
<tr>
<th>参数</th>
@ -7806,7 +8251,7 @@ http://localhost:3000/api/yystopf/ceshi/webhooks.json
</span><span class="nl">"branch_filter"</span><span class="p">:</span><span class="w"> </span><span class="s2">"*"</span><span class="p">,</span><span class="w">
</span><span class="nl">"events"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="s2">"push"</span><span class="p">]</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div><h3 id='7447e4874e-16'>返回字段说明:</h3>
</span></code></pre></div><h3 id='7447e4874e-19'>返回字段说明:</h3>
<table><thead>
<tr>
<th>参数</th>
@ -7878,9 +8323,9 @@ http://localhost:3000/api/yystopf/ceshi/webhooks.json
<div class="highlight"><pre class="highlight shell tab-shell"><code>curl <span class="nt">-X</span> PATCH <span class="se">\</span>
http://localhost:3000/api/yystopf/ceshi/webhooks/7.json
</code></pre></div><div class="highlight"><pre class="highlight javascript tab-javascript"><code><span class="k">await</span> <span class="nx">octokit</span><span class="p">.</span><span class="nx">request</span><span class="p">(</span><span class="dl">'</span><span class="s1">PATCH /api/yystopf/ceshi/webhooks/7.json</span><span class="dl">'</span><span class="p">)</span>
</code></pre></div><h3 id='http-17'>HTTP 请求</h3>
</code></pre></div><h3 id='http-20'>HTTP 请求</h3>
<p><code>PATCH /api/:owner/:repo/webhooks/:id.json</code></p>
<h3 id='2eb6f47757-17'>请求参数:</h3>
<h3 id='2eb6f47757-20'>请求参数:</h3>
<table><thead>
<tr>
<th>参数</th>
@ -8071,7 +8516,7 @@ http://localhost:3000/api/yystopf/ceshi/webhooks/7.json
</span><span class="nl">"branch_filter"</span><span class="p">:</span><span class="w"> </span><span class="s2">"*"</span><span class="p">,</span><span class="w">
</span><span class="nl">"events"</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="s2">"push"</span><span class="p">]</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre></div><h3 id='7447e4874e-17'>返回字段说明:</h3>
</span></code></pre></div><h3 id='7447e4874e-20'>返回字段说明:</h3>
<blockquote>
<p>返回的JSON示例:</p>
</blockquote>
@ -8092,9 +8537,9 @@ http://localhost:3000/api/yystopf/ceshi/webhooks/7.json
<div class="highlight"><pre class="highlight shell tab-shell"><code>curl <span class="nt">-X</span> DELETE <span class="se">\</span>
http://localhost:3000/api/yystopf/ceshi/webhooks/7.json
</code></pre></div><div class="highlight"><pre class="highlight javascript tab-javascript"><code><span class="k">await</span> <span class="nx">octokit</span><span class="p">.</span><span class="nx">request</span><span class="p">(</span><span class="dl">'</span><span class="s1">DELETE /api/yystopf/ceshi/webhooks/7.json</span><span class="dl">'</span><span class="p">)</span>
</code></pre></div><h3 id='http-18'>HTTP 请求</h3>
</code></pre></div><h3 id='http-21'>HTTP 请求</h3>
<p><code>DELETE /api/:owner/:repo/webhooks/:id.json</code></p>
<h3 id='2eb6f47757-18'>请求参数:</h3>
<h3 id='2eb6f47757-21'>请求参数:</h3>
<table><thead>
<tr>
<th>参数</th>
@ -8126,7 +8571,7 @@ http://localhost:3000/api/yystopf/ceshi/webhooks/7.json
<td>webhook id</td>
</tr>
</tbody></table>
<h3 id='7447e4874e-18'>返回字段说明:</h3>
<h3 id='7447e4874e-21'>返回字段说明:</h3>
<blockquote>
<p>返回的JSON示例:</p>
</blockquote>
@ -8147,9 +8592,9 @@ http://localhost:3000/api/yystopf/ceshi/webhooks/7.json
<div class="highlight"><pre class="highlight shell tab-shell"><code>curl <span class="nt">-X</span> GET <span class="se">\</span>
http://localhost:3000/api/yystopf/ceshi/webhooks/3/tasks.json
</code></pre></div><div class="highlight"><pre class="highlight javascript tab-javascript"><code><span class="k">await</span> <span class="nx">octokit</span><span class="p">.</span><span class="nx">request</span><span class="p">(</span><span class="dl">'</span><span class="s1">GET /api/yystopf/ceshi/webhooks/3/tasks.json</span><span class="dl">'</span><span class="p">)</span>
</code></pre></div><h3 id='http-19'>HTTP 请求</h3>
</code></pre></div><h3 id='http-22'>HTTP 请求</h3>
<p><code>GET /api/:owner/:repo/webhooks/:id/tasks.json</code></p>
<h3 id='2eb6f47757-19'>请求参数:</h3>
<h3 id='2eb6f47757-22'>请求参数:</h3>
<table><thead>
<tr>
<th>参数</th>
@ -8181,7 +8626,7 @@ http://localhost:3000/api/yystopf/ceshi/webhooks/3/tasks.json
<td>webhook ID</td>
</tr>
</tbody></table>
<h3 id='7447e4874e-19'>返回字段说明:</h3>
<h3 id='7447e4874e-22'>返回字段说明:</h3>
<table><thead>
<tr>
<th>参数</th>
@ -8418,9 +8863,9 @@ http://localhost:3000/api/yystopf/ceshi/webhooks/3/tasks.json
<div class="highlight"><pre class="highlight shell tab-shell"><code>curl <span class="nt">-X</span> POST <span class="se">\</span>
http://localhost:3000/api/yystopf/ceshi/webhooks/3/test.json
</code></pre></div><div class="highlight"><pre class="highlight javascript tab-javascript"><code><span class="k">await</span> <span class="nx">octokit</span><span class="p">.</span><span class="nx">request</span><span class="p">(</span><span class="dl">'</span><span class="s1">POST /api/yystopf/ceshi/webhooks/3/test.json</span><span class="dl">'</span><span class="p">)</span>
</code></pre></div><h3 id='http-20'>HTTP 请求</h3>
</code></pre></div><h3 id='http-23'>HTTP 请求</h3>
<p><code>POST /api/:owner/:repo/webhooks/:id/test.json</code></p>
<h3 id='2eb6f47757-20'>请求参数:</h3>
<h3 id='2eb6f47757-23'>请求参数:</h3>
<table><thead>
<tr>
<th>参数</th>
@ -8452,7 +8897,7 @@ http://localhost:3000/api/yystopf/ceshi/webhooks/3/test.json
<td>webhook ID</td>
</tr>
</tbody></table>
<h3 id='7447e4874e-20'>返回字段说明:</h3>
<h3 id='7447e4874e-23'>返回字段说明:</h3>
<blockquote>
<p>返回的JSON示例:</p>
</blockquote>