Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

update header x-frame-options

aichy126f80af9ffbebd
diff --git a/internal/controller/template_controller.go b/internal/controller/template_controller.go
index 894b4930..ccff3b1d 100644
--- a/internal/controller/template_controller.go
+++ b/internal/controller/template_controller.go
@@ -451,6 +451,7 @@ func (tc *TemplateController) html(ctx *gin.Context, code int, tpl string, siteI
if !ok {
data["path"] = ""
}
+ ctx.Header("X-Frame-Options", "DENY")
ctx.HTML(code, tpl, data)
}
diff --git a/internal/service/answer_service.go b/internal/service/answer_service.go
index 974482c9..bcadbdc6 100644
--- a/internal/service/answer_service.go
+++ b/internal/service/answer_service.go
@@ -164,7 +164,7 @@ func (as *AnswerService) Insert(ctx context.Context, req *schema.AnswerAddReq) (
if err != nil {
log.Error("UpdateLastAnswer error", err.Error())
}
- err = as.questionCommon.UpdataPostTime(ctx, req.QuestionID)
+ err = as.questionCommon.UpdatePostTime(ctx, req.QuestionID)
if err != nil {
return insertData.ID, err
}
@@ -268,7 +268,7 @@ func (as *AnswerService) Update(ctx context.Context, req *schema.AnswerUpdateReq
if err = as.answerRepo.UpdateAnswer(ctx, insertData, []string{"original_text", "parsed_text", "updated_at", "last_edit_user_id"}); err != nil {
return "", err
}
- err = as.questionCommon.UpdataPostTime(ctx, req.QuestionID)
+ err = as.questionCommon.UpdatePostTime(ctx, req.QuestionID)
if err != nil {
return insertData.ID, err
}
diff --git a/internal/service/question_common/question.go b/internal/service/question_common/question.go
index 23424d2c..79dbdc63 100644
--- a/internal/service/question_common/question.go
+++ b/internal/service/question_common/question.go
@@ -112,14 +112,14 @@ func (qs *QuestionCommon) UpdateLastAnswer(ctx context.Context, questionID, Answ
return qs.questionRepo.UpdateLastAnswer(ctx, question)
}
-func (qs *QuestionCommon) UpdataPostTime(ctx context.Context, questionID string) error {
+func (qs *QuestionCommon) UpdatePostTime(ctx context.Context, questionID string) error {
questioninfo := &entity.Question{}
now := time.Now()
questioninfo.ID = questionID
questioninfo.PostUpdateTime = now
return qs.questionRepo.UpdateQuestion(ctx, questioninfo, []string{"post_update_time"})
}
-func (qs *QuestionCommon) UpdataPostSetTime(ctx context.Context, questionID string, setTime time.Time) error {
+func (qs *QuestionCommon) UpdatePostSetTime(ctx context.Context, questionID string, setTime time.Time) error {
questioninfo := &entity.Question{}
questioninfo.ID = questionID
questioninfo.PostUpdateTime = setTime
diff --git a/internal/service/revision_service.go b/internal/service/revision_service.go
index bb65db32..3e8c3605 100644
--- a/internal/service/revision_service.go
+++ b/internal/service/revision_service.go
@@ -191,7 +191,7 @@ func (rs *RevisionService) revisionAuditAnswer(ctx context.Context, revisionitem
if saveerr != nil {
return saveerr
}
- saveerr = rs.questionCommon.UpdataPostSetTime(ctx, answerinfo.QuestionID, PostUpdateTime)
+ saveerr = rs.questionCommon.UpdatePostSetTime(ctx, answerinfo.QuestionID, PostUpdateTime)
if saveerr != nil {
return saveerr
}