Merge branches 'dev_aliyun', 'dev_jupyter' and 'dev_new_shixunsrepository' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_new_shixunsrepository

dev_new_shixunsrepository
杨树明 5 years ago
commit db8b3a9698

@ -106,3 +106,6 @@ gem 'omniauth-oauth2', '~> 1.6.0'
# global var
gem 'request_store'
# 敏感词汇
gem 'harmonious_dictionary', '~> 0.0.1'

@ -53,13 +53,15 @@ module GitHelper
end
# 添加目录
def git_add_folder(folder_path, author_name, author_email, message)
GitService.add_tree(file_path: folder_path, message: message, author_name: author_name, author_email: author_email)
def git_add_folder(repo_path, folder_path, author_name, author_email, message)
GitService.add_tree(repo_path: repo_path, file_path: folder_path, message: message, author_name: author_name,
author_email: author_email)
end
# 删除文件
def git_delete_file(file_path, author_name, author_email, message)
GitService.delete_file(file_path: file_path, message: message, author_name: author_name, author_email: author_email)
def git_delete_file(repo_path, file_path, author_name, author_email, message)
GitService.delete_file(repo_path, repo_path, file_path: file_path, message: message, author_name: author_name,
author_email: author_email)
end
# 版本库Fork功能

@ -85,7 +85,7 @@ class DiscussesController < ApplicationController
:hidden => !current_user.admin?) # 管理员回复的能够显示
rescue Exception => e
uid_logger_error("create discuss failed : #{e.message}")
raise Educoder::TipException.new("评论异常")
raise Educoder::TipException.new("评论异常,原因:#{e.message}")
end
end
@ -97,7 +97,7 @@ class DiscussesController < ApplicationController
:dis_type => @discuss.dis_type, :position => @discuss.position)
rescue Exception => e
uid_logger_error("reply discuss failed : #{e.message}")
raise Educoder::TipException.new("回复评论异常")
raise Educoder::TipException.new("回复评论异常,原因: #{e.message}")
end
end

@ -16,7 +16,7 @@ class ShixunsController < ApplicationController
:propaedeutics, :departments, :apply_shixun_mirror, :jupyter_exec,
:get_mirror_script, :download_file, :shixun_list, :batch_send_to_course]
before_action :find_repo_name, only: [:repository, :commits, :file_content, :update_file, :shixun_exec, :copy,
:add_file, :jupyter_exec]
:add_file, :jupyter_exec, :upload_git_file, :delete_git_file, :upload_git_folder]
before_action :allowed, only: [:update, :close, :update_propaedeutics, :settings, :publish, :apply_public, :upload_git_folder,
:shixun_members_added, :change_manager, :collaborators_delete, :upload_git_file,
@ -905,7 +905,7 @@ class ShixunsController < ApplicationController
author_name = current_user.real_name
author_email = current_user.git_mail
message = params[:message] || "upload folder by browser"
git_add_folder(@path, author_name, author_email, message)
git_add_folder(@repo_path, @path, author_name, author_email, message)
render_ok
end
@ -913,7 +913,7 @@ class ShixunsController < ApplicationController
author_name = current_user.real_name
author_email = current_user.git_mail
message = params[:message] || "delete file by browser"
git_delete_file(@path, author_name, author_email, message)
git_delete_file(@repo_path, @path, author_name, author_email, message)
render_ok
end
@ -1095,9 +1095,8 @@ private
@repo_path = if params[:secret_repository]
@shixun.shixun_secret_repository&.repo_path
else
@shixun.try(:repo_path)
@shixun.repo_path
end
logger.info("######{@repo_path}")
@path = params[:path]
end

@ -81,6 +81,8 @@ class Course < ApplicationRecord
# 老版的members弃用 现用course_members
has_many :members
validate :validate_sensitive_string
scope :hidden, ->(is_hidden = true) { where(is_hidden: is_hidden) }
scope :ended, ->(is_end = true) { where(is_end: is_end) }
scope :processing, -> { where(is_end: false) }
@ -435,4 +437,8 @@ class Course < ApplicationRecord
self.laboratory = Laboratory.current if laboratory_id.blank?
end
def validate_sensitive_string
raise("课堂名称包含敏感词汇,请重新输入") unless HarmoniousDictionary.clean?(name)
end
end

@ -6,4 +6,10 @@ class CourseList < ApplicationRecord
has_many :gtask_banks
has_many :gtopic_banks
belongs_to :user
validate :validate_sensitive_string
def validate_sensitive_string
raise("课程名称包含敏感词汇,请重新输入") unless HarmoniousDictionary.clean?(name)
end
end

@ -11,6 +11,8 @@ class Discuss < ApplicationRecord
belongs_to :dis, polymorphic: true
belongs_to :challenge, optional: true
validate :validate_sensitive_string
after_create :send_tiding
scope :children, -> (discuss_id){ where(parent_id: discuss_id).includes(:user).reorder(created_at: :asc) }
@ -69,4 +71,8 @@ class Discuss < ApplicationRecord
}
tidings.create!(base_attrs.merge(user_id: send_user_id))
end
def validate_sensitive_string
raise("内容包含敏感词汇,请重新输入") unless HarmoniousDictionary.clean?(content)
end
end

