From e6c21864bd7ee16f8d3f3b243dab497d4554c2ed Mon Sep 17 00:00:00 2001 From: liuzx Date: Fri, 7 Jan 2022 17:36:23 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E8=AE=BF=E9=97=AE?= =?UTF-8?q?=E9=87=8F=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routers/api/v1/api.go | 1 + routers/api/v1/repo/repo_dashbord.go | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go index dcea46ed6..723c6b4ef 100755 --- a/routers/api/v1/api.go +++ b/routers/api/v1/api.go @@ -534,6 +534,7 @@ func RegisterRoutes(m *macaron.Macaron) { m.Get("/downloadAllOpenI", repo.ServeAllProjectsOpenIStatisticsFile) m.Group("/project", func() { m.Get("", repo.GetAllProjectsPeriodStatistics) + m.Post("/numVisit", repo.ProjectNumVisit) m.Group("/:id", func() { m.Get("", repo.GetProjectLatestStatistics) diff --git a/routers/api/v1/repo/repo_dashbord.go b/routers/api/v1/repo/repo_dashbord.go index a8887a744..46596330f 100644 --- a/routers/api/v1/repo/repo_dashbord.go +++ b/routers/api/v1/repo/repo_dashbord.go @@ -12,6 +12,7 @@ import ( "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/log" + "code.gitea.io/gitea/modules/repository" "code.gitea.io/gitea/modules/context" "code.gitea.io/gitea/modules/setting" @@ -640,3 +641,26 @@ func getTotalPage(total int64, pageSize int) int { return int(total)/pageSize + another } + +func ProjectNumVisit(ctx *context.APIContext) { + var ( + err error + ) + + var userName = ctx.Query("user") + var projectName = ctx.Query("project") + var beginTime = ctx.Query("begintime") + var endTime = ctx.Query("endtime") + + var ProjectNumVisits int + ProjectNumVisits, err = repository.AppointProjectView(userName, projectName, beginTime, endTime) //访问量 + if err != nil { + ctx.NotFound(err) + } + log.Info("ProjectNumVisits is:", ProjectNumVisits) + + ctx.JSON(http.StatusOK, map[string]interface{}{ + "ProjectNumVisits": ProjectNumVisits, + "StatusOK": 0, + }) +} From 2f97fbbac3a817d0549629da4c30c88ef74cffe6 Mon Sep 17 00:00:00 2001 From: liuzx Date: Fri, 7 Jan 2022 18:32:48 +0800 Subject: [PATCH 2/6] update --- routers/api/v1/api.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go index 723c6b4ef..b81607c49 100755 --- a/routers/api/v1/api.go +++ b/routers/api/v1/api.go @@ -534,7 +534,7 @@ func RegisterRoutes(m *macaron.Macaron) { m.Get("/downloadAllOpenI", repo.ServeAllProjectsOpenIStatisticsFile) m.Group("/project", func() { m.Get("", repo.GetAllProjectsPeriodStatistics) - m.Post("/numVisit", repo.ProjectNumVisit) + m.Get("/numVisit", repo.ProjectNumVisit) m.Group("/:id", func() { m.Get("", repo.GetProjectLatestStatistics) From 5364060a4019d243a1e2d842198e5149d35cab9a Mon Sep 17 00:00:00 2001 From: wangjr Date: Mon, 17 Jan 2022 09:29:05 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E7=B2=BE=E9=80=89=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E6=A0=87=E7=AD=BE=E5=BA=95=E9=83=A8=E8=BE=B9=E8=B7=9D=E8=B0=83?= =?UTF-8?q?=E6=95=B4=EF=BC=8C=E4=B8=AA=E4=BA=BA=E4=BF=A1=E6=81=AF=E5=9B=BE?= =?UTF-8?q?=E6=A0=87=E5=B1=85=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/org/select_pro.tmpl | 8 +++++--- templates/user/profile.tmpl | 12 ++++++------ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/templates/org/select_pro.tmpl b/templates/org/select_pro.tmpl index 647bccd57..c88803e16 100755 --- a/templates/org/select_pro.tmpl +++ b/templates/org/select_pro.tmpl @@ -61,7 +61,9 @@ -webkit-line-clamp: 2; -webkit-box-orient: vertical; } - + .ui.cards>.card>.extra .tags > a{ + margin-top: 5px; + }
@@ -99,7 +101,7 @@ {{if .Topics }}
{{range .Topics}} - {{if ne . "" }}{{.}}{{end}} + {{if ne . "" }}{{.}}{{end}} {{end}}
@@ -108,7 +110,7 @@
-
+
{{svg "octicon-eye" 16}} {{.NumWatches}} diff --git a/templates/user/profile.tmpl b/templates/user/profile.tmpl index 9c483efe1..f14dc9b7a 100755 --- a/templates/user/profile.tmpl +++ b/templates/user/profile.tmpl @@ -77,14 +77,14 @@ {{.Name}} -
  • +
  • - - {{.NumMembers}} + + {{.NumMembers}}
  • -
  • - - {{.NumRepos}} +
  • + + {{.NumRepos}}
  • {{end}} From 010712cb01046c710d34593b79790385e62d5dd2 Mon Sep 17 00:00:00 2001 From: zouap Date: Mon, 17 Jan 2022 16:59:19 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=88=86=E6=9E=90?= =?UTF-8?q?=E6=8A=A5=E5=91=8A=E4=B8=8B=E8=BD=BD=E7=BB=93=E6=9E=9C=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/user_data_analysis.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/routers/repo/user_data_analysis.go b/routers/repo/user_data_analysis.go index e2d44ab0a..e71e8cb3a 100755 --- a/routers/repo/user_data_analysis.go +++ b/routers/repo/user_data_analysis.go @@ -91,19 +91,19 @@ func queryUserDataPage(ctx *context.Context, tableName string, queryObj interfac xlsx.SetCellValue(sheetName, "Q"+rows, formatTime) } - //设置默认打开的表单 - xlsx.SetActiveSheet(index) - filename := sheetName + "_" + ctx.Tr("user.static."+tableName) + ".xlsx" - ctx.Resp.Header().Set("Content-Disposition", "attachment; filename="+url.QueryEscape(filename)) - ctx.Resp.Header().Set("Content-Type", "application/octet-stream") - if _, err := xlsx.WriteTo(ctx.Resp); err != nil { - log.Info("writer exel error." + err.Error()) - } indexTotal += PAGE_SIZE if indexTotal >= count { break } } + //设置默认打开的表单 + xlsx.SetActiveSheet(index) + filename := sheetName + "_" + ctx.Tr("user.static."+tableName) + ".xlsx" + ctx.Resp.Header().Set("Content-Disposition", "attachment; filename="+url.QueryEscape(filename)) + ctx.Resp.Header().Set("Content-Type", "application/octet-stream") + if _, err := xlsx.WriteTo(ctx.Resp); err != nil { + log.Info("writer exel error." + err.Error()) + } } else { re, count := models.QueryUserStaticDataByTableName((page-1)*pageSize, pageSize, tableName, queryObj, userName) mapInterface := make(map[string]interface{}) From a7c28dc4634f3a31e36e4992842471edcfa14699 Mon Sep 17 00:00:00 2001 From: ychao_1983 Date: Tue, 18 Jan 2022 10:16:15 +0800 Subject: [PATCH 5/6] fix-1365 --- models/repo_watch.go | 5 ++++- services/socketwrap/clientManager.go | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/models/repo_watch.go b/models/repo_watch.go index 85a7834bb..31868fcae 100644 --- a/models/repo_watch.go +++ b/models/repo_watch.go @@ -305,7 +305,10 @@ func NotifyWatchersActions(acts []*Action) error { return err } } - return sess.Commit() + + err := sess.Commit() + producer(acts...) + return err } func watchIfAuto(e Engine, userID, repoID int64, isWrite bool) error { diff --git a/services/socketwrap/clientManager.go b/services/socketwrap/clientManager.go index c59936581..601c0f7a8 100644 --- a/services/socketwrap/clientManager.go +++ b/services/socketwrap/clientManager.go @@ -50,6 +50,7 @@ func (h *ClientsManager) Run() { } case message := <-models.ActionChan: if isInOpTypes(opTypes, message.OpType) { + message.Comment = nil LastActionsQueue.Push(message) for _, client := range h.Clients.Keys() { select { From f0ed241d8b6fd8559680626f86a113e2e2a1cd99 Mon Sep 17 00:00:00 2001 From: ychao_1983 Date: Fri, 21 Jan 2022 12:19:18 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E7=9A=84iframe=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/context/context.go | 6 +++++- modules/setting/setting.go | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/context/context.go b/modules/context/context.go index 6cb6c267a..653a1895f 100755 --- a/modules/context/context.go +++ b/modules/context/context.go @@ -328,7 +328,11 @@ func Contexter() macaron.Handler { } } - ctx.Resp.Header().Set(`X-Frame-Options`, `SAMEORIGIN`) + if setting.IFrameURL != "" { + ctx.Resp.Header().Set(`X-Frame-Options`, `ALLOW-FROM `+setting.IFrameURL) + } else { + ctx.Resp.Header().Set(`X-Frame-Options`, `SAMEORIGIN`) + } ctx.Data["CsrfToken"] = html.EscapeString(x.GetToken()) ctx.Data["CsrfTokenHtml"] = template.HTML(``) diff --git a/modules/setting/setting.go b/modules/setting/setting.go index 3d2bd91c5..5775ca552 100755 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -573,6 +573,7 @@ var ( OrgName string TeamName string }{} + IFrameURL string ) // DateLang transforms standard language locale name to corresponding value in datetime plugin. @@ -1340,6 +1341,8 @@ func NewContext() { sec = Cfg.Section("course") Course.OrgName = sec.Key("org_name").MustString("") Course.TeamName = sec.Key("team_name").MustString("") + sec = Cfg.Section("xFrame") + IFrameURL = sec.Key("url").MustString("") } func SetRadarMapConfig() {