Documentation
¶
Index ¶
Constants ¶
View Source
const (
CookieNameFlash = "hypercommit_flash"
)
View Source
const (
CookieNameUserID = "hypercommit_user_id"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthService ¶
type AuthService interface {
HashPassword(password string) (string, error)
CheckPassword(password, hash string) bool
SetUserCookie(w http.ResponseWriter, r *http.Request, userID int64)
GetUserFromCookie(r *http.Request) (*models.User, error)
ClearUserCookie(w http.ResponseWriter)
}
func NewAuthService ¶
func NewAuthService(users repositories.UsersRepository, signingSecret string) AuthService
type FlashMessage ¶
type FlashMessage struct {
Type FlashType
}
type FlashService ¶
type FlashService interface {
Set(w http.ResponseWriter, r *http.Request, flashType FlashType)
Get(r *http.Request) *FlashMessage
Clear(w http.ResponseWriter)
}
func NewFlashService ¶
func NewFlashService() FlashService
type GitHubOAuthService ¶
type GitHubOAuthService interface {
GetAuthURL(state string) string
ExchangeCode(code string) (*oauth2.Token, error)
GetUserInfo(token *oauth2.Token) (*GitHubUser, error)
}
func NewGitHubOAuthService ¶
func NewGitHubOAuthService(clientID, clientSecret, callbackURL string) GitHubOAuthService
type GitHubUser ¶
type GitService ¶
type GitService interface {
ListBranches(repoPath string) ([]string, error)
GetDefaultBranch(repoPath string) (string, error)
ListTree(repoPath, ref, path string) ([]TreeEntry, error)
GetFileContent(repoPath, ref, path string) ([]byte, error)
IsFile(repoPath, ref, path string) (bool, error)
}
func NewGitService ¶
func NewGitService(reposBasePath string) GitService
Click to show internal directories.
Click to hide internal directories.