@ -16,6 +16,7 @@ class Memo < ApplicationRecord
has_many :children, foreign_key: :parent_id, class_name: 'Memo'
has_many :attachments, as: :container, dependent: :destroy
has_many :tidings, as: :container, dependent: :destroy
validate :validate_sensitive_string
scope :field_for_list, lambda{
select([:id, :subject, :author_id, :sticky, :updated_at, :language, :reward, :all_replies_count, :viewed_count, :forum_id])
@ -54,4 +55,9 @@ class Memo < ApplicationRecord
self.tidings << Tiding.new(tiding_attr)
end
def validate_sensitive_string
raise("标题包含敏感词汇,请重新输入") unless HarmoniousDictionary.clean?(subject)
raise("内容包含敏感词汇,请重新输入") unless HarmoniousDictionary.clean?(content)
end
end

@ -178,13 +178,8 @@ class User < ApplicationRecord
validates_uniqueness_of :phone, :if => Proc.new { |user| user.phone_changed? && user.phone.present? }, case_sensitive: false
validates_length_of :login, maximum: LOGIN_LENGTH_LIMIT
validates_length_of :mail, maximum: MAIL_LENGTH_LMIT
# validates_format_of :mail, with: VALID_EMAIL_REGEX, multiline: true
# validates_format_of :phone, with: VALID_PHONE_REGEX, multiline: true
validate :validate_sensitive_string
validate :validate_password_length
#validate :validate_ID_number
#validates_format_of :ID_number, with: VALID_NUMBER_REGEX, multiline: true, message: "身份证号格式不对"
# validates :nickname, presence: true, length: { maximum: 10 }
# validates :lastname, presence: true
# 删除自动登录的token一旦退出下次会提示需要登录
def delete_autologin_token(value)
@ -727,6 +722,11 @@ class User < ApplicationRecord
end
end
def validate_sensitive_string
raise("真实姓名包含敏感词汇,请重新输入") unless HarmoniousDictionary.clean?(lastname)
raise("昵称包含敏感词汇,请重新输入") unless HarmoniousDictionary.clean?(nickname)
end
def set_laboratory
return unless new_record?

File diff suppressed because it is too large Load Diff

@ -0,0 +1,66 @@
6-4tianwang
89-64cdjp
ADMIN
Administrator
asshole
BLOWJOB
chinaliberal
chinamz
chinesenewsnet
Clockgemstone
creaders
Crestbone
dajiyuan
dfdz
DICK
falun
falundafa
Feelmistone
freechina
freenet
fuck
gcd
Gruepin
Guichuideng
HACKING
hongzhi
hrichina
HUANET
hypermart.net
incest
jiangdongriji
jiaochuang
jiaochun
KEFU
KISSMYASS
lihongzhi
minghui
minghuinews
nacb
Neckromancer
NMIS
PAPER64
penis
qiangjian
renminbao
renmingbao
SHIT
SUCKPENIS
taip
tibetalk
triangle
triangleboy
Tringel
UltraSurf
ustibet
voachinese
wangce
WEBZEN
wstaiji
xinsheng
YUMING
zangdu
ZHENGJIAN
ZHENGJIANWANG
ZHENSHANREN
zhuanfalun

@ -0,0 +1,67 @@
---
- 6-4tianwang
- 89-64cdjp
- ADMIN
- Administrator
- asshole
- BLOWJOB
- chinaliberal
- chinamz
- chinesenewsnet
- Clockgemstone
- creaders
- Crestbone
- dajiyuan
- dfdz
- DICK
- falun
- falundafa
- Feelmistone
- freechina
- freenet
- fuck
- gcd
- Gruepin
- Guichuideng
- HACKING
- hongzhi
- hrichina
- HUANET
- hypermart.net
- incest
- jiangdongriji
- jiaochuang
- jiaochun
- KEFU
- KISSMYASS
- lihongzhi
- minghui
- minghuinews
- nacb
- Neckromancer
- NMIS
- PAPER64
- penis
- qiangjian
- renminbao
- renmingbao
- SHIT
- SUCKPENIS
- taip
- tibetalk
- triangle
- triangleboy
- Tringel
- UltraSurf
- ustibet
- voachinese
- wangce
- WEBZEN
- wstaiji
- xinsheng
- YUMING
- zangdu
- ZHENGJIAN
- ZHENGJIANWANG
- ZHENSHANREN
-

@ -56,12 +56,17 @@
.ysltitbt{
float: left;
padding-top: 31px;
padding-top: 28px;
padding-left: 25px;
font-size: 21px;
color: #05101A;
color: #05101a;
text-align: left;
font-weight:bold;
font-weight: bold;
max-width: 805px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
display: inline-block;
}
.markdownysltext{
font-size: 14px;

@ -138,15 +138,26 @@
}
.shixunstartbutton33BD8C{
background: #33BD8C !important;
border: #33BD8C !important;
/* border: #33BD8C !important; */
cursor: inherit !important;
border: 1px solid #33BD8C !important;
background: transparent !important;
color: #33BD8C !important;
box-shadow: none;
text-shadow: none;
}
.shixunstartbuttonFF6601{
background: #FF6601 !important;
border: #FF6601 !important;
/*background: #FF6601 !important;*/
/*border: #FF6601 !important;*/
/*cursor: inherit !important;*/
/* border: #33BD8C !important; */
cursor: inherit !important;
border: 1px solid #FF6601 !important;
background: transparent !important;
color: #FF6601 !important;
box-shadow: none;
text-shadow: none;
}
.shixunstartbutton666666{

@ -107,7 +107,10 @@ class ShixunsIndex extends Component {
this.setState({
parsedid:parsed.id,
newtag_level:nawparsed,
newpalce:newpalce
tag_level:nawparsed,
newpalce:newpalce,
tag_id:parsed.id,
keyword: _keyword || keyword,
})
this.shixunresultend(params);
}

Loading…
Cancel
Save