forked from Gitlink/forgeplus
Compare commits
380 Commits
standalone
...
master
| Author | SHA1 | Date |
|---|---|---|
|
|
2b1ea5c717 | |
|
|
b774ba9e48 | |
|
|
93fdd503e3 | |
|
|
24a5a2e4e5 | |
|
|
5037f05ea2 | |
|
|
cb34089982 | |
|
|
4eb7d275a0 | |
|
|
89dd43e079 | |
|
|
6ffac40f8d | |
|
|
0364b2b47c | |
|
|
a3e94e47e7 | |
|
|
0be92d5288 | |
|
|
8665d989c1 | |
|
|
5df4f2d0b1 | |
|
|
33138aed80 | |
|
|
b21317eb0a | |
|
|
925e9f1c64 | |
|
|
6c73c6f485 | |
|
|
46873a77cd | |
|
|
7fdf4e7557 | |
|
|
272639f9fd | |
|
|
fe77a97057 | |
|
|
c9e259e2e8 | |
|
|
ce5beac223 | |
|
|
756ed9152e | |
|
|
e17021b9c1 | |
|
|
552037642e | |
|
|
21a78563a0 | |
|
|
8b72f5157c | |
|
|
49bd1a130a | |
|
|
ae6400a06d | |
|
|
36c6e77f6d | |
|
|
add2afeb5f | |
|
|
6ede037c62 | |
|
|
292248b9b8 | |
|
|
377adf901f | |
|
|
9e10625b8b | |
|
|
383019b7f5 | |
|
|
54c38fd9e7 | |
|
|
26621340f1 | |
|
|
d188e5bb7b | |
|
|
f7d3e7acdf | |
|
|
2b67333f74 | |
|
|
de9e7cfcd6 | |
|
|
5dbf614e00 | |
|
|
3d3c09a804 | |
|
|
12061f4ce8 | |
|
|
f94d224afc | |
|
|
73f0b2c075 | |
|
|
ad239580da | |
|
|
b55f24e6fe | |
|
|
0336aa0cca | |
|
|
a0138a8d7b | |
|
|
a3075c157b | |
|
|
a247c3ae46 | |
|
|
25630ce40f | |
|
|
acda84fec2 | |
|
|
cfcc0d8d0a | |
|
|
ba20708514 | |
|
|
64ffab243c | |
|
|
0d2ed00e4c | |
|
|
7303be9db2 | |
|
|
3e09ee08d3 | |
|
|
84a46a1042 | |
|
|
d887eb5d41 | |
|
|
3229ef5e2e | |
|
|
267adf354b | |
|
|
e91ae81589 | |
|
|
e94e45bb63 | |
|
|
3597dc38e7 | |
|
|
314ccdba0b | |
|
|
670f05c658 | |
|
|
e0b47faec9 | |
|
|
768b4f1f57 | |
|
|
2055a5a3a6 | |
|
|
f2ab9f6a28 | |
|
|
2e773e92fb | |
|
|
db736cae66 | |
|
|
13517c8eab | |
|
|
1bf1651b0c | |
|
|
77f31e3a78 | |
|
|
8b8388f8db | |
|
|
2dd567d212 | |
|
|
6ba0374119 | |
|
|
bf7178fb37 | |
|
|
53988cf557 | |
|
|
ba77db7cc3 | |
|
|
f221e9c069 | |
|
|
cc8899906f | |
|
|
7bc213fe88 | |
|
|
91125c5e44 | |
|
|
1e47fa7c91 | |
|
|
b63b15c7fd | |
|
|
38ef156b55 | |
|
|
26736a1cd6 | |
|
|
8ccaedd3d1 | |
|
|
1026a5ea3d | |
|
|
2a1b9792cd | |
|
|
5b9b08c05d | |
|
|
ccfe28ceb9 | |
|
|
d10334a825 | |
|
|
30eedbafb9 | |
|
|
7b6845ec3e | |
|
|
f80a33c9df | |
|
|
04f8bcb1b0 | |
|
|
0559110d12 | |
|
|
05dd162646 | |
|
|
0dea83488d | |
|
|
792810f4a9 | |
|
|
adf77df1bf | |
|
|
fde238eb1b | |
|
|
19c2367257 | |
|
|
233642d903 | |
|
|
fd54d4d10c | |
|
|
65dba54a41 | |
|
|
913f4faefd | |
|
|
8819c9b9ae | |
|
|
61a36cc847 | |
|
|
2b55bfacf8 | |
|
|
97af146a30 | |
|
|
b7c009ae94 | |
|
|
1fc75379e4 | |
|
|
ecde7be506 | |
|
|
87bcc7b8d0 | |
|
|
79e3ac3fa8 | |
|
|
a34f17b669 | |
|
|
8637dfb193 | |
|
|
90d0c8a282 | |
|
|
2c8e285170 | |
|
|
6d593f786b | |
|
|
b4c5991bc8 | |
|
|
59907c371d | |
|
|
2219dc5b76 | |
|
|
90928219fb | |
|
|
f68224ea2b | |
|
|
7df9bfd297 | |
|
|
fdc7c1565e | |
|
|
0c361b0c54 | |
|
|
7482458135 | |
|
|
4a4ffea71c | |
|
|
d6399e26db | |
|
|
f6c5916b97 | |
|
|
cfb7f61f0d | |
|
|
73c747397f | |
|
|
6eafc2eb84 | |
|
|
58e17d6a01 | |
|
|
b83982c623 | |
|
|
411e7535d9 | |
|
|
65ad9f6c44 | |
|
|
2724174f9a | |
|
|
35378c3a04 | |
|
|
697f022ab1 | |
|
|
cf6b991027 | |
|
|
6155187550 | |
|
|
26b00f364f | |
|
|
ba2e03287d | |
|
|
0414086daa | |
|
|
35f1b840a6 | |
|
|
c63258a519 | |
|
|
e96d4e3d05 | |
|
|
b1b234d6c0 | |
|
|
ef6d952124 | |
|
|
be73306cf8 | |
|
|
6683fef667 | |
|
|
289d1e795e | |
|
|
031ad5fb08 | |
|
|
6f0993396d | |
|
|
8cdacc3210 | |
|
|
01a38f89a7 | |
|
|
9a7e9b4237 | |
|
|
b744e10dfc | |
|
|
a54aa72f46 | |
|
|
b7a400060b | |
|
|
7ab159d7f9 | |
|
|
5fb4a82f2b | |
|
|
1a186547d3 | |
|
|
4dc1c0b7b4 | |
|
|
4c7963585f | |
|
|
1554268b17 | |
|
|
9950273460 | |
|
|
2dafe8c9c9 | |
|
|
8e8226d15b | |
|
|
810db632d9 | |
|
|
3762515207 | |
|
|
7ef905c7d6 | |
|
|
f9b1aac07e | |
|
|
e861dd059e | |
|
|
957a8f9d85 | |
|
|
49bcff6277 | |
|
|
abed0079d9 | |
|
|
dea9444a56 | |
|
|
493de92920 | |
|
|
a0b7cc99a1 | |
|
|
59a6e3121e | |
|
|
35cc2cb735 | |
|
|
f4ddc45d6b | |
|
|
30ffd95fa5 | |
|
|
51266553f8 | |
|
|
acb99701a1 | |
|
|
768764a814 | |
|
|
d106ac9763 | |
|
|
7a57108ca5 | |
|
|
99e0d8b128 | |
|
|
c562d5a102 | |
|
|
24e4020809 | |
|
|
1fd4196751 | |
|
|
89e755a590 | |
|
|
ec2f7d8c03 | |
|
|
302e501610 | |
|
|
7d6e09c696 | |
|
|
db0b47c39e | |
|
|
4453975b54 | |
|
|
2ebd8c44f5 | |
|
|
817b607a54 | |
|
|
6d2ae4dcf1 | |
|
|
5a5a602ce5 | |
|
|
4498369064 | |
|
|
109ef3fe1c | |
|
|
38f711f4ae | |
|
|
3333e8c779 | |
|
|
fd62ffdee2 | |
|
|
6ca883aedd | |
|
|
72b3279e8b | |
|
|
3a85d1d736 | |
|
|
1e159ec1cf | |
|
|
9d45ea07c8 | |
|
|
beb96c5526 | |
|
|
2562329a5e | |
|
|
2c5b9649aa | |
|
|
c8217d8596 | |
|
|
1ecd7f26b6 | |
|
|
d4b46dbf97 | |
|
|
03283813c2 | |
|
|
4b57e96914 | |
|
|
095c83d2d0 | |
|
|
03277d2ad7 | |
|
|
c2a4e62131 | |
|
|
f81b3a0b35 | |
|
|
6fb22d3117 | |
|
|
d0623e4d57 | |
|
|
32f03abe84 | |
|
|
24b5c4e672 | |
|
|
33c56e3e79 | |
|
|
ce7a0e4884 | |
|
|
5541002dab | |
|
|
228209b52c | |
|
|
9ee2c8dde3 | |
|
|
6a989f972a | |
|
|
2e2f7b2bd5 | |
|
|
cf190632a1 | |
|
|
d4d96759ac | |
|
|
abbb033fc7 | |
|
|
99fe06c788 | |
|
|
fa1a03e4db | |
|
|
28b8e15fea | |
|
|
624e5b150e | |
|
|
bf232f3518 | |
|
|
50a0ecdbd2 | |
|
|
bb0bbeb06c | |
|
|
1e427a62a6 | |
|
|
ef3472567e | |
|
|
e07af929b2 | |
|
|
31b07e47a9 | |
|
|
4c354f6841 | |
|
|
9cd148e108 | |
|
|
e6f2e9a798 | |
|
|
0da32d15a9 | |
|
|
c6461de871 | |
|
|
09bab2f462 | |
|
|
02b85859b5 | |
|
|
14462752cc | |
|
|
18377dc2e0 | |
|
|
743c63a796 | |
|
|
74c42f679a | |
|
|
300dffd2a1 | |
|
|
9db60413d9 | |
|
|
04c147d80d | |
|
|
1da6c582f0 | |
|
|
2e15988ad6 | |
|
|
f47c4e4b9c | |
|
|
1d1d6ebda1 | |
|
|
56103a885b | |
|
|
c9659fd926 | |
|
|
b73f724bb7 | |
|
|
ca85975197 | |
|
|
9763d5c780 | |
|
|
391059602e | |
|
|
dd938a218e | |
|
|
0ea45459b8 | |
|
|
d1adffbd76 | |
|
|
232bef8f88 | |
|
|
7e29a5d47f | |
|
|
174a2d47dc | |
|
|
9f23400d2a | |
|
|
3527e89866 | |
|
|
9a5a4e8d66 | |
|
|
92f0ed71a1 | |
|
|
9428b5aebb | |
|
|
72f88c8c13 | |
|
|
349c775404 | |
|
|
dd914595fa | |
|
|
3ac9c0b5d8 | |
|
|
0f5b0b6b48 | |
|
|
0f45f31db0 | |
|
|
3bd4187b0e | |
|
|
46456d956a | |
|
|
f15bc3a3bf | |
|
|
466705bd0f | |
|
|
a40c5a7619 | |
|
|
fc4520c06f | |
|
|
909488b072 | |
|
|
3a2b476dd0 | |
|
|
bbacebc1c9 | |
|
|
c344859063 | |
|
|
c85a15b794 | |
|
|
1b68e7c9d5 | |
|
|
2b03ccc67c | |
|
|
f18f71db9c | |
|
|
921c285d0f | |
|
|
bc7008d8a4 | |
|
|
61b0d4d302 | |
|
|
f094c3a84c | |
|
|
3b896fca3d | |
|
|
0faf192b45 | |
|
|
076120de8d | |
|
|
63cc2528cd | |
|
|
e3df5a0f64 | |
|
|
6be6dd1bf1 | |
|
|
d0baa9073d | |
|
|
f28d835e58 | |
|
|
f4a7903613 | |
|
|
a74b6a1ca4 | |
|
|
6e42b84040 | |
|
|
a46de1b658 | |
|
|
89c64e276e | |
|
|
46252c2feb | |
|
|
eb8266db90 | |
|
|
31923c9086 | |
|
|
5135f60e50 | |
|
|
b114ee9701 | |
|
|
d6aa23b484 | |
|
|
1b93da7f67 | |
|
|
cddb204d28 | |
|
|
da7e0a4143 | |
|
|
7116f38061 | |
|
|
a7968ed95c | |
|
|
2998fce62e | |
|
|
b45e9fb224 | |
|
|
fa57d3a9ba | |
|
|
9c9c376224 | |
|
|
cc6228bcfe | |
|
|
818781f6e0 | |
|
|
ba134ad0fa | |
|
|
1327fcb4f4 | |
|
|
166952560e | |
|
|
7fdd39291b | |
|
|
d78408d799 | |
|
|
f289b8046f | |
|
|
41a9773c90 | |
|
|
d14fca3792 | |
|
|
b66293b044 | |
|
|
9449bd6eb9 | |
|
|
9f4d9aa5db | |
|
|
a336e91dd8 | |
|
|
65a00efd32 | |
|
|
9859c30f9d | |
|
|
9232f3ca9b | |
|
|
24ac425c21 | |
|
|
e16452ac90 | |
|
|
8cc565ca0c | |
|
|
1b2a4e0b94 | |
|
|
99f7fe6102 | |
|
|
681a485192 | |
|
|
58354dc944 | |
|
|
e815710c57 | |
|
|
dbcac032dd | |
|
|
d1c8f1aead | |
|
|
bf1ffadf41 | |
|
|
f07ae49246 | |
|
|
5eee13ea87 |
20
Dockerfile
20
Dockerfile
|
|
@ -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'
|
||||
|
|
@ -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"
|
||||
|
|
@ -253,7 +253,7 @@ GEM
|
|||
pry-rails (0.3.9)
|
||||
pry (>= 0.10.4)
|
||||
public_suffix (4.0.3)
|
||||
puma (5.6.8)
|
||||
puma (5.6.5)
|
||||
nio4r (~> 2.0)
|
||||
raabro (1.4.0)
|
||||
rack (2.0.9)
|
||||
|
|
|
|||
15
README.md
15
README.md
|
|
@ -1,9 +1,10 @@
|
|||
# GitLink - CCF开源创新服务平台
|
||||
# GitLink - CCF开源创新服务平台。
|
||||
|
||||
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>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,13 @@
|
|||
class Admins::DashboardsController < Admins::BaseController
|
||||
def index
|
||||
# 查询优化
|
||||
week_greater_id = CommitLog.where(created_at: current_week).limit(1)[0]&.id
|
||||
#月份统计还需要优化
|
||||
month_greater_id = CommitLog.where(created_at: current_month).limit(1)[0]&.id
|
||||
# 用户活跃数
|
||||
day_user_ids = CommitLog.where(created_at: today).pluck(:user_id).uniq
|
||||
weekly_user_ids = CommitLog.where(created_at: current_week).pluck(:user_id).uniq
|
||||
month_user_ids = CommitLog.where(created_at: current_month).pluck(:user_id).uniq
|
||||
weekly_user_ids = CommitLog.where(created_at: current_week).where("id>= ?", week_greater_id).distinct.pluck(:user_id)
|
||||
month_user_ids = CommitLog.where(created_at: current_month).where("id>= ?", month_greater_id).distinct.pluck(:user_id)
|
||||
@active_user_count = User.where(last_login_on: today).or(User.where(id: day_user_ids)).count
|
||||
@weekly_active_user_count = User.where(last_login_on: current_week).or(User.where(id: weekly_user_ids)).count
|
||||
@month_active_user_count = User.where(last_login_on: current_month).or(User.where(id: month_user_ids)).count
|
||||
|
|
@ -18,8 +22,8 @@ class Admins::DashboardsController < Admins::BaseController
|
|||
|
||||
# 活跃项目数
|
||||
day_project_ids = (CommitLog.where(created_at: today).pluck(:project_id).uniq + Issue.where(created_on: today).pluck(:project_id).uniq).uniq
|
||||
weekly_project_ids = (CommitLog.where(created_at: current_week).pluck(:project_id).uniq + Issue.where(created_on: current_week).pluck(:project_id).uniq).uniq
|
||||
month_project_ids = (CommitLog.where(created_at: current_month).pluck(:project_id).uniq + Issue.where(created_on: current_month).pluck(:project_id).uniq).uniq
|
||||
weekly_project_ids = (CommitLog.where(created_at: current_week).where("id>= ?", week_greater_id).distinct.pluck(:project_id) + Issue.where(created_on: current_week).pluck(:project_id).uniq).uniq
|
||||
month_project_ids = (CommitLog.where(created_at: current_month).where("id>= ?", month_greater_id).distinct.pluck(:project_id) + Issue.where(created_on: current_month).pluck(:project_id).uniq).uniq
|
||||
@day_active_project_count = Project.where(updated_on: today).or(Project.where(id: day_project_ids)).count
|
||||
@weekly_active_project_count = Rails.cache.fetch("dashboardscontroller:weekly_active_project_count", expires_in: 10.minutes) do
|
||||
Project.where(updated_on: current_week).or(Project.where(id: weekly_project_ids)).count
|
||||
|
|
|
|||
|
|
@ -37,19 +37,22 @@ class Admins::ProjectsRankController < Admins::BaseController
|
|||
def export_excel(data)
|
||||
book = Spreadsheet::Workbook.new
|
||||
sheet = book.create_worksheet :name => "项目活跃度排行"
|
||||
sheet.row(0).concat %w(排名 项目全称 项目地址 得分 访问数 关注数 点赞数 fork数 疑修数 合并请求数 提交数)
|
||||
sheet.row(0).concat %w(排名 项目全称 项目地址 项目分类 首次创建时间 外部迁移/独立创建 得分 访问数 关注数 点赞数 fork数 疑修数 合并请求数 提交数)
|
||||
data.each_with_index do |d, index|
|
||||
sheet[index+1,0] = index+1
|
||||
sheet[index+1,1] = "#{d&.project&.owner&.real_name}/#{d&.project&.name}"
|
||||
sheet[index+1,2] = "#{Rails.application.config_for(:configuration)['platform_url']}/#{d&.project&.owner&.login}/#{d&.project&.identifier}"
|
||||
sheet[index+1,3] = d.score
|
||||
sheet[index+1,4] = d.visits
|
||||
sheet[index+1,5] = d.watchers
|
||||
sheet[index+1,6] = d.praises
|
||||
sheet[index+1,7] = d.forks
|
||||
sheet[index+1,8] = d.issues
|
||||
sheet[index+1,9] = d.pullrequests
|
||||
sheet[index+1,10] = d.commits
|
||||
sheet[index+1,3] = d&.project&.project_category&.name
|
||||
sheet[index+1,4] = d&.project&.created_on.present? ? d&.project&.created_on.strftime("%Y-%m-%d %H:%M:%S") : ""
|
||||
sheet[index+1,5] = d&.project&.common? ? "独立创建" : "外部迁移"
|
||||
sheet[index+1,6] = d.score
|
||||
sheet[index+1,7] = d.visits
|
||||
sheet[index+1,8] = d.watchers
|
||||
sheet[index+1,9] = d.praises
|
||||
sheet[index+1,10] = d.forks
|
||||
sheet[index+1,11] = d.issues
|
||||
sheet[index+1,12] = d.pullrequests
|
||||
sheet[index+1,13] = d.commits
|
||||
end
|
||||
book.write "#{Rails.root}/public/项目活跃度排行.xls"
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
class Api::V1::IssuesController < Api::V1::BaseController
|
||||
before_action :require_login, except: [:index, :show, :show_by_id]
|
||||
before_action :require_public_and_member_above, only: [:index, :show, :show_by_id, :create, :update, :destroy]
|
||||
before_action :require_public_and_member_above, only: [:index, :show, :show_by_id, :create, :update, :destroy]
|
||||
before_action :require_operate_above, only: [:batch_update, :batch_destroy]
|
||||
|
||||
def index
|
||||
|
|
@ -24,7 +24,7 @@ class Api::V1::IssuesController < Api::V1::BaseController
|
|||
before_action :check_issue_operate_permission, only: [:update, :destroy]
|
||||
before_action :load_issue_by_id, only: [:show_by_id]
|
||||
|
||||
def show_by_id
|
||||
def show_by_id
|
||||
@issue.associate_attachment_container
|
||||
@user_permission = current_user.present? && current_user.logged? && (@project.member?(current_user) || current_user.admin? || @issue.user == current_user)
|
||||
end
|
||||
|
|
@ -76,9 +76,9 @@ class Api::V1::IssuesController < Api::V1::BaseController
|
|||
end
|
||||
end
|
||||
|
||||
def load_issue_by_id
|
||||
def load_issue_by_id
|
||||
@issue = Issue.find_by_id(params[:index])
|
||||
if @issue.blank?
|
||||
if @issue.blank?
|
||||
render_not_found("疑修不存在!")
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -19,9 +19,10 @@ class CommitLogsController < ApplicationController
|
|||
params[:commits].each do |commit|
|
||||
commit_id = commit[:id]
|
||||
message = commit[:message]
|
||||
commit_date = Time.parse(commit[:timestamp]) || Time.now
|
||||
commit_log = CommitLog.create(user: user, project: project, repository_id: repository_id,
|
||||
name: repository_name, full_name: repository_full_name,
|
||||
ref: ref, commit_id: commit_id, message: message)
|
||||
ref: ref, commit_id: commit_id, message: message, created_at: commit_date, updated_at: commit_date)
|
||||
commit_log.project_trends.create(user_id: user.id, project_id: project&.id, action_type: "create") if user.id !=2
|
||||
# 统计数据新增
|
||||
CacheAsyncSetJob.perform_later("project_common_service", {commits: 1}, project.id)
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ class MainController < ApplicationController
|
|||
end
|
||||
|
||||
def index
|
||||
Rails.logger.info("request.referer============#{request.referer},#{params[:path]}") if request.referer.to_s.include?("educoder.net")
|
||||
domain_session = params[:_educoder_session]
|
||||
if domain_session
|
||||
uid_logger("main start domain_session is #{domain_session}")
|
||||
|
|
|
|||
|
|
@ -45,6 +45,9 @@ class Oauth::EducoderController < Oauth::BaseController
|
|||
result = EducoderOauth::Service.access_token(code)
|
||||
result = EducoderOauth::Service.user_info(result[:access_token])
|
||||
|
||||
Rails.logger.info("OAuth2-session-unionid====111=======#{result['login']}")
|
||||
tip_exception("调用头歌接口错误") if result['login'].blank?
|
||||
|
||||
# 存在该用户
|
||||
open_user = OpenUsers::Educoder.find_by(uid: result['login'])
|
||||
if open_user.present? && open_user.user.present?
|
||||
|
|
@ -68,7 +71,7 @@ class Oauth::EducoderController < Oauth::BaseController
|
|||
OpenUsers::Educoder.create!(user: current_user, uid: result['login'], extra: result)
|
||||
end
|
||||
end
|
||||
Rails.logger.info("[OAuth2] session[:unionid] -> #{session[:unionid]}")
|
||||
Rails.logger.info("OAuth2-session-unionid=========== #{session[:unionid]}")
|
||||
redirect_to "/bindlogin/educoder"
|
||||
|
||||
# redirect_to root_path(new_user: new_user)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class Oauth2Controller < ActionController::Base
|
||||
class Oauth2Controller < ApplicationController
|
||||
layout 'doorkeeper/application'
|
||||
include LoginHelper
|
||||
|
||||
|
|
@ -6,6 +6,9 @@ class Oauth2Controller < ActionController::Base
|
|||
client_id = params[:call_url].split("client_id=")[1].split("&redirect_uri")[0]
|
||||
@call_url = request.fullpath.split('call_url=').last
|
||||
@app = Doorkeeper::Application.find_by(uid: client_id)
|
||||
if User.current.logged?
|
||||
redirect_to @call_url + "&auth=" + User.current.login
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -168,7 +168,6 @@ class VersionReleasesController < ApplicationController
|
|||
attachment.container = target
|
||||
attachment.author_id = current_user.id
|
||||
attachment.description = ""
|
||||
attachment.uuid = SecureRandom.uuid
|
||||
attachment.save
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -145,17 +145,17 @@ module ProjectsHelper
|
|||
url = EduSetting.get("ai_shang_url") || "https://shang.gitlink.org.cn"
|
||||
case project.identifier.to_s.downcase
|
||||
when nil then ""
|
||||
when 'rails' then "#{url}/v1/rails/entropy"
|
||||
when 'jittor' then "#{url}/v1/jittor/entropy"
|
||||
when 'paddle' then "#{url}/v1/Paddle/entropy"
|
||||
when 'vue' then "#{url}/v1/vue/entropy"
|
||||
when 'bootstrap' then "#{url}/v1/bootstrap/entropy"
|
||||
when 'tensorflow' then "#{url}/v1/tensorflow/entropy"
|
||||
when 'kernel' then "#{url}/v1/openeuler/entropy"
|
||||
when 'opengauss-server' then "#{url}/v1/opengauss/entropy"
|
||||
when 'mindspore' then "#{url}/v1/mindspore/entropy"
|
||||
when 'openharmony' then "#{url}/api/openharmony/entropy"
|
||||
when 'openeuler' then "#{url}/api/openeuler/entropy"
|
||||
# when 'rails' then "#{url}/v1/rails/entropy"
|
||||
# when 'jittor' then "#{url}/v1/jittor/entropy"
|
||||
# when 'paddle' then "#{url}/v1/Paddle/entropy"
|
||||
# when 'vue' then "#{url}/v1/vue/entropy"
|
||||
# when 'bootstrap' then "#{url}/v1/bootstrap/entropy"
|
||||
# when 'tensorflow' then "#{url}/v1/tensorflow/entropy"
|
||||
# when 'kernel' then "#{url}/v1/openeuler/entropy"
|
||||
# when 'opengauss-server' then "#{url}/v1/opengauss/entropy"
|
||||
# when 'mindspore' then "#{url}/v1/mindspore/entropy"
|
||||
when 'openharmony-kernel' then "#{url}/api/openharmony/entropy"
|
||||
when 'kernel' then "#{url}/api/openeuler/entropy"
|
||||
when 'xiuos' then "#{url}/api/xiuos/entropy"
|
||||
else ''
|
||||
end
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ module EducoderOauth::Service
|
|||
begin
|
||||
Rails.logger.info("[EducoderOauth] [#{method.to_s.upcase}] #{url} || #{params}")
|
||||
|
||||
client = Faraday.new(url: EducoderOauth.base_url)
|
||||
client = Faraday.new(url: EducoderOauth.base_url, headers: {'X-EDU-Timestamp' => "#{Time.now.to_i}"})
|
||||
response = client.public_send(method, url, params)
|
||||
result = JSON.parse(response.body)
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class IdentityVerification < ApplicationRecord
|
|||
after_create do
|
||||
Attachment.where(uuid:[card_front,card_back,hold_card_front,hold_card_back]).update_all(is_public:0)
|
||||
end
|
||||
|
||||
|
||||
after_save do
|
||||
if state == "已通过"
|
||||
user.update(id_card_verify: true, website_permission: true)
|
||||
|
|
|
|||
|
|
@ -356,7 +356,7 @@ class Issue < ApplicationRecord
|
|||
end
|
||||
end
|
||||
|
||||
def to_builder
|
||||
def to_builder
|
||||
Jbuilder.new do |issue|
|
||||
issue.(self, :id, :project_issues_index, :subject, :description, :branch_name, :start_date, :due_date)
|
||||
issue.created_at self.created_on.strftime('%Y-%m-%d %H:%M')
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class Api::V1::Issues::ListService < ApplicationService
|
|||
end
|
||||
|
||||
def call
|
||||
raise Error, errors.full_messages.join(', ') unless valid?
|
||||
raise Error, errors.full_messages.join(', ') unless valid?
|
||||
# begin
|
||||
issue_query_data
|
||||
|
||||
|
|
|
|||
|
|
@ -39,14 +39,14 @@ class InfoRiskControlService < ApplicationService
|
|||
def remote_ip_risk_control
|
||||
result = Rails.cache.read("InfoRiskControlService-RemoteIp-#{remote_ip}")
|
||||
if result.present?
|
||||
if result.to_i > 20
|
||||
if result.to_i > 30
|
||||
@status = 0
|
||||
@message = "暂时无法请求,请稍后再试"
|
||||
else
|
||||
Rails.cache.write("InfoRiskControlService-RemoteIp-#{remote_ip}", result.to_i + 1)
|
||||
end
|
||||
else
|
||||
Rails.cache.write("InfoRiskControlService-RemoteIp-#{remote_ip}", 1, expires_in: 1.day)
|
||||
Rails.cache.write("InfoRiskControlService-RemoteIp-#{remote_ip}", 1, expires_in: 2.hours)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if @current_week_statistic.size ==1 && @pre_week_statistic.present? %>
|
||||
<% if @pre_week_statistic.present? %>
|
||||
<tr class="">
|
||||
<td>上周合计</td>
|
||||
<td><%= @pre_week_statistic.map(&:pv).sum %></td>
|
||||
|
|
|
|||
|
|
@ -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">
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
json.id attachment.uuid
|
||||
json.id attachment.uuid.blank? ? attachment.id : attachment.uuid
|
||||
json.title attachment.title
|
||||
json.description attachment.description
|
||||
json.filesize number_to_human_size(attachment.filesize)
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ json.phone @user.phone
|
|||
json.profile_completed @user.profile_is_completed?
|
||||
json.professional_certification @user.professional_certification
|
||||
json.devops_step @user.devops_step
|
||||
json.ci_certification @user.ci_certification?
|
||||
json.ci_certification false
|
||||
json.email @user.mail
|
||||
json.province @user.province
|
||||
json.city @user.city
|
||||
|
|
|
|||
|
|
@ -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' } %>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
class AddIndexCreatedCommitLogs < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_index :commit_logs, :created_at
|
||||
end
|
||||
end
|
||||
|
|
@ -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系统为例)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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]
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -0,0 +1 @@
|
|||
google-site-verification: google88c6634c68bf2d54.html
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue