Compare commits

...

115 Commits

Author SHA1 Message Date
xxq250 35cc2cb735 Merge pull request '20240326版本' (#344) from develop into master 2024-03-26 15:18:26 +08:00
xxq250 095c83d2d0 Merge pull request '20231213版本' (#342) from Trustie/forgeplus:trustie_server into master 2023-12-13 15:01:17 +08:00
xxq250 03277d2ad7 commit_log_to_db.rake trustie all 2023-12-09 12:23:17 +08:00
xxq250 c2a4e62131 commit_log_to_db.rake trustie all 2023-12-09 12:21:37 +08:00
xxq250 f81b3a0b35 commit_log_to_db.rake trustie 2023-12-09 09:40:03 +08:00
xxq250 6fb22d3117 Merge branch 'pre_trustie_server' into trustie_server 2023-12-01 14:59:47 +08:00
xxq250 d0623e4d57 rake copy attachemnt 2023-12-01 14:59:44 +08:00
xxq250 33c56e3e79 fixed 评论回复增加parent_id索引,解决性能问题 2023-11-15 08:53:30 +08:00
xxq250 5541002dab Merge branch 'pre_trustie_server' into trustie_server 2023-11-15 08:45:17 +08:00
xxq250 6a989f972a Merge branch 'pre_trustie_server' into trustie_server
# Conflicts:
#	app/models/issue.rb
#	app/models/journal.rb
2023-10-24 20:46:02 +08:00
xxq250 abbb033fc7 fixed issue评论里的附件解析关联,增强附件访问权限控制 2023-10-18 15:24:39 +08:00
xxq250 99fe06c788 fixed issue描述里的附件解析关联,增强附件访问权限控制 2023-10-18 15:16:14 +08:00
xxq250 fa1a03e4db Merge branch 'pre_trustie_server' into trustie_server 2023-10-18 14:02:49 +08:00
xxq250 bf232f3518 Merge branch 'pre_trustie_server' into trustie_server 2023-10-13 14:14:46 +08:00
xxq250 bb0bbeb06c fixed 文件增加是否文本判断,可显示多种文本文件 2023-10-11 17:25:24 +08:00
xxq250 ef3472567e fixed 组织pr识别 2023-10-07 21:12:58 +08:00
xxq250 e07af929b2 Merge branch 'pre_trustie_server' into trustie_server 2023-10-07 20:08:08 +08:00
xxq250 4c354f6841 Merge branch 'pre_trustie_server' into trustie_server 2023-09-28 15:33:37 +08:00
xxq250 e6f2e9a798 Merge branch 'pre_trustie_server' into trustie_server 2023-09-26 15:01:07 +08:00
xxq250 c6461de871 Merge branch 'pre_trustie_server' into trustie_server 2023-09-25 17:58:15 +08:00
xxq250 02b85859b5 pages 合并 2023-09-25 10:50:35 +08:00
xxq250 18377dc2e0 Merge branch 'pre_trustie_server' into trustie_server 2023-08-31 16:08:38 +08:00
xxq250 c9659fd926 fixed fork后重命名项目标识再forked失败 2023-08-22 12:25:15 +08:00
xxq250 b73f724bb7 fixed fork后重命名项目标识再forked失败 2023-08-22 11:45:10 +08:00
xxq250 ca85975197 fixed fork后重命名项目标识再forked失败 2023-08-22 11:42:26 +08:00
呱呱呱 9763d5c780 fix fork create bug 2023-08-22 09:46:06 +08:00
xxq250 391059602e Merge branch 'pre_trustie_server' into trustie_server
# Conflicts:
#	app/helpers/repositories_helper.rb
2023-08-16 17:18:03 +08:00
xxq250 0ea45459b8 fixed PR中合并来源显示错误,列表 2023-08-11 17:33:42 +08:00
xxq250 d1adffbd76 fixed PR中合并来源显示错误 2023-08-11 17:24:05 +08:00
xxq250 232bef8f88 fixed readme图片解析增加多种格式 2023-08-09 16:43:35 +08:00
xxq250 7e29a5d47f fixed readme图片解析增加多种格式 2023-08-09 16:43:34 +08:00
xxq250 174a2d47dc fixed @compare_result null done 2023-08-07 15:20:33 +08:00
xxq250 9f23400d2a readme中变量路径修正,放行符处理 2023-07-28 17:56:40 +08:00
xxq250 3527e89866 readme中变量路径修正,放行符处理 2023-07-28 17:54:14 +08:00
xxq250 9a5a4e8d66 readme中变量路径修正 2023-07-27 18:33:29 +08:00
xxq250 92f0ed71a1 readme中变量图片相对路径 2023-07-27 18:10:33 +08:00
xxq250 9428b5aebb SyncRepoUpdateTimeJob stop 2023-07-27 15:38:45 +08:00
xxq250 72f88c8c13 Update deploy.md 2023-07-18 15:52:54 +08:00
xxq250 349c775404 fixed 更新时判断是否有昵称 2023-07-17 23:05:26 +08:00
xxq250 dd914595fa 用户支持手机号搜索 2023-07-17 21:47:20 +08:00
xxq250 3ac9c0b5d8 merge develop 2023-07-14 14:07:48 +08:00
xxq250 0f45f31db0 Get gitea tokens 2023-07-12 15:22:32 +08:00
xxq250 3bd4187b0e fixed diff接口切换到hat 2023-07-11 17:00:57 +08:00
xxq250 46456d956a fixed 调用区块链接口 2023-07-11 15:30:01 +08:00
xxq250 f15bc3a3bf fixed log跟踪 2023-07-11 15:16:46 +08:00
xxq250 466705bd0f fixed 项目detail 2023-07-10 14:02:08 +08:00
xxq250 a40c5a7619 贡献者数量调整 2023-07-07 17:14:25 +08:00
xxq250 fc4520c06f 项目贡献排行分页参数3年内 2023-07-07 10:32:55 +08:00
xxq250 909488b072 项目贡献排行分页参数3年内 2023-07-07 10:31:35 +08:00
xxq250 3a2b476dd0 项目贡献排行分页参数 2023-07-07 10:05:07 +08:00
xxq250 bbacebc1c9 更新文件失败处理 2023-07-06 16:04:28 +08:00
xxq250 c344859063 更新文件日志 2023-07-06 15:37:37 +08:00
xxq250 c85a15b794 更新文件日志 2023-07-06 15:26:23 +08:00
xxq250 1b68e7c9d5 fixed: user rank project owner changed remove rank 2023-07-04 16:08:40 +08:00
xxq250 2b03ccc67c Merge branch 'pre_trustie_server' into trustie_server 2023-06-30 17:11:56 +08:00
chenjing 921c285d0f fix bug 2023-06-26 11:15:44 +08:00
xxq250 61b0d4d302 Merge branch 'pre_trustie_server' into trustie_server 2023-06-21 16:33:51 +08:00
xxq250 f094c3a84c Merge branch 'pre_trustie_server' into trustie_server 2023-06-21 16:19:54 +08:00
xxq250 3b896fca3d fixed job中issue不存在处理 2023-06-19 15:45:14 +08:00
xxq250 0faf192b45 fixed job中issue不存在处理 2023-06-19 15:41:28 +08:00
xxq250 076120de8d fixed job中issue不存在 2023-06-19 15:39:45 +08:00
xxq250 63cc2528cd Update README.md 2023-06-15 14:47:00 +08:00
xxq250 e3df5a0f64 Update README.md 2023-06-15 14:45:32 +08:00
xxq250 6be6dd1bf1 fixed readme中图片链接问号处理2 2023-06-15 14:43:13 +08:00
xxq250 d0baa9073d fixed readme中图片链接问号处理 2023-06-15 14:38:31 +08:00
xxq250 f28d835e58 Update README.md 2023-06-15 14:35:34 +08:00
xxq250 f4a7903613 fixed readme中图片链接问号处理 2023-06-15 14:31:00 +08:00
xxq250 a74b6a1ca4 Update README.md 2023-06-15 13:58:23 +08:00
xxq250 6e42b84040 图片链接 2023-06-15 13:54:49 +08:00
xxq250 a46de1b658 fixed 发送通知报错 2023-06-12 18:10:15 +08:00
xxq250 89c64e276e site css 2023-06-09 17:45:54 +08:00
xxq250 46252c2feb site css 2023-06-09 15:54:08 +08:00
xxq250 eb8266db90 site css 2023-06-09 15:52:04 +08:00
xxq250 31923c9086 competition 配置 2023-06-09 15:49:26 +08:00
xxq250 5135f60e50 merge pre 2023-06-09 15:38:41 +08:00
xxqfamous b114ee9701 fixed 最后提交增加参数stat加整 2023-06-06 17:55:04 +08:00
xxqfamous d6aa23b484 fixed 注册错误记录日志 2023-06-05 16:21:05 +08:00
xxqfamous 1b93da7f67 Merge branch 'standalone_develop' into trustie_server 2023-06-05 16:05:28 +08:00
xxqfamous cddb204d28 Merge branch 'pre_trustie_server' into trustie_server 2023-06-05 15:01:36 +08:00
xxqfamous da7e0a4143 Merge branch 'pre_trustie_server' into trustie_server 2023-05-30 18:34:00 +08:00
xxqfamous 7116f38061 fixed 修改用户参数错误 log 2023-05-30 14:00:36 +08:00
xxqfamous a7968ed95c fixed 修改用户参数错误 log 2023-05-30 13:55:48 +08:00
xxqfamous 2998fce62e fixed 修改用户参数错误 log 2023-05-30 13:51:29 +08:00
xxqfamous b45e9fb224 fixed 修改用户参数错误 log 2023-05-30 12:40:30 +08:00
xxqfamous fa57d3a9ba fixed 修改用户参数错误 log 2023-05-30 12:38:36 +08:00
xxqfamous 9c9c376224 fixed 修改用户参数错误 log 2023-05-30 12:36:43 +08:00
xxqfamous cc6228bcfe fixed 修改用户参数错误 2023-05-30 12:34:49 +08:00
xxqfamous 818781f6e0 fixed 修改用户参数错误 2023-05-30 12:34:09 +08:00
xxqfamous ba134ad0fa fixed 修改用户 log 2023-05-30 12:27:16 +08:00
xxqfamous 1327fcb4f4 fixed 修改用户 log 2023-05-30 12:25:34 +08:00
xxqfamous 166952560e fixed 修改用户 log 2023-05-30 11:43:59 +08:00
xxqfamous 7fdd39291b fixed 修改用户 2023-05-30 11:41:36 +08:00
xxqfamous d78408d799 Merge branch 'pre_trustie_server' into trustie_server 2023-05-30 11:38:33 +08:00
xxqfamous f289b8046f 竞赛用户关联优化 2023-05-30 11:16:54 +08:00
xxqfamous 41a9773c90 注册失败日志 2023-05-29 15:15:52 +08:00
xxqfamous d14fca3792 fixed 项目查询增加id参数 2023-05-24 14:35:26 +08:00
xxq250 b66293b044 Add Dockerfile-ruby 2023-05-24 10:12:10 +08:00
xxqfamous 9449bd6eb9 fixed 补偿users.gitea_uid不存在的用户,error message 2023-05-22 14:20:47 +08:00
xxqfamous 9f4d9aa5db fixed 补偿users.gitea_uid不存在的用户,error message 2023-05-22 14:17:24 +08:00
xxqfamous a336e91dd8 fixed 补偿users.gitea_uid不存在的用户 2023-05-22 14:02:42 +08:00
xxqfamous 65a00efd32 fixed 补偿users.gitea_uid不存在的用户 2023-05-22 14:01:14 +08:00
xxqfamous 9859c30f9d fixed 补偿users.gitea_uid不存在的用户 2023-05-22 11:35:26 +08:00
xxqfamous 9232f3ca9b fixed 补偿users.gitea_uid不存在的用户 2023-05-22 11:33:00 +08:00
xxqfamous 24ac425c21 fixed 修改user login唯一索引 2023-05-22 11:22:12 +08:00
xxqfamous e16452ac90 fixed 修改user login唯一索引 2023-05-20 12:28:35 +08:00
xxqfamous 8cc565ca0c fixed 修改user login唯一索引 2023-05-20 12:27:34 +08:00
xxqfamous 1b2a4e0b94 fixed 清除user未使用关联表 2023-05-20 11:35:20 +08:00
xxqfamous 99f7fe6102 Merge branch 'pre_trustie_server' into trustie_server 2023-05-19 15:01:10 +08:00
xxq250 681a485192 fixed 审批utf8mb4 2023-05-18 09:50:56 +08:00
xxq250 58354dc944 Merge branch 'pre_trustie_server' into trustie_server 2023-05-12 17:06:36 +08:00
xxq250 e815710c57 Update Dockerfile 2023-05-11 10:27:42 +08:00
xxq250 dbcac032dd Update Dockerfile 2023-05-11 10:23:36 +08:00
xxq250 d1c8f1aead 整理gitea docker配置文件 2023-05-10 18:38:35 +08:00
xxq250 bf1ffadf41 整理docker配置文件 2023-05-10 17:41:15 +08:00
xxq250 f07ae49246 整理配置文件 2023-05-10 17:31:57 +08:00
17 changed files with 338 additions and 39 deletions

View File

@ -1,13 +1,17 @@
FROM ubuntu:20.04
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt install -y tzdata
# basics
RUN apt-get install -y libssl-dev curl libmysqlclient-dev imagemagick nodejs mysql-server redis-server tzdata
RUN apt-get install -y libssl-dev curl libmysqlclient-dev imagemagick nodejs mysql-server redis-server
RUN ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
# confirm openssl version
RUN openssl version
RUN which openssl
# install RVM, Ruby, and Bundler
RUN \curl -L https://get.rvm.io | bash -s stable
# rvm environment variable
RUN /bin/bash -l -c "source /etc/profile.d/rvm.sh"
RUN /bin/bash -l -c "rvm requirements"
# replace ruby mirror url, accelerate install ruby
RUN sed -i 's/rvm_remote_server_url2/#rvm_remote_server_url2/g' /usr/local/rvm/config/db
@ -37,11 +41,19 @@ RUN /bin/bash -l -c 'gem install puma -v 5.6.5'
RUN rm -rf Gemfile.lock
RUN cp config/configuration.yml.example config/configuration.yml
RUN cp config/database.yml.example config/database.yml
RUN cp config/database-docker.yml.example config/database.yml
RUN touch config/redis.yml
RUN touch config/elasticsearch.yml
RUN /bin/bash -l -c 'bundle install'
#EXPOSE 4000
#RUN /bin/bash -l -c 'RAILS_ENV=production puma'
RUN redis-server &
RUN /bin/bash -l -c 'bundle exec rake sync_table_structure:import_csv'
RUN /bin/bash -l -c 'rails db:migrate RAILS_ENV=development'
RUN /bin/bash -l -c 'bundle exec sidekiq -C config/sidekiq.yml -e production -d'
EXPOSE 4000
RUN /bin/bash -l -c 'RAILS_ENV=production puma -C config/puma.rb'

19
Dockerfile-ruby Normal file
View File

@ -0,0 +1,19 @@
FROM ubuntu:20.04
RUN apt-get update
# basics
RUN apt-get install -y libssl-dev curl libmysqlclient-dev imagemagick nodejs mysql-server redis-server tzdata
RUN ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
# confirm openssl version
RUN openssl version
RUN which openssl
# install RVM, Ruby, and Bundler
RUN \curl -L https://get.rvm.io | bash -s stable
RUN /bin/bash -l -c "rvm requirements"
# replace ruby mirror url, accelerate install ruby
RUN sed -i 's/rvm_remote_server_url2/#rvm_remote_server_url2/g' /usr/local/rvm/config/db
RUN sed -i 's/cache.ruby-lang.org/cache.ruby-china.com/g' /usr/local/rvm/config/db
# install ruby
RUN /bin/bash -l -c "rvm install 2.4.5"
# confirm ruby version
RUN /bin/bash -l -c "rvm list"
RUN /bin/bash -l -c "ruby -v"

View File

@ -245,13 +245,12 @@ GEM
powerpack (0.1.2)
prettier (0.18.2)
public_suffix (4.0.3)
puma (3.12.2)
puma (5.6.5)
nio4r (~> 2.0)
raabro (1.4.0)
rack (2.0.9)
rack-cors (1.1.1)
rack (>= 2.0.0)
rack-mini-profiler (2.0.1)
rack (>= 1.2.0)
rack-protection (2.0.8.1)
rack
rack-test (1.1.0)
@ -514,9 +513,8 @@ DEPENDENCIES
parallel (~> 1.19, >= 1.19.1)
pdfkit
prettier
puma (~> 3.11)
puma (~> 5.6.5)
rack-cors
rack-mini-profiler
rails (~> 5.2.0)
rails-i18n (~> 5.1)
ransack
@ -538,7 +536,7 @@ DEPENDENCIES
sidekiq-cron (= 1.2.0)
sidekiq-failures
simple_form
simple_xlsx_reader
simple_xlsx_reader (~> 1.0.4)
sinatra
solargraph (~> 0.38.0)
spreadsheet

View File

@ -3,7 +3,8 @@
GitLink确实开源是中国计算机学会CCF官方指定的开源创新服务平台旨在以“为开源创新服务”为使命以“成为开源创新的汇聚地”为愿景秉承“创新、开放、协作、共享”的价值观致力于为大规模开源开放协同创新助力赋能打造创新成果孵化和新工科人才培养的开源创新生态
<center>
<img src="https://code.gitlink.org.cn/young/forgeplus/raw/branch/master/docs/figs/gitlink.png?raw=true" width=80% /></center>
<img src="docs/figs/gitlink.png" width=80% /></center>
## 特色功能
@ -174,31 +175,31 @@ http://localhost:3000/
- 项目列表
<center>
<img src="https://code.gitlink.org.cn/young/forgeplus/raw/branch/master/docs/figs/project_list.png?raw=true" width=50% />
<img src="docs/figs/project_list.png" width=80% />
</center>
- 代码仓库
<center>
<img src="https://code.gitlink.org.cn/young/forgeplus/raw/branch/master/docs/figs/repo.png?raw=true" width=50% />
<img src="docs/figs/repo.png" width=80% />
</center>
- 任务管理
<center>
<img src="https://code.gitlink.org.cn/young/forgeplus/raw/branch/master/docs/figs/issues.png?raw=true" width=50% />
<img src="docs/figs/issues.png" width=80% />
</center>
- 合并请求
<center>
<img src="https://code.gitlink.org.cn/young/forgeplus/raw/branch/master/docs/figs/PR.png?raw=true" width=50% />
<img src="docs/figs/PR.png" width=80% />
</center>
- 引擎配置
<center>
<img src="https://code.gitlink.org.cn/young/forgeplus/raw/branch/master/docs/figs/engine.png?raw=true" width=50% />
<img src="docs/figs/engine.png" width=80% />
</center>

View File

@ -253,6 +253,7 @@ class PullRequestsController < ApplicationController
normal_status(-1, result.message)
end
rescue => e
logger_error(e)
normal_status(-1, e.message)
raise ActiveRecord::Rollback
end

View File

@ -9,7 +9,7 @@ module Register
login_exist = Owner.exists?(login: login) || ReversedKeyword.check_exists?(login)
if user.present?
raise LoginError, '登录名已被使用' if login_exist && login != user&.login
raise LoginError, '登录名已被他人使用' if login_exist && login != user&.login
else
raise LoginError, '登录名已被使用' if login_exist
end

View File

@ -8,7 +8,7 @@ module Register
def check!
user = User.find_by(id: user_id)
Rails.logger.info "Register::RemoteForm params: id: #{user&.id}; username: #{username}; email: #{email}; password: #{password}; platform: #{platform}"
Rails.logger.info "Register::RemoteForm params: id: #{user_id}; username: #{username}; email: #{email}; password: #{password}; platform: #{platform}"
check_login(username, user)
check_mail(email,user)
check_password(password)

View File

@ -3,11 +3,11 @@
<tr>
<th width="5%">序号</th>
<th width="15%">名称</th>
<th width="30%">路由</th>
<th width="20%">标识</th>
<th width="35%">路由</th>
<th width="15%">标识</th>
<th width="10%">类型</th>
<th width="20%"><%= sort_tag('创建时间', name: 'created_at', path: admins_sites_path) %></th>
<th width="25%">操作</th>
<th width="15%"><%= sort_tag('创建时间', name: 'created_at', path: admins_sites_path) %></th>
<th width="15%">操作</th>
</tr>
</thead>
<tbody>
@ -20,7 +20,7 @@
</td>
<td><%= site.url %></td>
<td><%= overflow_hidden_span display_text(site.key), width: 150 %></td>
<td><%= overflow_hidden_span display_text(site.key), width: 170 %></td>
<td><%= site.site_type.humanize %></td>
<td><%= site.created_at&.strftime('%Y-%m-%d %H:%M') %></td>
<td class="action-container">

View File

@ -6,7 +6,7 @@
<%= form_tag(admins_sites_path, method: :get, class: 'form-inline search-form flex-1', remote: true) do %>
<div class="form-group mr-2">
<label for="status">类型:</label>
<% type_options = [['全部', ''], ['Add', Site.site_types[:add]], ['Personal', Site.site_types[:personal]], ['Common', Site.site_types[:common]]] %>
<% type_options = [['全部', ''], ['Add', Site.site_types[:add]], ['Personal', Site.site_types[:personal]], ['Common', Site.site_types[:common]], ['Competition', Site.site_types[:competition]]] %>
<%= select_tag(:site_type, options_for_select(type_options), class: 'form-control') %>
</div>

View File

@ -0,0 +1,28 @@
default: &default
adapter: mysql2
host: <%= ENV.fetch("MYSQL_HOST") { '127.0.0.1' } %>
encoding: utf8mb4
reconnect: true
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
username: <%= ENV.fetch("MYSQL_USER") { 'root' } %>
password: <%= ENV.fetch("MYSQL_PWD") { '123456' } %>
gitea_server:
adapter: mysql2
database: <%= ENV.fetch("MYSQL_DB") { 'gitea' } %>
host: 127.0.0.1
username: <%= ENV.fetch("MYSQL_USER") { 'root' } %>
password: <%= ENV.fetch("MYSQL_PWD") { '123456' } %>
encoding: utf8
development:
<<: *default
host: 127.0.0.1
database: forge_development
test:
<<: *default
database: forge_test
production:
<<: *default
database: <%= ENV.fetch("MYSQL_DB") { 'forge_production' } %>

View File

@ -16,9 +16,9 @@
## Steps
### 1. 克隆稳定版本仓库
### 1. 克隆本地版本仓库(去掉了邮箱和手机号验证码)
```
git clone -b standalone https://git.trustie.net/jasder/forgeplus.git
git clone -b dev_local_v1 https://gitlink.org.cn/Gitlink/forgeplus.git
```
### 2. 安装依赖包
@ -54,7 +54,7 @@ default: &default
### 4. 配置gitea服务(可选)
**如需要部署自己的gitea平台请参考gitea官方平台https://docs.gitea.io/zh-cn/install-from-binary/**
**因目前gitea平台api受限暂时推荐从forge平台获取gitea部署文件进行部署https://forgeplus.trustie.net/projects/Trustie/gitea-binary**
**因目前gitea平台api受限暂时推荐从forge平台获取gitea部署文件进行部署https://gitlink.org.cn/Gitlink/gitea-binary**
#### 配置gitea服务步骤
1. 部署gitea服务并注册root账户
@ -93,7 +93,7 @@ rails db:migrate RAILS_ENV=development
### 9. clone前端代码
**将前端代码克隆到public/react目录下目录结构应该是: public/react/build**
```bash
git clone -b standalone https://git.trustie.net/jasder/build.git
git clone -b dev_local_v1 https://gitlink.org.cn/Gitlink/build.git
```
### 10. 启动redis(此处已mac系统为例)

16
gitea/Dockerfile Normal file
View File

@ -0,0 +1,16 @@
FROM golang:1.20.4
RUN yum update -y && \
yum install -y wget gcc make openssl-devel bzip2-devel libffi-devel zlib-devel git
#ENV GIT_SSH_COMMAND='ssh -o StrictHostKeyChecking=no -i /root/.ssh/id_rsa'
RUN yum install -y autoconf gettext && \
wget http://github.com/git/git/archive/v2.32.0.tar.gz && \
tar -xvf v2.32.0.tar.gz && \
rm -f v2.32.0.tar.gz && \
cd git-* && \
make configure && \
./configure --prefix=/usr && \
make -j16 && \
make install

121
gitea/app.ini Normal file
View File

@ -0,0 +1,121 @@
APP_NAME = Trustie: Git with trustie
RUN_USER = git
RUN_MODE = prod
[oauth2]
JWT_SECRET = pyD-ZA6zwykBhVCWdF5FsdRGDtM6kg16JLhcCu8uLPM
[security]
INTERNAL_TOKEN = eyDDbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE1NzQyMzU3OTN9.w7RDQaNanZHdC2XIrr9kAntPIjhfkXXOiBnNTbEdqQ8
INSTALL_LOCK = true
SECRET_KEY = K4DDaucPzKQnTf7WQxKFIoFNtIlsWVacoN5Ss3VDypQBUes7Ncy96UU735sfGOar
PASSWORD_COMPLEXITY = off
REVERSE_PROXY_LIMIT = 1
REVERSE_PROXY_TRUSTED_PROXIES = *
[database]
DB_TYPE = mysql
HOST = 127.0.0.1:3306
NAME = gitea
USER = root
PASSWD = `123456`
CHARSET = utf8
SSL_MODE = disable
PATH = /var/lib/gitea/data/gitea.db
CONN_MAX_LIFE_TIME=180
MAX_IDLE_CONNS=5
MAX_OPEN_CONNS=200
LOG_SQL =true
[repository]
ROOT = /data/gitea-repositories
DEFAULT_BRANCH = master
[lfs]
PATH = /data/gitea/data/lfs
[server]
SSH_DOMAIN = testgitea2.trustie.net
DOMAIN = testgitea2.trustie.net
ROOT_URL = https://testgitea2.trustie.net/
DISABLE_SSH = false
SSH_PORT = 22
LFS_START_SERVER = true
LFS_CONTENT_PATH = /data/gitea/data/lfs
LFS_JWT_SECRET = n2kib4qdArULO57JW0jD2Ygm3z1ehzI8Y4zVfbxouyY
OFFLINE_MODE = false
ENABLE_PPROF = true
#REGISTER_EMAIL_CONFIRM = false
[webhook]
QUEUE_LENGTH = 1000
DELIVER_TIMEOUT = 5
SKIP_TLS_VERIFY = false
PAGING_NUM = 10
#PROXY_URL =
#PROXY_HOSTS =
[mailer]
ENABLED = false
[service]
REGISTER_EMAIL_CONFIRM = false
ENABLE_NOTIFY_MAIL = ANCH = master
DISABLE_REGISTRATION = false
ALLOW_ONLY_EXTERNAL_REGISTRATION = false
ENABLE_CAPTCHA = false
REQUIRE_SIGNIN_VIEW = true
DEFAULT_KEEP_EMAIL_PRIVATE = false
DEFAULT_ALLOW_CREATE_ORGANIZATION = true
DEFAULT_ENABLE_TIMETRACKING = true
NO_REPLY_ADDRESS = noreply.example.org
SHOW_REGISTRATION_BUTTON = false
[picture]
DISABLE_GRAVATAR = true
ENABLE_FEDERATED_AVATAR = false
[openid]
ENABLE_OPENID_SIGNIN = true
ENABLE_OPENID_SIGNUP = true
[session]
PROVIDER = file
[log]
MODE = file
LEVEL = Trace
ROOT_PATH = /var/lib/gitea/log
REDIRECT_MACARON_LOG = true
[api]
DEFAULT_PAGING_NUM = 20
[git]
PATH =
DISABLE_DIFF_HIGHLIGHT = false
MAX_GIT_DIFF_LINES = 250
MAX_GIT_DIFF_LINE_CHARACTERS = 1200
MAX_GIT_DIFF_FILES = 25
GC_ARGS =
EnableAutoGitWireProtocol = true
; Operation timeout in seconds
[git.timeout]
DEFAULT = 1800
MIGRATE = 21600
MIRROR = 1800
CLONE = 1800
PULL = 1800
GC = 60
[migrations]
ALLOW_LOCALNETWORKS = true
[cron.update_mirrors]
SCHEDULE = @every 24h
[cron.delete_repo_archives]
ENABLED = true
RUN_AT_START = true
SCHEDULE = @every 72h

41
gitea/gitea.service Normal file
View File

@ -0,0 +1,41 @@
[Unit]
Description=Gitea (Git with a cup of tea)
After=syslog.target
After=network.target
[Service]
# Uncomment the next line if you have repos with lots of files and get a HTTP 500 error because of that
# LimitNOFILE=524288:524288
RestartSec=2s
Type=simple
User=git
Group=git
WorkingDirectory=/var/lib/gitea/
# If using Unix socket: tells systemd to create the /run/gitea folder, which will contain the gitea.sock file
# (manually creating /run/gitea doesn't work, because it would not persist across reboots)
#RuntimeDirectory=gitea
ExecStart=/usr/local/bin/gitea web --config /etc/gitea/app.ini
Restart=always
Environment=USER=git HOME=/home/git GITEA_WORK_DIR=/var/lib/gitea
# If you install Git to directory prefix other than default PATH (which happens
# for example if you install other versions of Git side-to-side with
# distribution version), uncomment below line and add that prefix to PATH
# Don't forget to place git-lfs binary on the PATH below if you want to enable
# Git LFS support
#Environment=PATH=/path/to/git/bin:/bin:/sbin:/usr/bin:/usr/sbin
# If you want to bind Gitea to a port below 1024, uncomment
# the two values below, or use socket activation to pass Gitea its ports as above
###
#CapabilityBoundingSet=CAP_NET_BIND_SERVICE
#AmbientCapabilities=CAP_NET_BIND_SERVICE
###
# In some cases, when using CapabilityBoundingSet and AmbientCapabilities option, you may want to
# set the following value to false to allow capabilities to be applied on gitea process. The following
# value if set to true sandboxes gitea service and prevent any processes from running with privileges
# in the host user namespace.
###
#PrivateUsers=false
###
[Install]
WantedBy=multi-user.target

View File

@ -1,16 +1,19 @@
namespace :commit_log_to_db do
desc "commit_log_to_db"
task done: :environment do
puts "project_id=================#{ENV['project_id']}"
return if ENV['project_id'].blank?
projects = Project.where(id: ENV['project_id'])
if ENV['project_name'] == "jittor"
projects = Project.where(id: [1403791,1404837,1404087,1403854,1403883,1403886,1403894,1404027,1404187,1404234,1404291,1404522,1404238,1404632,1404003,1403975,1404285,1404525,1404017,1403843,1403867,1403874,1403878,1403881,1403887,1403898,1403916,1403937,1403954,1403961,1403963,1403965,1403967,1403972,1403974,1403976,1403977,1403978,1404007,1404012,1404020,1404023,1404032,1404042,1404058,1404065,1404069,1404071,1404072,1404078,1404094,1404104,1404143,1404146,1404167,1404173,1404174,1404175,1404210,1404216,1404226,1404229,1404240,1404242,1404244,1404247,1404248,1404250,1404261,1404272,1404276,1404290,1404327,1404333,1404360,1404450,1404460,1404466,1404485,1404489,1404491,1404496,1404500,1404502,1404507,1404519,1404521,1404523,1404527,1404530,1404532,1404537,1404540,1404541,1404710,1404328,1404211,1404241,1404107,1403880,1404271,1404268,1404745,1404101,1404051,1404047,1404052,1406706,1403852,1403931,1404165,1404607,1404498,1404014,1404045,1404043,1403739,1403801,1403815,1403821,1403822,1403824,1403836,1403853,1403872,1403904,1403906,1403909,1403915,1403919,1403921,1403943,1403945,1403971,1403981,1404022,1404026,1404030,1404037,1404091,1404133,1404163,1404184,1404209,1404212,1404220,1404246,1404249,1404263,1404265,1404287,1404299,1404311,1404497,1404506,1404546,1404558,1404577,1404582,1404591,1404592,1404594,1404595,1404596,1404597,1404605,1404606,1404609,1404639,1404641,1404659,1404671,1404681,1404702,1404748,1404754,1404759,1404785,1404879,1404955,1405169,1405205,1405265,1405374,1407368,1407446,1407671,1407673,1404956,1404079,1404080,1403889,1404665,1404801,1404224,1404931,1404544,1403844,1404036,1404067,1404587,1404696,1404732,1404598,1405192,1404162,1403920,1403903,1405248,1403792,1403817,1403962,1403841,1404188,1404185,1405273,1404575,1404550,1404834,1405420,1404141,1405256,1404633,1405277,1404590,1404796,1405230,1405189,1404584,1405257,1405198,1403925,1404692,1405253,1403809,1405118,1404756,1404962,1404864,1405190,1405258,1405274,1404642,1404924,1404453,1404926,1404649,1404237,1404233,1404600,1404758,1405259,1404157,1404444,1404451,1404920,1404919,1404927,1403830,1404658,1405145,1405185,1403842,1403807,1403895,1404549,1404593,1404750,1404798,1404551,1404701,1405156,1404579,1404655,1405267,1404957,1404556,1404651,1404456,1405430,1403955,1404063,1404214,1403942,1404040,1404804,1428732,1403939,1404208,1404245,1405278,1404139,1403850,1404192,1404293,1404297,1404370,1404492,1404693,1404757,1404329,1404512,1404228,1404314,1404016,1404652,1405275,1404832,1404561,1404653,1404704,1404892,1404589,1404953,1405269,1404881,1404221,1404230,1404793,1403953,1404933,1404035,1404599,1403924,1404119,1404526,1404581,1404705,1404709,1404073,1403808,1403892,1404574,1403849,1404251,1404792,1403865,1404640,1404783,1404048,1406707,1404708,1404053,1404295,1404050,1404049,1404044,1404274,1404046,1404636])
end
if ENV['project_name'] == "mindspore"
projects = Project.where(identifier: ['MindSpore-first-experience', ' MindSpore-install', 'MindSpore-Application-practice', 'MindSpore-Model-Development', 'MindSpore-Data-preprocessing', 'Mindspore-Data-storage-use', 'MindSpore-Data-storage-kunpeng', 'MindSpore-LeNet-jzx3', 'MindSpore-competition'] )
end
# puts "project_id=================#{ENV['project_id']}"
# return if ENV['project_id'].blank?
# projects = Project.where(id: ENV['project_id'])
# if ENV['project_name'] == "jittor"
# projects = Project.where(id: [1403791,1404837,1404087,1403854,1403883,1403886,1403894,1404027,1404187,1404234,1404291,1404522,1404238,1404632,1404003,1403975,1404285,1404525,1404017,1403843,1403867,1403874,1403878,1403881,1403887,1403898,1403916,1403937,1403954,1403961,1403963,1403965,1403967,1403972,1403974,1403976,1403977,1403978,1404007,1404012,1404020,1404023,1404032,1404042,1404058,1404065,1404069,1404071,1404072,1404078,1404094,1404104,1404143,1404146,1404167,1404173,1404174,1404175,1404210,1404216,1404226,1404229,1404240,1404242,1404244,1404247,1404248,1404250,1404261,1404272,1404276,1404290,1404327,1404333,1404360,1404450,1404460,1404466,1404485,1404489,1404491,1404496,1404500,1404502,1404507,1404519,1404521,1404523,1404527,1404530,1404532,1404537,1404540,1404541,1404710,1404328,1404211,1404241,1404107,1403880,1404271,1404268,1404745,1404101,1404051,1404047,1404052,1406706,1403852,1403931,1404165,1404607,1404498,1404014,1404045,1404043,1403739,1403801,1403815,1403821,1403822,1403824,1403836,1403853,1403872,1403904,1403906,1403909,1403915,1403919,1403921,1403943,1403945,1403971,1403981,1404022,1404026,1404030,1404037,1404091,1404133,1404163,1404184,1404209,1404212,1404220,1404246,1404249,1404263,1404265,1404287,1404299,1404311,1404497,1404506,1404546,1404558,1404577,1404582,1404591,1404592,1404594,1404595,1404596,1404597,1404605,1404606,1404609,1404639,1404641,1404659,1404671,1404681,1404702,1404748,1404754,1404759,1404785,1404879,1404955,1405169,1405205,1405265,1405374,1407368,1407446,1407671,1407673,1404956,1404079,1404080,1403889,1404665,1404801,1404224,1404931,1404544,1403844,1404036,1404067,1404587,1404696,1404732,1404598,1405192,1404162,1403920,1403903,1405248,1403792,1403817,1403962,1403841,1404188,1404185,1405273,1404575,1404550,1404834,1405420,1404141,1405256,1404633,1405277,1404590,1404796,1405230,1405189,1404584,1405257,1405198,1403925,1404692,1405253,1403809,1405118,1404756,1404962,1404864,1405190,1405258,1405274,1404642,1404924,1404453,1404926,1404649,1404237,1404233,1404600,1404758,1405259,1404157,1404444,1404451,1404920,1404919,1404927,1403830,1404658,1405145,1405185,1403842,1403807,1403895,1404549,1404593,1404750,1404798,1404551,1404701,1405156,1404579,1404655,1405267,1404957,1404556,1404651,1404456,1405430,1403955,1404063,1404214,1403942,1404040,1404804,1428732,1403939,1404208,1404245,1405278,1404139,1403850,1404192,1404293,1404297,1404370,1404492,1404693,1404757,1404329,1404512,1404228,1404314,1404016,1404652,1405275,1404832,1404561,1404653,1404704,1404892,1404589,1404953,1405269,1404881,1404221,1404230,1404793,1403953,1404933,1404035,1404599,1403924,1404119,1404526,1404581,1404705,1404709,1404073,1403808,1403892,1404574,1403849,1404251,1404792,1403865,1404640,1404783,1404048,1406707,1404708,1404053,1404295,1404050,1404049,1404044,1404274,1404046,1404636])
# end
# if ENV['project_name'] == "mindspore"
# projects = Project.where(identifier: ['MindSpore-first-experience', ' MindSpore-install', 'MindSpore-Application-practice', 'MindSpore-Model-Development', 'MindSpore-Data-preprocessing', 'Mindspore-Data-storage-use', 'MindSpore-Data-storage-kunpeng', 'MindSpore-LeNet-jzx3', 'MindSpore-competition'] )
# end
# projects = Project.where(id: [5533,2,5971,299,1707,4418,1673,290,17,29,907,956,162,950])
projects = Project.where("id < 6200").where("id not in(5533,2,5971,299,1707,4418,1673,290,17,29,907,956,162,950)").where("project_type !=2")
projects.each_with_index do |project, index|
next if project.owner.nil?
result = Gitea::Repository::Commits::ListService.call(project.owner.login,project.identifier,sha: "", page: 1, limit: 200, token: project.owner.gitea_token)
next if result.blank? || result[:total_count].blank?
total_count = result[:total_count]

View File

@ -0,0 +1,44 @@
namespace :copy_attachment_files do
desc "copy_attachment_files to out path"
task done: :environment do
cp_path = ENV['path'] || "/home/pdl/cp_files"
container_type = ENV['_type']
next if container_type.blank?
Dir.mkdir(cp_path) unless Dir.exist?(cp_path)
attachments = Attachment.where(container_type: container_type)
attachments.each do |file|
file_path = File.join(file.disk_directory.to_s, file.disk_filename.to_s)
next unless File.exist?("#{Rails.root.to_s}/files/#{file_path}")
dir_path_year = "#{cp_path}/#{file.disk_directory.to_s.split("/")[0]}"
Dir.mkdir(dir_path_year) unless Dir.exist?(dir_path_year)
dir_path = "#{cp_path}/#{file.disk_directory}"
Dir.mkdir(dir_path) unless Dir.exist?(dir_path)
puts "cp #{Rails.root.to_s + File.join("/files/", file_path)} #{dir_path}"
system("cp #{Rails.root.to_s + File.join("/files/", file_path)} #{dir_path}")
end
end
task memo: :environment do
cp_path = ENV['path'] || "/home/pdl/cp_files"
memos = Memo.where("content like '%/attachments/send_file/%'")
att_ids = []
memos.each do |memo|
# 附件的格式为(/api/attachments/ + 附件id的形式提取出id进行附件属性关联做附件访问权限控制
att_ids += memo.content.to_s.scan(/\(\/attachments\/send_file\/.+\)/).map{|s|s.match(/\d+/)[0]}
att_ids += memo.content.to_s.scan(/\/attachments\/send_file\/.+\"/).map{|s|s.match(/\d+/)[0]}
att_ids += memo.content.to_s.scan(/\/attachments\/send_file\/\d+/).map{|s|s.match(/\d+/)[0]}
end
if att_ids.present?
attachments = Attachment.where(id: att_ids)
attachments.each do |file|
file_path = File.join(file.disk_directory, file.disk_filename)
dir_path_year = "#{cp_path}/#{file.disk_directory.to_s.split("/")[0]}"
Dir.mkdir(dir_path_year) unless Dir.exist?(dir_path_year)
dir_path = "#{cp_path}/#{file.disk_directory}"
Dir.mkdir(dir_path) unless Dir.exist?(dir_path)
puts "cp #{Rails.root.to_s + File.join("/files/", file_path)} #{dir_path}"
system("cp #{Rails.root.to_s + File.join("/files/", file_path)} #{dir_path}")
end
end
end
end

View File

@ -4,22 +4,37 @@ namespace :repair_gitea_user do
users = User.find_by_sql("SELECT * FROM `users` WHERE id !=2 AND type='User' AND NOT EXISTS (SELECT * FROM forgegitea.`user` WHERE forgegitea.`user`.id=users.gitea_uid)")
puts "total users count:#{users.count}"
success_count = 0
update_count = 0
users.each do |user|
begin
interactor = Gitea::RegisterInteractor.call({ username: user.login, email: user.mail, password: "abc12345678" })
if interactor.success?
gitea_user = interactor.result
result = Gitea::User::GenerateTokenService.call(user.login, password)
result = Gitea::User::GenerateTokenService.call(user.login, "abc12345678" )
user.gitea_token = result['sha1']
user.gitea_uid = gitea_user[:body]['id']
user.is_sync_pwd = false
user.save!
success_count = success_count + 1
else
if interactor.result[:message].present? && interactor.result[:message].to_s.include?("user already exists")
uid = ActiveRecord::Base.connection.query_value("SELECT id FROM forgegitea.`user` WHERE forgegitea.`user`.name='#{user.login}' and forgegitea.`user`.email='#{user.mail}'")
if uid.present?
result = Gitea::User::GenerateTokenService.call(user.login, "abc12345678" )
if result['sha1'].present?
user.gitea_token = result['sha1']
user.gitea_uid = uid
user.is_sync_pwd = false
user.save!
update_count = update_count + 1
end
end
end
end
rescue Exception => e
puts "repair gitea user: #{user.id}:#{user.login}:, error:#{e}"
end
end
puts "repair gitea user success total: #{success_count}"
puts "repair gitea user success total: #{success_count},update_count:#{update_count}"
end
end