forked from Gitlink/forgeplus
Compare commits
40 Commits
Author | SHA1 | Date |
---|---|---|
|
55e9409d9a | |
|
d13ac9e9fe | |
|
253196e000 | |
|
4d751e6b3e | |
|
755fff03a1 | |
|
a117f0bf73 | |
|
7176d3d2d5 | |
|
8874898ff3 | |
|
9e814ee16a | |
|
fe47840e53 | |
|
afecd95947 | |
|
2ec14f6665 | |
|
1c7e74ed1d | |
|
0a6957f193 | |
|
4bd3d98021 | |
|
14df764275 | |
|
24be0501b7 | |
|
b45fb35ea1 | |
|
3646822ec3 | |
|
9d5609e544 | |
|
3f9a3aacfa | |
|
38458764b4 | |
|
dd94480486 | |
|
3dd62f40df | |
|
a0f13e3a0c | |
|
600235effa | |
|
7578fb9e0a | |
|
c8a356b836 | |
|
eb38b3fda4 | |
|
2c5c03f77c | |
|
67f3a87afc | |
|
b5553e2c97 | |
|
a542b02181 | |
|
b7786fc870 | |
|
31f44685d9 | |
|
41e6d6ab09 | |
|
d24703be75 | |
|
487d548e9f | |
|
07696682ca | |
|
c64f241cf8 |
|
@ -10,7 +10,7 @@
|
|||
|
||||
# Ignore lock config file
|
||||
*.log
|
||||
.env
|
||||
|
||||
# mac
|
||||
*.DS_Store
|
||||
.bashrc
|
||||
|
@ -84,5 +84,4 @@ redis_data/
|
|||
dump.rdb
|
||||
.tags*
|
||||
ceshi_user.xlsx
|
||||
public/trace_task_results
|
||||
public/项目活跃度排行.xls
|
||||
public/trace_task_results
|
58
Dockerfile
58
Dockerfile
|
@ -1,59 +1,29 @@
|
|||
FROM ubuntu:20.04
|
||||
RUN apt-get update
|
||||
FROM registry.cn-hangzhou.aliyuncs.com/gitlink/ruby:2.4.5
|
||||
|
||||
ADD ./ /home/pdl/gitlink
|
||||
|
||||
WORKDIR /home/pdl/gitlink
|
||||
|
||||
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
|
||||
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
|
||||
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"
|
||||
|
||||
#RUN apt-get install -y nodejs
|
||||
|
||||
WORKDIR /home/app/gitlink
|
||||
|
||||
ADD ./ /home/app/gitlink
|
||||
|
||||
RUN cd /home/app/gitlink
|
||||
|
||||
RUN /bin/bash -l -c 'gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/'
|
||||
|
||||
RUN /bin/bash -l -c 'gem update --system'
|
||||
|
||||
RUN /bin/bash -l -c 'gem install bundler -v 2.3.26'
|
||||
RUN /bin/bash -l -c 'gem install rake'
|
||||
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-docker.yml.example config/database.yml
|
||||
RUN cp config/database.yml.example config/database.yml
|
||||
RUN cp config/environments/production.rb.example config/environments/production.rb
|
||||
RUN cp config/secrets.yml.example config/secrets.yml
|
||||
RUN touch config/redis.yml
|
||||
RUN touch config/elasticsearch.yml
|
||||
RUN mkdir log
|
||||
|
||||
RUN /bin/bash -l -c 'bundle install'
|
||||
#RUN /bin/bash -l -c 'RAILS_ENV=production rails db:create'
|
||||
#RUN /bin/bash -l -c 'RAILS_ENV=production bundle exec rake sync_table_structure:import_csv'
|
||||
#RUN /bin/bash -l -c 'RAILS_ENV=production rails db:migrate'
|
||||
|
||||
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'
|
||||
#EXPOSE 4000
|
||||
#RUN /bin/bash -l -c 'RAILS_ENV=production puma'
|
4
Gemfile
4
Gemfile
|
@ -20,6 +20,8 @@ gem 'bootsnap', '>= 1.1.0', require: false
|
|||
|
||||
gem 'chinese_pinyin'
|
||||
|
||||
# gem 'loofah','~> 2.20.0'
|
||||
|
||||
gem 'rack-cors'
|
||||
gem 'redis-rails'
|
||||
gem 'roo-xls'
|
||||
|
@ -141,4 +143,4 @@ gem 'doorkeeper'
|
|||
|
||||
gem 'doorkeeper-jwt'
|
||||
|
||||
gem 'gitea-client', '~> 1.4.6'
|
||||
gem 'gitea-client', '~> 1.4.2'
|
||||
|
|
333
Gemfile.lock
333
Gemfile.lock
|
@ -1,47 +1,47 @@
|
|||
GEM
|
||||
remote: https://mirrors.cloud.tencent.com/rubygems/
|
||||
specs:
|
||||
aasm (5.0.6)
|
||||
aasm (5.5.0)
|
||||
concurrent-ruby (~> 1.0)
|
||||
actioncable (5.2.4.1)
|
||||
actionpack (= 5.2.4.1)
|
||||
actioncable (5.2.8.1)
|
||||
actionpack (= 5.2.8.1)
|
||||
nio4r (~> 2.0)
|
||||
websocket-driver (>= 0.6.1)
|
||||
actionmailer (5.2.4.1)
|
||||
actionpack (= 5.2.4.1)
|
||||
actionview (= 5.2.4.1)
|
||||
activejob (= 5.2.4.1)
|
||||
actionmailer (5.2.8.1)
|
||||
actionpack (= 5.2.8.1)
|
||||
actionview (= 5.2.8.1)
|
||||
activejob (= 5.2.8.1)
|
||||
mail (~> 2.5, >= 2.5.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
actionpack (5.2.4.1)
|
||||
actionview (= 5.2.4.1)
|
||||
activesupport (= 5.2.4.1)
|
||||
actionpack (5.2.8.1)
|
||||
actionview (= 5.2.8.1)
|
||||
activesupport (= 5.2.8.1)
|
||||
rack (~> 2.0, >= 2.0.8)
|
||||
rack-test (>= 0.6.3)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
||||
actionview (5.2.4.1)
|
||||
activesupport (= 5.2.4.1)
|
||||
actionview (5.2.8.1)
|
||||
activesupport (= 5.2.8.1)
|
||||
builder (~> 3.1)
|
||||
erubi (~> 1.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
||||
active_decorator (1.3.2)
|
||||
active_decorator (1.4.0)
|
||||
activesupport
|
||||
activejob (5.2.4.1)
|
||||
activesupport (= 5.2.4.1)
|
||||
activejob (5.2.8.1)
|
||||
activesupport (= 5.2.8.1)
|
||||
globalid (>= 0.3.6)
|
||||
activemodel (5.2.4.1)
|
||||
activesupport (= 5.2.4.1)
|
||||
activerecord (5.2.4.1)
|
||||
activemodel (= 5.2.4.1)
|
||||
activesupport (= 5.2.4.1)
|
||||
activemodel (5.2.8.1)
|
||||
activesupport (= 5.2.8.1)
|
||||
activerecord (5.2.8.1)
|
||||
activemodel (= 5.2.8.1)
|
||||
activesupport (= 5.2.8.1)
|
||||
arel (>= 9.0)
|
||||
activestorage (5.2.4.1)
|
||||
actionpack (= 5.2.4.1)
|
||||
activerecord (= 5.2.4.1)
|
||||
marcel (~> 0.3.1)
|
||||
activesupport (5.2.4.1)
|
||||
activestorage (5.2.8.1)
|
||||
actionpack (= 5.2.8.1)
|
||||
activerecord (= 5.2.8.1)
|
||||
marcel (~> 1.0.0)
|
||||
activesupport (5.2.8.1)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (>= 0.7, < 2)
|
||||
minitest (~> 5.1)
|
||||
|
@ -50,20 +50,20 @@ GEM
|
|||
activerecord (>= 5.0, < 6.1)
|
||||
acts_as_list (0.9.19)
|
||||
activerecord (>= 3.0)
|
||||
addressable (2.7.0)
|
||||
public_suffix (>= 2.0.2, < 5.0)
|
||||
ancestry (3.0.7)
|
||||
activerecord (>= 3.2.0)
|
||||
annotate (2.6.5)
|
||||
addressable (2.8.4)
|
||||
public_suffix (>= 2.0.2, < 6.0)
|
||||
ancestry (4.0.0)
|
||||
activerecord (>= 5.2.4.5)
|
||||
annotate (2.6.7)
|
||||
activerecord (>= 2.3.0)
|
||||
rake (>= 0.8.7)
|
||||
rake (~> 10.4.2, >= 10.4.2)
|
||||
archive-zip (0.12.0)
|
||||
io-like (~> 0.3.0)
|
||||
arel (9.0.0)
|
||||
ast (2.4.0)
|
||||
autoprefixer-rails (9.7.4)
|
||||
execjs
|
||||
awesome_print (1.8.0)
|
||||
ast (2.4.2)
|
||||
autoprefixer-rails (10.4.13.0)
|
||||
execjs (~> 2)
|
||||
awesome_print (1.9.2)
|
||||
axlsx (3.0.0.pre)
|
||||
htmlentities (~> 4.3, >= 4.3.4)
|
||||
mimemagic (~> 0.3)
|
||||
|
@ -72,40 +72,40 @@ GEM
|
|||
axlsx_rails (0.5.2)
|
||||
actionpack (>= 3.1)
|
||||
axlsx (>= 2.0.1)
|
||||
backport (1.1.2)
|
||||
benchmark (0.1.0)
|
||||
backport (1.2.0)
|
||||
benchmark (0.2.1)
|
||||
bindex (0.8.1)
|
||||
bootsnap (1.4.6)
|
||||
msgpack (~> 1.0)
|
||||
bootsnap (1.12.0)
|
||||
msgpack (~> 1.2)
|
||||
bootstrap (4.3.1)
|
||||
autoprefixer-rails (>= 9.1.0)
|
||||
popper_js (>= 1.14.3, < 2)
|
||||
sassc-rails (>= 2.0.0)
|
||||
builder (3.2.4)
|
||||
bulk_insert (1.7.0)
|
||||
bulk_insert (1.9.0)
|
||||
activerecord (>= 3.2.0)
|
||||
capybara (3.15.1)
|
||||
capybara (3.32.2)
|
||||
addressable
|
||||
mini_mime (>= 0.1.3)
|
||||
nokogiri (~> 1.8)
|
||||
rack (>= 1.6.0)
|
||||
rack-test (>= 0.6.3)
|
||||
regexp_parser (~> 1.2)
|
||||
regexp_parser (~> 1.5)
|
||||
xpath (~> 3.2)
|
||||
chartkick (3.3.1)
|
||||
chartkick (3.4.2)
|
||||
childprocess (3.0.0)
|
||||
chinese_pinyin (1.0.2)
|
||||
chinese_pinyin (1.1.0)
|
||||
chromedriver-helper (2.1.1)
|
||||
archive-zip (~> 0.10)
|
||||
nokogiri (~> 1.8)
|
||||
chunky_png (1.3.11)
|
||||
concurrent-ruby (1.1.6)
|
||||
connection_pool (2.2.2)
|
||||
chunky_png (1.4.0)
|
||||
concurrent-ruby (1.2.2)
|
||||
connection_pool (2.2.5)
|
||||
crass (1.0.6)
|
||||
deep_cloneable (3.0.0)
|
||||
activerecord (>= 3.1.0, < 7)
|
||||
diff-lcs (1.3)
|
||||
diffy (3.3.0)
|
||||
diff-lcs (1.5.0)
|
||||
diffy (3.4.2)
|
||||
domain_name (0.5.20190701)
|
||||
unf (>= 0.0.5, < 1.0.0)
|
||||
doorkeeper (5.5.1)
|
||||
|
@ -121,19 +121,19 @@ GEM
|
|||
elasticsearch-transport (7.5.0)
|
||||
faraday (>= 0.14, < 1)
|
||||
multi_json
|
||||
enumerize (2.3.1)
|
||||
enumerize (2.5.0)
|
||||
activesupport (>= 3.2)
|
||||
erubi (1.9.0)
|
||||
et-orbi (1.2.4)
|
||||
erubi (1.12.0)
|
||||
et-orbi (1.2.7)
|
||||
tzinfo
|
||||
execjs (2.7.0)
|
||||
execjs (2.8.1)
|
||||
faraday (0.15.4)
|
||||
multipart-post (>= 1.2, < 3)
|
||||
ffi (1.12.2)
|
||||
ffi (1.15.5)
|
||||
font-awesome-sass (4.7.0)
|
||||
sass (>= 3.2)
|
||||
fugit (1.4.1)
|
||||
et-orbi (~> 1.1, >= 1.1.8)
|
||||
fugit (1.8.1)
|
||||
et-orbi (~> 1, >= 1.2.7)
|
||||
raabro (~> 1.4)
|
||||
gitea-client (1.4.2)
|
||||
rest-client (~> 2.1.0)
|
||||
|
@ -145,78 +145,78 @@ GEM
|
|||
groupdate (4.1.2)
|
||||
activesupport (>= 4.2)
|
||||
harmonious_dictionary (0.0.1)
|
||||
hashie (3.6.0)
|
||||
hashie (5.0.0)
|
||||
htmlentities (4.3.4)
|
||||
http-accept (1.7.0)
|
||||
http-cookie (1.0.5)
|
||||
domain_name (~> 0.5)
|
||||
i18n (1.8.2)
|
||||
i18n (1.13.0)
|
||||
concurrent-ruby (~> 1.0)
|
||||
io-like (0.3.1)
|
||||
jaro_winkler (1.5.4)
|
||||
jbuilder (2.10.0)
|
||||
jaro_winkler (1.5.5)
|
||||
jbuilder (2.11.5)
|
||||
actionview (>= 5.0.0)
|
||||
activesupport (>= 5.0.0)
|
||||
jquery-rails (4.3.5)
|
||||
jquery-rails (4.5.1)
|
||||
rails-dom-testing (>= 1, < 3)
|
||||
railties (>= 4.2.0)
|
||||
thor (>= 0.14, < 2.0)
|
||||
jwt (2.2.1)
|
||||
kaminari (1.2.0)
|
||||
jwt (2.3.0)
|
||||
kaminari (1.2.2)
|
||||
activesupport (>= 4.1.0)
|
||||
kaminari-actionview (= 1.2.0)
|
||||
kaminari-activerecord (= 1.2.0)
|
||||
kaminari-core (= 1.2.0)
|
||||
kaminari-actionview (1.2.0)
|
||||
kaminari-actionview (= 1.2.2)
|
||||
kaminari-activerecord (= 1.2.2)
|
||||
kaminari-core (= 1.2.2)
|
||||
kaminari-actionview (1.2.2)
|
||||
actionview
|
||||
kaminari-core (= 1.2.0)
|
||||
kaminari-activerecord (1.2.0)
|
||||
kaminari-core (= 1.2.2)
|
||||
kaminari-activerecord (1.2.2)
|
||||
activerecord
|
||||
kaminari-core (= 1.2.0)
|
||||
kaminari-core (1.2.0)
|
||||
letter_avatar (0.3.8)
|
||||
kaminari-core (= 1.2.2)
|
||||
kaminari-core (1.2.2)
|
||||
letter_avatar (0.3.9)
|
||||
listen (3.1.5)
|
||||
rb-fsevent (~> 0.9, >= 0.9.4)
|
||||
rb-inotify (~> 0.9, >= 0.9.7)
|
||||
ruby_dep (~> 1.2)
|
||||
loofah (2.4.0)
|
||||
loofah (2.20.0)
|
||||
crass (~> 1.0.2)
|
||||
nokogiri (>= 1.5.9)
|
||||
mail (2.7.1)
|
||||
mini_mime (>= 0.1.1)
|
||||
marcel (0.3.3)
|
||||
mimemagic (~> 0.3.2)
|
||||
marcel (1.0.2)
|
||||
maruku (0.7.3)
|
||||
method_source (0.9.2)
|
||||
method_source (1.0.0)
|
||||
mime-types (3.4.1)
|
||||
mime-types-data (~> 3.2015)
|
||||
mime-types-data (3.2023.0218.1)
|
||||
mimemagic (0.3.10)
|
||||
mimemagic (0.4.3)
|
||||
nokogiri (~> 1)
|
||||
rake
|
||||
mini_mime (1.0.2)
|
||||
mini_mime (1.1.2)
|
||||
mini_portile2 (2.4.0)
|
||||
minitest (5.14.0)
|
||||
msgpack (1.3.3)
|
||||
multi_json (1.14.1)
|
||||
minitest (5.15.0)
|
||||
msgpack (1.6.1)
|
||||
multi_json (1.15.0)
|
||||
multi_xml (0.6.0)
|
||||
multipart-post (2.1.1)
|
||||
mustermann (1.1.1)
|
||||
multipart-post (2.3.0)
|
||||
mustermann (1.1.2)
|
||||
ruby2_keywords (~> 0.0.1)
|
||||
mysql2 (0.5.3)
|
||||
mysql2 (0.5.5)
|
||||
netrc (0.11.0)
|
||||
nio4r (2.5.2)
|
||||
nokogiri (1.10.8)
|
||||
nio4r (2.5.9)
|
||||
nokogiri (1.10.10)
|
||||
mini_portile2 (~> 2.4.0)
|
||||
oauth2 (1.4.4)
|
||||
faraday (>= 0.8, < 2.0)
|
||||
oauth2 (1.4.8)
|
||||
faraday (>= 0.8, < 3.0)
|
||||
jwt (>= 1.0, < 3.0)
|
||||
multi_json (~> 1.3)
|
||||
multi_xml (~> 0.5)
|
||||
rack (>= 1.2, < 3)
|
||||
omniauth (1.9.0)
|
||||
hashie (>= 3.4.6, < 3.7.0)
|
||||
omniauth (1.9.2)
|
||||
hashie (>= 3.4.6)
|
||||
rack (>= 1.6.2, < 3)
|
||||
omniauth-cas (1.1.1)
|
||||
omniauth-cas (2.0.0)
|
||||
addressable (~> 2.3)
|
||||
nokogiri (~> 1.5)
|
||||
omniauth (~> 1.2)
|
||||
|
@ -235,84 +235,81 @@ GEM
|
|||
omniauth-wechat-oauth2 (0.2.2)
|
||||
omniauth (>= 1.3.2)
|
||||
omniauth-oauth2 (>= 1.1.1)
|
||||
parallel (1.19.1)
|
||||
parser (2.7.1.1)
|
||||
ast (~> 2.4.0)
|
||||
pdfkit (0.8.4.1)
|
||||
polyamorous (2.3.2)
|
||||
activerecord (>= 5.2.1)
|
||||
popper_js (1.16.0)
|
||||
powerpack (0.1.2)
|
||||
prettier (0.18.2)
|
||||
public_suffix (4.0.3)
|
||||
parallel (1.20.1)
|
||||
parser (2.7.2.0)
|
||||
ast (~> 2.4.1)
|
||||
pdfkit (0.8.4.3.2)
|
||||
popper_js (1.16.1)
|
||||
powerpack (0.1.3)
|
||||
prettier (2.1.0)
|
||||
public_suffix (4.0.7)
|
||||
puma (5.6.5)
|
||||
nio4r (~> 2.0)
|
||||
raabro (1.4.0)
|
||||
rack (2.0.9)
|
||||
rack-cors (1.1.1)
|
||||
rack (2.0.9.3)
|
||||
rack-cors (2.0.1)
|
||||
rack (>= 2.0.0)
|
||||
rack-protection (2.0.8.1)
|
||||
rack
|
||||
rack-test (1.1.0)
|
||||
rack (>= 1.0, < 3)
|
||||
rails (5.2.4.1)
|
||||
actioncable (= 5.2.4.1)
|
||||
actionmailer (= 5.2.4.1)
|
||||
actionpack (= 5.2.4.1)
|
||||
actionview (= 5.2.4.1)
|
||||
activejob (= 5.2.4.1)
|
||||
activemodel (= 5.2.4.1)
|
||||
activerecord (= 5.2.4.1)
|
||||
activestorage (= 5.2.4.1)
|
||||
activesupport (= 5.2.4.1)
|
||||
rack-test (2.1.0)
|
||||
rack (>= 1.3)
|
||||
rails (5.2.8.1)
|
||||
actioncable (= 5.2.8.1)
|
||||
actionmailer (= 5.2.8.1)
|
||||
actionpack (= 5.2.8.1)
|
||||
actionview (= 5.2.8.1)
|
||||
activejob (= 5.2.8.1)
|
||||
activemodel (= 5.2.8.1)
|
||||
activerecord (= 5.2.8.1)
|
||||
activestorage (= 5.2.8.1)
|
||||
activesupport (= 5.2.8.1)
|
||||
bundler (>= 1.3.0)
|
||||
railties (= 5.2.4.1)
|
||||
railties (= 5.2.8.1)
|
||||
sprockets-rails (>= 2.0.0)
|
||||
rails-dom-testing (2.0.3)
|
||||
activesupport (>= 4.2.0)
|
||||
nokogiri (>= 1.6)
|
||||
rails-html-sanitizer (1.3.0)
|
||||
loofah (~> 2.3)
|
||||
rails-html-sanitizer (1.5.0)
|
||||
loofah (~> 2.19, >= 2.19.1)
|
||||
rails-i18n (5.1.3)
|
||||
i18n (>= 0.7, < 2)
|
||||
railties (>= 5.0, < 6)
|
||||
railties (5.2.4.1)
|
||||
actionpack (= 5.2.4.1)
|
||||
activesupport (= 5.2.4.1)
|
||||
railties (5.2.8.1)
|
||||
actionpack (= 5.2.8.1)
|
||||
activesupport (= 5.2.8.1)
|
||||
method_source
|
||||
rake (>= 0.8.7)
|
||||
thor (>= 0.19.0, < 2.0)
|
||||
rainbow (3.0.0)
|
||||
rake (13.0.1)
|
||||
ransack (2.3.2)
|
||||
activerecord (>= 5.2.1)
|
||||
activesupport (>= 5.2.1)
|
||||
rainbow (3.1.1)
|
||||
rake (10.4.2)
|
||||
ransack (2.4.1)
|
||||
activerecord (>= 5.2.4)
|
||||
activesupport (>= 5.2.4)
|
||||
i18n
|
||||
polyamorous (= 2.3.2)
|
||||
rb-fsevent (0.10.3)
|
||||
rb-fsevent (0.11.2)
|
||||
rb-inotify (0.10.1)
|
||||
ffi (~> 1.0)
|
||||
rchardet (1.8.0)
|
||||
redcarpet (3.5.0)
|
||||
redis (4.1.3)
|
||||
redis-actionpack (5.2.0)
|
||||
actionpack (>= 5, < 7)
|
||||
redcarpet (3.6.0)
|
||||
redis (4.8.1)
|
||||
redis-actionpack (5.3.0)
|
||||
actionpack (>= 5, < 8)
|
||||
redis-rack (>= 2.1.0, < 3)
|
||||
redis-store (>= 1.1.0, < 2)
|
||||
redis-activesupport (5.2.0)
|
||||
activesupport (>= 3, < 7)
|
||||
redis-activesupport (5.3.0)
|
||||
activesupport (>= 3, < 8)
|
||||
redis-store (>= 1.3, < 2)
|
||||
redis-rack (2.1.2)
|
||||
redis-rack (2.1.4)
|
||||
rack (>= 2.0.8, < 3)
|
||||
redis-store (>= 1.2, < 2)
|
||||
redis-rails (5.0.2)
|
||||
redis-actionpack (>= 5.0, < 6)
|
||||
redis-activesupport (>= 5.0, < 6)
|
||||
redis-store (>= 1.2, < 2)
|
||||
redis-store (1.8.2)
|
||||
redis (>= 4, < 5)
|
||||
regexp_parser (1.7.0)
|
||||
request_store (1.5.0)
|
||||
redis-store (1.9.2)
|
||||
redis (>= 4, < 6)
|
||||
regexp_parser (1.8.2)
|
||||
request_store (1.5.1)
|
||||
rack (>= 1.4)
|
||||
rest-client (2.1.0)
|
||||
http-accept (>= 1.7.0, < 2.0)
|
||||
|
@ -333,15 +330,15 @@ GEM
|
|||
rqrcode_png (0.1.5)
|
||||
chunky_png
|
||||
rqrcode
|
||||
rspec-core (3.9.1)
|
||||
rspec-support (~> 3.9.1)
|
||||
rspec-expectations (3.9.0)
|
||||
rspec-core (3.9.3)
|
||||
rspec-support (~> 3.9.3)
|
||||
rspec-expectations (3.9.4)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.9.0)
|
||||
rspec-mocks (3.9.1)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.9.0)
|
||||
rspec-rails (3.9.0)
|
||||
rspec-rails (3.9.1)
|
||||
actionpack (>= 3.0)
|
||||
activesupport (>= 3.0)
|
||||
railties (>= 3.0)
|
||||
|
@ -349,7 +346,7 @@ GEM
|
|||
rspec-expectations (~> 3.9.0)
|
||||
rspec-mocks (~> 3.9.0)
|
||||
rspec-support (~> 3.9.0)
|
||||
rspec-support (3.9.2)
|
||||
rspec-support (3.9.4)
|
||||
rubocop (0.52.1)
|
||||
parallel (~> 1.10)
|
||||
parser (>= 2.4.0.2, < 3.0)
|
||||
|
@ -358,8 +355,8 @@ GEM
|
|||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (~> 1.0, >= 1.0.1)
|
||||
ruby-ole (1.2.12.2)
|
||||
ruby-progressbar (1.10.1)
|
||||
ruby2_keywords (0.0.2)
|
||||
ruby-progressbar (1.13.0)
|
||||
ruby2_keywords (0.0.5)
|
||||
ruby_dep (1.5.0)
|
||||
rubyzip (1.3.0)
|
||||
sass (3.7.4)
|
||||
|
@ -367,13 +364,13 @@ GEM
|
|||
sass-listen (4.0.0)
|
||||
rb-fsevent (~> 0.9, >= 0.9.4)
|
||||
rb-inotify (~> 0.9, >= 0.9.7)
|
||||
sass-rails (5.0.7)
|
||||
railties (>= 4.0.0, < 6)
|
||||
sass-rails (5.1.0)
|
||||
railties (>= 5.2.0)
|
||||
sass (~> 3.1)
|
||||
sprockets (>= 2.8, < 4.0)
|
||||
sprockets-rails (>= 2.0, < 4.0)
|
||||
tilt (>= 1.1, < 3)
|
||||
sassc (2.2.1)
|
||||
sassc (2.4.0)
|
||||
ffi (~> 1.9)
|
||||
sassc-rails (2.1.2)
|
||||
railties (>= 4.0.0)
|
||||
|
@ -381,9 +378,9 @@ GEM
|
|||
sprockets (> 3.0)
|
||||
sprockets-rails
|
||||
tilt
|
||||
searchkick (3.1.3)
|
||||
activemodel (>= 4.2)
|
||||
elasticsearch (>= 5)
|
||||
searchkick (4.6.3)
|
||||
activemodel (>= 5)
|
||||
elasticsearch (>= 6, < 7.14)
|
||||
hashie
|
||||
selenium-webdriver (3.142.7)
|
||||
childprocess (>= 0.5, < 4.0)
|
||||
|
@ -398,10 +395,10 @@ GEM
|
|||
sidekiq (>= 4.2.1)
|
||||
sidekiq-failures (1.0.4)
|
||||
sidekiq (>= 4.0.0)
|
||||
simple_form (5.0.2)
|
||||
simple_form (5.0.3)
|
||||
actionpack (>= 5.0)
|
||||
activemodel (>= 5.0)
|
||||
simple_xlsx_reader (1.0.4)
|
||||
simple_xlsx_reader (1.0.5)
|
||||
nokogiri
|
||||
rubyzip
|
||||
sinatra (2.0.8.1)
|
||||
|
@ -423,46 +420,45 @@ GEM
|
|||
thor (~> 1.0)
|
||||
tilt (~> 2.0)
|
||||
yard (~> 0.9)
|
||||
spreadsheet (1.2.6)
|
||||
ruby-ole (>= 1.0)
|
||||
spring (2.0.2)
|
||||
activesupport (>= 4.2)
|
||||
spreadsheet (1.3.0)
|
||||
ruby-ole
|
||||
spring (2.1.1)
|
||||
spring-watcher-listen (2.0.1)
|
||||
listen (>= 2.7, < 4.0)
|
||||
spring (>= 1.2, < 3.0)
|
||||
sprockets (3.7.2)
|
||||
concurrent-ruby (~> 1.0)
|
||||
rack (> 1, < 3)
|
||||
sprockets-rails (3.2.1)
|
||||
sprockets-rails (3.2.2)
|
||||
actionpack (>= 4.0)
|
||||
activesupport (>= 4.0)
|
||||
sprockets (>= 3.0.0)
|
||||
thor (1.0.1)
|
||||
thor (1.2.2)
|
||||
thread_safe (0.3.6)
|
||||
tilt (2.0.10)
|
||||
tilt (2.1.0)
|
||||
turbolinks (5.2.1)
|
||||
turbolinks-source (~> 5.2)
|
||||
turbolinks-source (5.2.0)
|
||||
tzinfo (1.2.6)
|
||||
tzinfo (1.2.11)
|
||||
thread_safe (~> 0.1)
|
||||
uglifier (4.2.0)
|
||||
execjs (>= 0.3.0, < 3)
|
||||
unf (0.1.4)
|
||||
unf_ext
|
||||
unf_ext (0.0.8.2)
|
||||
unicode-display_width (1.6.1)
|
||||
unicode-display_width (1.8.0)
|
||||
web-console (3.7.0)
|
||||
actionview (>= 5.0)
|
||||
activemodel (>= 5.0)
|
||||
bindex (>= 0.4.0)
|
||||
railties (>= 5.0)
|
||||
websocket-driver (0.7.1)
|
||||
websocket-driver (0.7.5)
|
||||
websocket-extensions (>= 0.1.0)
|
||||
websocket-extensions (0.1.4)
|
||||
wkhtmltopdf-binary (0.12.5.4)
|
||||
websocket-extensions (0.1.5)
|
||||
wkhtmltopdf-binary (0.12.6.6)
|
||||
xpath (3.2.0)
|
||||
nokogiri (~> 1.8)
|
||||
yard (0.9.24)
|
||||
yard (0.9.34)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
@ -501,6 +497,7 @@ DEPENDENCIES
|
|||
kaminari (~> 1.1, >= 1.1.1)
|
||||
letter_avatar
|
||||
listen (>= 3.0.5, < 3.2)
|
||||
loofah (~> 2.20.0)
|
||||
mysql2 (>= 0.4.4, < 0.6.0)
|
||||
oauth2
|
||||
omniauth (~> 1.9.0)
|
||||
|
@ -549,4 +546,4 @@ DEPENDENCIES
|
|||
wkhtmltopdf-binary
|
||||
|
||||
BUNDLED WITH
|
||||
2.1.4
|
||||
1.17.3
|
||||
|
|
13
README.md
13
README.md
|
@ -3,8 +3,7 @@
|
|||
GitLink(确实开源)是中国计算机学会(CCF)官方指定的开源创新服务平台,旨在以“为开源创新服务”为使命,以“成为开源创新的汇聚地”为愿景,秉承“创新、开放、协作、共享”的价值观,致力于为大规模开源开放协同创新助力赋能,打造创新成果孵化和新工科人才培养的开源创新生态!
|
||||
|
||||
<center>
|
||||
<img src="docs/figs/gitlink.png" width=80% /></center>
|
||||
|
||||
<img src="https://code.gitlink.org.cn/young/forgeplus/raw/branch/master/docs/figs/gitlink.png?raw=true" width=80% /></center>
|
||||
|
||||
## 特色功能
|
||||
|
||||
|
@ -175,31 +174,31 @@ http://localhost:3000/
|
|||
- 项目列表
|
||||
|
||||
<center>
|
||||
<img src="docs/figs/project_list.png" width=80% />
|
||||
<img src="https://code.gitlink.org.cn/young/forgeplus/raw/branch/master/docs/figs/project_list.png?raw=true" width=50% />
|
||||
</center>
|
||||
|
||||
- 代码仓库
|
||||
|
||||
<center>
|
||||
<img src="docs/figs/repo.png" width=80% />
|
||||
<img src="https://code.gitlink.org.cn/young/forgeplus/raw/branch/master/docs/figs/repo.png?raw=true" width=50% />
|
||||
</center>
|
||||
|
||||
- 任务管理
|
||||
|
||||
<center>
|
||||
<img src="docs/figs/issues.png" width=80% />
|
||||
<img src="https://code.gitlink.org.cn/young/forgeplus/raw/branch/master/docs/figs/issues.png?raw=true" width=50% />
|
||||
</center>
|
||||
|
||||
- 合并请求
|
||||
|
||||
<center>
|
||||
<img src="docs/figs/PR.png" width=80% />
|
||||
<img src="https://code.gitlink.org.cn/young/forgeplus/raw/branch/master/docs/figs/PR.png?raw=true" width=50% />
|
||||
</center>
|
||||
|
||||
- 引擎配置
|
||||
|
||||
<center>
|
||||
<img src="docs/figs/engine.png" width=80% />
|
||||
<img src="https://code.gitlink.org.cn/young/forgeplus/raw/branch/master/docs/figs/engine.png?raw=true" width=50% />
|
||||
</center>
|
||||
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
//= require codemirror/mode/shell/shell
|
||||
//= require editormd/editormd
|
||||
//= require editormd/languages/zh-tw
|
||||
//= require dragula/dragula
|
||||
|
||||
|
||||
//= require_tree ./i18n
|
||||
//= require_tree ./admins
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
// Place all the behaviors and hooks related to the matching controller here.
|
||||
// All this logic will automatically be available in application.js.
|
|
@ -1,2 +0,0 @@
|
|||
// Place all the behaviors and hooks related to the matching controller here.
|
||||
// All this logic will automatically be available in application.js.
|
|
@ -63,7 +63,7 @@ $(document).on('turbolinks:load', function() {
|
|||
|
||||
if(!valid) return;
|
||||
$.ajax({
|
||||
method: 'PUT',
|
||||
method: 'PATCH',
|
||||
dataType: 'json',
|
||||
url: $form.attr('action'),
|
||||
data: new FormData($form[0]),
|
||||
|
|
|
@ -1,65 +0,0 @@
|
|||
$(document).on('turbolinks:load', function(){
|
||||
if ($('body.admins-organizations-index-page').length > 0) {
|
||||
var showSuccessNotify = function() {
|
||||
$.notify({
|
||||
message: '操作成功'
|
||||
},{
|
||||
type: 'success'
|
||||
});
|
||||
}
|
||||
|
||||
// organizations open cla
|
||||
$('.organizations-list-container').on('click', '.open-cla-action', function(){
|
||||
var $openClaAction = $(this);
|
||||
var $closeClaAction = $openClaAction.siblings('.close-cla-action');
|
||||
|
||||
var userId = $openClaAction.data('id');
|
||||
customConfirm({
|
||||
content: '确认开通吗?',
|
||||
ok: function () {
|
||||
$.ajax({
|
||||
url: '/admins/organizations/' + userId + '/open_cla',
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
success: function() {
|
||||
showSuccessNotify();
|
||||
$closeClaAction.show();
|
||||
$openClaAction.hide();
|
||||
},
|
||||
error: function(res){
|
||||
$.notify({ message: res.responseJSON.message }, { type: 'danger' });
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
// organizations close cla
|
||||
$('.organizations-list-container').on('click', '.close-cla-action', function(){
|
||||
var $closeClaAction = $(this);
|
||||
var $openClaAction= $closeClaAction.siblings('.open-cla-action');
|
||||
|
||||
var userId = $openClaAction.data('id');
|
||||
customConfirm({
|
||||
content: '确认关闭吗?',
|
||||
ok: function () {
|
||||
$.ajax({
|
||||
url: '/admins/organizations/' + userId + '/close_cla',
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
success: function() {
|
||||
showSuccessNotify();
|
||||
$openClaAction.show();
|
||||
$closeClaAction.hide();
|
||||
},
|
||||
error: function(res){
|
||||
$.notify({ message: res.responseJSON.message }, { type: 'danger' });
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
});
|
|
@ -1,3 +0,0 @@
|
|||
// Place all the behaviors and hooks related to the matching controller here.
|
||||
// All this logic will automatically be available in application.js.
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
// Place all the behaviors and hooks related to the matching controller here.
|
||||
// All this logic will automatically be available in application.js.
|
|
@ -1,2 +0,0 @@
|
|||
// Place all the behaviors and hooks related to the matching controller here.
|
||||
// All this logic will automatically be available in application.js.
|
|
@ -1,2 +0,0 @@
|
|||
// Place all the behaviors and hooks related to the matching controller here.
|
||||
// All this logic will automatically be available in application.js.
|
|
@ -1,2 +0,0 @@
|
|||
// Place all the behaviors and hooks related to the matching controller here.
|
||||
// All this logic will automatically be available in application.js.
|
|
@ -1,2 +0,0 @@
|
|||
// Place all the behaviors and hooks related to the matching controller here.
|
||||
// All this logic will automatically be available in application.js.
|
|
@ -1,3 +0,0 @@
|
|||
// Place all the styles related to the admins/glcc_pr_check controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
|
@ -1,3 +0,0 @@
|
|||
// Place all the styles related to the admins/identity_verifications controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
|
@ -1,3 +0,0 @@
|
|||
// Place all the styles related to the admins/page_themes controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
|
@ -1,3 +0,0 @@
|
|||
// Place all the styles related to the admins/site_pages controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
|
@ -1,3 +0,0 @@
|
|||
// Place all the styles related to the identity_verifications controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
|
@ -1,3 +0,0 @@
|
|||
// Place all the styles related to the organizations/clas controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
|
@ -1,3 +0,0 @@
|
|||
// Place all the styles related to the pages controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
|
@ -1,3 +0,0 @@
|
|||
// Place all the styles related to the users/clas controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
|
@ -4,16 +4,15 @@ class AccountsController < ApplicationController
|
|||
|
||||
#skip_before_action :check_account, :only => [:logout]
|
||||
|
||||
def simple_update
|
||||
def simple_update
|
||||
simple_update_params.merge!(username: params[:username]&.gsub(/\s+/, ""))
|
||||
simple_update_params.merge!(email: params[:email]&.gsub(/\s+/, ""))
|
||||
simple_update_params.merge!(platform: (params[:platform] || 'forge')&.gsub(/\s+/, ""))
|
||||
Register::RemoteForm.new(simple_update_params.merge(user_id: current_user.id)).validate!
|
||||
Register::RemoteForm.new(simple_update_params).validate!
|
||||
|
||||
ActiveRecord::Base.transaction do
|
||||
result = auto_update(current_user, simple_update_params)
|
||||
if result[:message].blank?
|
||||
UserAction.create(:action_id => current_user.id, :action_type => "sync_educoder_user", :user_id => current_user.id, :ip => request.remote_ip) if params[:platform] == "educoder"
|
||||
render_ok
|
||||
else
|
||||
render_error(result[:message])
|
||||
|
@ -161,11 +160,8 @@ class AccountsController < ApplicationController
|
|||
successful_authentication(user)
|
||||
render_ok
|
||||
end
|
||||
elsif interactor.result[:message].to_s.include?("user already exists")
|
||||
UserAction.create(:action_id => 2, :action_type => "register_error", :user_id => user.try(:id).to_i, :ip => "code: #{register_params[:code]}; login: #{register_params[:login]}; namespace: #{register_params[:namespace]}; password: #{password};")
|
||||
normal_status(-1, "用户已注册,请勿连续操作。")
|
||||
else
|
||||
tip_exception(-1, interactor.result[:message])
|
||||
tip_exception(-1, interactor.error)
|
||||
end
|
||||
rescue Register::BaseForm::EmailError => e
|
||||
render_result(-2, e.message)
|
||||
|
@ -180,14 +176,9 @@ class AccountsController < ApplicationController
|
|||
rescue Register::BaseForm::VerifiCodeError => e
|
||||
render_result(-6, e.message)
|
||||
rescue Exception => e
|
||||
if user.present? && !e.message.to_s.include?("user already exists")
|
||||
# Gitea::User::DeleteService.call(user.login)
|
||||
# user.destroy
|
||||
end
|
||||
Rails.logger.error("##:register error--#{user.try(:id)},message:#{e.message}")
|
||||
UserAction.create(:action_id => 1, :action_type => "register_error", :user_id => user.try(:id).to_i, :ip => "code: #{register_params[:code]}; login: #{register_params[:login]}; namespace: #{register_params[:namespace]}; password: #{password};")
|
||||
logger_error(e)
|
||||
tip_exception(-1, "注册失败")
|
||||
Gitea::User::DeleteService.call(user.login) unless user.nil?
|
||||
uid_logger_error(e.message)
|
||||
tip_exception(-1, e.message)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -201,12 +192,12 @@ class AccountsController < ApplicationController
|
|||
return normal_status(-2, "违反平台使用规范,账号已被锁定") if @user.locked?
|
||||
|
||||
login_control = LimitForbidControl::UserLogin.new(@user)
|
||||
return normal_status(-2, "登录密码出错已达上限,账号已被锁定,请#{login_control.forbid_expires/60}分钟后重新登录或找回密码") if login_control.forbid?
|
||||
return normal_status(-2, "登录密码出错已达上限,账号已被锁定, 请#{login_control.forbid_expires/60}分钟后重新登录或找回密码") if login_control.forbid?
|
||||
|
||||
password_ok = @user.check_password?(params[:password].to_s)
|
||||
unless password_ok
|
||||
if login_control.remain_times-1 == 0
|
||||
normal_status(-2, "登录密码出错已达上限,账号已被锁定,请#{login_control.forbid_expires/60}分钟后重新登录或找回密码")
|
||||
normal_status(-2, "登录密码出错已达上限,账号已被锁定, 请#{login_control.forbid_expires/60}分钟后重新登录或找回密码")
|
||||
else
|
||||
normal_status(-2, "你已经输错密码#{login_control.error_times+1}次,还剩余#{login_control.remain_times-1}次机会")
|
||||
end
|
||||
|
@ -222,7 +213,6 @@ class AccountsController < ApplicationController
|
|||
end
|
||||
|
||||
def change_password
|
||||
return render_error("两次输入的密码不一致") if params[:password].to_s != params[:new_password_repeat].to_s
|
||||
@user = User.find_by(login: params[:login])
|
||||
return render_error("此用户禁止修改密码!") if @user.id.to_i === 104691
|
||||
return render_error("未找到相关用户!") if @user.blank?
|
||||
|
@ -360,17 +350,6 @@ class AccountsController < ApplicationController
|
|||
Register::LoginCheckColumnsForm.new(check_params.merge(user: current_user)).validate!
|
||||
render_ok
|
||||
end
|
||||
|
||||
def check_keywords
|
||||
text = params[:text].to_s.each_char.select { |c| c.bytes.first < 240 }.join('')
|
||||
data = ! ReversedKeyword.check_exists?(text)
|
||||
result = {
|
||||
status: 0,
|
||||
data: data,
|
||||
message: data ? "" : "无法使用以下关键词:#{text},请重新命名"
|
||||
}
|
||||
render_ok(result)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
|
|
|
@ -21,75 +21,13 @@ class Admins::DashboardsController < Admins::BaseController
|
|||
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
|
||||
@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
|
||||
end
|
||||
@month_active_project_count = Rails.cache.fetch("dashboardscontroller:month_active_project_count", expires_in: 1.hours) do
|
||||
Project.where(updated_on: current_month).or(Project.where(id: month_project_ids)).count
|
||||
end
|
||||
@weekly_active_project_count = Project.where(updated_on: current_week).or(Project.where(id: weekly_project_ids)).count
|
||||
@month_active_project_count = Project.where(updated_on: current_month).or(Project.where(id: month_project_ids)).count
|
||||
|
||||
# 新增项目数
|
||||
@day_new_project_count = Rails.cache.fetch("dashboardscontroller:day_new_project_count", expires_in: 10.minutes) do
|
||||
Project.where(created_on: today).count
|
||||
end
|
||||
@weekly_new_project_count = Rails.cache.fetch("dashboardscontroller:weekly_new_project_count", expires_in: 10.minutes) do
|
||||
Project.where(created_on: current_week).count
|
||||
end
|
||||
@month_new_project_count = Rails.cache.fetch("dashboardscontroller:month_new_project_count", expires_in: 1.hours) do
|
||||
Project.where(created_on: current_month).count
|
||||
end
|
||||
|
||||
|
||||
# 总的平台用户数
|
||||
# 总的平台项目数
|
||||
# 总的平台组织数
|
||||
# 总的平台Issue数、评论数、PR数、Commit数
|
||||
@user_count = Rails.cache.fetch("dashboardscontroller:platform:user_count", expires_in: 1.days) do
|
||||
User.count
|
||||
end
|
||||
@project_count = Rails.cache.fetch("dashboardscontroller:platform:project_count", expires_in: 1.days) do
|
||||
Project.count
|
||||
end
|
||||
@organization_count = Rails.cache.fetch("dashboardscontroller:platform:organization_count", expires_in: 1.days) do
|
||||
Organization.count
|
||||
end
|
||||
@issue_count = Rails.cache.fetch("dashboardscontroller:platform:issue_count", expires_in: 1.days) do
|
||||
Issue.count
|
||||
end
|
||||
@comment_count = Rails.cache.fetch("dashboardscontroller:platform:comment_count", expires_in: 1.days) do
|
||||
Journal.count
|
||||
end
|
||||
@pr_count = Rails.cache.fetch("dashboardscontroller:platform:pr_count", expires_in: 1.days) do
|
||||
PullRequest.count
|
||||
end
|
||||
@commit_count = Rails.cache.fetch("dashboardscontroller:platform:commit_count", expires_in: 1.days) do
|
||||
CommitLog.count
|
||||
end
|
||||
|
||||
@subject_name = ["用户数", "项目数", "组织数", "Issue数", "Issue评论数", "PR数", "Commit数"]
|
||||
@subject_icon = ["fa-user","fa-git", "fa-sitemap", "fa-warning", "fa-comments", "fa-share-alt", "fa-upload"]
|
||||
@subject_data = [@user_count, @project_count, @organization_count, @issue_count, @comment_count, @pr_count, @commit_count]
|
||||
|
||||
|
||||
tongji_service = Baidu::TongjiService.new
|
||||
@access_token = tongji_service.access_token
|
||||
Rails.logger.info "baidu_tongji_auth access_token ===== #{@access_token}"
|
||||
# @overview_data = tongji_service.api_overview
|
||||
last_date = DailyPlatformStatistic.order(:date).last
|
||||
start_date = last_date.date
|
||||
end_date = Time.now
|
||||
if @access_token.present?
|
||||
@overview_data = Rails.cache.fetch("dashboardscontroller:baidu_tongji:overview_data", expires_in: 10.minutes) do
|
||||
tongji_service.source_from_batch_add(start_date, end_date)
|
||||
@overview_data = tongji_service.overview_batch_add(start_date, end_date)
|
||||
@overview_data
|
||||
end
|
||||
end
|
||||
|
||||
@current_week_statistic = DailyPlatformStatistic.where(date: current_week)
|
||||
@pre_week_statistic = DailyPlatformStatistic.where(date: pre_week)
|
||||
|
||||
|
||||
|
||||
@day_new_project_count = Project.where(created_on: today).count
|
||||
@weekly_new_project_count = Project.where(created_on: current_week).count
|
||||
@month_new_project_count = Project.where(created_on: current_month).count
|
||||
end
|
||||
|
||||
def month_active_user
|
||||
|
@ -104,19 +42,6 @@ class Admins::DashboardsController < Admins::BaseController
|
|||
render_ok(data: data)
|
||||
end
|
||||
|
||||
def baidu_tongji
|
||||
tongji_service = Baidu::TongjiService.new
|
||||
redirect_to tongji_service.code_url
|
||||
end
|
||||
|
||||
def baidu_tongji_auth
|
||||
if params[:code].present?
|
||||
tongji_service = Baidu::TongjiService.new
|
||||
tongji_service.get_access_token(params[:code])
|
||||
end
|
||||
redirect_to "/admins/"
|
||||
end
|
||||
|
||||
def evaluate
|
||||
names = []
|
||||
data = []
|
||||
|
@ -138,12 +63,8 @@ class Admins::DashboardsController < Admins::BaseController
|
|||
Time.now.beginning_of_day..Time.now.end_of_day
|
||||
end
|
||||
|
||||
def pre_7_days
|
||||
7.days.ago.end_of_day..Time.now.end_of_day
|
||||
end
|
||||
|
||||
def current_week
|
||||
Time.now.beginning_of_week..Time.now.end_of_day
|
||||
7.days.ago.end_of_day..Time.now.end_of_day
|
||||
end
|
||||
|
||||
def current_month
|
||||
|
@ -151,7 +72,6 @@ class Admins::DashboardsController < Admins::BaseController
|
|||
end
|
||||
|
||||
def pre_week
|
||||
# 14.days.ago.end_of_day..7.days.ago.end_of_day
|
||||
Time.now.prev_week..Time.now.prev_week.end_of_week
|
||||
14.days.ago.end_of_day..7.days.ago.end_of_day
|
||||
end
|
||||
end
|
|
@ -1,32 +0,0 @@
|
|||
class Admins::GlccPrCheckController < Admins::BaseController
|
||||
def index
|
||||
params[:sort_by] = params[:sort_by].presence || 'created_on'
|
||||
params[:sort_direction] = params[:sort_direction].presence || 'desc'
|
||||
examine_materials = Admins::GlccExamineMaterial.call(params)
|
||||
@examine_materials = paginate examine_materials.includes(:glcc_student)
|
||||
end
|
||||
|
||||
def send_mail
|
||||
year = if params[:date].present?
|
||||
params[:date][:year]
|
||||
end
|
||||
if year.nil?
|
||||
return redirect_to admins_glcc_pr_check_index_path
|
||||
flash[:error] = "时间不能为空"
|
||||
end
|
||||
if params[:term].blank?
|
||||
return redirect_to admins_glcc_pr_check_index_path
|
||||
flash[:error] = "考核选项不能为空"
|
||||
end
|
||||
|
||||
examine_materials = GlccMediumTermExamineMaterial.where(\
|
||||
term: params[:term],
|
||||
created_on: [Time.now.change(year:year).beginning_of_year .. Time.now.change(year:year).end_of_year]
|
||||
)
|
||||
examine_materials.map{ |e|
|
||||
e.send_mail
|
||||
}
|
||||
flash[:danger] = "#{year} 年 #{params[:term].to_i == 1 ? "中期考核": "结项考核"} PR 检测邮件已全部发送完毕,一共#{examine_materials.count}封邮件"
|
||||
redirect_to admins_glcc_pr_check_index_path
|
||||
end
|
||||
end
|
|
@ -1,37 +0,0 @@
|
|||
class Admins::IdentityVerificationsController < Admins::BaseController
|
||||
before_action :finder_identity_verification, except: [:index]
|
||||
def index
|
||||
params[:sort_by] = params[:sort_by].presence || 'created_at'
|
||||
params[:sort_direction] = params[:sort_direction].presence || 'desc'
|
||||
identity_verifications = Admins::IdentityVerificationQuery.call(params)
|
||||
@identity_verifications = paginate identity_verifications.preload(:user)
|
||||
end
|
||||
|
||||
def show
|
||||
render 'edit'
|
||||
end
|
||||
def edit
|
||||
end
|
||||
|
||||
def update
|
||||
if update_params[:state] == "已拒绝" && update_params[:description].blank?
|
||||
flash[:danger] = '拒绝理由不能为空'
|
||||
render 'edit'
|
||||
else
|
||||
UserAction.create(action_id: @identity_verification.id, action_type: "UpdateIdentityVerifications", user_id: current_user.id, :ip => request.remote_ip, data_bank: @identity_verification.attributes.to_json)
|
||||
@identity_verification.update(update_params)
|
||||
redirect_to admins_identity_verifications_path
|
||||
flash[:success] = "更新成功"
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def finder_identity_verification
|
||||
@identity_verification = IdentityVerification.find(params[:id])
|
||||
@user = @identity_verification.user
|
||||
end
|
||||
|
||||
def update_params
|
||||
params.require(:identity_verification).permit(:state, :description)
|
||||
end
|
||||
end
|
|
@ -1,29 +0,0 @@
|
|||
class Admins::IssuesRankController < Admins::BaseController
|
||||
|
||||
def index
|
||||
@statistics = DailyProjectStatistic.where('date >= ? AND date <= ?', begin_date, end_date)
|
||||
@statistics = @statistics.group(:project_id).joins(:project).select("project_id,
|
||||
sum(issues) as issues,
|
||||
sum(closed_issues) as closed_issues,
|
||||
projects.issues_count as issues_count")
|
||||
@statistics = @statistics.order("#{sort_by} #{sort_direction}").limit(50)
|
||||
end
|
||||
|
||||
private
|
||||
def begin_date
|
||||
params.fetch(:begin_date, (Date.yesterday-7.days).to_s)
|
||||
end
|
||||
|
||||
def end_date
|
||||
params.fetch(:end_date, Date.yesterday.to_s)
|
||||
end
|
||||
|
||||
def sort_by
|
||||
DailyProjectStatistic.column_names.include?(params.fetch(:sort_by, "issues")) ? params.fetch(:sort_by, "issues") : "issues"
|
||||
end
|
||||
|
||||
def sort_direction
|
||||
%w(desc asc).include?(params.fetch(:sort_direction, "desc")) ? params.fetch(:sort_direction, "desc") : "desc"
|
||||
end
|
||||
|
||||
end
|
|
@ -25,6 +25,6 @@ class Admins::LaboratorySettingsController < Admins::BaseController
|
|||
params.permit(:identifier, :name,
|
||||
:nav_logo, :login_logo, :tab_logo, :oj_banner,
|
||||
:subject_banner, :course_banner, :competition_banner, :moop_cases_banner,
|
||||
:footer, navbar: %i[name link hidden index])
|
||||
:footer, navbar: %i[name link hidden])
|
||||
end
|
||||
end
|
|
@ -49,7 +49,7 @@ class Admins::MessageTemplatesController < Admins::BaseController
|
|||
def message_template_params
|
||||
# type = @message_template.present? ? @message_template.type : "MessageTemplate::CustomTip"
|
||||
# params.require(type.split("::").join("_").underscore.to_sym).permit!
|
||||
params.require(:message_template_custom_tip).permit!
|
||||
params.require(:message_template).permit!
|
||||
end
|
||||
|
||||
def get_template
|
||||
|
|
|
@ -9,29 +9,12 @@ class Admins::OrganizationsController < Admins::BaseController
|
|||
@orgs = paginate orgs
|
||||
end
|
||||
|
||||
|
||||
def open_cla
|
||||
@org.open_cla!
|
||||
render_ok
|
||||
end
|
||||
|
||||
def close_cla
|
||||
if @org.cla.nil?
|
||||
@org.close_cla!
|
||||
render_ok
|
||||
else
|
||||
render_error(' 该组织已创建CLA 不允许关闭')
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def show
|
||||
end
|
||||
|
||||
def destroy
|
||||
@org.destroy!
|
||||
Admins::DeleteOrganizationService.call(@org.login)
|
||||
UserAction.create(action_id: @org.id, action_type: "DestroyOrganization", user_id: current_user.id, :ip => request.remote_ip, data_bank: @org.attributes.to_json)
|
||||
render_delete_success
|
||||
end
|
||||
|
||||
|
|
|
@ -1,79 +0,0 @@
|
|||
class Admins::PageThemesController < Admins::BaseController
|
||||
before_action :finder_page_theme, only: [:edit, :update, :destroy]
|
||||
|
||||
def index
|
||||
params[:sort_by] = params[:sort_by].presence || 'created_at'
|
||||
params[:sort_direction] = params[:sort_direction].presence || 'desc'
|
||||
|
||||
page_themes = Admins::PageThemesQuery.call(params)
|
||||
|
||||
@page_themes = paginate page_themes
|
||||
end
|
||||
|
||||
def show
|
||||
render 'edit'
|
||||
end
|
||||
|
||||
def edit
|
||||
end
|
||||
|
||||
def create
|
||||
@page_theme = PageTheme.new theme_params
|
||||
if @page_theme.save
|
||||
save_image_file(params[:image])
|
||||
redirect_to admins_page_themes_path
|
||||
flash[:success] = "新增主题成功"
|
||||
else
|
||||
redirect_to admins_page_themes_path
|
||||
flash[:danger] = "新增主题失败: #{@page_theme.errors.messages.values.flatten.join(',')}"
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
if PageTheme.where(language_frame: @page_theme.language_frame).count <= 1
|
||||
flash[:danger] = "删除主题失败,必须存在一个主题"
|
||||
return redirect_to admins_page_themes_path
|
||||
end
|
||||
|
||||
if @page_theme.destroy
|
||||
redirect_to admins_page_themes_path
|
||||
flash[:success] = "删除主题成功"
|
||||
else
|
||||
redirect_to admins_page_themes_path
|
||||
flash[:danger] = "删除主题失败"
|
||||
end
|
||||
end
|
||||
|
||||
def new
|
||||
@page_theme = PageTheme.new
|
||||
end
|
||||
|
||||
def update
|
||||
@page_theme.attributes = theme_params
|
||||
if @page_theme.save
|
||||
save_image_file(params[:image])
|
||||
redirect_to admins_page_themes_path
|
||||
flash[:success] = "更新成功"
|
||||
else
|
||||
redirect_to admins_page_themes_path
|
||||
flash[:danger] = "更新失败"
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def finder_page_theme
|
||||
@page_theme = PageTheme.find(params[:id])
|
||||
end
|
||||
|
||||
def theme_params
|
||||
params.require(:page_theme).permit(:language_frame, :name, :cate, :image_url, :clone_url, :order_index)
|
||||
end
|
||||
|
||||
def save_image_file(file)
|
||||
return unless file.present? && file.is_a?(ActionDispatch::Http::UploadedFile)
|
||||
file_path = Util::FileManage.source_disk_filename(@page_theme, "image")
|
||||
File.delete(file_path) if File.exist?(file_path) # 删除之前的文件
|
||||
Util.write_file(file, file_path)
|
||||
end
|
||||
|
||||
end
|
|
@ -35,7 +35,6 @@ class Admins::ProjectsController < Admins::BaseController
|
|||
Gitea::Repository::DeleteService.new(project.owner, project.identifier).call
|
||||
project.destroy!
|
||||
# render_delete_success
|
||||
UserAction.create(action_id: project.id, action_type: "DestroyProject", user_id: current_user.id, :ip => request.remote_ip, data_bank: project.attributes.to_json)
|
||||
redirect_to admins_projects_path
|
||||
flash[:success] = "删除成功"
|
||||
end
|
||||
|
|
|
@ -1,55 +1,16 @@
|
|||
class Admins::ProjectsRankController < Admins::BaseController
|
||||
|
||||
def index
|
||||
@statistics = DailyProjectStatistic.where("date >= ? AND date <= ?", begin_date, end_date)
|
||||
@statistics = @statistics.group(:project_id).select("project_id,
|
||||
sum(score) as score,
|
||||
sum(visits) as visits,
|
||||
sum(watchers) as watchers,
|
||||
sum(praises) as praises,
|
||||
sum(forks) as forks,
|
||||
sum(issues) as issues,
|
||||
sum(pullrequests) as pullrequests,
|
||||
sum(commits) as commits").includes(:project)
|
||||
@statistics = @statistics.order("#{sort_by} #{sort_direction}")
|
||||
export_excel(@statistics.limit(50))
|
||||
@rank_date = rank_date
|
||||
deleted_data = $redis_cache.smembers("v2-project-rank-deleted")
|
||||
$redis_cache.zrem("v2-project-rank-#{rank_date}", deleted_data) unless deleted_data.blank?
|
||||
@date_rank = $redis_cache.zrevrange("v2-project-rank-#{rank_date}", 0, -1, withscores: true)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def begin_date
|
||||
params.fetch(:begin_date, (Date.yesterday-7.days).to_s)
|
||||
end
|
||||
|
||||
def end_date
|
||||
params.fetch(:end_date, Date.yesterday.to_s)
|
||||
end
|
||||
|
||||
def sort_by
|
||||
DailyProjectStatistic.column_names.include?(params.fetch(:sort_by, "score")) ? params.fetch(:sort_by, "score") : "score"
|
||||
end
|
||||
|
||||
def sort_direction
|
||||
%w(desc asc).include?(params.fetch(:sort_direction, "desc")) ? params.fetch(:sort_direction, "desc") : "desc"
|
||||
end
|
||||
|
||||
def export_excel(data)
|
||||
book = Spreadsheet::Workbook.new
|
||||
sheet = book.create_worksheet :name => "项目活跃度排行"
|
||||
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
|
||||
end
|
||||
book.write "#{Rails.root}/public/项目活跃度排行.xls"
|
||||
def rank_date
|
||||
params.fetch(:date, Date.today.to_s)
|
||||
end
|
||||
|
||||
end
|
|
@ -1,50 +0,0 @@
|
|||
class Admins::SitePagesController < Admins::BaseController
|
||||
before_action :finder_site_page, except: [:index]
|
||||
|
||||
def index
|
||||
params[:sort_by] = params[:sort_by].presence || 'created_at'
|
||||
params[:sort_direction] = params[:sort_direction].presence || 'desc'
|
||||
|
||||
pages = Admins::SitePagesQuery.call(params)
|
||||
|
||||
@site_pages = paginate pages.preload(:user)
|
||||
end
|
||||
|
||||
def show
|
||||
render 'edit'
|
||||
end
|
||||
|
||||
def edit
|
||||
end
|
||||
|
||||
|
||||
def destroy
|
||||
if @site_page.destroy
|
||||
redirect_to admins_site_pages_path
|
||||
flash[:success] = "删除站点成功"
|
||||
else
|
||||
redirect_to admins_site_pages_path
|
||||
flash[:danger] = "删除站点失败"
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
if update_params[:state] == "false" && update_params[:state_description].blank?
|
||||
flash[:danger] = '关闭站点理由不能为空'
|
||||
else
|
||||
@site_page.update(update_params)
|
||||
flash[:success] = '保存成功'
|
||||
end
|
||||
render 'edit'
|
||||
end
|
||||
|
||||
private
|
||||
def finder_site_page
|
||||
@site_page = Page.find(params[:id])
|
||||
@user = @site_page.user
|
||||
end
|
||||
|
||||
def update_params
|
||||
params.require(:page).permit(:state, :state_description)
|
||||
end
|
||||
end
|
|
@ -25,7 +25,7 @@ class Admins::SystemNotificationsController < Admins::BaseController
|
|||
@notification = SystemNotification.new(notification_params)
|
||||
if @notification.save
|
||||
redirect_to admins_system_notifications_path
|
||||
flash[:success] = '系统公告创建成功'
|
||||
flash[:success] = '系统消息创建成功'
|
||||
else
|
||||
redirect_to admins_system_notifications_path
|
||||
flash[:danger] = @notification.errors.full_messages.join(",")
|
||||
|
@ -37,7 +37,7 @@ class Admins::SystemNotificationsController < Admins::BaseController
|
|||
if @notification.update_attributes(notification_params)
|
||||
format.html do
|
||||
redirect_to admins_system_notifications_path
|
||||
flash[:success] = '系统公告更新成功'
|
||||
flash[:success] = '系统消息更新成功'
|
||||
end
|
||||
format.js {render_ok}
|
||||
else
|
||||
|
@ -53,10 +53,10 @@ class Admins::SystemNotificationsController < Admins::BaseController
|
|||
def destroy
|
||||
if @notification.destroy
|
||||
redirect_to admins_system_notifications_path
|
||||
flash[:success] = "系统公告删除成功"
|
||||
flash[:success] = "系统消息删除成功"
|
||||
else
|
||||
redirect_to admins_system_notifications_path
|
||||
flash[:danger] = "系统公告删除失败"
|
||||
flash[:danger] = "系统消息删除失败"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class Admins::UsersController < Admins::BaseController
|
||||
before_action :finder_user, except: [:index]
|
||||
before_action :finder_user, except: [:index]
|
||||
|
||||
def index
|
||||
params[:sort_by] = params[:sort_by].presence || 'created_on'
|
||||
|
@ -25,16 +25,15 @@ class Admins::UsersController < Admins::BaseController
|
|||
end
|
||||
|
||||
def destroy
|
||||
UserAction.create(action_id: @user.id, action_type: "DestroyUser", user_id: current_user.id, :ip => request.remote_ip, data_bank: @user.attributes.to_json)
|
||||
@user.destroy!
|
||||
Gitea::User::DeleteService.call(@user.login)
|
||||
|
||||
|
||||
render_delete_success
|
||||
end
|
||||
|
||||
def lock
|
||||
@user.lock!
|
||||
UserAction.create(action_id: @user.id, action_type: "LockUser", user_id: current_user.id, :ip => request.remote_ip)
|
||||
|
||||
render_ok
|
||||
end
|
||||
|
||||
|
@ -73,6 +72,6 @@ class Admins::UsersController < Admins::BaseController
|
|||
def update_params
|
||||
params.require(:user).permit(%i[lastname nickname gender technical_title is_shixun_marker
|
||||
mail phone location location_city school_id department_id admin
|
||||
password login website_permission])
|
||||
password login])
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,12 +7,4 @@ class Api::V1::Issues::IssuePrioritiesController < Api::V1::BaseController
|
|||
@priorities = @priorities.ransack(name_cont: params[:keyword]).result if params[:keyword]
|
||||
@priorities = kaminary_select_paginate(@priorities)
|
||||
end
|
||||
|
||||
def pm_index
|
||||
@priorities = IssuePriority.order(position: :asc)
|
||||
@priorities = @priorities.ransack(name_cont: params[:keyword]).result if params[:keyword]
|
||||
@priorities = kaminary_select_paginate(@priorities)
|
||||
render "index"
|
||||
end
|
||||
|
||||
end
|
|
@ -1,5 +1,5 @@
|
|||
class Api::V1::Issues::IssueTagsController < Api::V1::BaseController
|
||||
before_action :require_login, except: [:index, :pm_index]
|
||||
before_action :require_login, except: [:index]
|
||||
before_action :require_public_and_member_above, only: [:index]
|
||||
before_action :require_operate_above, only: [:create, :update, :destroy]
|
||||
|
||||
|
@ -7,17 +7,12 @@ class Api::V1::Issues::IssueTagsController < Api::V1::BaseController
|
|||
@issue_tags = @project.issue_tags.reorder("#{sort_by} #{sort_direction}")
|
||||
@issue_tags = @issue_tags.ransack(name_cont: params[:keyword]).result if params[:keyword].present?
|
||||
if params[:only_name]
|
||||
@issue_tags = kaminary_select_paginate(@issue_tags.select(:id, :name, :color))
|
||||
@issue_tags = kaminary_select_paginate(@issue_tags.select(:id, :name, :color))
|
||||
else
|
||||
@issue_tags = kaminari_paginate(@issue_tags.includes(:project, :user, :issue_issues, :pull_request_issues))
|
||||
end
|
||||
end
|
||||
|
||||
def pm_index
|
||||
@issue_tags = IssueTag.init_mp_issues_tags
|
||||
render_ok(@issue_tags)
|
||||
end
|
||||
|
||||
def create
|
||||
@issue_tag = @project.issue_tags.new(issue_tag_params)
|
||||
if @issue_tag.save!
|
||||
|
|
|
@ -8,11 +8,4 @@ class Api::V1::Issues::StatuesController < Api::V1::BaseController
|
|||
@statues = @statues.ransack(name_cont: params[:keyword]).result if params[:keyword].present?
|
||||
@statues = kaminary_select_paginate(@statues)
|
||||
end
|
||||
|
||||
def pm_index
|
||||
@statues = IssueStatus.order("position asc")
|
||||
@statues = @statues.ransack(name_cont: params[:keyword]).result if params[:keyword].present?
|
||||
@statues = kaminary_select_paginate(@statues)
|
||||
render "index"
|
||||
end
|
||||
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_login, except: [:index, :show]
|
||||
before_action :require_public_and_member_above, only: [:index, :show, :create, :update, :destroy]
|
||||
before_action :require_operate_above, only: [:batch_update, :batch_destroy]
|
||||
|
||||
def index
|
||||
|
@ -22,15 +22,8 @@ class Api::V1::IssuesController < Api::V1::BaseController
|
|||
|
||||
before_action :load_issue, only: [:show, :update, :destroy]
|
||||
before_action :check_issue_operate_permission, only: [:update, :destroy]
|
||||
before_action :load_issue_by_id, only: [: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
|
||||
|
||||
def show
|
||||
@issue.associate_attachment_container
|
||||
def show
|
||||
@user_permission = current_user.present? && current_user.logged? && (@project.member?(current_user) || current_user.admin? || @issue.user == current_user)
|
||||
end
|
||||
|
||||
|
@ -76,13 +69,6 @@ class Api::V1::IssuesController < Api::V1::BaseController
|
|||
end
|
||||
end
|
||||
|
||||
def load_issue_by_id
|
||||
@issue = Issue.find_by_id(params[:index])
|
||||
if @issue.blank?
|
||||
render_not_found("疑修不存在!")
|
||||
end
|
||||
end
|
||||
|
||||
def load_issues
|
||||
return render_error("请输入正确的ID数组!") unless params[:ids].is_a?(Array)
|
||||
params[:ids].each do |id|
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
class Api::V1::Projects::Actions::ActionsController < Api::V1::Projects::Actions::BaseController
|
||||
|
||||
def index
|
||||
begin
|
||||
gitea_result = $gitea_hat_client.get_repos_actions_by_owner_repo(@project&.owner&.login, @project&.identifier)
|
||||
@data = gitea_result[:data]["Workflows"]
|
||||
rescue
|
||||
@data = []
|
||||
end
|
||||
end
|
||||
|
||||
def disable
|
||||
return render_error("请输入正确的流水线文件!") if params[:workflow].blank?
|
||||
gitea_result = $gitea_hat_client.post_repos_actions_disable(@project&.owner&.login, @project&.identifier, {query: {workflow: params[:workflow]}}) rescue nil
|
||||
if gitea_result
|
||||
render_ok
|
||||
else
|
||||
render_error("禁用流水线失败")
|
||||
end
|
||||
end
|
||||
|
||||
def enable
|
||||
return render_error("请输入正确的流水线文件!") if params[:workflow].blank?
|
||||
gitea_result = $gitea_hat_client.post_repos_actions_enable(@project&.owner&.login, @project&.identifier, {query: {workflow: params[:workflow]}}) rescue nil
|
||||
if gitea_result
|
||||
render_ok
|
||||
else
|
||||
render_error("取消禁用流水线失败")
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,4 +0,0 @@
|
|||
class Api::V1::Projects::Actions::BaseController < Api::V1::BaseController
|
||||
before_action :require_public_and_member_above
|
||||
|
||||
end
|
|
@ -1,12 +0,0 @@
|
|||
class Api::V1::Projects::Actions::RunsController < Api::V1::Projects::Actions::BaseController
|
||||
|
||||
def index
|
||||
@result_object = Api::V1::Projects::Actions::Runs::ListService.call(@project, {workflow: params[:workflow], page: page, limit: limit}, current_user&.gitea_token)
|
||||
puts @result_object
|
||||
end
|
||||
|
||||
def job_show
|
||||
@result_object = Api::V1::Projects::Actions::Runs::JobShowService.call(@project, params[:run_id], params[:job], params[:log_cursors], current_user&.gitea_token)
|
||||
end
|
||||
|
||||
end
|
|
@ -2,14 +2,14 @@ class Api::V1::Projects::BranchesController < Api::V1::BaseController
|
|||
before_action :require_public_and_member_above, only: [:index, :all]
|
||||
|
||||
def index
|
||||
@result_object = Api::V1::Projects::Branches::ListService.call(@project, {name: params[:keyword], state: params[:state], page: page, limit: limit}, current_user&.gitea_token)
|
||||
@result_object = Api::V1::Projects::Branches::ListService.call(@project, {name: params[:keyword], page: page, limit: limit}, current_user&.gitea_token)
|
||||
end
|
||||
|
||||
def all
|
||||
@result_object = Api::V1::Projects::Branches::AllListService.call(@project, current_user&.gitea_token)
|
||||
end
|
||||
|
||||
before_action :require_operate_above, only: [:create, :destroy, :restore]
|
||||
before_action :require_operate_above, only: [:create, :destroy]
|
||||
|
||||
def create
|
||||
@result_object = Api::V1::Projects::Branches::CreateService.call(@project, branch_params, current_user&.gitea_token)
|
||||
|
@ -17,31 +17,13 @@ class Api::V1::Projects::BranchesController < Api::V1::BaseController
|
|||
|
||||
def destroy
|
||||
@result_object = Api::V1::Projects::Branches::DeleteService.call(@project, params[:name], current_user&.gitea_token)
|
||||
if @result_object
|
||||
# 有开启的pr需要一同关闭
|
||||
# 1、删除本仓库中存在未关闭的pr,即本仓库分支1->分支2
|
||||
# 2、如果是fork仓库,考虑删除主仓库中存在未关闭的pr,即本仓库:分支1->主:分支2,同时分两种删除:1删除本仓库分支1,2删除主仓库分支2
|
||||
close_pull_requests_by(@project, params[:name])
|
||||
if @project.forked_from_project_id.present?
|
||||
# fork项目中删除分支
|
||||
close_pull_requests_by(@project.fork_project, params[:name])
|
||||
end
|
||||
|
||||
if @result_object
|
||||
return render_ok
|
||||
else
|
||||
return render_error('删除分支失败!')
|
||||
end
|
||||
end
|
||||
|
||||
def restore
|
||||
@result_object = Api::V1::Projects::Branches::RestoreService.call(@project, params[:branch_id], params[:branch_name], current_user&.gitea_token)
|
||||
if @result_object
|
||||
return render_ok
|
||||
else
|
||||
return render_error('恢复分支失败!')
|
||||
end
|
||||
end
|
||||
|
||||
before_action :require_manager_above, only: [:update_default_branch]
|
||||
|
||||
def update_default_branch
|
||||
|
@ -57,19 +39,4 @@ class Api::V1::Projects::BranchesController < Api::V1::BaseController
|
|||
def branch_params
|
||||
params.require(:branch).permit(:new_branch_name, :old_branch_name)
|
||||
end
|
||||
|
||||
def close_pull_requests_by(project, branch_name)
|
||||
open_pull_requests = project.pull_requests.opening.where(head: branch_name).or(project.pull_requests.opening.where(base: branch_name))
|
||||
if open_pull_requests.present?
|
||||
open_pull_requests.each do |pull_request|
|
||||
closed = PullRequests::CloseService.call(project.owner, project.repository, pull_request, current_user)
|
||||
if closed === true
|
||||
pull_request.project_trends.create!(user: current_user, project: project,action_type: ProjectTrend::CLOSE)
|
||||
# 合并请求下issue处理为关闭
|
||||
pull_request.issue&.update_attributes!({status_id:5})
|
||||
SendTemplateMessageJob.perform_later('PullRequestClosed', current_user.id, pull_request.id) if Site.has_notice_menu?
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,5 +1,5 @@
|
|||
class Api::V1::Projects::CommitsController < Api::V1::BaseController
|
||||
before_action :require_public_and_member_above, only: [:index, :diff, :recent]
|
||||
before_action :require_public_and_member_above, only: [:index, :diff]
|
||||
|
||||
def index
|
||||
@result_object = Api::V1::Projects::Commits::ListService.call(@project, {page: page, limit: limit, sha: params[:sha]}, current_user&.gitea_token)
|
||||
|
@ -9,8 +9,4 @@ class Api::V1::Projects::CommitsController < Api::V1::BaseController
|
|||
def diff
|
||||
@result_object = Api::V1::Projects::Commits::DiffService.call(@project, params[:sha], current_user&.gitea_token)
|
||||
end
|
||||
|
||||
def recent
|
||||
@result_object = Api::V1::Projects::Commits::RecentService.call(@project, {keyword: params[:keyword], page: page, limit: limit}, current_user&.gitea_token)
|
||||
end
|
||||
end
|
|
@ -1,13 +1,10 @@
|
|||
class Api::V1::Projects::TagsController < Api::V1::BaseController
|
||||
before_action :require_public_and_member_above, only: [:index, :show]
|
||||
before_action :require_public_and_member_above, only: [:index]
|
||||
|
||||
def index
|
||||
@release_tags = @repository.version_releases.pluck(:tag_name)
|
||||
@result_object = Api::V1::Projects::Tags::ListService.call(@project, {page: page, limit: limit}, current_user&.gitea_token)
|
||||
end
|
||||
|
||||
def show
|
||||
@result_object = Api::V1::Projects::Tags::GetService.call(@project, params[:name], current_user&.gitea_token)
|
||||
puts @result_object
|
||||
end
|
||||
|
||||
before_action :require_operate_above, only: [:destroy]
|
||||
|
|
|
@ -81,7 +81,7 @@ class ApplicationController < ActionController::Base
|
|||
# 判断用户的邮箱或者手机是否可用
|
||||
# params[:type] 1: 注册;2:忘记密码;3:绑定
|
||||
def check_mail_and_phone_valid login, type
|
||||
unless login =~ /\A[a-zA-Z0-9]+([._\-\\]*[a-zA-Z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+\z/ || login =~ /^1\d{10}$/
|
||||
unless login =~ /^[a-zA-Z0-9]+([._\\]*[a-zA-Z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/ || login =~ /^1\d{10}$/
|
||||
tip_exception(-2, "请输入正确的手机号或邮箱")
|
||||
end
|
||||
|
||||
|
@ -222,11 +222,11 @@ class ApplicationController < ActionController::Base
|
|||
end
|
||||
|
||||
def require_profile_completed
|
||||
tip_exception(411, "请完善资料后再操作") unless User.current.profile_is_completed?
|
||||
# tip_exception(411, "请完善资料后再操作") unless User.current.profile_is_completed?
|
||||
end
|
||||
|
||||
def require_user_profile_completed(user)
|
||||
tip_exception(412, "请用户完善资料后再操作") unless user.profile_is_completed?
|
||||
# tip_exception(412, "请用户完善资料后再操作") unless user.profile_is_completed?
|
||||
end
|
||||
|
||||
# 异常提醒
|
||||
|
@ -715,7 +715,7 @@ class ApplicationController < ActionController::Base
|
|||
end
|
||||
|
||||
def find_user_with_id
|
||||
@user = User.find_by(type: 'User', id: params[:user_id])
|
||||
@user = User.find_by_id params[:user_id]
|
||||
# render_not_found("未找到’#{params[:login]}’相关的用户") unless @user
|
||||
render_error("未找到相关的用户") unless @user
|
||||
end
|
||||
|
@ -1103,7 +1103,7 @@ class ApplicationController < ActionController::Base
|
|||
"author_time": commit['commit']['author']['date'],
|
||||
"committer_time": commit['commit']['committer']['date'],
|
||||
"content": commit['commit']['message'],
|
||||
"commit_diff": commit_diff.present? ? commit_diff['Files'].to_s : ""
|
||||
"commit_diff": commit_diff['Files'].to_s
|
||||
}.to_json
|
||||
resp_body = Blockchain::InvokeBlockchainApi.call(params)
|
||||
if resp_body['status'] == 7
|
||||
|
@ -1161,19 +1161,6 @@ class ApplicationController < ActionController::Base
|
|||
end
|
||||
def find_atme_receivers
|
||||
@atme_receivers = User.where(login: params[:receivers_login])
|
||||
end
|
||||
|
||||
# 接口限流,请求量大有性能问题
|
||||
def request_limit
|
||||
record_count = Rails.cache.read("request/#{controller_name}/#{Time.now.strftime('%Y%m%d%H%M')}/#{request.remote_ip}")
|
||||
if record_count.present?
|
||||
record_count = record_count + 1
|
||||
else
|
||||
record_count = 1
|
||||
end
|
||||
tip_exception("请求太快,请稍后再试。") if record_count > 100
|
||||
|
||||
Rails.cache.write("request/#{controller_name}/#{Time.now.strftime('%Y%m%d%H%M')}/#{request.remote_ip}", record_count, expires_in: 1.minute)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -38,14 +38,12 @@ class AttachmentsController < ApplicationController
|
|||
url = ("/repos"+url.split(base_url + "/api")[1])
|
||||
filepath, ref = url.split("/")[-1].split("?")
|
||||
url.gsub!(url.split("/")[-1], '')
|
||||
Rails.logger.info("url===#{url}")
|
||||
Rails.logger.info(filepath)
|
||||
request_url = [domain, api_url, URI.encode(url), URI.escape(filepath), "?ref=#{URI.escape(ref.split('ref=')[1])}&access_token=#{User.where(admin: true).take&.gitea_token}"].join
|
||||
Rails.logger.info("request_url===#{request_url}")
|
||||
puts filepath
|
||||
request_url = [domain, api_url, url, CGI.escape(filepath), "?ref=#{CGI.escape(ref.split('ref=')[1])}&access_token=#{User.where(admin: true).take&.gitea_token}"].join
|
||||
response = Faraday.get(request_url)
|
||||
filename = filepath
|
||||
else
|
||||
response = Faraday.get(URI.encode(url))
|
||||
response = Faraday.get(url)
|
||||
filename = params[:download_url].to_s.split("/").pop()
|
||||
end
|
||||
send_data(response.body.force_encoding("UTF-8"), filename: filename, type: "application/octet-stream", disposition: 'attachment')
|
||||
|
@ -94,7 +92,6 @@ class AttachmentsController < ApplicationController
|
|||
@attachment.author_id = current_user.id
|
||||
@attachment.disk_directory = month_folder
|
||||
@attachment.cloud_url = remote_path
|
||||
@attachment.uuid = SecureRandom.uuid
|
||||
@attachment.save!
|
||||
else
|
||||
logger.info "文件已存在,id = #{@attachment.id}, filename = #{@attachment.filename}"
|
||||
|
@ -144,14 +141,12 @@ class AttachmentsController < ApplicationController
|
|||
|
||||
private
|
||||
def find_file
|
||||
tip_exception(404, "您访问的页面不存在或已被删除") if params[:id].blank?
|
||||
@file =
|
||||
if params[:type] == 'history'
|
||||
AttachmentHistory.find params[:id]
|
||||
else
|
||||
Attachment.where_id_or_uuid(params[:id]).first
|
||||
Attachment.find params[:id]
|
||||
end
|
||||
tip_exception(404, "您访问的页面不存在或已被删除") if @file.blank?
|
||||
end
|
||||
|
||||
def delete_file(file_path)
|
||||
|
@ -221,22 +216,18 @@ class AttachmentsController < ApplicationController
|
|||
def attachment_candown
|
||||
unless current_user.admin? || current_user.business?
|
||||
candown = true
|
||||
if @file.container && @file.uuid.nil?
|
||||
if @file.container
|
||||
if @file.container.is_a?(Issue)
|
||||
project = @file.container.project
|
||||
candown = project.is_public || (current_user.logged? && project.member?(current_user))
|
||||
elsif @file.container.is_a?(Journal)
|
||||
project = @file.container.issue.project
|
||||
candown = project.is_public || (current_user.logged? && project.member?(current_user))
|
||||
elsif @file.container.is_a?(Project)
|
||||
project = @file.container
|
||||
candown = project.is_public || (current_user.logged? && project.member?(current_user))
|
||||
else
|
||||
project = nil
|
||||
end
|
||||
tip_exception(403, "您没有权限进入") if project.present? && !candown
|
||||
end
|
||||
tip_exception(403, "您没有权限查看") if @file.is_public == 0 && @file.author_id != current_user.id
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ class BindUsersController < ApplicationController
|
|||
bind_user = User.try_to_login(params[:username], params[:password])
|
||||
tip_exception '用户名或者密码错误' if bind_user.blank?
|
||||
tip_exception '用户名或者密码错误' unless bind_user.check_password?(params[:password].to_s)
|
||||
tip_exception '参数错误' unless ["qq", "wechat", "gitee", "github", "educoder", "acge"].include?(params[:type].to_s)
|
||||
tip_exception '参数错误' unless ["qq", "wechat", "gitee", "github", "educoder"].include?(params[:type].to_s)
|
||||
tip_exception '该账号已被绑定,请更换其他账号进行绑定' if bind_user.bind_open_user?(params[:type].to_s)
|
||||
|
||||
"OpenUsers::#{params[:type].to_s.capitalize}".constantize.create!(user: bind_user, uid: session[:unionid])
|
||||
|
|
|
@ -5,17 +5,13 @@ class ForksController < ApplicationController
|
|||
before_action :authenticate_project!, :authenticate_user!
|
||||
|
||||
def create
|
||||
@new_project = Projects::ForkService.new(current_user, @project, params[:organization], params[:new_name], params[:new_identifier]).call
|
||||
@new_project = Projects::ForkService.new(current_user, @project, params[:organization]).call
|
||||
end
|
||||
|
||||
private
|
||||
def authenticate_project!
|
||||
if current_user&.id == @project.user_id
|
||||
render_result(-1, "自己不能fork自己的项目")
|
||||
elsif @project.fork_users.where(user_id: current_user.id).present?
|
||||
fork = @project.fork_users.find_by(user_id: current_user.id)
|
||||
render json: { status: 0, id: fork.fork_project_id, identifier: fork.fork_project&.identifier, message: "fork失败,你已拥有了这个项目 #{fork.fork_project&.identifier}" }
|
||||
return
|
||||
elsif Project.exists?(user_id: current_user.id, identifier: @project.identifier)
|
||||
render_result(0, "fork失败,你已拥有了这个项目")
|
||||
end
|
||||
|
@ -28,4 +24,4 @@ class ForksController < ApplicationController
|
|||
return if @project.member?(current_user) || current_user.admin?
|
||||
render_forbidden('你没有权限操作')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
class IdentityVerificationsController < ApplicationController
|
||||
before_action :require_login
|
||||
before_action :require_profile_completed, only: [:create]
|
||||
|
||||
def index
|
||||
@id_verify = current_user.identity_verification
|
||||
return render_ok({data:nil}) unless @id_verify
|
||||
end
|
||||
|
||||
def create
|
||||
return tip_exception(-1, "您已提交过身份审核,请勿重复提交") if IdentityVerification.exists?(user:current_user)
|
||||
return tip_exception(-1, "身份证输入有误")unless create_params[:number] =~ User::VALID_NUMBER_REGEX
|
||||
@id_verify = IdentityVerification.new(create_params)
|
||||
@id_verify.user = current_user
|
||||
@id_verify.save
|
||||
end
|
||||
|
||||
def update
|
||||
return tip_exception(-1, "身份证输入有误")unless create_params[:number] =~ User::VALID_NUMBER_REGEX
|
||||
current_user.identity_verification.update(create_params.merge({ state: 0 }))
|
||||
current_user.update(id_card_verify: false)
|
||||
@id_verify = current_user.identity_verification
|
||||
end
|
||||
|
||||
private
|
||||
def create_params
|
||||
params.permit(:number, :name, :card_front, :card_back, :hold_card_front, :hold_card_back)
|
||||
end
|
||||
end
|
|
@ -1,12 +1,12 @@
|
|||
class IssuesController < ApplicationController
|
||||
before_action :require_login, except: [:index, :show, :index_chosen, :index_to_name]
|
||||
before_action :require_login, except: [:index, :show, :index_chosen]
|
||||
before_action :require_profile_completed, only: [:create]
|
||||
before_action :load_project
|
||||
before_action :set_user
|
||||
before_action :check_menu_authorize, except: [:index_chosen]
|
||||
before_action :check_issue_permission
|
||||
before_action :operate_issue_permission, only:[:create, :update, :destroy, :clean, :series_update, :copy]
|
||||
before_action :check_project_public, only: [:index ,:show, :copy, :index_chosen, :close_issue, :index_to_name]
|
||||
before_action :check_project_public, only: [:index ,:show, :copy, :index_chosen, :close_issue]
|
||||
|
||||
before_action :set_issue, only: [:edit, :update, :destroy, :show, :copy, :close_issue, :lock_issue]
|
||||
before_action :check_token_enough, :find_atme_receivers, only: [:create, :update]
|
||||
|
@ -49,27 +49,6 @@ class IssuesController < ApplicationController
|
|||
@issue_chosen = issue_left_chosen(@project, nil)
|
||||
end
|
||||
|
||||
def index_to_name
|
||||
issues_index = params[:index].map(&:to_i)
|
||||
exit_index = []
|
||||
issues_result = @project.issues.where(project_issues_index:issues_index).map{ |e|
|
||||
exit_index << e.project_issues_index
|
||||
{
|
||||
id:e.id,
|
||||
project_issues_index:e.project_issues_index,
|
||||
subject:e.subject
|
||||
}
|
||||
|
||||
}
|
||||
not_exit = issues_index - exit_index
|
||||
not_exit.map{|e|
|
||||
issues_result << {id: nil,
|
||||
project_issues_index:e,
|
||||
subject: nil}
|
||||
}
|
||||
render json: issues_result
|
||||
end
|
||||
|
||||
def commit_issues
|
||||
issues = @project.issues.issue_issue.includes(:user,:tracker)
|
||||
issues = issues.where(is_private: false) unless current_user.present? && (current_user.admin? || @project.member?(current_user))
|
||||
|
@ -139,7 +118,7 @@ class IssuesController < ApplicationController
|
|||
SendTemplateMessageJob.perform_later('ProjectIssue', current_user.id, @issue&.id) if Site.has_notice_menu?
|
||||
if params[:attachment_ids].present?
|
||||
params[:attachment_ids].each do |id|
|
||||
attachment = Attachment.where_id_or_uuid(id).select(:id, :container_id, :container_type)&.first
|
||||
attachment = Attachment.select(:id, :container_id, :container_type)&.find_by_id(id)
|
||||
unless attachment.blank?
|
||||
attachment.container = @issue
|
||||
attachment.author_id = current_user.id
|
||||
|
@ -232,7 +211,7 @@ class IssuesController < ApplicationController
|
|||
if issue_files.present?
|
||||
change_files = true
|
||||
issue_files.each do |id|
|
||||
attachment = Attachment.where_id_or_uuid(id).select(:id, :container_id, :container_type)&.first
|
||||
attachment = Attachment.select(:id, :container_id, :container_type)&.find_by_id(id)
|
||||
unless attachment.blank?
|
||||
attachment.container = @issue
|
||||
attachment.author_id = current_user.id
|
||||
|
@ -321,7 +300,6 @@ class IssuesController < ApplicationController
|
|||
@issue_user = @issue.user
|
||||
@issue_assign_to = @issue.get_assign_user
|
||||
@join_users = join_users(@issue)
|
||||
@issue.associate_attachment_container
|
||||
#总耗时
|
||||
# cost_time(@issue)
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ class JournalsController < ApplicationController
|
|||
if journal.save
|
||||
if params[:attachment_ids].present?
|
||||
params[:attachment_ids].each do |id|
|
||||
attachment = Attachment.where_id_or_uuid(id).select(:id, :container_id, :container_type)&.first
|
||||
attachment = Attachment.select(:id, :container_id, :container_type)&.find_by_id(id)
|
||||
unless attachment.blank?
|
||||
attachment.container = journal
|
||||
attachment.author_id = current_user.id
|
||||
|
|
|
@ -8,18 +8,6 @@ class MainController < ApplicationController
|
|||
render :json => { status: 0, message: Time.now.to_i }
|
||||
end
|
||||
|
||||
def test_404
|
||||
status_code = 404
|
||||
status = status_code.to_s
|
||||
fname = %w[404 403 422 500].include?(status) ? status : "unknown"
|
||||
|
||||
respond_to do |format|
|
||||
format.html { render template: "/shared/#{fname}", handler: [:erb], status: status }
|
||||
format.xml { render :xml => Laboratory.limit(1).to_xml, status: status }
|
||||
format.all { render body: nil, status: status }
|
||||
end
|
||||
end
|
||||
|
||||
def index
|
||||
domain_session = params[:_educoder_session]
|
||||
if domain_session
|
||||
|
@ -36,8 +24,6 @@ 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, :content_type=> 'text/html'
|
||||
elsif params[:path].to_s.include?("test_404")
|
||||
test_404
|
||||
else
|
||||
render file: 'public/react/build/index.html', :layout => false, :content_type=> 'text/html'
|
||||
end
|
||||
|
|
|
@ -1,67 +0,0 @@
|
|||
class Oauth::AcgeController < Oauth::BaseController
|
||||
include RegisterHelper
|
||||
|
||||
def create
|
||||
begin
|
||||
uid = params['uid'].to_s.strip
|
||||
tip_exception("uid不能为空") if uid.blank?
|
||||
redirect_uri = params['redirect_uri'].to_s.strip
|
||||
tip_exception("redirect_uri不能为空") if redirect_uri.blank?
|
||||
email = params['email'].to_s.strip
|
||||
tip_exception("email不能为空") if email.blank?
|
||||
phone = params['phone'].to_s.strip
|
||||
tip_exception("phone不能为空") if phone.blank?
|
||||
name = params['name'].to_s.strip
|
||||
tip_exception("name不能为空") if name.blank?
|
||||
|
||||
open_user = OpenUsers::Acge.find_by(uid: uid)
|
||||
if open_user.present? && open_user.user.present?
|
||||
successful_authentication(open_user.user)
|
||||
redirect_to redirect_uri
|
||||
return
|
||||
else
|
||||
if current_user.blank? || !current_user.logged?
|
||||
session[:unionid] = uid
|
||||
user = User.find_by(mail: email) || User.find_by(phone: phone)
|
||||
if user.present?
|
||||
OpenUsers::Acge.create!(user: user, uid: uid)
|
||||
successful_authentication(user)
|
||||
redirect_to redirect_uri
|
||||
|
||||
return
|
||||
else
|
||||
username = uid[0..7]
|
||||
password = SecureRandom.hex(4)
|
||||
reg_result = autologin_register(username, email, password, 'acge', phone, name)
|
||||
existing_rows = CSV.read("public/操作系统大赛用户信息.csv")
|
||||
new_row = [username, email, password, phone, name]
|
||||
existing_rows << new_row
|
||||
CSV.open("public/操作系统大赛用户信息.csv", 'wb') do |csv|
|
||||
existing_rows.each { |row| csv << row }
|
||||
end
|
||||
if reg_result[:message].blank?
|
||||
open_user = OpenUsers::Acge.create!(user_id: reg_result[:user][:id], uid: uid)
|
||||
successful_authentication(open_user.user)
|
||||
redirect_to redirect_uri
|
||||
|
||||
return
|
||||
else
|
||||
render_error(reg_result[:message])
|
||||
end
|
||||
end
|
||||
else
|
||||
OpenUsers::Acge.create!(user: current_user, uid: uid)
|
||||
successful_authentication(current_user)
|
||||
redirect_to redirect_uri
|
||||
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
Rails.logger.info("[OAuth2] session[:unionid] -> #{session[:unionid]}")
|
||||
# redirect_to "/bindlogin/acge?redirect_uri=#{redirect_uri}"
|
||||
rescue Exception => ex
|
||||
render_error(ex.message)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -20,12 +20,12 @@ class Oauth2Controller < ActionController::Base
|
|||
return @error = {msg: '违反平台使用规范,账号已被锁定', id: 'login'} if @user.locked?
|
||||
|
||||
login_control = LimitForbidControl::UserLogin.new(@user)
|
||||
return @error = {msg: "登录密码出错已达上限,账号已被锁定,请#{login_control.forbid_expires/60}分钟后重新登录或找回密码", id: 'account'} if login_control.forbid?
|
||||
return @error = {msg: "登录密码出错已达上限,账号已被锁定, 请#{login_control.forbid_expires/60}分钟后重新登录或找回密码", id: 'account'} if login_control.forbid?
|
||||
|
||||
password_ok = @user.check_password?(params[:password].to_s)
|
||||
unless password_ok
|
||||
if login_control.remain_times-1 == 0
|
||||
@error = {msg: "登录密码出错已达上限,账号已被锁定,请#{login_control.forbid_expires/60}分钟后重新登录或找回密码", id: 'account'}
|
||||
@error = {msg: "登录密码出错已达上限,账号已被锁定, 请#{login_control.forbid_expires/60}分钟后重新登录或找回密码", id: 'account'}
|
||||
else
|
||||
@error = {msg: "你已经输错密码#{login_control.error_times+1}次,还剩余#{login_control.remain_times-1}次机会", id: 'account'}
|
||||
end
|
||||
|
|
|
@ -1,70 +0,0 @@
|
|||
class Organizations::ClasController < Organizations::BaseController
|
||||
before_action :load_organization
|
||||
before_action :load_cla, only: [:show, :update, :destroy]
|
||||
before_action :check_user_can_edit_org, only: [:create, :update, :destroy]
|
||||
|
||||
def index
|
||||
@cla = @organization.cla
|
||||
end
|
||||
|
||||
def show
|
||||
@is_admin = can_edit_org?
|
||||
@is_member = @organization.is_member?(current_user.id)
|
||||
@is_sign = @organization.is_sign?(current_user.id)
|
||||
@cla_sign_email = if @is_sign
|
||||
@organization.cla_sign_email(current_user.id)
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
tip_exception("您的组织还未拥有创建CLA权限,请联系管理员") if @organization.enabling_cla == false
|
||||
ActiveRecord::Base.transaction do
|
||||
if @organization.cla.present?
|
||||
return tip_exception("组织已存在CLA!")
|
||||
else
|
||||
Organizations::CreateClaForm.new(cla_params).validate!
|
||||
@cla = Cla.build(cla_params,@organization.id)
|
||||
end
|
||||
end
|
||||
rescue Exception => e
|
||||
uid_logger_error(e.message)
|
||||
tip_exception(e.message)
|
||||
end
|
||||
|
||||
def update
|
||||
ActiveRecord::Base.transaction do
|
||||
Organizations::CreateClaForm.new(cla_params).validate!
|
||||
@cla.update(cla_params)
|
||||
end
|
||||
rescue Exception => e
|
||||
uid_logger_error(e.message)
|
||||
tip_exception(e.message)
|
||||
end
|
||||
|
||||
def destroy
|
||||
tip_exception("组织CLA已被签署,无法删除") if @cla.user_clas.size > 0
|
||||
ActiveRecord::Base.transaction do
|
||||
@cla.destroy!
|
||||
end
|
||||
render_ok
|
||||
rescue Exception => e
|
||||
uid_logger_error(e.message)
|
||||
tip_exception(e.message)
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
def cla_params
|
||||
params.permit(:name, :key, :content, :pr_need)
|
||||
end
|
||||
|
||||
def load_organization
|
||||
@organization = Organization.find_by(login: params[:organization_id]) || Organization.find_by(id: params[:organization_id])
|
||||
return render_not_found("组织不存在") if @organization.nil?
|
||||
end
|
||||
|
||||
def load_cla
|
||||
@cla = Cla.find_by!(organization:@organization, key: params[:id])
|
||||
end
|
||||
|
||||
end
|
|
@ -1,38 +1,19 @@
|
|||
class Organizations::OrganizationUsersController < Organizations::BaseController
|
||||
before_action :load_organization
|
||||
before_action :load_operate_user, :load_organization_user, only: [:destroy, :pm_check_user]
|
||||
before_action :check_user_can_edit_org, only: [:destroy]
|
||||
before_action :load_operate_user, :load_organization_user, :check_user_can_edit_org, only: [:destroy]
|
||||
|
||||
def index
|
||||
# @organization_users = @organization.organization_users.includes(:user)
|
||||
# if params[:search].present?
|
||||
# search = params[:search].to_s.downcase
|
||||
# user_condition_users = User.like(search).to_sql
|
||||
# team_condition_teams = User.joins(:teams).merge(@organization.teams.like(search)).to_sql
|
||||
# users = User.from("( #{user_condition_users} UNION #{team_condition_teams }) AS users")
|
||||
#
|
||||
# @organization_users = @organization_users.where(user_id: users).distinct
|
||||
# end
|
||||
#
|
||||
# @organization_users = kaminari_paginate(@organization_users)
|
||||
|
||||
organization_user_ids = @organization.organization_users.pluck(:user_id).uniq
|
||||
project_member_user_ids = @organization.projects.joins(:members).pluck("members.user_id").uniq
|
||||
ids = organization_user_ids + project_member_user_ids
|
||||
users = User.where(id: ids).reorder(Arel.sql("FIELD(users.id,#{ids.join(',')})"))
|
||||
@organization_users = @organization.organization_users.includes(:user)
|
||||
if params[:search].present?
|
||||
search = params[:search].to_s.downcase
|
||||
user_condition_users = User.like(search).to_sql
|
||||
team_condition_teams = User.joins(:teams).merge(@organization.teams.like(search)).to_sql
|
||||
user_ids = User.from("( #{user_condition_users} UNION #{team_condition_teams }) AS users").pluck(:id)
|
||||
users = User.from("( #{user_condition_users} UNION #{team_condition_teams }) AS users")
|
||||
|
||||
users = users.where(id: user_ids)
|
||||
@organization_users = @organization_users.where(user_id: users).distinct
|
||||
end
|
||||
@users = kaminari_paginate(users)
|
||||
end
|
||||
|
||||
def pm_check_user
|
||||
render_ok
|
||||
@organization_users = kaminari_paginate(@organization_users)
|
||||
end
|
||||
|
||||
def destroy
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
class Organizations::TeamUsersController < Organizations::BaseController
|
||||
before_action :load_organization, :load_team
|
||||
before_action :load_operate_user, only: [:create, :destroy, :pm_check_user]
|
||||
before_action :load_operate_user, only: [:create, :destroy]
|
||||
before_action :check_user_profile_completed, only: [:create]
|
||||
before_action :load_team_user, only: [:destroy, :pm_check_user]
|
||||
before_action :load_team_user, only: [:destroy]
|
||||
before_action :check_user_can_edit_org, only: [:create, :destroy]
|
||||
|
||||
def index
|
||||
|
@ -14,10 +14,6 @@ class Organizations::TeamUsersController < Organizations::BaseController
|
|||
@team_users = kaminari_paginate(@team_users)
|
||||
end
|
||||
|
||||
def pm_check_user
|
||||
render_ok
|
||||
end
|
||||
|
||||
def create
|
||||
ActiveRecord::Base.transaction do
|
||||
@team_user = TeamUser.build(@organization.id, @operate_user.id, @team.id)
|
||||
|
|
|
@ -4,12 +4,11 @@ class ProjectsController < ApplicationController
|
|||
include ProjectsHelper
|
||||
include Acceleratorable
|
||||
|
||||
before_action :require_login, except: %i[index branches branches_slice group_type_list simple show mp_show fork_users praise_users watch_users recommend banner_recommend about menu_list verify_auth_token]
|
||||
before_action :require_profile_completed, only: [:create, :migrate,:page_migrate,:verify_auth_token]
|
||||
before_action :load_repository, except: %i[index mp_show group_type_list migrate page_migrate create recommend banner_recommend verify_auth_token]
|
||||
before_action :require_login, except: %i[index branches branches_slice group_type_list simple show fork_users praise_users watch_users recommend banner_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 banner_recommend]
|
||||
before_action :authorizate_user_can_edit_project!, only: %i[update]
|
||||
before_action :project_public?, only: %i[fork_users praise_users watch_users]
|
||||
before_action :request_limit, only: %i[index]
|
||||
|
||||
def menu_list
|
||||
menu = []
|
||||
|
@ -43,11 +42,11 @@ class ProjectsController < ApplicationController
|
|||
if category_id.blank? && params[:search].blank? && params[:topic_id].blank?
|
||||
# 默认查询时count性能问题处理
|
||||
ProjectCategory.sum("projects_count") - Project.visible.joins("left join organization_extensions on organization_extensions.organization_id = projects.user_id").where("organization_extensions.visibility =2").count
|
||||
elsif params[:search].present? || params[:topic_id].present?
|
||||
elsif params[:search].present? || params[:topic_id].present?
|
||||
@projects.total_count
|
||||
else
|
||||
cate = ProjectCategory.find_by(id: category_id)
|
||||
cate&.projects_count || 0
|
||||
cate = ProjectCategory.find_by(id: category_id)
|
||||
cate&.projects_count || 0
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -55,32 +54,26 @@ class ProjectsController < ApplicationController
|
|||
ActiveRecord::Base.transaction do
|
||||
Projects::CreateForm.new(project_params).validate!
|
||||
@project = Projects::CreateService.new(current_user, project_params).call
|
||||
OpenProjectDevOpsJob.set(wait: 5.seconds).perform_later(@project&.id, current_user.id)
|
||||
UpdateProjectTopicJob.perform_later(@project.id) if @project.id.present?
|
||||
# OpenProjectDevOpsJob.set(wait: 5.seconds).perform_later(@project&.id, current_user.id)
|
||||
end
|
||||
rescue Exception => e
|
||||
uid_logger_error(e.message)
|
||||
tip_exception(e.message)
|
||||
end
|
||||
|
||||
def verify_auth_token
|
||||
data = Projects::VerifyAuthTokenService.call(params[:clone_addr], params[:auth_token])
|
||||
render_ok({data: data})
|
||||
end
|
||||
|
||||
def migrate
|
||||
Projects::MigrateForm.new(mirror_params).validate!
|
||||
|
||||
@project =
|
||||
@project =
|
||||
if EduSetting.get("mirror_address").to_s.include?("github") && enable_accelerator?(mirror_params[:clone_addr])
|
||||
source_clone_url = mirror_params[:clone_addr]
|
||||
uid_logger("########## 已动加速器 ##########")
|
||||
result = Gitea::Accelerator::MigrateService.call(mirror_params)
|
||||
if result[:status] == :success
|
||||
Rails.logger.info "########## 加速镜像成功 ########## "
|
||||
Projects::MigrateService.call(current_user,
|
||||
mirror_params.merge(source_clone_url: source_clone_url,
|
||||
clone_addr: accelerator_url(mirror_params[:repository_name])))
|
||||
Projects::MigrateService.call(current_user,
|
||||
mirror_params.merge(source_clone_url: source_clone_url,
|
||||
clone_addr: accelerator_url(mirror_params[:repository_name])))
|
||||
else
|
||||
Projects::MigrateService.call(current_user, mirror_params)
|
||||
end
|
||||
|
@ -97,54 +90,12 @@ class ProjectsController < ApplicationController
|
|||
tip_exception(e.message)
|
||||
end
|
||||
|
||||
|
||||
def page_migrate
|
||||
return normal_status(-1, "您还未开通Page服务,无法进行新建站点") unless current_user.id_card_verify
|
||||
return normal_status(-1, "你已使用了 #{page_site_params[:identifier]} 作为page标识") if Page.exists?(identifier: page_site_params[:identifier], user: current_user)
|
||||
|
||||
Projects::MigrateForm.new(mirror_params).validate!
|
||||
|
||||
@project =
|
||||
if EduSetting.get("mirror_address").to_s.include?("github") && enable_accelerator?(mirror_params[:clone_addr])
|
||||
source_clone_url = mirror_params[:clone_addr]
|
||||
uid_logger("########## 已动加速器 ##########")
|
||||
result = Gitea::Accelerator::MigrateService.call(mirror_params)
|
||||
if result[:status] == :success
|
||||
Rails.logger.info "########## 加速镜像成功 ########## "
|
||||
Projects::MigrateService.call(current_user,
|
||||
mirror_params.merge(source_clone_url: source_clone_url,
|
||||
clone_addr: accelerator_url(mirror_params[:repository_name])))
|
||||
else
|
||||
Projects::MigrateService.call(current_user, mirror_params)
|
||||
end
|
||||
elsif EduSetting.get("mirror_address").to_s.include?("cnpmjs") && mirror_params[:clone_addr].include?("github.com")
|
||||
source_clone_url = mirror_params[:clone_addr]
|
||||
clone_url = source_clone_url.gsub('github.com', 'github.com.cnpmjs.org')
|
||||
uid_logger("########## 更改clone_addr ##########")
|
||||
Projects::MigrateService.call(current_user, mirror_params.merge(source_clone_url: source_clone_url, clone_addr: clone_url))
|
||||
else
|
||||
Projects::MigrateService.call(current_user, mirror_params)
|
||||
end
|
||||
if @project.present?
|
||||
page = Page.new page_site_params
|
||||
page.user = current_user
|
||||
page.project = @project
|
||||
end
|
||||
|
||||
if page.save
|
||||
render json: page
|
||||
end
|
||||
rescue Exception => e
|
||||
uid_logger_error(e.message)
|
||||
tip_exception(e.message)
|
||||
end
|
||||
|
||||
def branches
|
||||
return @branches = [] unless @project.forge?
|
||||
|
||||
# result = Gitea::Repository::Branches::ListService.call(@owner, @project.identifier)
|
||||
result = Gitea::Repository::Branches::ListNameService.call(@owner, @project.identifier, params[:name])
|
||||
@branches = result.is_a?(Hash) ? (result.key?(:status) ? [] : result) : result
|
||||
@branches = result.is_a?(Hash) ? (result.key?(:status) ? [] : result) : result
|
||||
end
|
||||
|
||||
def branches_slice
|
||||
|
@ -178,7 +129,7 @@ class ProjectsController < ApplicationController
|
|||
ActiveRecord::Base.transaction do
|
||||
# TODO:
|
||||
# 临时特殊处理修改website、lesson_url操作方法
|
||||
if project_params.has_key?("website")
|
||||
if project_params.has_key?("website")
|
||||
if params[:project_topic_names].is_a?(Array)
|
||||
ProjectTopicRalate.where(project: @project).destroy_all
|
||||
params[:project_topic_names].each do |name|
|
||||
|
@ -193,19 +144,13 @@ class ProjectsController < ApplicationController
|
|||
default_branch: @project.default_branch
|
||||
}
|
||||
Gitea::Repository::UpdateService.call(@owner, @project.identifier, gitea_params)
|
||||
elsif project_params.has_key?("has_actions")
|
||||
gitea_params = {
|
||||
has_actions: project_params[:has_actions]
|
||||
}
|
||||
Gitea::Repository::UpdateService.call(@owner, @project.identifier, gitea_params)
|
||||
else
|
||||
validate_params = project_params.slice(:name, :description,
|
||||
:project_category_id, :project_language_id, :private, :identifier)
|
||||
|
||||
validate_params = project_params.slice(:name, :description,
|
||||
:project_category_id, :project_language_id, :private, :identifier)
|
||||
|
||||
Projects::UpdateForm.new(validate_params.merge(user_id: @project.user_id, project_identifier: @project.identifier, project_name: @project.name)).validate!
|
||||
|
||||
private = params[:private].nil? ? !@project.is_public : params[:private]
|
||||
private = @project.forked_from_project.present? ? !@project.forked_from_project.is_public : private
|
||||
|
||||
private = @project.forked_from_project.present? ? !@project.forked_from_project.is_public : params[:private] || false
|
||||
|
||||
new_project_params = project_params.except(:private).merge(is_public: !private)
|
||||
@project.update_attributes!(new_project_params)
|
||||
|
@ -217,7 +162,7 @@ class ProjectsController < ApplicationController
|
|||
name: @project.identifier
|
||||
}
|
||||
gitea_repo = Gitea::Repository::UpdateService.call(@owner, @project&.repository&.identifier, gitea_params)
|
||||
@project.repository.update_attributes({ hidden: gitea_repo["private"], identifier: gitea_repo["name"] })
|
||||
@project.repository.update_attributes({hidden: gitea_repo["private"], identifier: gitea_repo["name"]})
|
||||
# 更新对应所属分类下的项目数量(私有)
|
||||
before_is_public = @project.previous_changes[:is_public].present? ? @project.previous_changes[:is_public][0] : @project.is_public
|
||||
after_is_public = @project.previous_changes[:is_public].present? ? @project.previous_changes[:is_public][1] : @project.is_public
|
||||
|
@ -238,15 +183,6 @@ class ProjectsController < ApplicationController
|
|||
def show
|
||||
end
|
||||
|
||||
def mp_show
|
||||
@project = Project.joins(:owner).find params[:project_id]
|
||||
data={
|
||||
owner:@project.owner.try(:login),
|
||||
identifier:@project.identifier
|
||||
}
|
||||
render_ok(data:data)
|
||||
end
|
||||
|
||||
def destroy
|
||||
if current_user.admin? || @project.manager?(current_user)
|
||||
ActiveRecord::Base.transaction do
|
||||
|
@ -267,13 +203,13 @@ class ProjectsController < ApplicationController
|
|||
|
||||
def quit
|
||||
user_is_admin = current_user.admin? || @project.manager?(current_user)
|
||||
if !user_is_admin && @project.member(current_user.id) && @project.forge?
|
||||
if !user_is_admin && @project.member(current_user.id) && @project.forge?
|
||||
ActiveRecord::Base.transaction do
|
||||
Projects::DeleteMemberInteractor.call(@project.owner, @project, current_user)
|
||||
SendTemplateMessageJob.perform_later('ProjectMemberLeft', current_user.id, current_user.id, @project.id) if Site.has_notice_menu?
|
||||
render_ok
|
||||
end
|
||||
else
|
||||
else
|
||||
render_forbidden('你不能退出该仓库')
|
||||
end
|
||||
rescue Exception => e
|
||||
|
@ -302,13 +238,6 @@ class ProjectsController < ApplicationController
|
|||
def simple
|
||||
# 为了缓存活跃项目的基本信息,后续删除
|
||||
Cache::V2::ProjectCommonService.new(@project.id).read
|
||||
# 项目名称,标识,所有者变化时重置缓存
|
||||
project_common = $redis_cache.hgetall("v2-project-common:#{@project.id}")
|
||||
if project_common.present?
|
||||
if project_common["name"] != @project.name || project_common["identifier"] != @project.identifier || project_common["owner_id"] != @project.user_id
|
||||
Cache::V2::ProjectCommonService.new(@project.id).reset
|
||||
end
|
||||
end
|
||||
json_response(@project, current_user)
|
||||
end
|
||||
|
||||
|
@ -337,7 +266,7 @@ class ProjectsController < ApplicationController
|
|||
if @project_detail.save!
|
||||
attachment_ids = Array(params[:attachment_ids])
|
||||
logger.info "=============> #{Array(params[:attachment_ids])}"
|
||||
@attachments = Attachment.where(id: attachment_ids)
|
||||
@attachments = Attachment.where(id: attachment_ids)
|
||||
@attachments.update_all(
|
||||
container_id: @project_detail.id,
|
||||
container_type: @project_detail.model_name.name,
|
||||
|
@ -350,22 +279,17 @@ class ProjectsController < ApplicationController
|
|||
|
||||
|
||||
private
|
||||
|
||||
def project_params
|
||||
params.permit(:user_id, :name, :description, :repository_name, :website, :lesson_url, :default_branch, :identifier,
|
||||
:project_category_id, :project_language_id, :license_id, :ignore_id, :private, :has_actions,
|
||||
:blockchain, :blockchain_token_all, :blockchain_init_token, :pr_view_admin)
|
||||
:project_category_id, :project_language_id, :license_id, :ignore_id, :private,
|
||||
:blockchain, :blockchain_token_all, :blockchain_init_token)
|
||||
end
|
||||
|
||||
def mirror_params
|
||||
params.permit(:user_id, :name, :description, :repository_name, :is_mirror, :auth_username, :auth_token,
|
||||
params.permit(:user_id, :name, :description, :repository_name, :is_mirror, :auth_username,
|
||||
:auth_password, :project_category_id, :project_language_id, :clone_addr, :private)
|
||||
end
|
||||
|
||||
def page_site_params
|
||||
params.permit(:site_name, :identifier,:language_frame,:theme)
|
||||
end
|
||||
|
||||
def project_public?
|
||||
return if @project.is_public?
|
||||
|
||||
|
|
|
@ -67,7 +67,6 @@ class PullRequestsController < ApplicationController
|
|||
Issues::CreateForm.new({subject: params[:title], description: params[:body].blank? ? params[:body] : params[:body].b}).validate!
|
||||
@pull_request, @gitea_pull_request = PullRequests::CreateService.call(current_user, @owner, @project, params)
|
||||
if @gitea_pull_request[:status] == :success
|
||||
PullRequests::SendJournalService.call(@project, @pull_request, current_user)
|
||||
@pull_request.bind_gitea_pull_request!(@gitea_pull_request[:body]["number"], @gitea_pull_request[:body]["id"])
|
||||
reviewers = User.where(id: params[:reviewer_ids])
|
||||
@pull_request.reviewers = reviewers
|
||||
|
@ -193,7 +192,6 @@ class PullRequestsController < ApplicationController
|
|||
end
|
||||
|
||||
def show
|
||||
tip_exception(403, "你没有权限访问") if @project.pr_view_admin? && !@project.manager?(current_user)
|
||||
@issue_user = @issue.user
|
||||
@issue_assign_to = @issue.get_assign_user
|
||||
@gitea_pull = Gitea::PullRequest::GetService.call(@owner.login,
|
||||
|
@ -203,7 +201,6 @@ class PullRequestsController < ApplicationController
|
|||
|
||||
def pr_merge
|
||||
return render_forbidden("你没有权限操作.") unless @project.operator?(current_user)
|
||||
return normal_status(-1, "该分支存在冲突,无法自动合并.") unless @pull_request.conflict_files.blank?
|
||||
|
||||
if params[:do].blank?
|
||||
normal_status(-1, "请选择合并方式")
|
||||
|
@ -253,7 +250,6 @@ class PullRequestsController < ApplicationController
|
|||
normal_status(-1, result.message)
|
||||
end
|
||||
rescue => e
|
||||
logger_error(e)
|
||||
normal_status(-1, e.message)
|
||||
raise ActiveRecord::Rollback
|
||||
end
|
||||
|
|
|
@ -66,8 +66,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 = GiteaService.gitea_config[:domain]+"/#{@project.owner.login}/#{@project.identifier}/raw/branch/#{@ref}/"
|
||||
@repo_detail = $gitea_client.get_repos_by_owner_repo(@owner.login, @project.identifier)
|
||||
return render_not_found if @entries.blank? && !@repo_detail["empty"]
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -178,9 +176,6 @@ class RepositoriesController < ApplicationController
|
|||
result = Gitea::Repository::Contributors::GetService.call(@owner, @repository.identifier, {page: params[:page], limit: params[:limit]})
|
||||
@total_count = result[:total_count]
|
||||
@contributors = result.is_a?(Hash) ? result[:body] : []
|
||||
|
||||
add_contributors_count = EduSetting.get("ProjectAddContributors-#{@project.id}")
|
||||
@total_count = @total_count + add_contributors_count.to_i
|
||||
end
|
||||
rescue
|
||||
@contributors = []
|
||||
|
@ -268,9 +263,8 @@ class RepositoriesController < ApplicationController
|
|||
end
|
||||
@path = GiteaService.gitea_config[:domain]+"/#{@owner.login}/#{@repository.identifier}/raw/branch/#{params[:ref]}/"
|
||||
@readme = result[:status] === :success ? result[:body] : nil
|
||||
# replace_content 前置,防止被content改写
|
||||
@readme['replace_content'] = readme_decode64_content(@readme, @owner, @repository, params[:ref], @path)
|
||||
@readme['content'] = decode64_content(@readme, @owner, @repository, params[:ref], @path)
|
||||
@readme['replace_content'] = readme_decode64_content(@readme, @owner, @repository, params[:ref], @path)
|
||||
render json: @readme.slice("type", "encoding", "size", "name", "path", "content", "sha", "replace_content")
|
||||
rescue
|
||||
render json: nil
|
||||
|
|
|
@ -2,7 +2,6 @@ class SettingsController < ApplicationController
|
|||
def show
|
||||
@old_projects_url = nil
|
||||
get_navbar
|
||||
site_page_deploy_domain
|
||||
get_add_menu
|
||||
get_common_menu
|
||||
get_sub_competitions
|
||||
|
@ -12,33 +11,15 @@ class SettingsController < ApplicationController
|
|||
get_top_system_notification
|
||||
end
|
||||
|
||||
def check_url
|
||||
url = params[:url]
|
||||
task_id = params[:task]
|
||||
term = params[:term]
|
||||
return normal_status(-1, "缺少url参数") unless url.present?
|
||||
return normal_status(-1, "缺少term参数") unless term.present?
|
||||
return normal_status(-1, "缺少task参数") unless task_id.present?
|
||||
glcc_mate = GlccMediumTermExamineMaterial.new(code_or_pr_url: url, task_id: task_id, term: term, created_on:Time.now)
|
||||
state = glcc_mate.check_pr_url
|
||||
errors = glcc_mate.gennerate_content(state)
|
||||
render_ok({ state:state, state_html: errors})
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
def get_navbar
|
||||
@navbar = default_laboratory.navbar.sort_by{|e| e["index"].to_i }
|
||||
# if User.current.logged?
|
||||
# pernal_index = {"name"=>"个人主页", "link"=>get_site_url("url", "#{Rails.application.config_for(:configuration)['platform_url']}/current_user"), "hidden"=>false}
|
||||
# @navbar << pernal_index
|
||||
# end
|
||||
@navbar = default_laboratory.navbar
|
||||
if User.current.logged?
|
||||
pernal_index = {"name"=>"个人主页", "link"=>get_site_url("url", "#{Rails.application.config_for(:configuration)['platform_url']}/current_user"), "hidden"=>false}
|
||||
@navbar << pernal_index
|
||||
end
|
||||
end
|
||||
|
||||
def site_page_deploy_domain
|
||||
@deploy_domain = EduSetting.find_by_name("site_page_deploy_domain").try(:value)
|
||||
end
|
||||
|
||||
def get_add_menu
|
||||
@add = []
|
||||
Site.add.select(:id, :name, :url, :key).to_a.map(&:serializable_hash).each do |site|
|
||||
|
@ -82,6 +63,7 @@ class SettingsController < ApplicationController
|
|||
|
||||
def get_third_party
|
||||
@third_party = []
|
||||
return if EduSetting.get("is_local") == "true"
|
||||
@third_party << {
|
||||
name: 'educoder',
|
||||
url: EducoderOauth.oauth_url
|
||||
|
@ -90,6 +72,7 @@ class SettingsController < ApplicationController
|
|||
|
||||
def get_third_party_new
|
||||
@third_party_new = []
|
||||
return if EduSetting.get("is_local") == "true"
|
||||
@third_party_new << {
|
||||
name: 'educoder',
|
||||
url: EducoderOauth.oauth_url,
|
||||
|
|
|
@ -1,102 +0,0 @@
|
|||
class SitePagesController < ApplicationController
|
||||
before_action :require_login, except: [:softbot_build, :themes]
|
||||
before_action :require_profile_completed, only: [:create]
|
||||
before_action :load_project, except: [:softbot_build, :index, :themes]
|
||||
before_action :authenticate_user!, except: [:softbot_build, :index, :themes, :show]
|
||||
before_action :authenticate_member!, only: [:show]
|
||||
|
||||
def index
|
||||
pages = PageQuery.call(params,current_user)
|
||||
@total_count = pages.size
|
||||
@pages = paginate(pages)
|
||||
end
|
||||
|
||||
def show
|
||||
@page = Page.find_by(project_id: @project.id)
|
||||
return render_ok({data:nil}) unless @page.present?
|
||||
end
|
||||
|
||||
def create
|
||||
return normal_status(-1, '你还未开通Page服务,无法进行部署') unless current_user.website_permission
|
||||
return normal_status(-1, '你已开通Page服务') if Page.exists?(user: current_user)
|
||||
return normal_status(-1, '该仓库已开通Page服务') if Page.exists?(project: @project)
|
||||
@page = Page.new(create_params)
|
||||
@page.user = current_user
|
||||
@page.project = @project
|
||||
@page.save
|
||||
end
|
||||
|
||||
def update
|
||||
return normal_status(-1, '你还未开通Page服务') unless current_user.website_permission
|
||||
return normal_status(-1, '你还未开通Page站点') unless Page.exists?(user: current_user)
|
||||
@page = Page.find_by(user: current_user)
|
||||
@page.update(language_frame: params[:language_frame])
|
||||
render_ok
|
||||
end
|
||||
|
||||
def build
|
||||
return normal_status(-1, '你还未开通Page服务,无法进行部署') unless current_user.website_permission
|
||||
return normal_status(-1, '该仓库还未开通Page服务,无法进行部署') unless Page.exists?(project: @project)
|
||||
@page = Page.find params[:id]
|
||||
return normal_status(-1, @page.state_description) unless @page.state
|
||||
response_str = @page.deploy_page(params[:branch])
|
||||
data = JSON.parse(response_str)['result'] || (data = JSON.parse(response_str)['error'])
|
||||
if data.to_s.include?('部署成功')
|
||||
@page.update(last_build_at: Time.now, build_state: true, last_build_info: data)
|
||||
else
|
||||
@page.update(build_state:false, last_build_info: data)
|
||||
end
|
||||
render_ok({data: data.nil? ? nil : data.split("\n") })
|
||||
end
|
||||
|
||||
def softbot_build
|
||||
branch = params[:ref].split('/').last
|
||||
user = User.find_by_login params[:repository][:owner][:login]
|
||||
return normal_status(-1, '你还未开通Page服务,无法进行部署') unless user.website_permission
|
||||
|
||||
project = Project.where(identifier: params[:repository][:name],user_id: user.id)
|
||||
return normal_status(-1, '你没有权限操作') if project.owner?(user)
|
||||
return normal_status(-1, '该仓库还未开通Page服务,无法进行部署') if Page.exists?(user: user, project: project)
|
||||
|
||||
@page = Page.find_by(user: user, project: project)
|
||||
response_str = @page.deploy_page(branch)
|
||||
data = JSON.parse(response_str)['result']
|
||||
if data.nil?
|
||||
data = JSON.parse(response_str)['error']
|
||||
end
|
||||
|
||||
if data.include?('部署成功')
|
||||
@page.update(last_build_at: Time.now, build_state: true, last_build_info: data)
|
||||
else
|
||||
@page.update(build_state:false, last_build_info: data)
|
||||
end
|
||||
render_ok
|
||||
end
|
||||
|
||||
def themes
|
||||
# data = YAML.load_file(Rails.root.join('config/admins', 'page_themes.yml'))
|
||||
# render_ok({themes:data[theme_params.downcase]})
|
||||
@themes = PageTheme.where(language_frame:theme_params).order(order_index: :asc)
|
||||
end
|
||||
|
||||
private
|
||||
def authenticate_user!
|
||||
unless @project.manager?(current_user) || current_user.admin?
|
||||
return render_forbidden('你不是管理员,没有权限操作')
|
||||
end
|
||||
end
|
||||
|
||||
def authenticate_member!
|
||||
unless @project.member?(current_user) || current_user.admin?
|
||||
return render_forbidden('你不是成员,没有权限操作')
|
||||
end
|
||||
end
|
||||
|
||||
def theme_params
|
||||
params[:language_frame] || 'hugo'
|
||||
end
|
||||
|
||||
def create_params
|
||||
params.permit(:identifier, :language_frame, :theme, :site_name)
|
||||
end
|
||||
end
|
|
@ -1,43 +0,0 @@
|
|||
class Users::ClasController < Users::BaseController
|
||||
before_action :require_login
|
||||
before_action :private_user_resources!
|
||||
def index
|
||||
@user_clas = UserCla.where(user: current_user)
|
||||
end
|
||||
|
||||
def show
|
||||
@user_cla = current_user.user_clas.find params[:id]
|
||||
end
|
||||
|
||||
def create
|
||||
@user_cla = current_user.user_clas.find_by(cla_id: params[:cla_id])
|
||||
if @user_cla.nil?
|
||||
ActiveRecord::Base.transaction do
|
||||
Users::UserClaForm.new(user_cla_params).validate!
|
||||
@user_cla = UserCla.build(user_cla_params, current_user.id)
|
||||
|
||||
end
|
||||
elsif @user_cla.state == "failed"
|
||||
@user_cla.update_by_params(user_cla_params)
|
||||
elsif @user_cla.state == "signed"
|
||||
return render_error('协议生效中,请勿重复签署')
|
||||
end
|
||||
render_ok
|
||||
rescue Exception => e
|
||||
uid_logger_error(e.message)
|
||||
tip_exception(e.message)
|
||||
end
|
||||
|
||||
def destroy
|
||||
@user_cla = current_user.user_clas.find params[:id]
|
||||
@user_cla.update_attributes(state: 2)
|
||||
render_ok
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def user_cla_params
|
||||
params.permit(:email, :real_name, :cla_id)
|
||||
end
|
||||
|
||||
end
|
|
@ -6,7 +6,6 @@ class Users::ProjectTrendsController < Users::BaseController
|
|||
else
|
||||
@project_trends = observed_user.project_trends
|
||||
end
|
||||
@project_trends = @project_trends.left_joins(:project).where("projects.is_public = TRUE")
|
||||
@project_trends = kaminari_paginate(@project_trends.includes(:trend, :project).order(created_at: :desc))
|
||||
end
|
||||
end
|
|
@ -22,7 +22,7 @@ class UsersController < ApplicationController
|
|||
end
|
||||
|
||||
def list
|
||||
scope = User.active.like(params[:search]).includes(:user_extension).order(nickname: :desc, last_login_on: :desc)
|
||||
scope = User.active.recent.like(params[:search]).includes(:user_extension)
|
||||
@total_count = scope.size
|
||||
@users = paginate(scope)
|
||||
end
|
||||
|
@ -212,10 +212,6 @@ class UsersController < ApplicationController
|
|||
def update
|
||||
return render_not_found unless @user = User.find_by(login: params[:id]) || User.find_by_id(params[:id])
|
||||
return render_forbidden unless User.current.logged? && (current_user&.admin? || current_user.id == @user.id)
|
||||
if user_params[:nickname].present?
|
||||
keywords = user_params[:nickname].to_s.each_char.select { |c| c.bytes.first < 240 }.join('')
|
||||
return normal_status(-1, "昵称中包含关键词:#{keywords},请重新命名") if ReversedKeyword.check_exists?(keywords)
|
||||
end
|
||||
Util.write_file(@image, avatar_path(@user)) if user_params[:image].present?
|
||||
@user.attributes = user_params.except(:image)
|
||||
unless @user.save
|
||||
|
@ -763,11 +759,10 @@ class UsersController < ApplicationController
|
|||
password = "12345678"
|
||||
|
||||
# 没有用户时,新建用户并登录
|
||||
user = phone.present? ? User.find_by(phone: phone) : nil
|
||||
user = User.where("login = ? or phone = ? or mail = ? ", "#{login}", phone, email).first if user.nil?
|
||||
user = User.where("login = ? or phone = ? or mail = ? ", "#{login}", phone, email).first
|
||||
if user.present?
|
||||
# 手机号先记录,后续用
|
||||
user.update_column(:phone, "#{phone}") if phone.present? && user.phone.blank?
|
||||
user.update_column(:phone, "#{phone}") if phone.present?
|
||||
else
|
||||
ActiveRecord::Base.transaction do
|
||||
email = "#{login}@gitlink.org.cn" if email.blank?
|
||||
|
|
|
@ -152,12 +152,11 @@ class VersionReleasesController < ApplicationController
|
|||
|
||||
def create_attachments(attachment_ids, target)
|
||||
attachment_ids.each do |id|
|
||||
attachment = Attachment.where_id_or_uuid(id).select(:id, :container_id, :container_type)&.first
|
||||
attachment = Attachment.select(:id, :container_id, :container_type)&.find_by_id(id)
|
||||
unless attachment.blank?
|
||||
attachment.container = target
|
||||
attachment.author_id = current_user.id
|
||||
attachment.description = ""
|
||||
attachment.uuid = SecureRandom.uuid
|
||||
attachment.save
|
||||
end
|
||||
end
|
||||
|
|
|
@ -58,6 +58,7 @@ class BaseForm
|
|||
def check_verifi_code(verifi_code, code)
|
||||
code = strip(code)
|
||||
return if code == "123123" && EduSetting.get("code_debug") # 万能验证码,用于测试 # TODO 万能验证码,用于测试
|
||||
return if EduSetting.get("is_local") == "true" || Rails.application.config_for(:configuration)['is_local'].to_s =="true" # 本地版不需要验证码
|
||||
raise VerifiCodeError, "验证码已失效" if !verifi_code&.effective?
|
||||
raise VerifiCodeError, "验证码不正确" if verifi_code&.code != code
|
||||
end
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
class Organizations::CreateClaForm < BaseForm
|
||||
KEY_REGEX = /^(?!_)(?!.*?_$)[a-zA-Z0-9_-]+$/ #只含有数字、字母、下划线不能以下划线开头和结尾
|
||||
attr_accessor :name, :key, :content, :pr_need
|
||||
validates :name , :key, presence: true
|
||||
validates :key, format: { with: KEY_REGEX, multiline: true, message: "只能含有数字、字母、下划线且不能以下划线开头和结尾" }
|
||||
end
|
|
@ -1,12 +1,12 @@
|
|||
class Organizations::CreateForm < BaseForm
|
||||
NAME_REGEX = /^[a-zA-Z0-9]+([-_.][a-zA-Z0-9]+)*$/ #只含有数字、字母、下划线不能以下划线开头和结尾
|
||||
NAME_REGEX = /^(?!_)(?!.*?_$)[a-zA-Z0-9_-]+$/ #只含有数字、字母、下划线不能以下划线开头和结尾
|
||||
attr_accessor :name, :description, :website, :location, :repo_admin_change_team_access, :visibility, :max_repo_creation, :nickname, :original_name
|
||||
|
||||
validates :name, :nickname, :visibility, presence: true
|
||||
validates :name, :nickname, length: { maximum: 100 }
|
||||
validates :location, length: { maximum: 50 }
|
||||
validates :description, length: { maximum: 200 }
|
||||
validates :name, format: { with: NAME_REGEX, multiline: true, message: "只能以数字或字母开头,仅支持横杠、下划线、点三种符号,不允许符号连续排列,长度4-50个字符" }
|
||||
validates :name, format: { with: NAME_REGEX, multiline: true, message: "只能含有数字、字母、下划线且不能以下划线开头和结尾" }
|
||||
|
||||
validate do
|
||||
check_name(name) unless name.blank? || name == original_name
|
||||
|
|
|
@ -28,10 +28,6 @@ class Projects::CreateForm < BaseForm
|
|||
raise "ignore_id值无效." if ignore_id && Ignore.find_by(id: ignore_id).blank?
|
||||
end
|
||||
|
||||
def check_auto_init
|
||||
raise "auto_init值无效." if ignore_id && license_id && !auto_init
|
||||
end
|
||||
|
||||
def check_owner
|
||||
@project_owner = Owner.find_by(id: user_id)
|
||||
raise "user_id值无效." if user_id && @project_owner.blank?
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class Projects::MigrateForm < BaseForm
|
||||
attr_accessor :user_id, :name, :repository_name, :project_category_id, :description, :auth_token,
|
||||
attr_accessor :user_id, :name, :repository_name, :project_category_id, :description,
|
||||
:project_language_id, :clone_addr, :private, :is_mirror, :auth_username, :auth_password, :owner
|
||||
|
||||
validates :user_id, :name, :repository_name, :clone_addr, presence: true
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
module Register
|
||||
class RemoteForm < Register::BaseForm
|
||||
# login 登陆方式,支持邮箱、登陆、手机号等
|
||||
attr_accessor :username, :email, :password, :platform, :user_id
|
||||
attr_accessor :username, :email, :password, :platform
|
||||
|
||||
validates :username, :email, :password, presence: true
|
||||
validate :check!
|
||||
|
||||
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}"
|
||||
check_login(username, user)
|
||||
check_mail(email,user)
|
||||
Rails.logger.info "Register::RemoteForm params: username: #{username}; email: #{email}; password: #{password}; platform: #{platform}"
|
||||
check_login(username)
|
||||
check_mail(email)
|
||||
check_password(password)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
class Users::UserClaForm
|
||||
include ActiveModel::Model
|
||||
attr_accessor :email, :real_name, :cla_id
|
||||
validates :email, presence: true, format: { with: CustomRegexp::EMAIL }
|
||||
end
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
module Admins::GlccPrCheckHelper
|
||||
end
|
|
@ -1,2 +0,0 @@
|
|||
module Admins::IdentityVerificationsHelper
|
||||
end
|
|
@ -1,2 +0,0 @@
|
|||
module Admins::PageThemesHelper
|
||||
end
|
|
@ -1,2 +0,0 @@
|
|||
module Admins::SitePagesHelper
|
||||
end
|
|
@ -299,7 +299,7 @@ module ApplicationHelper
|
|||
end
|
||||
|
||||
def download_url attachment,options={}
|
||||
attachment&.uuid.present? ? attachment_path(attachment.uuid,options) : attachment_path(attachment,options)
|
||||
attachment_path(attachment,options)
|
||||
end
|
||||
|
||||
# 耗时:天、小时、分、秒
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
module IdentityVerificationsHelper
|
||||
end
|
|
@ -1,2 +0,0 @@
|
|||
module Organizations::ClasHelper
|
||||
end
|
|
@ -1,2 +0,0 @@
|
|||
module PagesHelper
|
||||
end
|
|
@ -16,11 +16,7 @@ module RepositoriesHelper
|
|||
|
||||
def image_type?(str)
|
||||
default_type = %w(png jpg gif tif psd svg bmp webp jpeg ico psd)
|
||||
default_type.include?(str.to_s.gsub("\r", "").downcase)
|
||||
end
|
||||
|
||||
def is_text_file?(entry)
|
||||
entry['is_text_file']
|
||||
default_type.include?(str&.downcase)
|
||||
end
|
||||
|
||||
def is_readme?(type, str)
|
||||
|
@ -40,26 +36,18 @@ module RepositoriesHelper
|
|||
end
|
||||
|
||||
def render_cache_commit_author(author_json)
|
||||
user = nil
|
||||
if author_json["name"].present? && author_json["email"].present?
|
||||
user = find_user_in_redis_cache(author_json['name'], author_json['email'])
|
||||
return find_user_in_redis_cache(author_json['name'], author_json['email'])
|
||||
end
|
||||
if author_json["Name"].present? && author_json["Email"].present?
|
||||
user = find_user_in_redis_cache(author_json['Name'], author_json['Email'])
|
||||
return find_user_in_redis_cache(author_json['Name'], author_json['Email'])
|
||||
end
|
||||
if user.blank? && author_json["email"].present?
|
||||
user = User.find_by(mail: author_json["email"])
|
||||
end
|
||||
if user.blank? && author_json["Email"].present?
|
||||
user = User.find_by(mail: author_json["Email"])
|
||||
end
|
||||
user
|
||||
end
|
||||
|
||||
def readme_render_decode64_content(str, owner, repo, ref, path)
|
||||
return nil if str.blank?
|
||||
begin
|
||||
content = Base64.decode64(content).force_encoding('UTF-8').valid_encoding? ? Base64.decode64(str).force_encoding('UTF-8') : Base64.decode64(str).force_encoding("GBK").encode("UTF-8")
|
||||
content = Base64.decode64(str).force_encoding('UTF-8')
|
||||
|
||||
c_regex = /\!\[.*?\]\((.*?)\)/
|
||||
src_regex = /src=\"(.*?)\"/
|
||||
|
@ -119,34 +107,19 @@ module RepositoriesHelper
|
|||
def new_readme_render_decode64_content(str, owner, repo, ref, readme_path, readme_name)
|
||||
file_path = readme_path.include?('/') ? readme_path.gsub("/#{readme_name}", '') : readme_path.gsub("#{readme_name}", '')
|
||||
return nil if str.blank?
|
||||
content = Base64.decode64(str).force_encoding('UTF-8').valid_encoding? ? Base64.decode64(str).force_encoding('UTF-8') : Base64.decode64(str).force_encoding("GBK").encode("UTF-8")
|
||||
content = Base64.decode64(str).force_encoding('UTF-8')
|
||||
# s_regex = /\s\!\[.*?\]\((.*?)\)\s/
|
||||
s_regex_c = /`{1,2}[^`](.*?)`{1,2}/
|
||||
s_regex = /```([\s\S]*?)```[\s]?/
|
||||
s_regex_1 = /\[.*?\]\((.*?)\)/
|
||||
# 变量图片相对路径
|
||||
s_regex_2 = /\[.*?\]:(.*?)\n/
|
||||
src_regex = /src=\"(.*?)\"/
|
||||
src_regex_1 = /src=\'(.*?)\'/
|
||||
src_regex_2 = /src = (.*?) /
|
||||
src_regex_3 = /src= (.*?) /
|
||||
src_regex_4 = /src =(.*?) /
|
||||
src_regex_5 = /src =(.*?) /
|
||||
href_regex = /href=\"(.*?)\"/
|
||||
href_regex_1 = /href=\'(.*?)\'/
|
||||
ss_c = content.to_s.scan(s_regex_c)
|
||||
ss = content.to_s.scan(s_regex)
|
||||
ss_1 = content.to_s.scan(s_regex_1)
|
||||
ss_2 = content.to_s.scan(s_regex_2)
|
||||
ss_src = content.to_s.scan(src_regex)
|
||||
ss_src_1 = content.to_s.scan(src_regex_1)
|
||||
ss_src_2 = content.to_s.scan(src_regex_2)
|
||||
ss_src_3 = content.to_s.scan(src_regex_3)
|
||||
ss_src_4 = content.to_s.scan(src_regex_4)
|
||||
ss_src_5 = content.to_s.scan(src_regex_5)
|
||||
ss_href = content.to_s.scan(href_regex)
|
||||
ss_href_1 = content.to_s.scan(href_regex_1)
|
||||
total_sources = {ss_c: ss_c,ss: ss, ss_1: ss_1, ss_2: ss_2, ss_src: ss_src, ss_src_1: ss_src_1, ss_src_2: ss_src_2, ss_src_3: ss_src_3, ss_src_4: ss_src_4, ss_src_5: ss_src_5, ss_href: ss_href, ss_href_1: ss_href_1}
|
||||
total_sources = {ss_c: ss_c,ss: ss, ss_1: ss_1, ss_src: ss_src, ss_src_1: ss_src_1}
|
||||
# total_sources.uniq!
|
||||
total_sources.except(:ss, :ss_c).each do |k, sources|
|
||||
sources.each do |s|
|
||||
|
@ -155,50 +128,28 @@ module RepositoriesHelper
|
|||
# 链接直接跳过不做替换
|
||||
next if s_content.starts_with?('http://') || s_content.starts_with?('https://') || s_content.starts_with?('mailto:') || s_content.blank?
|
||||
ext = File.extname(s_content)[1..-1]
|
||||
ext = ext.split("?")[0] if ext.include?("?")
|
||||
if (image_type?(ext) || download_type(ext)) && !ext.blank?
|
||||
s_content = File.expand_path(s_content, file_path)
|
||||
s_content = s_content.split("#{Rails.root}/")[1]
|
||||
# content = content.gsub(s[0], "/#{s_content}")
|
||||
join_xxx = s_content.include?("?") ? "&" : "?"
|
||||
s_content = [base_url, "/api/#{owner&.login}/#{repo.identifier}/raw/#{s_content}#{join_xxx}ref=#{ref}"].join
|
||||
case k.to_s
|
||||
s_content = [base_url, "/api/#{owner&.login}/#{repo.identifier}/raw/#{s_content}?ref=#{ref}"].join
|
||||
case k.to_s
|
||||
when 'ss_src'
|
||||
content = content.gsub("src=\"#{s[0]}\"", "src=\"#{s_content}\"")
|
||||
when 'ss_src_1'
|
||||
content = content.gsub("src=\'#{s[0]}\'", "src=\'#{s_content}\'")
|
||||
when 'ss_src_2'
|
||||
content = content.gsub("src = #{s[0]}", "src=\'#{s_content}\'")
|
||||
when 'ss_src_3'
|
||||
content = content.gsub("src= #{s[0]}", "src=\'#{s_content}\'")
|
||||
when 'ss_src_4'
|
||||
content = content.gsub("src =#{s[0]}", "src=\'#{s_content}\'")
|
||||
when 'ss_src_5'
|
||||
content = content.gsub("src=#{s[0]}", "src=\'#{s_content}\'")
|
||||
when 'ss_2'
|
||||
content = content.gsub(/]:#{s[0]}/, "]: #{s_content.to_s.gsub(" ","").gsub("\r", "")}")
|
||||
when 'ss_href'
|
||||
content = content.gsub("href=\"#{s[0]}\"", "href=\"#{s_content}\"")
|
||||
when 'ss_href_1'
|
||||
content = content.gsub("href=\'#{s[0]}\'", "href=\'#{s_content}\'")
|
||||
else
|
||||
content = content.gsub("(#{s[0]})", "(#{s_content})")
|
||||
end
|
||||
else
|
||||
path = [owner&.login, repo&.identifier, 'tree', ref, file_path].join("/")
|
||||
s_content = File.expand_path(s_content, path)
|
||||
s_content = s_content.split("#{Rails.root}")[1]
|
||||
s_content = s_content.split("#{Rails.root}/")[1]
|
||||
case k.to_s
|
||||
when 'ss_src'
|
||||
content = content.gsub("src=\"#{s[0]}\"", "src=\"/#{s_content}\"")
|
||||
when 'ss_src_1'
|
||||
content = content.gsub("src=\'#{s[0]}\'", "src=\'/#{s_content}\'")
|
||||
when 'ss_2'
|
||||
content = content.gsub(/]:#{s[0]}/, "]: /#{s_content.to_s.gsub(" ","").gsub("\r", "")}")
|
||||
when 'ss_href'
|
||||
content = content.gsub("href=\"#{s[0]}\"", "href=\"#{s_content}\"")
|
||||
when 'ss_href_1'
|
||||
content = content.gsub("href=\'#{s[0]}\'", "href=\'#{s_content}\'")
|
||||
else
|
||||
content = content.gsub("(#{s[0]})", "(/#{s_content})")
|
||||
end
|
||||
|
@ -217,10 +168,9 @@ module RepositoriesHelper
|
|||
after_ss_c_souces.each_with_index do |s, index|
|
||||
content = content.gsub("#{s[0]}","#{total_sources[:ss_c][index][0]}")
|
||||
end
|
||||
|
||||
return content
|
||||
rescue Exception => e
|
||||
Rails.logger.error("===================#{readme_path}:#{readme_name}:error:#{e}")
|
||||
# e.backtrace.each { |msg| Rails.logger.error(msg) }
|
||||
rescue
|
||||
return str
|
||||
end
|
||||
|
||||
|
@ -236,7 +186,8 @@ module RepositoriesHelper
|
|||
|
||||
def readme_decode64_content(entry, owner, repo, ref, path=nil)
|
||||
Rails.logger.info("entry===#{entry["type"]} #{entry["name"]}")
|
||||
content = entry['content'].present? ? entry['content'] : Gitea::Repository::Entries::GetService.call(owner, repo.identifier, URI.escape(entry['path']), ref: ref)['content']
|
||||
content = Gitea::Repository::Entries::GetService.call(owner, repo.identifier, URI.escape(entry['path']), ref: ref)['content']
|
||||
# Rails.logger.info("content===#{content}")
|
||||
# readme_render_decode64_content(content, owner, repo, ref)
|
||||
new_readme_render_decode64_content(content, owner, repo, ref, entry['path'], entry['name'])
|
||||
end
|
||||
|
@ -244,12 +195,10 @@ module RepositoriesHelper
|
|||
def decode64_content(entry, owner, repo, ref, path=nil)
|
||||
if is_readme?(entry['type'], entry['name'])
|
||||
Rails.logger.info("entry===#{entry["type"]} #{entry["name"]}")
|
||||
content = entry['content'].present? ? entry['content'] : Gitea::Repository::Entries::GetService.call(owner, repo.identifier, URI.escape(entry['path']), ref: ref)['content']
|
||||
content = Gitea::Repository::Entries::GetService.call(owner, repo.identifier, URI.escape(entry['path']), ref: ref)['content']
|
||||
# Rails.logger.info("content===#{content}")
|
||||
return Base64.decode64(content).force_encoding("GBK").encode("UTF-8") unless Base64.decode64(content).force_encoding('UTF-8').valid_encoding?
|
||||
# readme_render_decode64_content(content, owner, repo, ref)
|
||||
return Base64.decode64(content).force_encoding('UTF-8')
|
||||
elsif entry['is_text_file'] == true
|
||||
return render_decode64_content(entry['content'])
|
||||
else
|
||||
file_type = File.extname(entry['name'].to_s)[1..-1]
|
||||
if image_type?(file_type)
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
module Users::ClasHelper
|
||||
end
|
|
@ -42,10 +42,6 @@ module Gitea
|
|||
def render_result(response)
|
||||
if response.status == 200
|
||||
@result = JSON.parse(response.body)
|
||||
else
|
||||
Rails.logger.error("Gitea::Repository::Entries::DeleteService error[#{response.status}]======#{response.body}")
|
||||
@error = "删除失败,请确认该分支是否是保护分支。"
|
||||
@error = "删除失败,参数sha不匹配。" if response.body.to_s.include?("sha does not match")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -42,9 +42,6 @@ module Gitea
|
|||
def render_result(response)
|
||||
if response.status == 200
|
||||
@result = JSON.parse(response.body)
|
||||
else
|
||||
Rails.logger.error("Gitea::Repository::Entries::UpdateService error[#{response.status}]======#{response.body}")
|
||||
@error = "更新失败,请确认该分支是否是保护分支。"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
# 按天获取百度统计数据,pv,访问,ip和来源分类占比
|
||||
# 其他统计:前一周用户留存率
|
||||
class DailyPlatformStatisticsJob < ApplicationJob
|
||||
queue_as :default
|
||||
|
||||
def perform(*args)
|
||||
Rails.logger.info("*********开始统计*********")
|
||||
|
||||
tongji_service = Baidu::TongjiService.new
|
||||
access_token = tongji_service.access_token
|
||||
Rails.logger.info "job baidu_tongji_auth access_token ===== #{access_token}"
|
||||
ActiveJob::Base.logger.info "job baidu_tongji_auth access_token ===== #{access_token}"
|
||||
# 从最后一个记录日期开始,如果遗漏日期数据可以补充数据
|
||||
last_date = DailyPlatformStatistic.order(:date).last
|
||||
start_date = last_date.date
|
||||
end_date = Time.now
|
||||
if access_token.present?
|
||||
tongji_service.overview_batch_add(start_date, end_date)
|
||||
|
||||
# 本周访问来源占比,每天记录一次,如果遗漏日期数据可以补充数据
|
||||
tongji_service.source_from_batch_add(start_date, end_date)
|
||||
end
|
||||
# 周用户留存率
|
||||
pre_week_user_ids = User.where(created_on: pre_week).pluck(:id).uniq
|
||||
weekly_keep_user_count = User.where(id: pre_week_user_ids).where(last_login_on: current_week).count
|
||||
weekly_keep_rate = format("%.2f", pre_week_user_ids.size > 0 ? weekly_keep_user_count.to_f / pre_week_user_ids.size : 0)
|
||||
|
||||
job_date = 1.days.ago
|
||||
daily_statistic = DailyPlatformStatistic.find_or_initialize_by(date: job_date)
|
||||
daily_statistic.weekly_keep_rate = weekly_keep_rate
|
||||
daily_statistic.save
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def current_week
|
||||
Time.now.beginning_of_week..Time.now.end_of_day
|
||||
end
|
||||
|
||||
def pre_week
|
||||
# 7.days.ago.beginning_of_week..7.days.ago.beginning_of_week.end_of_week
|
||||
Time.now.prev_week..Time.now.prev_week.end_of_week
|
||||
end
|
||||
end
|
|
@ -1,35 +0,0 @@
|
|||
class DailyProjectStatisticsJob < ApplicationJob
|
||||
queue_as :cache
|
||||
|
||||
def perform
|
||||
date = (Date.today - 1.days).to_s
|
||||
daily_data_keys = $redis_cache.keys("v2-project-statistic:*-#{date}")
|
||||
daily_data_keys.each do |key|
|
||||
result = $redis_cache.hgetall(key)
|
||||
project_id = key.gsub('v2-project-statistic:', '').gsub("-#{date}", '')
|
||||
next unless Project.find_by_id(project_id).present?
|
||||
visits = result["visits"].to_i
|
||||
watchers = result["watchers"].to_i
|
||||
praises = result["praises"].to_i
|
||||
forks = result["forks"].to_i
|
||||
issues = result["issues"].to_i
|
||||
closed_issues = result["closed_issues"].to_i
|
||||
pullrequests = result["pullrequests"].to_i
|
||||
commits = result["commits"].to_i
|
||||
score = visits *1 + watchers *5 + praises * 5 + forks * 10 + issues *5 + pullrequests * 10 + commits * 5
|
||||
DailyProjectStatistic.create!(
|
||||
project_id: project_id,
|
||||
date: date,
|
||||
score: score ,
|
||||
visits: visits,
|
||||
watchers: watchers,
|
||||
praises: praises,
|
||||
forks: forks,
|
||||
issues: issues,
|
||||
closed_issues: closed_issues,
|
||||
pullrequests: pullrequests,
|
||||
commits: commits
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,16 +0,0 @@
|
|||
class DelayExpiredIssueAndMilestoneJob < ApplicationJob
|
||||
queue_as :message
|
||||
|
||||
def perform
|
||||
Issue.where(due_date: Date.today + 1.days).find_each do |issue|
|
||||
SendTemplateMessageJob.perform_later('IssueExpire', issue.id) if Site.has_notice_menu?
|
||||
end
|
||||
Version.where(effective_date: Date.today + 1.days).find_each do |version|
|
||||
SendTemplateMessageJob.perform_later('ProjectMilestoneEarlyExpired', version.id) if Site.has_notice_menu?
|
||||
end
|
||||
Version.where(effective_date: Date.today - 1.days).find_each do |version|
|
||||
SendTemplateMessageJob.perform_later('ProjectMilestoneExpired', version.id) if Site.has_notice_menu?
|
||||
end
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,10 @@
|
|||
class DelayExpiredIssueJob < ApplicationJob
|
||||
queue_as :message
|
||||
|
||||
def perform
|
||||
Issue.where(due_date: Date.today + 1.days).find_each do |issue|
|
||||
SendTemplateMessageJob.perform_later('IssueExpire', issue.id) if Site.has_notice_menu?
|
||||
end
|
||||
end
|
||||
|
||||
end
|
|
@ -15,13 +15,11 @@ class MigrateRemoteRepositoryJob < ApplicationJob
|
|||
## open jianmu devops
|
||||
project_id = repo&.project&.id
|
||||
puts "############ mirror project_id,user_id: #{project_id},#{user_id} ############"
|
||||
OpenProjectDevOpsJob.set(wait: 5.seconds).perform_later(project_id, user_id) if project_id.present? && user_id.present?
|
||||
UpdateProjectTopicJob.set(wait: 1.seconds).perform_later(project_id) if project_id.present?
|
||||
# OpenProjectDevOpsJob.set(wait: 5.seconds).perform_later(project_id, user_id) if project_id.present? && user_id.present?
|
||||
puts "############ mirror status: #{repo.mirror.status} ############"
|
||||
else
|
||||
repo&.mirror&.failed!
|
||||
end
|
||||
# UpdateProjectTopicJob 中语言要延迟1S才能获取
|
||||
BroadcastMirrorRepoMsgJob.set(wait: 1.seconds).perform_later(repo.id) unless repo&.mirror.waiting?
|
||||
BroadcastMirrorRepoMsgJob.perform_later(repo.id) unless repo&.mirror.waiting?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -8,7 +8,7 @@ class SendTemplateMessageJob < ApplicationJob
|
|||
receivers_id, template_id, props = args[0], args[1], args[2]
|
||||
template = MessageTemplate.find_by_id(template_id)
|
||||
return unless template.present?
|
||||
receivers = User.where("id in(?)", receivers_id).or(User.where(mail: receivers_id))
|
||||
receivers = User.where(id: receivers_id).or(User.where(mail: receivers_id))
|
||||
not_exists_receivers = receivers_id - receivers.pluck(:id) - receivers.pluck(:mail)
|
||||
receivers_string, content, notification_url = MessageTemplate::CustomTip.get_message_content(receivers, template, props)
|
||||
Notice::Write::CreateService.call(receivers_string, content, notification_url, source, {receivers_id: receivers_id, template_id: template_id, props: props})
|
||||
|
@ -221,20 +221,6 @@ class SendTemplateMessageJob < ApplicationJob
|
|||
receivers_email_string, email_title, email_content = MessageTemplate::ProjectMilestone.get_email_message_content(receiver, operator, milestone)
|
||||
Notice::Write::EmailCreateService.call(receivers_email_string, email_title, email_content)
|
||||
end
|
||||
when 'ProjectMilestoneExpired'
|
||||
milestone_id = args[0]
|
||||
milestone = Version.find_by_id(milestone_id)
|
||||
return unless milestone.present? && milestone&.project.present?
|
||||
receivers = User.where(id: milestone.user_id)
|
||||
receivers_string, content, notification_url = MessageTemplate::ProjectMilestoneExpired.get_message_content(receivers, milestone)
|
||||
Notice::Write::CreateService.call(receivers_string, content, notification_url, source, {milestone_id: milestone_id, operator_id: operator_id})
|
||||
when 'ProjectMilestoneEarlyExpired'
|
||||
milestone_id = args[0]
|
||||
milestone = Version.find_by_id(milestone_id)
|
||||
return unless milestone.present? && milestone&.project.present?
|
||||
receivers = User.where(id: milestone.user_id)
|
||||
receivers_string, content, notification_url = MessageTemplate::ProjectMilestoneEarlyExpired.get_message_content(receivers, milestone)
|
||||
Notice::Write::CreateService.call(receivers_string, content, notification_url, source, {milestone_id: milestone_id, operator_id: operator_id})
|
||||
when 'ProjectPraised'
|
||||
operator_id, project_id = args[0], args[1]
|
||||
operator = User.find_by_id(operator_id)
|
||||
|
|
|
@ -3,9 +3,9 @@ class SyncRepoUpdateTimeJob < ApplicationJob
|
|||
|
||||
def perform(*args)
|
||||
# Do something later
|
||||
# Project.forge.find_each do |project|
|
||||
# update_repo_time!(project)
|
||||
# end
|
||||
Project.forge.find_each do |project|
|
||||
update_repo_time!(project)
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -49,9 +49,9 @@ class TouchWebhookJob < ApplicationJob
|
|||
when 'IssueComment'
|
||||
issue_id, sender_id, comment_id, action_type, comment_json = args[0], args[1], args[2], args[3], args[4]
|
||||
issue = Issue.find_by_id issue_id
|
||||
sender = User.find_by_id sender_id
|
||||
return if issue.nil? || sender.nil?
|
||||
comment = issue.comment_journals.find_by_id comment_id
|
||||
sender = User.find_by_id sender_id
|
||||
return if issue.nil? || sender.nil?
|
||||
return if action_type == 'edited' && comment_json.blank?
|
||||
|
||||
issue.project.webhooks.each do |webhook|
|
||||
|
@ -63,10 +63,10 @@ class TouchWebhookJob < ApplicationJob
|
|||
when 'PullRequestComment'
|
||||
issue_id, sender_id, comment_id, action_type, comment_json = args[0], args[1], args[2], args[3], args[4]
|
||||
issue = Issue.find_by_id(issue_id)
|
||||
comment = issue.comment_journals.find_by_id comment_id
|
||||
sender = User.find_by_id sender_id
|
||||
pull = issue.try(:pull_request)
|
||||
return if issue.nil? || pull.nil? || sender.nil?
|
||||
comment = issue.comment_journals.find_by_id comment_id
|
||||
return if pull.nil? || sender.nil?
|
||||
return if action_type == 'edited' && comment_json.blank?
|
||||
|
||||
pull.project.webhooks.each do |webhook|
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
class UpdateProjectTopicJob < ApplicationJob
|
||||
include ProjectsHelper
|
||||
|
||||
queue_as :message
|
||||
|
||||
def perform(project_id)
|
||||
project = Project.find_by(id: project_id)
|
||||
return if project.blank?
|
||||
begin
|
||||
languages = $gitea_client.get_repos_languages_by_owner_repo(project.owner.login, project.identifier)
|
||||
puts "#{project.owner.login}/#{project.identifier} get_repos_languages:#{languages}"
|
||||
topic_count = 0
|
||||
if project.project_category_id.present?
|
||||
project_topic = ProjectTopic.find_or_create_by!(name: project.project_category.name.downcase)
|
||||
project_topic_ralate = project_topic.project_topic_ralates.find_or_create_by!(project_id: project.id)
|
||||
if project_topic.present? && project_topic_ralate.present?
|
||||
topic_count +=1
|
||||
end
|
||||
end
|
||||
languages.each do |k, _|
|
||||
next if topic_count >= 3
|
||||
project_topic = ProjectTopic.find_or_create_by!(name: k.downcase)
|
||||
project_topic_ralate = project_topic.project_topic_ralates.find_or_create_by!(project_id: project.id)
|
||||
if project_topic.present? && project_topic_ralate.present?
|
||||
topic_count +=1
|
||||
end
|
||||
end
|
||||
rescue => e
|
||||
puts "get_repos_languages: error:#{e.message}"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
|
@ -1,20 +0,0 @@
|
|||
module Getway
|
||||
class << self
|
||||
def getway_config
|
||||
getway_config = {}
|
||||
|
||||
begin
|
||||
config = Rails.application.config_for(:configuration).symbolize_keys!
|
||||
getway_config = config[:getway].symbolize_keys!
|
||||
raise 'getway config missing' if getway_config.blank?
|
||||
rescue => ex
|
||||
raise ex if Rails.env.production?
|
||||
|
||||
puts %Q{\033[33m [warning] getway config or configuration.yml missing,
|
||||
please add it or execute 'cp config/configuration.yml.example config/configuration.yml' \033[0m}
|
||||
getway_config = {}
|
||||
end
|
||||
getway_config
|
||||
end
|
||||
end
|
||||
end
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue