From 840d1e0324e3526e1353cb9b7625a318d7a05b3a Mon Sep 17 00:00:00 2001 From: qwerty287 Date: Thu, 23 Dec 2021 14:49:01 +0100 Subject: [PATCH 01/14] Allow creation of OAuth2 applications for orgs --- routers/web/org/setting.go | 156 ++++++++++++++++++ routers/web/web.go | 16 ++ templates/org/settings/applications.tmpl | 72 ++++++++ templates/org/settings/applications_edit.tmpl | 67 ++++++++ templates/org/settings/navbar.tmpl | 5 + 5 files changed, 316 insertions(+) create mode 100644 templates/org/settings/applications.tmpl create mode 100644 templates/org/settings/applications_edit.tmpl diff --git a/routers/web/org/setting.go b/routers/web/org/setting.go index 081e103f79b55..1f3636bae188c 100644 --- a/routers/web/org/setting.go +++ b/routers/web/org/setting.go @@ -6,12 +6,14 @@ package org import ( + "fmt" "net/http" "net/url" "strings" "code.gitea.io/gitea/models" "code.gitea.io/gitea/models/db" + "code.gitea.io/gitea/models/login" repo_model "code.gitea.io/gitea/models/repo" user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/models/webhook" @@ -35,6 +37,10 @@ const ( tplSettingsHooks base.TplName = "org/settings/hooks" // tplSettingsLabels template path for render labels settings tplSettingsLabels base.TplName = "org/settings/labels" + // tplSettingsLabels template path for render application settings + tplSettingsApplications base.TplName = "org/settings/applications" + // tplSettingsLabels template path for render application edit settings + tplSettingsEditApplication base.TplName = "org/settings/applications_edit" ) // Settings render the main settings page @@ -230,3 +236,153 @@ func Labels(ctx *context.Context) { ctx.Data["LabelTemplates"] = models.LabelTemplates ctx.HTML(http.StatusOK, tplSettingsLabels) } + +// Applications render org applications page +func Applications(ctx *context.Context) { + ctx.Data["Title"] = ctx.Tr("settings.applications") + ctx.Data["PageIsOrgSettings"] = true + ctx.Data["PageIsSettingsApplications"] = true + + apps, err := login.GetOAuth2ApplicationsByUserID(ctx.Org.Organization.ID) + if err != nil { + ctx.ServerError("GetOAuth2ApplicationsByUserID", err) + return + } + ctx.Data["Applications"] = apps + + ctx.HTML(http.StatusOK, tplSettingsApplications) +} + +// ApplicationsPost response for adding an oauth2 application +func ApplicationsPost(ctx *context.Context) { + form := web.GetForm(ctx).(*forms.EditOAuth2ApplicationForm) + ctx.Data["Title"] = ctx.Tr("settings.applications") + ctx.Data["PageIsOrgSettings"] = true + ctx.Data["PageIsSettingsApplications"] = true + + if ctx.HasError() { + apps, err := login.GetOAuth2ApplicationsByUserID(ctx.Org.Organization.ID) + if err != nil { + ctx.ServerError("GetOAuth2ApplicationsByUserID", err) + return + } + ctx.Data["Applications"] = apps + + ctx.HTML(http.StatusOK, tplSettingsApplications) + return + } + + app, err := login.CreateOAuth2Application(login.CreateOAuth2ApplicationOptions{ + Name: form.Name, + RedirectURIs: []string{form.RedirectURI}, + UserID: ctx.Org.Organization.ID, + }) + if err != nil { + ctx.ServerError("CreateOAuth2Application", err) + return + } + ctx.Data["App"] = app + ctx.Data["ClientSecret"], err = app.GenerateClientSecret() + if err != nil { + ctx.ServerError("GenerateClientSecret", err) + return + } + ctx.Flash.Success(ctx.Tr("settings.create_oauth2_application_success")) + ctx.HTML(http.StatusOK, tplSettingsEditApplication) +} + +// EditApplication response for editing oauth2 application +func EditApplication(ctx *context.Context) { + app, err := login.GetOAuth2ApplicationByID(ctx.ParamsInt64("id")) + if err != nil { + if login.IsErrOAuthApplicationNotFound(err) { + ctx.NotFound("Application not found", err) + return + } + ctx.ServerError("GetOAuth2ApplicationByID", err) + return + } + if app.UID != ctx.Org.Organization.ID { + ctx.NotFound("Application not found", nil) + return + } + ctx.Data["PageIsOrgSettings"] = true + ctx.Data["PageIsSettingsApplications"] = true + ctx.Data["App"] = app + ctx.HTML(http.StatusOK, tplSettingsEditApplication) +} + +// EditApplicationPost response for editing oauth2 application +func EditApplicationPost(ctx *context.Context) { + form := web.GetForm(ctx).(*forms.EditOAuth2ApplicationForm) + ctx.Data["Title"] = ctx.Tr("settings.applications") + ctx.Data["PageIsOrgSettings"] = true + ctx.Data["PageIsSettingsApplications"] = true + + if ctx.HasError() { + apps, err := login.GetOAuth2ApplicationsByUserID(ctx.Org.Organization.ID) + if err != nil { + ctx.ServerError("GetOAuth2ApplicationsByUserID", err) + return + } + ctx.Data["Applications"] = apps + + ctx.HTML(http.StatusOK, tplSettingsApplications) + return + } + var err error + if ctx.Data["App"], err = login.UpdateOAuth2Application(login.UpdateOAuth2ApplicationOptions{ + ID: ctx.ParamsInt64("id"), + Name: form.Name, + RedirectURIs: []string{form.RedirectURI}, + UserID: ctx.Org.Organization.ID, + }); err != nil { + ctx.ServerError("UpdateOAuth2Application", err) + return + } + ctx.Flash.Success(ctx.Tr("settings.update_oauth2_application_success")) + ctx.HTML(http.StatusOK, tplSettingsEditApplication) +} + +// ApplicationsRegenerateSecret handles the post request for regenerating the secret +func ApplicationsRegenerateSecret(ctx *context.Context) { + ctx.Data["Title"] = ctx.Tr("settings") + ctx.Data["PageIsSettingsApplications"] = true + ctx.Data["PageIsOrgSettings"] = true + + app, err := login.GetOAuth2ApplicationByID(ctx.ParamsInt64("id")) + if err != nil { + if login.IsErrOAuthApplicationNotFound(err) { + ctx.NotFound("Application not found", err) + return + } + ctx.ServerError("GetOAuth2ApplicationByID", err) + return + } + if app.UID != ctx.Org.Organization.ID { + ctx.NotFound("Application not found", nil) + return + } + ctx.Data["App"] = app + ctx.Data["ClientSecret"], err = app.GenerateClientSecret() + if err != nil { + ctx.ServerError("GenerateClientSecret", err) + return + } + ctx.Flash.Success(ctx.Tr("settings.update_oauth2_application_success")) + ctx.HTML(http.StatusOK, tplSettingsEditApplication) +} + +// DeleteApplication deletes the given oauth2 application +func DeleteApplication(ctx *context.Context) { + if err := login.DeleteOAuth2Application(ctx.FormInt64("id"), ctx.Org.Organization.ID); err != nil { + ctx.ServerError("DeleteOAuth2Application", err) + return + } + log.Trace("OAuth2 Application deleted: %s", ctx.User.Name) + + ctx.Flash.Success(ctx.Tr("settings.remove_oauth2_application_success")) + ctx.JSON(http.StatusOK, map[string]interface{}{ + "redirect": fmt.Sprintf("%s/org/%s/settings/applications", setting.AppSubURL, ctx.Org.Organization.Name), + }) +} diff --git a/routers/web/web.go b/routers/web/web.go index ebd0995df8379..1c767bfb4d950 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -544,6 +544,20 @@ func RegisterRoutes(m *web.Route) { Post(bindIgnErr(forms.UpdateOrgSettingForm{}), org.SettingsPost) m.Post("/avatar", bindIgnErr(forms.AvatarForm{}), org.SettingsAvatar) m.Post("/avatar/delete", org.SettingsDeleteAvatar) + m.Group("/applications", func() { + m.Combo("").Get(org.Applications). + Post(bindIgnErr(forms.EditOAuth2ApplicationForm{}), org.ApplicationsPost) + m.Group("/{id}", func() { + m.Combo("").Get(org.EditApplication).Post(bindIgnErr(forms.EditOAuth2ApplicationForm{}), org.EditApplicationPost) + m.Post("/regenerate_secret", org.ApplicationsRegenerateSecret) + m.Post("/delete", org.DeleteApplication) + }) + }, func(ctx *context.Context) { + if !setting.OAuth2.Enable { + ctx.Error(http.StatusForbidden) + return + } + }) m.Group("/hooks", func() { m.Get("", org.Webhooks) @@ -581,6 +595,8 @@ func RegisterRoutes(m *web.Route) { }) m.Route("/delete", "GET,POST", org.SettingsDelete) + }, func(ctx *context.Context) { + ctx.Data["EnableOAuth2"] = setting.OAuth2.Enable }) }, context.OrgAssignment(true, true)) }, reqSignIn) diff --git a/templates/org/settings/applications.tmpl b/templates/org/settings/applications.tmpl new file mode 100644 index 0000000000000..cd700f4e3985a --- /dev/null +++ b/templates/org/settings/applications.tmpl @@ -0,0 +1,72 @@ +{{template "base/head" .}} +
+ {{template "org/header" .}} +
+
+ {{template "org/settings/navbar" .}} +
+ {{template "base/alert" .}} +

+ {{.i18n.Tr "settings.applications"}} +

+
+
+
+ {{.i18n.Tr "settings.oauth2_application_create_description"}} +
+ {{range $app := .Applications}} +
+
+ + {{svg "octicon-pencil" 16 "mr-2"}} + {{$.i18n.Tr "settings.oauth2_application_edit"}} + + +
+
+ {{$app.Name}} +
+
+ {{end}} +
+
+
+ {{.i18n.Tr "settings.create_oauth2_application" }} +
+
+ {{.CsrfTokenHtml}} +
+ + +
+
+ + +
+ +
+
+ + +
+
+
+
+
+{{template "base/footer" .}} diff --git a/templates/org/settings/applications_edit.tmpl b/templates/org/settings/applications_edit.tmpl new file mode 100644 index 0000000000000..580824c08a500 --- /dev/null +++ b/templates/org/settings/applications_edit.tmpl @@ -0,0 +1,67 @@ +{{template "base/head" .}} +
+ {{template "org/header" .}} +
+
+ {{template "org/settings/navbar" .}} +
+ {{template "base/alert" .}} +

+ {{.i18n.Tr "settings.edit_oauth2_application"}} +

+
+ {{.CsrfTokenHtml}} +
+ + +
+ {{if .ClientSecret}} +
+ + +
+ {{else}} +
+ + +
+ {{end}} +
+ {{.i18n.Tr "settings.oauth2_regenerate_secret_hint"}} +
+ {{.CsrfTokenHtml}} + {{.i18n.Tr "settings.oauth2_regenerate_secret"}} +
+
+
+
+
+ {{.CsrfTokenHtml}} +
+ + +
+
+ + +
+ +
+
+
+
+
+
+ +{{template "base/footer" .}} diff --git a/templates/org/settings/navbar.tmpl b/templates/org/settings/navbar.tmpl index b70e6b1d09bd9..4ae98c671bc63 100644 --- a/templates/org/settings/navbar.tmpl +++ b/templates/org/settings/navbar.tmpl @@ -12,6 +12,11 @@ {{.i18n.Tr "repo.labels"}} + {{if .EnableOAuth2}} + + {{.i18n.Tr "settings.applications"}} + + {{end}} {{.i18n.Tr "org.settings.delete"}} From 2e3bccf731212091de5c2f4d7c9bcfdd031cf936 Mon Sep 17 00:00:00 2001 From: qwerty287 Date: Fri, 7 Jan 2022 16:58:00 +0100 Subject: [PATCH 02/14] Fix import --- routers/web/org/setting.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/routers/web/org/setting.go b/routers/web/org/setting.go index 1f3636bae188c..9ee3cbc56d30e 100644 --- a/routers/web/org/setting.go +++ b/routers/web/org/setting.go @@ -13,7 +13,7 @@ import ( "code.gitea.io/gitea/models" "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/models/login" + "code.gitea.io/gitea/models/auth" repo_model "code.gitea.io/gitea/models/repo" user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/models/webhook" @@ -243,7 +243,7 @@ func Applications(ctx *context.Context) { ctx.Data["PageIsOrgSettings"] = true ctx.Data["PageIsSettingsApplications"] = true - apps, err := login.GetOAuth2ApplicationsByUserID(ctx.Org.Organization.ID) + apps, err := auth.GetOAuth2ApplicationsByUserID(ctx.Org.Organization.ID) if err != nil { ctx.ServerError("GetOAuth2ApplicationsByUserID", err) return @@ -261,7 +261,7 @@ func ApplicationsPost(ctx *context.Context) { ctx.Data["PageIsSettingsApplications"] = true if ctx.HasError() { - apps, err := login.GetOAuth2ApplicationsByUserID(ctx.Org.Organization.ID) + apps, err := auth.GetOAuth2ApplicationsByUserID(ctx.Org.Organization.ID) if err != nil { ctx.ServerError("GetOAuth2ApplicationsByUserID", err) return @@ -272,7 +272,7 @@ func ApplicationsPost(ctx *context.Context) { return } - app, err := login.CreateOAuth2Application(login.CreateOAuth2ApplicationOptions{ + app, err := auth.CreateOAuth2Application(auth.CreateOAuth2ApplicationOptions{ Name: form.Name, RedirectURIs: []string{form.RedirectURI}, UserID: ctx.Org.Organization.ID, @@ -293,9 +293,9 @@ func ApplicationsPost(ctx *context.Context) { // EditApplication response for editing oauth2 application func EditApplication(ctx *context.Context) { - app, err := login.GetOAuth2ApplicationByID(ctx.ParamsInt64("id")) + app, err := auth.GetOAuth2ApplicationByID(ctx.ParamsInt64("id")) if err != nil { - if login.IsErrOAuthApplicationNotFound(err) { + if auth.IsErrOAuthApplicationNotFound(err) { ctx.NotFound("Application not found", err) return } @@ -320,7 +320,7 @@ func EditApplicationPost(ctx *context.Context) { ctx.Data["PageIsSettingsApplications"] = true if ctx.HasError() { - apps, err := login.GetOAuth2ApplicationsByUserID(ctx.Org.Organization.ID) + apps, err := auth.GetOAuth2ApplicationsByUserID(ctx.Org.Organization.ID) if err != nil { ctx.ServerError("GetOAuth2ApplicationsByUserID", err) return @@ -331,7 +331,7 @@ func EditApplicationPost(ctx *context.Context) { return } var err error - if ctx.Data["App"], err = login.UpdateOAuth2Application(login.UpdateOAuth2ApplicationOptions{ + if ctx.Data["App"], err = auth.UpdateOAuth2Application(auth.UpdateOAuth2ApplicationOptions{ ID: ctx.ParamsInt64("id"), Name: form.Name, RedirectURIs: []string{form.RedirectURI}, @@ -350,9 +350,9 @@ func ApplicationsRegenerateSecret(ctx *context.Context) { ctx.Data["PageIsSettingsApplications"] = true ctx.Data["PageIsOrgSettings"] = true - app, err := login.GetOAuth2ApplicationByID(ctx.ParamsInt64("id")) + app, err := auth.GetOAuth2ApplicationByID(ctx.ParamsInt64("id")) if err != nil { - if login.IsErrOAuthApplicationNotFound(err) { + if auth.IsErrOAuthApplicationNotFound(err) { ctx.NotFound("Application not found", err) return } @@ -375,7 +375,7 @@ func ApplicationsRegenerateSecret(ctx *context.Context) { // DeleteApplication deletes the given oauth2 application func DeleteApplication(ctx *context.Context) { - if err := login.DeleteOAuth2Application(ctx.FormInt64("id"), ctx.Org.Organization.ID); err != nil { + if err := auth.DeleteOAuth2Application(ctx.FormInt64("id"), ctx.Org.Organization.ID); err != nil { ctx.ServerError("DeleteOAuth2Application", err) return } From 171701ab7a35d5db5365886f640cc7f4c39f2b20 Mon Sep 17 00:00:00 2001 From: qwerty287 Date: Fri, 7 Jan 2022 17:12:12 +0100 Subject: [PATCH 03/14] fmt --- routers/web/org/setting.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/web/org/setting.go b/routers/web/org/setting.go index 9ee3cbc56d30e..b26db62b79b41 100644 --- a/routers/web/org/setting.go +++ b/routers/web/org/setting.go @@ -12,8 +12,8 @@ import ( "strings" "code.gitea.io/gitea/models" - "code.gitea.io/gitea/models/db" "code.gitea.io/gitea/models/auth" + "code.gitea.io/gitea/models/db" repo_model "code.gitea.io/gitea/models/repo" user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/models/webhook" From 1f920dfed91bb7af3cd2904584812379ce0d6bbc Mon Sep 17 00:00:00 2001 From: qwerty287 Date: Sun, 27 Mar 2022 14:17:41 +0200 Subject: [PATCH 04/14] Fix merge --- routers/web/org/setting.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/web/org/setting.go b/routers/web/org/setting.go index 1fb9b1498f016..977f1de1f99ac 100644 --- a/routers/web/org/setting.go +++ b/routers/web/org/setting.go @@ -384,7 +384,7 @@ func DeleteApplication(ctx *context.Context) { ctx.ServerError("DeleteOAuth2Application", err) return } - log.Trace("OAuth2 Application deleted: %s", ctx.User.Name) + log.Trace("OAuth2 Application deleted: %s", ctx.Doer.Name) ctx.Flash.Success(ctx.Tr("settings.remove_oauth2_application_success")) ctx.JSON(http.StatusOK, map[string]interface{}{ From c04065bb3d53b4929153f8f6808de04d07da8f2a Mon Sep 17 00:00:00 2001 From: qwerty287 Date: Sun, 5 Jun 2022 09:03:38 +0200 Subject: [PATCH 05/14] Adapt refactors --- routers/web/org/setting.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/routers/web/org/setting.go b/routers/web/org/setting.go index 9c2dd826f039d..a5c3db9f154ee 100644 --- a/routers/web/org/setting.go +++ b/routers/web/org/setting.go @@ -252,7 +252,7 @@ func Applications(ctx *context.Context) { ctx.Data["PageIsOrgSettings"] = true ctx.Data["PageIsSettingsApplications"] = true - apps, err := auth.GetOAuth2ApplicationsByUserID(ctx.Org.Organization.ID) + apps, err := auth.GetOAuth2ApplicationsByUserID(ctx, ctx.Org.Organization.ID) if err != nil { ctx.ServerError("GetOAuth2ApplicationsByUserID", err) return @@ -270,7 +270,7 @@ func ApplicationsPost(ctx *context.Context) { ctx.Data["PageIsSettingsApplications"] = true if ctx.HasError() { - apps, err := auth.GetOAuth2ApplicationsByUserID(ctx.Org.Organization.ID) + apps, err := auth.GetOAuth2ApplicationsByUserID(ctx, ctx.Org.Organization.ID) if err != nil { ctx.ServerError("GetOAuth2ApplicationsByUserID", err) return @@ -281,7 +281,7 @@ func ApplicationsPost(ctx *context.Context) { return } - app, err := auth.CreateOAuth2Application(auth.CreateOAuth2ApplicationOptions{ + app, err := auth.CreateOAuth2Application(ctx, auth.CreateOAuth2ApplicationOptions{ Name: form.Name, RedirectURIs: []string{form.RedirectURI}, UserID: ctx.Org.Organization.ID, @@ -302,7 +302,7 @@ func ApplicationsPost(ctx *context.Context) { // EditApplication response for editing oauth2 application func EditApplication(ctx *context.Context) { - app, err := auth.GetOAuth2ApplicationByID(ctx.ParamsInt64("id")) + app, err := auth.GetOAuth2ApplicationByID(ctx, ctx.ParamsInt64("id")) if err != nil { if auth.IsErrOAuthApplicationNotFound(err) { ctx.NotFound("Application not found", err) @@ -329,7 +329,7 @@ func EditApplicationPost(ctx *context.Context) { ctx.Data["PageIsSettingsApplications"] = true if ctx.HasError() { - apps, err := auth.GetOAuth2ApplicationsByUserID(ctx.Org.Organization.ID) + apps, err := auth.GetOAuth2ApplicationsByUserID(ctx, ctx.Org.Organization.ID) if err != nil { ctx.ServerError("GetOAuth2ApplicationsByUserID", err) return @@ -359,7 +359,7 @@ func ApplicationsRegenerateSecret(ctx *context.Context) { ctx.Data["PageIsSettingsApplications"] = true ctx.Data["PageIsOrgSettings"] = true - app, err := auth.GetOAuth2ApplicationByID(ctx.ParamsInt64("id")) + app, err := auth.GetOAuth2ApplicationByID(ctx, ctx.ParamsInt64("id")) if err != nil { if auth.IsErrOAuthApplicationNotFound(err) { ctx.NotFound("Application not found", err) From fe95171f00387febf2c8a4a6f43af4955c508550 Mon Sep 17 00:00:00 2001 From: qwerty287 Date: Mon, 26 Sep 2022 18:27:10 +0200 Subject: [PATCH 06/14] Use `locale.Tr` --- templates/org/settings/applications.tmpl | 20 ++++++++--------- templates/org/settings/applications_edit.tmpl | 22 +++++++++---------- templates/org/settings/navbar.tmpl | 2 +- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/templates/org/settings/applications.tmpl b/templates/org/settings/applications.tmpl index cd700f4e3985a..182908ad4b418 100644 --- a/templates/org/settings/applications.tmpl +++ b/templates/org/settings/applications.tmpl @@ -7,25 +7,25 @@
{{template "base/alert" .}}

- {{.i18n.Tr "settings.applications"}} + {{.locale.Tr "settings.applications"}}

- {{.i18n.Tr "settings.oauth2_application_create_description"}} + {{.locale.Tr "settings.oauth2_application_create_description"}}
{{range $app := .Applications}}
{{svg "octicon-pencil" 16 "mr-2"}} - {{$.i18n.Tr "settings.oauth2_application_edit"}} + {{$.locale.Tr "settings.oauth2_application_edit"}}
@@ -36,20 +36,20 @@
- {{.i18n.Tr "settings.create_oauth2_application" }} + {{.locale.Tr "settings.create_oauth2_application" }}
{{.CsrfTokenHtml}}
- +
- +
@@ -57,10 +57,10 @@ diff --git a/templates/org/settings/applications_edit.tmpl b/templates/org/settings/applications_edit.tmpl index 580824c08a500..6578a8d786b60 100644 --- a/templates/org/settings/applications_edit.tmpl +++ b/templates/org/settings/applications_edit.tmpl @@ -7,30 +7,30 @@
{{template "base/alert" .}}

- {{.i18n.Tr "settings.edit_oauth2_application"}} + {{.locale.Tr "settings.edit_oauth2_application"}}

{{.CsrfTokenHtml}}
- +
{{if .ClientSecret}}
- +
{{else}}
- +
{{end}}
- {{.i18n.Tr "settings.oauth2_regenerate_secret_hint"}} + {{.locale.Tr "settings.oauth2_regenerate_secret_hint"}}
{{.CsrfTokenHtml}} - {{.i18n.Tr "settings.oauth2_regenerate_secret"}} + {{.locale.Tr "settings.oauth2_regenerate_secret"}}
@@ -38,15 +38,15 @@
{{.CsrfTokenHtml}}
- +
- +
@@ -57,10 +57,10 @@ diff --git a/templates/org/settings/navbar.tmpl b/templates/org/settings/navbar.tmpl index 0ddbc3ee0640f..e7cbb87344d1b 100644 --- a/templates/org/settings/navbar.tmpl +++ b/templates/org/settings/navbar.tmpl @@ -14,7 +14,7 @@ {{if .EnableOAuth2}} - {{.i18n.Tr "settings.applications"}} + {{.locale.Tr "settings.applications"}} {{end}} From 16d6a90dc057284e6dea38bc3301d4a7fcf37955 Mon Sep 17 00:00:00 2001 From: qwerty287 Date: Mon, 3 Oct 2022 09:36:16 +0200 Subject: [PATCH 07/14] Remove modal --- assets/go-licenses.json | 18 ++++++++++++++---- templates/org/settings/applications_edit.tmpl | 10 ---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/assets/go-licenses.json b/assets/go-licenses.json index 8d129557de07f..db0b00865edb5 100644 --- a/assets/go-licenses.json +++ b/assets/go-licenses.json @@ -75,8 +75,8 @@ "licenseText": "\n Apache License\n Version 2.0, January 2004\n http://www.apache.org/licenses/\n\n TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n 1. Definitions.\n\n \"License\" shall mean the terms and conditions for use, reproduction,\n and distribution as defined by Sections 1 through 9 of this document.\n\n \"Licensor\" shall mean the copyright owner or entity authorized by\n the copyright owner that is granting the License.\n\n \"Legal Entity\" shall mean the union of the acting entity and all\n other entities that control, are controlled by, or are under common\n control with that entity. For the purposes of this definition,\n \"control\" means (i) the power, direct or indirect, to cause the\n direction or management of such entity, whether by contract or\n otherwise, or (ii) ownership of fifty percent (50%) or more of the\n outstanding shares, or (iii) beneficial ownership of such entity.\n\n \"You\" (or \"Your\") shall mean an individual or Legal Entity\n exercising permissions granted by this License.\n\n \"Source\" form shall mean the preferred form for making modifications,\n including but not limited to software source code, documentation\n source, and configuration files.\n\n \"Object\" form shall mean any form resulting from mechanical\n transformation or translation of a Source form, including but\n not limited to compiled object code, generated documentation,\n and conversions to other media types.\n\n \"Work\" shall mean the work of authorship, whether in Source or\n Object form, made available under the License, as indicated by a\n copyright notice that is included in or attached to the work\n (an example is provided in the Appendix below).\n\n \"Derivative Works\" shall mean any work, whether in Source or Object\n form, that is based on (or derived from) the Work and for which the\n editorial revisions, annotations, elaborations, or other modifications\n represent, as a whole, an original work of authorship. For the purposes\n of this License, Derivative Works shall not include works that remain\n separable from, or merely link (or bind by name) to the interfaces of,\n the Work and Derivative Works thereof.\n\n \"Contribution\" shall mean any work of authorship, including\n the original version of the Work and any modifications or additions\n to that Work or Derivative Works thereof, that is intentionally\n submitted to Licensor for inclusion in the Work by the copyright owner\n or by an individual or Legal Entity authorized to submit on behalf of\n the copyright owner. For the purposes of this definition, \"submitted\"\n means any form of electronic, verbal, or written communication sent\n to the Licensor or its representatives, including but not limited to\n communication on electronic mailing lists, source code control systems,\n and issue tracking systems that are managed by, or on behalf of, the\n Licensor for the purpose of discussing and improving the Work, but\n excluding communication that is conspicuously marked or otherwise\n designated in writing by the copyright owner as \"Not a Contribution.\"\n\n \"Contributor\" shall mean Licensor and any individual or Legal Entity\n on behalf of whom a Contribution has been received by Licensor and\n subsequently incorporated within the Work.\n\n 2. Grant of Copyright License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n copyright license to reproduce, prepare Derivative Works of,\n publicly display, publicly perform, sublicense, and distribute the\n Work and such Derivative Works in Source or Object form.\n\n 3. Grant of Patent License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n (except as stated in this section) patent license to make, have made,\n use, offer to sell, sell, import, and otherwise transfer the Work,\n where such license applies only to those patent claims licensable\n by such Contributor that are necessarily infringed by their\n Contribution(s) alone or by combination of their Contribution(s)\n with the Work to which such Contribution(s) was submitted. If You\n institute patent litigation against any entity (including a\n cross-claim or counterclaim in a lawsuit) alleging that the Work\n or a Contribution incorporated within the Work constitutes direct\n or contributory patent infringement, then any patent licenses\n granted to You under this License for that Work shall terminate\n as of the date such litigation is filed.\n\n 4. Redistribution. You may reproduce and distribute copies of the\n Work or Derivative Works thereof in any medium, with or without\n modifications, and in Source or Object form, provided that You\n meet the following conditions:\n\n (a) You must give any other recipients of the Work or\n Derivative Works a copy of this License; and\n\n (b) You must cause any modified files to carry prominent notices\n stating that You changed the files; and\n\n (c) You must retain, in the Source form of any Derivative Works\n that You distribute, all copyright, patent, trademark, and\n attribution notices from the Source form of the Work,\n excluding those notices that do not pertain to any part of\n the Derivative Works; and\n\n (d) If the Work includes a \"NOTICE\" text file as part of its\n distribution, then any Derivative Works that You distribute must\n include a readable copy of the attribution notices contained\n within such NOTICE file, excluding those notices that do not\n pertain to any part of the Derivative Works, in at least one\n of the following places: within a NOTICE text file distributed\n as part of the Derivative Works; within the Source form or\n documentation, if provided along with the Derivative Works; or,\n within a display generated by the Derivative Works, if and\n wherever such third-party notices normally appear. The contents\n of the NOTICE file are for informational purposes only and\n do not modify the License. You may add Your own attribution\n notices within Derivative Works that You distribute, alongside\n or as an addendum to the NOTICE text from the Work, provided\n that such additional attribution notices cannot be construed\n as modifying the License.\n\n You may add Your own copyright statement to Your modifications and\n may provide additional or different license terms and conditions\n for use, reproduction, or distribution of Your modifications, or\n for any such Derivative Works as a whole, provided Your use,\n reproduction, and distribution of the Work otherwise complies with\n the conditions stated in this License.\n\n 5. Submission of Contributions. Unless You explicitly state otherwise,\n any Contribution intentionally submitted for inclusion in the Work\n by You to the Licensor shall be under the terms and conditions of\n this License, without any additional terms or conditions.\n Notwithstanding the above, nothing herein shall supersede or modify\n the terms of any separate license agreement you may have executed\n with Licensor regarding such Contributions.\n\n 6. Trademarks. This License does not grant permission to use the trade\n names, trademarks, service marks, or product names of the Licensor,\n except as required for reasonable and customary use in describing the\n origin of the Work and reproducing the content of the NOTICE file.\n\n 7. Disclaimer of Warranty. Unless required by applicable law or\n agreed to in writing, Licensor provides the Work (and each\n Contributor provides its Contributions) on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n implied, including, without limitation, any warranties or conditions\n of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n PARTICULAR PURPOSE. You are solely responsible for determining the\n appropriateness of using or redistributing the Work and assume any\n risks associated with Your exercise of permissions under this License.\n\n 8. Limitation of Liability. In no event and under no legal theory,\n whether in tort (including negligence), contract, or otherwise,\n unless required by applicable law (such as deliberate and grossly\n negligent acts) or agreed to in writing, shall any Contributor be\n liable to You for damages, including any direct, indirect, special,\n incidental, or consequential damages of any character arising as a\n result of this License or out of the use or inability to use the\n Work (including but not limited to damages for loss of goodwill,\n work stoppage, computer failure or malfunction, or any and all\n other commercial damages or losses), even if such Contributor\n has been advised of the possibility of such damages.\n\n 9. Accepting Warranty or Additional Liability. While redistributing\n the Work or Derivative Works thereof, You may choose to offer,\n and charge a fee for, acceptance of support, warranty, indemnity,\n or other liability obligations and/or rights consistent with this\n License. However, in accepting such obligations, You may act only\n on Your own behalf and on Your sole responsibility, not on behalf\n of any other Contributor, and only if You agree to indemnify,\n defend, and hold each Contributor harmless for any liability\n incurred by, or claims asserted against, such Contributor by reason\n of your accepting any such warranty or additional liability.\n\n END OF TERMS AND CONDITIONS\n\n APPENDIX: How to apply the Apache License to your work.\n\n To apply the Apache License to your work, attach the following\n boilerplate notice, with the fields enclosed by brackets \"[]\"\n replaced with your own identifying information. (Don't include\n the brackets!) The text should be enclosed in the appropriate\n comment syntax for the file format. We also recommend that a\n file or class name and description of purpose be included on the\n same \"printed page\" as the copyright notice for easier\n identification within third-party archives.\n\n Copyright 2016 by the authors\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n================================================================================\n\nPortions of runcontainer.go are from the Go standard library, which is licensed\nunder:\n\nCopyright (c) 2009 The Go Authors. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are\nmet:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the following disclaimer\n in the documentation and/or other materials provided with the\n distribution.\n * Neither the name of Google Inc. nor the names of its\n contributors may be used to endorse or promote products derived from\n this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" }, { - "name": "github.com/alecthomas/chroma", - "path": "github.com/alecthomas/chroma/COPYING", + "name": "github.com/alecthomas/chroma/v2", + "path": "github.com/alecthomas/chroma/v2/COPYING", "licenseText": "Copyright (C) 2017 Alec Thomas\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\nof the Software, and to permit persons to whom the Software is furnished to do\nso, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n" }, { @@ -114,6 +114,11 @@ "path": "github.com/blevesearch/bleve_index_api/LICENSE", "licenseText": "\n Apache License\n Version 2.0, January 2004\n http://www.apache.org/licenses/\n\n TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n 1. Definitions.\n\n \"License\" shall mean the terms and conditions for use, reproduction,\n and distribution as defined by Sections 1 through 9 of this document.\n\n \"Licensor\" shall mean the copyright owner or entity authorized by\n the copyright owner that is granting the License.\n\n \"Legal Entity\" shall mean the union of the acting entity and all\n other entities that control, are controlled by, or are under common\n control with that entity. For the purposes of this definition,\n \"control\" means (i) the power, direct or indirect, to cause the\n direction or management of such entity, whether by contract or\n otherwise, or (ii) ownership of fifty percent (50%) or more of the\n outstanding shares, or (iii) beneficial ownership of such entity.\n\n \"You\" (or \"Your\") shall mean an individual or Legal Entity\n exercising permissions granted by this License.\n\n \"Source\" form shall mean the preferred form for making modifications,\n including but not limited to software source code, documentation\n source, and configuration files.\n\n \"Object\" form shall mean any form resulting from mechanical\n transformation or translation of a Source form, including but\n not limited to compiled object code, generated documentation,\n and conversions to other media types.\n\n \"Work\" shall mean the work of authorship, whether in Source or\n Object form, made available under the License, as indicated by a\n copyright notice that is included in or attached to the work\n (an example is provided in the Appendix below).\n\n \"Derivative Works\" shall mean any work, whether in Source or Object\n form, that is based on (or derived from) the Work and for which the\n editorial revisions, annotations, elaborations, or other modifications\n represent, as a whole, an original work of authorship. For the purposes\n of this License, Derivative Works shall not include works that remain\n separable from, or merely link (or bind by name) to the interfaces of,\n the Work and Derivative Works thereof.\n\n \"Contribution\" shall mean any work of authorship, including\n the original version of the Work and any modifications or additions\n to that Work or Derivative Works thereof, that is intentionally\n submitted to Licensor for inclusion in the Work by the copyright owner\n or by an individual or Legal Entity authorized to submit on behalf of\n the copyright owner. For the purposes of this definition, \"submitted\"\n means any form of electronic, verbal, or written communication sent\n to the Licensor or its representatives, including but not limited to\n communication on electronic mailing lists, source code control systems,\n and issue tracking systems that are managed by, or on behalf of, the\n Licensor for the purpose of discussing and improving the Work, but\n excluding communication that is conspicuously marked or otherwise\n designated in writing by the copyright owner as \"Not a Contribution.\"\n\n \"Contributor\" shall mean Licensor and any individual or Legal Entity\n on behalf of whom a Contribution has been received by Licensor and\n subsequently incorporated within the Work.\n\n 2. Grant of Copyright License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n copyright license to reproduce, prepare Derivative Works of,\n publicly display, publicly perform, sublicense, and distribute the\n Work and such Derivative Works in Source or Object form.\n\n 3. Grant of Patent License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n (except as stated in this section) patent license to make, have made,\n use, offer to sell, sell, import, and otherwise transfer the Work,\n where such license applies only to those patent claims licensable\n by such Contributor that are necessarily infringed by their\n Contribution(s) alone or by combination of their Contribution(s)\n with the Work to which such Contribution(s) was submitted. If You\n institute patent litigation against any entity (including a\n cross-claim or counterclaim in a lawsuit) alleging that the Work\n or a Contribution incorporated within the Work constitutes direct\n or contributory patent infringement, then any patent licenses\n granted to You under this License for that Work shall terminate\n as of the date such litigation is filed.\n\n 4. Redistribution. You may reproduce and distribute copies of the\n Work or Derivative Works thereof in any medium, with or without\n modifications, and in Source or Object form, provided that You\n meet the following conditions:\n\n (a) You must give any other recipients of the Work or\n Derivative Works a copy of this License; and\n\n (b) You must cause any modified files to carry prominent notices\n stating that You changed the files; and\n\n (c) You must retain, in the Source form of any Derivative Works\n that You distribute, all copyright, patent, trademark, and\n attribution notices from the Source form of the Work,\n excluding those notices that do not pertain to any part of\n the Derivative Works; and\n\n (d) If the Work includes a \"NOTICE\" text file as part of its\n distribution, then any Derivative Works that You distribute must\n include a readable copy of the attribution notices contained\n within such NOTICE file, excluding those notices that do not\n pertain to any part of the Derivative Works, in at least one\n of the following places: within a NOTICE text file distributed\n as part of the Derivative Works; within the Source form or\n documentation, if provided along with the Derivative Works; or,\n within a display generated by the Derivative Works, if and\n wherever such third-party notices normally appear. The contents\n of the NOTICE file are for informational purposes only and\n do not modify the License. You may add Your own attribution\n notices within Derivative Works that You distribute, alongside\n or as an addendum to the NOTICE text from the Work, provided\n that such additional attribution notices cannot be construed\n as modifying the License.\n\n You may add Your own copyright statement to Your modifications and\n may provide additional or different license terms and conditions\n for use, reproduction, or distribution of Your modifications, or\n for any such Derivative Works as a whole, provided Your use,\n reproduction, and distribution of the Work otherwise complies with\n the conditions stated in this License.\n\n 5. Submission of Contributions. Unless You explicitly state otherwise,\n any Contribution intentionally submitted for inclusion in the Work\n by You to the Licensor shall be under the terms and conditions of\n this License, without any additional terms or conditions.\n Notwithstanding the above, nothing herein shall supersede or modify\n the terms of any separate license agreement you may have executed\n with Licensor regarding such Contributions.\n\n 6. Trademarks. This License does not grant permission to use the trade\n names, trademarks, service marks, or product names of the Licensor,\n except as required for reasonable and customary use in describing the\n origin of the Work and reproducing the content of the NOTICE file.\n\n 7. Disclaimer of Warranty. Unless required by applicable law or\n agreed to in writing, Licensor provides the Work (and each\n Contributor provides its Contributions) on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n implied, including, without limitation, any warranties or conditions\n of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n PARTICULAR PURPOSE. You are solely responsible for determining the\n appropriateness of using or redistributing the Work and assume any\n risks associated with Your exercise of permissions under this License.\n\n 8. Limitation of Liability. In no event and under no legal theory,\n whether in tort (including negligence), contract, or otherwise,\n unless required by applicable law (such as deliberate and grossly\n negligent acts) or agreed to in writing, shall any Contributor be\n liable to You for damages, including any direct, indirect, special,\n incidental, or consequential damages of any character arising as a\n result of this License or out of the use or inability to use the\n Work (including but not limited to damages for loss of goodwill,\n work stoppage, computer failure or malfunction, or any and all\n other commercial damages or losses), even if such Contributor\n has been advised of the possibility of such damages.\n\n 9. Accepting Warranty or Additional Liability. While redistributing\n the Work or Derivative Works thereof, You may choose to offer,\n and charge a fee for, acceptance of support, warranty, indemnity,\n or other liability obligations and/or rights consistent with this\n License. However, in accepting such obligations, You may act only\n on Your own behalf and on Your sole responsibility, not on behalf\n of any other Contributor, and only if You agree to indemnify,\n defend, and hold each Contributor harmless for any liability\n incurred by, or claims asserted against, such Contributor by reason\n of your accepting any such warranty or additional liability.\n\n END OF TERMS AND CONDITIONS\n\n APPENDIX: How to apply the Apache License to your work.\n\n To apply the Apache License to your work, attach the following\n boilerplate notice, with the fields enclosed by brackets \"[]\"\n replaced with your own identifying information. (Don't include\n the brackets!) The text should be enclosed in the appropriate\n comment syntax for the file format. We also recommend that a\n file or class name and description of purpose be included on the\n same \"printed page\" as the copyright notice for easier\n identification within third-party archives.\n\n Copyright [yyyy] [name of copyright owner]\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License." }, + { + "name": "github.com/blevesearch/geo", + "path": "github.com/blevesearch/geo/LICENSE", + "licenseText": "\n Apache License\n Version 2.0, January 2004\n http://www.apache.org/licenses/\n\n TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n 1. Definitions.\n\n \"License\" shall mean the terms and conditions for use, reproduction,\n and distribution as defined by Sections 1 through 9 of this document.\n\n \"Licensor\" shall mean the copyright owner or entity authorized by\n the copyright owner that is granting the License.\n\n \"Legal Entity\" shall mean the union of the acting entity and all\n other entities that control, are controlled by, or are under common\n control with that entity. For the purposes of this definition,\n \"control\" means (i) the power, direct or indirect, to cause the\n direction or management of such entity, whether by contract or\n otherwise, or (ii) ownership of fifty percent (50%) or more of the\n outstanding shares, or (iii) beneficial ownership of such entity.\n\n \"You\" (or \"Your\") shall mean an individual or Legal Entity\n exercising permissions granted by this License.\n\n \"Source\" form shall mean the preferred form for making modifications,\n including but not limited to software source code, documentation\n source, and configuration files.\n\n \"Object\" form shall mean any form resulting from mechanical\n transformation or translation of a Source form, including but\n not limited to compiled object code, generated documentation,\n and conversions to other media types.\n\n \"Work\" shall mean the work of authorship, whether in Source or\n Object form, made available under the License, as indicated by a\n copyright notice that is included in or attached to the work\n (an example is provided in the Appendix below).\n\n \"Derivative Works\" shall mean any work, whether in Source or Object\n form, that is based on (or derived from) the Work and for which the\n editorial revisions, annotations, elaborations, or other modifications\n represent, as a whole, an original work of authorship. For the purposes\n of this License, Derivative Works shall not include works that remain\n separable from, or merely link (or bind by name) to the interfaces of,\n the Work and Derivative Works thereof.\n\n \"Contribution\" shall mean any work of authorship, including\n the original version of the Work and any modifications or additions\n to that Work or Derivative Works thereof, that is intentionally\n submitted to Licensor for inclusion in the Work by the copyright owner\n or by an individual or Legal Entity authorized to submit on behalf of\n the copyright owner. For the purposes of this definition, \"submitted\"\n means any form of electronic, verbal, or written communication sent\n to the Licensor or its representatives, including but not limited to\n communication on electronic mailing lists, source code control systems,\n and issue tracking systems that are managed by, or on behalf of, the\n Licensor for the purpose of discussing and improving the Work, but\n excluding communication that is conspicuously marked or otherwise\n designated in writing by the copyright owner as \"Not a Contribution.\"\n\n \"Contributor\" shall mean Licensor and any individual or Legal Entity\n on behalf of whom a Contribution has been received by Licensor and\n subsequently incorporated within the Work.\n\n 2. Grant of Copyright License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n copyright license to reproduce, prepare Derivative Works of,\n publicly display, publicly perform, sublicense, and distribute the\n Work and such Derivative Works in Source or Object form.\n\n 3. Grant of Patent License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n (except as stated in this section) patent license to make, have made,\n use, offer to sell, sell, import, and otherwise transfer the Work,\n where such license applies only to those patent claims licensable\n by such Contributor that are necessarily infringed by their\n Contribution(s) alone or by combination of their Contribution(s)\n with the Work to which such Contribution(s) was submitted. If You\n institute patent litigation against any entity (including a\n cross-claim or counterclaim in a lawsuit) alleging that the Work\n or a Contribution incorporated within the Work constitutes direct\n or contributory patent infringement, then any patent licenses\n granted to You under this License for that Work shall terminate\n as of the date such litigation is filed.\n\n 4. Redistribution. You may reproduce and distribute copies of the\n Work or Derivative Works thereof in any medium, with or without\n modifications, and in Source or Object form, provided that You\n meet the following conditions:\n\n (a) You must give any other recipients of the Work or\n Derivative Works a copy of this License; and\n\n (b) You must cause any modified files to carry prominent notices\n stating that You changed the files; and\n\n (c) You must retain, in the Source form of any Derivative Works\n that You distribute, all copyright, patent, trademark, and\n attribution notices from the Source form of the Work,\n excluding those notices that do not pertain to any part of\n the Derivative Works; and\n\n (d) If the Work includes a \"NOTICE\" text file as part of its\n distribution, then any Derivative Works that You distribute must\n include a readable copy of the attribution notices contained\n within such NOTICE file, excluding those notices that do not\n pertain to any part of the Derivative Works, in at least one\n of the following places: within a NOTICE text file distributed\n as part of the Derivative Works; within the Source form or\n documentation, if provided along with the Derivative Works; or,\n within a display generated by the Derivative Works, if and\n wherever such third-party notices normally appear. The contents\n of the NOTICE file are for informational purposes only and\n do not modify the License. You may add Your own attribution\n notices within Derivative Works that You distribute, alongside\n or as an addendum to the NOTICE text from the Work, provided\n that such additional attribution notices cannot be construed\n as modifying the License.\n\n You may add Your own copyright statement to Your modifications and\n may provide additional or different license terms and conditions\n for use, reproduction, or distribution of Your modifications, or\n for any such Derivative Works as a whole, provided Your use,\n reproduction, and distribution of the Work otherwise complies with\n the conditions stated in this License.\n\n 5. Submission of Contributions. Unless You explicitly state otherwise,\n any Contribution intentionally submitted for inclusion in the Work\n by You to the Licensor shall be under the terms and conditions of\n this License, without any additional terms or conditions.\n Notwithstanding the above, nothing herein shall supersede or modify\n the terms of any separate license agreement you may have executed\n with Licensor regarding such Contributions.\n\n 6. Trademarks. This License does not grant permission to use the trade\n names, trademarks, service marks, or product names of the Licensor,\n except as required for reasonable and customary use in describing the\n origin of the Work and reproducing the content of the NOTICE file.\n\n 7. Disclaimer of Warranty. Unless required by applicable law or\n agreed to in writing, Licensor provides the Work (and each\n Contributor provides its Contributions) on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n implied, including, without limitation, any warranties or conditions\n of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n PARTICULAR PURPOSE. You are solely responsible for determining the\n appropriateness of using or redistributing the Work and assume any\n risks associated with Your exercise of permissions under this License.\n\n 8. Limitation of Liability. In no event and under no legal theory,\n whether in tort (including negligence), contract, or otherwise,\n unless required by applicable law (such as deliberate and grossly\n negligent acts) or agreed to in writing, shall any Contributor be\n liable to You for damages, including any direct, indirect, special,\n incidental, or consequential damages of any character arising as a\n result of this License or out of the use or inability to use the\n Work (including but not limited to damages for loss of goodwill,\n work stoppage, computer failure or malfunction, or any and all\n other commercial damages or losses), even if such Contributor\n has been advised of the possibility of such damages.\n\n 9. Accepting Warranty or Additional Liability. While redistributing\n the Work or Derivative Works thereof, You may choose to offer,\n and charge a fee for, acceptance of support, warranty, indemnity,\n or other liability obligations and/or rights consistent with this\n License. However, in accepting such obligations, You may act only\n on Your own behalf and on Your sole responsibility, not on behalf\n of any other Contributor, and only if You agree to indemnify,\n defend, and hold each Contributor harmless for any liability\n incurred by, or claims asserted against, such Contributor by reason\n of your accepting any such warranty or additional liability.\n\n END OF TERMS AND CONDITIONS\n\n APPENDIX: How to apply the Apache License to your work.\n\n To apply the Apache License to your work, attach the following\n boilerplate notice, with the fields enclosed by brackets \"[]\"\n replaced with your own identifying information. (Don't include\n the brackets!) The text should be enclosed in the appropriate\n comment syntax for the file format. We also recommend that a\n file or class name and description of purpose be included on the\n same \"printed page\" as the copyright notice for easier\n identification within third-party archives.\n\n Copyright [yyyy] [name of copyright owner]\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n" + }, { "name": "github.com/blevesearch/go-porterstemmer", "path": "github.com/blevesearch/go-porterstemmer/LICENSE", @@ -404,6 +409,11 @@ "path": "github.com/golang-sql/sqlexp/LICENSE", "licenseText": "Copyright (c) 2017 The Go Authors. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are\nmet:\n\n * Redistributions of source code must retain the above copyright\nnotice, this list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above\ncopyright notice, this list of conditions and the following disclaimer\nin the documentation and/or other materials provided with the\ndistribution.\n * Neither the name of Google Inc. nor the names of its\ncontributors may be used to endorse or promote products derived from\nthis software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\nOWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\nSPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\nDATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\nTHEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" }, + { + "name": "github.com/golang/geo", + "path": "github.com/golang/geo/LICENSE", + "licenseText": "\n Apache License\n Version 2.0, January 2004\n http://www.apache.org/licenses/\n\n TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n 1. Definitions.\n\n \"License\" shall mean the terms and conditions for use, reproduction,\n and distribution as defined by Sections 1 through 9 of this document.\n\n \"Licensor\" shall mean the copyright owner or entity authorized by\n the copyright owner that is granting the License.\n\n \"Legal Entity\" shall mean the union of the acting entity and all\n other entities that control, are controlled by, or are under common\n control with that entity. For the purposes of this definition,\n \"control\" means (i) the power, direct or indirect, to cause the\n direction or management of such entity, whether by contract or\n otherwise, or (ii) ownership of fifty percent (50%) or more of the\n outstanding shares, or (iii) beneficial ownership of such entity.\n\n \"You\" (or \"Your\") shall mean an individual or Legal Entity\n exercising permissions granted by this License.\n\n \"Source\" form shall mean the preferred form for making modifications,\n including but not limited to software source code, documentation\n source, and configuration files.\n\n \"Object\" form shall mean any form resulting from mechanical\n transformation or translation of a Source form, including but\n not limited to compiled object code, generated documentation,\n and conversions to other media types.\n\n \"Work\" shall mean the work of authorship, whether in Source or\n Object form, made available under the License, as indicated by a\n copyright notice that is included in or attached to the work\n (an example is provided in the Appendix below).\n\n \"Derivative Works\" shall mean any work, whether in Source or Object\n form, that is based on (or derived from) the Work and for which the\n editorial revisions, annotations, elaborations, or other modifications\n represent, as a whole, an original work of authorship. For the purposes\n of this License, Derivative Works shall not include works that remain\n separable from, or merely link (or bind by name) to the interfaces of,\n the Work and Derivative Works thereof.\n\n \"Contribution\" shall mean any work of authorship, including\n the original version of the Work and any modifications or additions\n to that Work or Derivative Works thereof, that is intentionally\n submitted to Licensor for inclusion in the Work by the copyright owner\n or by an individual or Legal Entity authorized to submit on behalf of\n the copyright owner. For the purposes of this definition, \"submitted\"\n means any form of electronic, verbal, or written communication sent\n to the Licensor or its representatives, including but not limited to\n communication on electronic mailing lists, source code control systems,\n and issue tracking systems that are managed by, or on behalf of, the\n Licensor for the purpose of discussing and improving the Work, but\n excluding communication that is conspicuously marked or otherwise\n designated in writing by the copyright owner as \"Not a Contribution.\"\n\n \"Contributor\" shall mean Licensor and any individual or Legal Entity\n on behalf of whom a Contribution has been received by Licensor and\n subsequently incorporated within the Work.\n\n 2. Grant of Copyright License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n copyright license to reproduce, prepare Derivative Works of,\n publicly display, publicly perform, sublicense, and distribute the\n Work and such Derivative Works in Source or Object form.\n\n 3. Grant of Patent License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n (except as stated in this section) patent license to make, have made,\n use, offer to sell, sell, import, and otherwise transfer the Work,\n where such license applies only to those patent claims licensable\n by such Contributor that are necessarily infringed by their\n Contribution(s) alone or by combination of their Contribution(s)\n with the Work to which such Contribution(s) was submitted. If You\n institute patent litigation against any entity (including a\n cross-claim or counterclaim in a lawsuit) alleging that the Work\n or a Contribution incorporated within the Work constitutes direct\n or contributory patent infringement, then any patent licenses\n granted to You under this License for that Work shall terminate\n as of the date such litigation is filed.\n\n 4. Redistribution. You may reproduce and distribute copies of the\n Work or Derivative Works thereof in any medium, with or without\n modifications, and in Source or Object form, provided that You\n meet the following conditions:\n\n (a) You must give any other recipients of the Work or\n Derivative Works a copy of this License; and\n\n (b) You must cause any modified files to carry prominent notices\n stating that You changed the files; and\n\n (c) You must retain, in the Source form of any Derivative Works\n that You distribute, all copyright, patent, trademark, and\n attribution notices from the Source form of the Work,\n excluding those notices that do not pertain to any part of\n the Derivative Works; and\n\n (d) If the Work includes a \"NOTICE\" text file as part of its\n distribution, then any Derivative Works that You distribute must\n include a readable copy of the attribution notices contained\n within such NOTICE file, excluding those notices that do not\n pertain to any part of the Derivative Works, in at least one\n of the following places: within a NOTICE text file distributed\n as part of the Derivative Works; within the Source form or\n documentation, if provided along with the Derivative Works; or,\n within a display generated by the Derivative Works, if and\n wherever such third-party notices normally appear. The contents\n of the NOTICE file are for informational purposes only and\n do not modify the License. You may add Your own attribution\n notices within Derivative Works that You distribute, alongside\n or as an addendum to the NOTICE text from the Work, provided\n that such additional attribution notices cannot be construed\n as modifying the License.\n\n You may add Your own copyright statement to Your modifications and\n may provide additional or different license terms and conditions\n for use, reproduction, or distribution of Your modifications, or\n for any such Derivative Works as a whole, provided Your use,\n reproduction, and distribution of the Work otherwise complies with\n the conditions stated in this License.\n\n 5. Submission of Contributions. Unless You explicitly state otherwise,\n any Contribution intentionally submitted for inclusion in the Work\n by You to the Licensor shall be under the terms and conditions of\n this License, without any additional terms or conditions.\n Notwithstanding the above, nothing herein shall supersede or modify\n the terms of any separate license agreement you may have executed\n with Licensor regarding such Contributions.\n\n 6. Trademarks. This License does not grant permission to use the trade\n names, trademarks, service marks, or product names of the Licensor,\n except as required for reasonable and customary use in describing the\n origin of the Work and reproducing the content of the NOTICE file.\n\n 7. Disclaimer of Warranty. Unless required by applicable law or\n agreed to in writing, Licensor provides the Work (and each\n Contributor provides its Contributions) on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n implied, including, without limitation, any warranties or conditions\n of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n PARTICULAR PURPOSE. You are solely responsible for determining the\n appropriateness of using or redistributing the Work and assume any\n risks associated with Your exercise of permissions under this License.\n\n 8. Limitation of Liability. In no event and under no legal theory,\n whether in tort (including negligence), contract, or otherwise,\n unless required by applicable law (such as deliberate and grossly\n negligent acts) or agreed to in writing, shall any Contributor be\n liable to You for damages, including any direct, indirect, special,\n incidental, or consequential damages of any character arising as a\n result of this License or out of the use or inability to use the\n Work (including but not limited to damages for loss of goodwill,\n work stoppage, computer failure or malfunction, or any and all\n other commercial damages or losses), even if such Contributor\n has been advised of the possibility of such damages.\n\n 9. Accepting Warranty or Additional Liability. While redistributing\n the Work or Derivative Works thereof, You may choose to offer,\n and charge a fee for, acceptance of support, warranty, indemnity,\n or other liability obligations and/or rights consistent with this\n License. However, in accepting such obligations, You may act only\n on Your own behalf and on Your sole responsibility, not on behalf\n of any other Contributor, and only if You agree to indemnify,\n defend, and hold each Contributor harmless for any liability\n incurred by, or claims asserted against, such Contributor by reason\n of your accepting any such warranty or additional liability.\n\n END OF TERMS AND CONDITIONS\n\n APPENDIX: How to apply the Apache License to your work.\n\n To apply the Apache License to your work, attach the following\n boilerplate notice, with the fields enclosed by brackets \"[]\"\n replaced with your own identifying information. (Don't include\n the brackets!) The text should be enclosed in the appropriate\n comment syntax for the file format. We also recommend that a\n file or class name and description of purpose be included on the\n same \"printed page\" as the copyright notice for easier\n identification within third-party archives.\n\n Copyright [yyyy] [name of copyright owner]\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n" + }, { "name": "github.com/golang/protobuf", "path": "github.com/golang/protobuf/LICENSE", @@ -785,8 +795,8 @@ "licenseText": "Copyright 2015 Yohann Coppel\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n" }, { - "name": "github.com/yuin/goldmark-highlighting", - "path": "github.com/yuin/goldmark-highlighting/LICENSE", + "name": "github.com/yuin/goldmark-highlighting/v2", + "path": "github.com/yuin/goldmark-highlighting/v2/LICENSE", "licenseText": "MIT License\n\nCopyright (c) 2019 Yusuke Inuzuka\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n" }, { diff --git a/templates/org/settings/applications_edit.tmpl b/templates/org/settings/applications_edit.tmpl index 6578a8d786b60..6e4324ec17368 100644 --- a/templates/org/settings/applications_edit.tmpl +++ b/templates/org/settings/applications_edit.tmpl @@ -54,14 +54,4 @@
- {{template "base/footer" .}} From 4031fa832b4ed00e4bdd1e6e1ff8c9db0638c007 Mon Sep 17 00:00:00 2001 From: qwerty287 Date: Wed, 5 Oct 2022 20:37:39 +0200 Subject: [PATCH 08/14] Remove dupl code on tmpls --- templates/org/settings/applications.tmpl | 56 +----------------- .../user/settings/applications_oauth2.tmpl | 57 +------------------ .../settings/applications_oauth2_list.tmpl | 56 ++++++++++++++++++ 3 files changed, 59 insertions(+), 110 deletions(-) create mode 100644 templates/user/settings/applications_oauth2_list.tmpl diff --git a/templates/org/settings/applications.tmpl b/templates/org/settings/applications.tmpl index 182908ad4b418..8bdd99deb8621 100644 --- a/templates/org/settings/applications.tmpl +++ b/templates/org/settings/applications.tmpl @@ -9,62 +9,8 @@

{{.locale.Tr "settings.applications"}}

-
- -
-
- {{.locale.Tr "settings.create_oauth2_application" }} -
-
- {{.CsrfTokenHtml}} -
- - -
-
- - -
- -
-
- -
+ {{template "user/settings/applications_oauth2_list" .}}
diff --git a/templates/user/settings/applications_oauth2.tmpl b/templates/user/settings/applications_oauth2.tmpl index 5e53ed00ca13f..47d8dfc2de3f8 100644 --- a/templates/user/settings/applications_oauth2.tmpl +++ b/templates/user/settings/applications_oauth2.tmpl @@ -1,59 +1,6 @@

{{.locale.Tr "settings.manage_oauth2_applications"}}

-
-
-
- {{.locale.Tr "settings.oauth2_application_create_description"}} -
- {{range $app := .Applications}} -
-
- - {{svg "octicon-pencil" 16 "mr-2"}} - {{$.locale.Tr "settings.oauth2_application_edit"}} - - -
-
- {{$app.Name}} -
-
- {{end}} -
-
-
-
- {{.locale.Tr "settings.create_oauth2_application"}} -
-
- {{.CsrfTokenHtml}} -
- - -
-
- - -
- -
-
- +{{template "user/settings/applications_oauth2_list" .}} + diff --git a/templates/user/settings/applications_oauth2_list.tmpl b/templates/user/settings/applications_oauth2_list.tmpl new file mode 100644 index 0000000000000..b5dbc5f4a79e9 --- /dev/null +++ b/templates/user/settings/applications_oauth2_list.tmpl @@ -0,0 +1,56 @@ +
+
+
+ {{.locale.Tr "settings.oauth2_application_create_description"}} +
+ {{range $app := .Applications}} +
+
+ + {{svg "octicon-pencil" 16 "mr-2"}} + {{$.locale.Tr "settings.oauth2_application_edit"}} + + +
+
+ {{$app.Name}} +
+
+ {{end}} +
+
+
+
+ {{.locale.Tr "settings.create_oauth2_application"}} +
+
+ {{.CsrfTokenHtml}} +
+ + +
+
+ + +
+ +
+
+ + From 6facd1eeef73e51ed47a89ebdb564fb35873362c Mon Sep 17 00:00:00 2001 From: qwerty287 Date: Wed, 5 Oct 2022 20:58:05 +0200 Subject: [PATCH 09/14] Fixes and move edit form to separate tmpl --- templates/org/settings/applications_edit.tmpl | 54 +--------------- .../settings/applications_oauth2_edit.tmpl | 62 +------------------ .../applications_oauth2_edit_form.tmpl | 51 +++++++++++++++ .../settings/applications_oauth2_list.tmpl | 6 +- 4 files changed, 57 insertions(+), 116 deletions(-) create mode 100644 templates/user/settings/applications_oauth2_edit_form.tmpl diff --git a/templates/org/settings/applications_edit.tmpl b/templates/org/settings/applications_edit.tmpl index 6e4324ec17368..51130614ef6dd 100644 --- a/templates/org/settings/applications_edit.tmpl +++ b/templates/org/settings/applications_edit.tmpl @@ -1,57 +1,7 @@ {{template "base/head" .}}
{{template "org/header" .}} -
-
- {{template "org/settings/navbar" .}} -
- {{template "base/alert" .}} -

- {{.locale.Tr "settings.edit_oauth2_application"}} -

-
- {{.CsrfTokenHtml}} -
- - -
- {{if .ClientSecret}} -
- - -
- {{else}} -
- - -
- {{end}} -
- {{.locale.Tr "settings.oauth2_regenerate_secret_hint"}} -
- {{.CsrfTokenHtml}} - {{.locale.Tr "settings.oauth2_regenerate_secret"}} -
-
-
-
-
- {{.CsrfTokenHtml}} -
- - -
-
- - -
- -
-
-
-
-
+ + {{template "user/settings/applications_oauth2_edit_form" .}}
{{template "base/footer" .}} diff --git a/templates/user/settings/applications_oauth2_edit.tmpl b/templates/user/settings/applications_oauth2_edit.tmpl index be3e78e46b8d2..eb40976fb1976 100644 --- a/templates/user/settings/applications_oauth2_edit.tmpl +++ b/templates/user/settings/applications_oauth2_edit.tmpl @@ -1,68 +1,8 @@ {{template "base/head" .}}
{{template "user/settings/navbar" .}} -
- {{template "base/alert" .}} -

- {{.locale.Tr "settings.edit_oauth2_application"}} -

-
-

{{.locale.Tr "settings.oauth2_application_create_description"}}

-
-
- {{.CsrfTokenHtml}} -
- - -
- {{if .ClientSecret}} -
- - -
- {{else}} -
- - -
- {{end}} -
- - {{.locale.Tr "settings.oauth2_regenerate_secret_hint"}} -
- {{.CsrfTokenHtml}} - {{.locale.Tr "settings.oauth2_regenerate_secret"}} -
-
-
-
-
- {{.CsrfTokenHtml}} -
- - -
-
- - -
- -
-
-
-
- {{template "base/footer" .}} diff --git a/templates/user/settings/applications_oauth2_edit_form.tmpl b/templates/user/settings/applications_oauth2_edit_form.tmpl new file mode 100644 index 0000000000000..31631d9f92373 --- /dev/null +++ b/templates/user/settings/applications_oauth2_edit_form.tmpl @@ -0,0 +1,51 @@ +
+ {{template "base/alert" .}} +

+ {{.locale.Tr "settings.edit_oauth2_application"}} +

+
+

{{.locale.Tr "settings.oauth2_application_create_description"}}

+
+
+ {{.CsrfTokenHtml}} +
+ + +
+ {{if .ClientSecret}} +
+ + +
+ {{else}} +
+ + +
+ {{end}} +
+ + {{.locale.Tr "settings.oauth2_regenerate_secret_hint"}} +
+ {{.CsrfTokenHtml}} + {{.locale.Tr "settings.oauth2_regenerate_secret"}} +
+
+
+
+
+ {{.CsrfTokenHtml}} +
+ + +
+
+ + +
+ +
+
+
diff --git a/templates/user/settings/applications_oauth2_list.tmpl b/templates/user/settings/applications_oauth2_list.tmpl index b5dbc5f4a79e9..be0553dcc4463 100644 --- a/templates/user/settings/applications_oauth2_list.tmpl +++ b/templates/user/settings/applications_oauth2_list.tmpl @@ -6,12 +6,12 @@ {{range $app := .Applications}}
- + {{svg "octicon-pencil" 16 "mr-2"}} {{$.locale.Tr "settings.oauth2_application_edit"}}
-
+ {{.CsrfTokenHtml}}
diff --git a/web_src/less/_base.less b/web_src/less/_base.less index a2c27acfdf093..c176fdcc44a39 100644 --- a/web_src/less/_base.less +++ b/web_src/less/_base.less @@ -1801,7 +1801,9 @@ a.ui.label:hover { border: 1px solid var(--color-light-border); color: var(--color-text); } - +.ui.tertiary.button { + border: none; +} .page-content .ui.button { box-shadow: none !important; } From 95d76860ce929bc921a9cdcadced59ba6f25a39c Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Thu, 6 Oct 2022 13:14:53 +0800 Subject: [PATCH 12/14] fix org application url --- routers/web/web.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/web/web.go b/routers/web/web.go index a18cef33bc7c6..832d2c4b1caac 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -665,7 +665,7 @@ func RegisterRoutes(m *web.Route) { m.Group("/applications", func() { m.Combo("").Get(org.Applications). Post(bindIgnErr(forms.EditOAuth2ApplicationForm{}), org.OAuthApplicationsPost) - m.Group("/{id}", func() { + m.Group("/oauth2/{id}", func() { m.Combo("").Get(org.OAuth2ApplicationShow).Post(bindIgnErr(forms.EditOAuth2ApplicationForm{}), org.OAuth2ApplicationEdit) m.Post("/regenerate_secret", org.OAuthApplicationsRegenerateSecret) m.Post("/delete", org.DeleteOAuth2Application) From c5123328675e367bc4a37d441ca04dd3990326ce Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Thu, 6 Oct 2022 13:31:15 +0800 Subject: [PATCH 13/14] fix links --- routers/web/org/setting_oauth2.go | 2 +- routers/web/user/setting/oauth2_common.go | 4 ++-- routers/web/web.go | 8 ++++---- templates/user/settings/applications_oauth2_list.tmpl | 7 +++---- templates/user/settings/grants_oauth2.tmpl | 3 +-- 5 files changed, 11 insertions(+), 13 deletions(-) diff --git a/routers/web/org/setting_oauth2.go b/routers/web/org/setting_oauth2.go index 61701e7646304..868111c39bfe5 100644 --- a/routers/web/org/setting_oauth2.go +++ b/routers/web/org/setting_oauth2.go @@ -1,11 +1,11 @@ package org import ( - "code.gitea.io/gitea/modules/base" "fmt" "net/http" "code.gitea.io/gitea/models/auth" + "code.gitea.io/gitea/modules/base" "code.gitea.io/gitea/modules/context" "code.gitea.io/gitea/modules/setting" user_setting "code.gitea.io/gitea/routers/web/user/setting" diff --git a/routers/web/user/setting/oauth2_common.go b/routers/web/user/setting/oauth2_common.go index 29c1fd49008b7..f02f6ab0419d9 100644 --- a/routers/web/user/setting/oauth2_common.go +++ b/routers/web/user/setting/oauth2_common.go @@ -129,7 +129,7 @@ func (oa *OAuth2CommonHandlers) RegenerateSecret(ctx *context.Context) { // DeleteApp deletes the given oauth2 application func (oa *OAuth2CommonHandlers) DeleteApp(ctx *context.Context) { - if err := auth.DeleteOAuth2Application(ctx.FormInt64("id"), oa.OwnerID); err != nil { + if err := auth.DeleteOAuth2Application(ctx.ParamsInt64("id"), oa.OwnerID); err != nil { ctx.ServerError("DeleteOAuth2Application", err) return } @@ -140,7 +140,7 @@ func (oa *OAuth2CommonHandlers) DeleteApp(ctx *context.Context) { // RevokeGrant revokes the grant func (oa *OAuth2CommonHandlers) RevokeGrant(ctx *context.Context) { - if err := auth.RevokeOAuth2Grant(ctx, ctx.FormInt64("id"), oa.OwnerID); err != nil { + if err := auth.RevokeOAuth2Grant(ctx, ctx.ParamsInt64("grantId"), oa.OwnerID); err != nil { ctx.ServerError("RevokeOAuth2Grant", err) return } diff --git a/routers/web/web.go b/routers/web/web.go index 832d2c4b1caac..656cd52b54b13 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -427,8 +427,8 @@ func RegisterRoutes(m *web.Route) { m.Post("/{id}", bindIgnErr(forms.EditOAuth2ApplicationForm{}), user_setting.OAuthApplicationsEdit) m.Post("/{id}/regenerate_secret", user_setting.OAuthApplicationsRegenerateSecret) m.Post("", bindIgnErr(forms.EditOAuth2ApplicationForm{}), user_setting.OAuthApplicationsPost) - m.Post("/delete", user_setting.DeleteOAuth2Application) - m.Post("/revoke", user_setting.RevokeOAuth2Grant) + m.Post("/{id}/delete", user_setting.DeleteOAuth2Application) + m.Post("/{id}/revoke/{grantId}", user_setting.RevokeOAuth2Grant) }) m.Combo("/applications").Get(user_setting.Applications). Post(bindIgnErr(forms.NewAccessTokenForm{}), user_setting.ApplicationsPost) @@ -663,8 +663,8 @@ func RegisterRoutes(m *web.Route) { m.Post("/avatar", bindIgnErr(forms.AvatarForm{}), org.SettingsAvatar) m.Post("/avatar/delete", org.SettingsDeleteAvatar) m.Group("/applications", func() { - m.Combo("").Get(org.Applications). - Post(bindIgnErr(forms.EditOAuth2ApplicationForm{}), org.OAuthApplicationsPost) + m.Get("", org.Applications) + m.Post("/oauth2", bindIgnErr(forms.EditOAuth2ApplicationForm{}), org.OAuthApplicationsPost) m.Group("/oauth2/{id}", func() { m.Combo("").Get(org.OAuth2ApplicationShow).Post(bindIgnErr(forms.EditOAuth2ApplicationForm{}), org.OAuth2ApplicationEdit) m.Post("/regenerate_secret", org.OAuthApplicationsRegenerateSecret) diff --git a/templates/user/settings/applications_oauth2_list.tmpl b/templates/user/settings/applications_oauth2_list.tmpl index be0553dcc4463..47d7ecfaa482a 100644 --- a/templates/user/settings/applications_oauth2_list.tmpl +++ b/templates/user/settings/applications_oauth2_list.tmpl @@ -6,13 +6,12 @@ {{range $app := .Applications}}
- + {{svg "octicon-pencil" 16 "mr-2"}} {{$.locale.Tr "settings.oauth2_application_edit"}} @@ -28,7 +27,7 @@
{{.locale.Tr "settings.create_oauth2_application"}}
- + {{.CsrfTokenHtml}}
diff --git a/templates/user/settings/grants_oauth2.tmpl b/templates/user/settings/grants_oauth2.tmpl index 40432c729b367..e67fd2d22257f 100644 --- a/templates/user/settings/grants_oauth2.tmpl +++ b/templates/user/settings/grants_oauth2.tmpl @@ -10,8 +10,7 @@
From e385e92cf85488564faac15eff55d0d374df973c Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Thu, 6 Oct 2022 13:52:06 +0800 Subject: [PATCH 14/14] fix lint --- routers/web/org/setting_oauth2.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/routers/web/org/setting_oauth2.go b/routers/web/org/setting_oauth2.go index 868111c39bfe5..47d1141f34ba7 100644 --- a/routers/web/org/setting_oauth2.go +++ b/routers/web/org/setting_oauth2.go @@ -1,3 +1,7 @@ +// Copyright 2022 The Gitea Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + package org import (