c572fcfe04
Rename the Go module path from code.gitea.io/gitea to git.mokoconsulting.tech/MokoConsulting/MokoGitea across the entire codebase. Scope: - go.mod module declaration - 2,235 Go source files (import paths) - Dockerfile WORKDIR and COPY paths - Swagger API templates - golangci.yml linter config External dependencies (code.gitea.io/gitea-vet, code.gitea.io/sdk/gitea, gitea.com/gitea/act, etc.) are intentionally NOT renamed — they are separate upstream modules. Closes #132 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
59 lines
1.4 KiB
Go
59 lines
1.4 KiB
Go
// Copyright 2021 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package oauth2
|
|
|
|
import (
|
|
"html/template"
|
|
|
|
"git.mokoconsulting.tech/MokoConsulting/MokoGitea/modules/log"
|
|
"git.mokoconsulting.tech/MokoConsulting/MokoGitea/modules/svg"
|
|
)
|
|
|
|
// BaseProvider represents a common base for Provider
|
|
type BaseProvider struct {
|
|
name string
|
|
displayName string
|
|
|
|
// TODO: maybe some providers also support SSH public keys, then they can set this to true
|
|
supportSSHPublicKey bool
|
|
}
|
|
|
|
func (b *BaseProvider) SupportSSHPublicKey() bool {
|
|
return b.supportSSHPublicKey
|
|
}
|
|
|
|
// Name provides the technical name for this provider
|
|
func (b *BaseProvider) Name() string {
|
|
return b.name
|
|
}
|
|
|
|
// DisplayName returns the friendly name for this provider
|
|
func (b *BaseProvider) DisplayName() string {
|
|
return b.displayName
|
|
}
|
|
|
|
// IconHTML returns icon HTML for this provider
|
|
func (b *BaseProvider) IconHTML(size int) template.HTML {
|
|
svgName := "gitea-" + b.name
|
|
switch b.name {
|
|
case "gplus":
|
|
svgName = "gitea-google"
|
|
case "github":
|
|
svgName = "octicon-mark-github"
|
|
}
|
|
svgHTML := svg.RenderHTML(svgName, size)
|
|
if svgHTML == "" {
|
|
log.Error("No SVG icon for oauth2 provider %q", b.name)
|
|
svgHTML = svg.RenderHTML("gitea-openid", size)
|
|
}
|
|
return svgHTML
|
|
}
|
|
|
|
// CustomURLSettings returns the custom url settings for this provider
|
|
func (b *BaseProvider) CustomURLSettings() *CustomURLSettings {
|
|
return nil
|
|
}
|
|
|
|
var _ Provider = &BaseProvider{}
|