Compare commits

...

14 Commits

4 changed files with 90 additions and 15 deletions

View File

@ -0,0 +1,68 @@
version: 2
name: gitlink正式环境
description: ""
global:
concurrent: 1
workflow:
- ref: start
name: 开始
task: start
- ref: git_clone_0
name: git clone
on-failure: ignore
task: git_clone@1.2.6
input:
remote_url: '"https://gitlink.org.cn/Gitlink/gitea_hat.git"'
ref: '"refs/heads/master"'
commit_id: '""'
depth: 1
needs:
- start
- ref: end
name: 结束
task: end
needs:
- gitlink_ssh_cmd_0
- ref: gitlink_scp_resource_0
name: scp复制文件支持跳板机
on-failure: ignore
task: yystopf/gitlink_scp_resource@0.0.7
input:
ssh_private_key: ((ssh.siyao))
remote_host: '"10.9.117.109"'
remote_port: '"22"'
remote_user: '"root"'
remote_file: '"/root/gitea"'
local_file: golang_build_node_0.bin_dir
gateway_host: '"123.59.135.93"'
gateway_port: '"51123"'
gateway_user: '"pdl"'
temp_file: '"/home/pdl/gitea"'
needs:
- golang_build_node_0
- ref: golang_build_node_0
name: golang_build_node
on-failure: ignore
task: yystopf/golang_build_node@0.0.2
input:
workspace: git_clone_0.git_path
out_bin_name: '"gitea"'
goos: '"linux"'
goarch: '"amd64"'
needs:
- git_clone_0
- ref: gitlink_ssh_cmd_0
name: ssh执行命令支持跳板机
task: yystopf/gitlink_ssh_cmd@0.0.6
input:
ssh_private_key: ((ssh.siyao))
remote_host: '"10.9.117.109"'
remote_port: '"22"'
remote_user: '"root"'
gateway_host: '"123.59.135.93"'
gateway_port: '"51123"'
gateway_user: '"pdl"'
ssh_cmd: '"sh update.sh"'
needs:
- gitlink_scp_resource_0

View File

@ -41,6 +41,10 @@
## 编译
```
sh build.sh
```
类Linux平台在项目根目录运行
```shell
# 编译Linux 64位可执行程序

View File

@ -137,12 +137,12 @@ func GetReadmeContents(ctx *context.APIContext) {
readmeSortArr := []string{"readme", "readme.en.md", "readme_en.md", "readme.md", "readme.ch.md", "readme_ch.md", "readme.zh.md", "readme_zh.md", "readme.cn.md", "readme_cn.md"}
readmePath := ""
readmePathInArrIndex := 0
filesListInterface, err := files_service.GetContentsOrList(ctx, ctx.Repo.Repository, "", ref)
filesListInterface, err := hat_files_service.GetContentsOrList(ctx, ctx.Repo.Repository, "", ref)
if err != nil {
ctx.Error(http.StatusInternalServerError, "GetContentsOrList", err)
return
}
filesList, ok := filesListInterface.([]*api.ContentsResponse)
filesList, ok := filesListInterface.([]*hat_api.ContentsResponse)
if ok {
for _, file := range filesList {
for i, sortItem := range readmeSortArr {

View File

@ -134,21 +134,24 @@ func GetContents(ctx context.Context, repo *repo_model.Repository, treePath, ref
if err != nil {
return nil, err
}
var isTextFile = false
blob, err := gitRepo.GetBlob(entry.ID.String())
if err != nil {
return nil, err
}
dataRc, err := blob.DataAsync()
if err != nil {
return nil, err
}
buf := make([]byte, 1024)
n, _ := util.ReadAtMost(dataRc, buf)
buf = buf[:n]
if !entry.IsSubModule() {
blob, err := gitRepo.GetBlob(entry.ID.String())
if err != nil {
return nil, err
}
dataRc, err := blob.DataAsync()
if err != nil {
return nil, err
}
buf := make([]byte, 1024)
n, _ := util.ReadAtMost(dataRc, buf)
buf = buf[:n]
st := typesniffer.DetectContentType(buf)
isTextFile := st.IsText()
st := typesniffer.DetectContentType(buf)
isTextFile = st.IsText()
}
contentsResponse := &hat_api.ContentsResponse{
ContentsResponse: &gitea_api.ContentsResponse{