]> source.dussan.org Git - gitea.git/commitdiff
CLI support for OAuth sources custom icons (#14166)
authorDaniil Pankratov <mobigod0@gmail.com>
Mon, 28 Dec 2020 08:39:12 +0000 (11:39 +0300)
committerGitHub <noreply@github.com>
Mon, 28 Dec 2020 08:39:12 +0000 (09:39 +0100)
Co-authored-by: Daniil Pankratov <daniil.pankratov@t-systems.com>
cmd/admin.go
docs/content/doc/usage/command-line.en-us.md

index 25faaae188610c831941017590409674c32fb9d0..b4e0c3cb5ee6b6de63e907757638ca6fa3d7903b 100644 (file)
@@ -282,6 +282,11 @@ var (
                        Value: "",
                        Usage: "Use a custom Email URL (option for GitHub)",
                },
+               cli.StringFlag{
+                       Name:  "icon-url",
+                       Value: "",
+                       Usage: "Custom icon URL for OAuth2 login source",
+               },
        }
 
        microcmdAuthUpdateOauth = cli.Command{
@@ -606,6 +611,7 @@ func parseOAuth2Config(c *cli.Context) *models.OAuth2Config {
                ClientSecret:                  c.String("secret"),
                OpenIDConnectAutoDiscoveryURL: c.String("auto-discover-url"),
                CustomURLMapping:              customURLMapping,
+               IconURL:                       c.String("icon-url"),
        }
 }
 
@@ -658,6 +664,10 @@ func runUpdateOauth(c *cli.Context) error {
                oAuth2Config.OpenIDConnectAutoDiscoveryURL = c.String("auto-discover-url")
        }
 
+       if c.IsSet("icon-url") {
+               oAuth2Config.IconURL = c.String("icon-url")
+       }
+
        // update custom URL mapping
        var customURLMapping = &oauth2.CustomURLMapping{}
 
index 98d047fb489e674ffc2f6902bb6987e5e2432f5c..192eaa2c5aa46997a1f1e3256ac8ff2e54ac898d 100644 (file)
@@ -114,6 +114,7 @@ Admin operations:
         - `--custom-token-url`: Use a custom Token URL (option for GitLab/GitHub).
         - `--custom-profile-url`: Use a custom Profile URL (option for GitLab/GitHub).
         - `--custom-email-url`: Use a custom Email URL (option for GitHub).
+        - `--icon-url`: Custom icon URL for OAuth2 login source.
       - Examples:
         - `gitea admin auth add-oauth --name external-github --provider github --key OBTAIN_FROM_SOURCE --secret OBTAIN_FROM_SOURCE`
     - `update-oauth`:
@@ -129,6 +130,7 @@ Admin operations:
         - `--custom-token-url`: Use a custom Token URL (option for GitLab/GitHub).
         - `--custom-profile-url`: Use a custom Profile URL (option for GitLab/GitHub).
         - `--custom-email-url`: Use a custom Email URL (option for GitHub).
+        - `--icon-url`: Custom icon URL for OAuth2 login source.
       - Examples:
         - `gitea admin auth update-oauth --id 1 --name external-github-updated`
     - `add-ldap`: Add new LDAP (via Bind DN) authentication source
@@ -465,4 +467,4 @@ Restore-repo restore repository data from disk dir:
   - `--repo_dir dir`, `-r dir`: Repository dir path to restore from
   - `--owner_name lunny`: Restore destination owner name
   - `--repo_name tango`: Restore destination repository name
-  - `--units <units>`: Which items will be restored, one or more units should be separated as comma. wiki, issues, labels, releases, release_assets, milestones, pull_requests, comments are allowed. Empty means all units.
\ No newline at end of file
+  - `--units <units>`: Which items will be restored, one or more units should be separated as comma. wiki, issues, labels, releases, release_assets, milestones, pull_requests, comments are allowed. Empty means all units.