Documentation
¶
Index ¶
- Variables
- func BP(b bool) *bool
- func Bookmarks(r *http.Request) (string, error)
- func BookmarksEditCreateAction(w http.ResponseWriter, r *http.Request) error
- func BookmarksEditSaveAction(w http.ResponseWriter, r *http.Request) error
- func BookmarksExist(r *http.Request) (bool, error)
- func CategoryEditSaveAction(w http.ResponseWriter, r *http.Request) error
- func CoreAdderMiddleware(next http.Handler) http.Handler
- func CreateBookmarks(ctx context.Context, user string, token *oauth2.Token, branch, text string) error
- func DefaultConfigPath() string
- func EditCategoryPage(w http.ResponseWriter, r *http.Request) error
- func ExtractCategoryByIndex(bookmarks string, index int) (string, error)
- func FaviconProxyHandler(w http.ResponseWriter, r *http.Request)
- func GetBookmarks(ctx context.Context, user, ref string, token *oauth2.Token) (string, string, error)
- func GetBookmarksRepoName() string
- func GetCompiledTemplates(funcs template.FuncMap) *template.Template
- func GetFavicon() []byte
- func GetMainCSSData() []byte
- func LoadEnvFile(path string) error
- func MergeConfig(dst *Config, src Config)
- func NewFuncs(r *http.Request) template.FuncMap
- func Oauth2CallbackPage(w http.ResponseWriter, r *http.Request) error
- func ProviderNames() []string
- func RegisterProvider(p Provider)
- func ReplaceCategoryByIndex(bookmarks string, index int, newText string) (string, error)
- func SP(s string) *string
- func SetProviderByName(name string) bool
- func SetVersion(pVersion, pCommit, pDate string)
- func TaskDoneAutoRefreshPage(w http.ResponseWriter, r *http.Request) error
- func UpdateBookmarks(ctx context.Context, user string, token *oauth2.Token, ...) error
- func UserAdderMiddleware(next http.Handler) http.Handler
- func UserLogoutAction(w http.ResponseWriter, r *http.Request) error
- type BookmarkBlock
- type BookmarkCategory
- type BookmarkColumn
- type BookmarkEntry
- type BookmarkPage
- type Branch
- type Commit
- type Config
- type Configuration
- type ContextValues
- type CoreData
- type FavIcon
- type GitHubProvider
- func (p GitHubProvider) CreateBookmarks(ctx context.Context, user string, token *oauth2.Token, branch, text string) error
- func (p GitHubProvider) CreateRepo(ctx context.Context, user string, token *oauth2.Token, name string) error
- func (p GitHubProvider) CurrentUser(ctx context.Context, token *oauth2.Token) (*User, error)
- func (GitHubProvider) DefaultServer() string
- func (p GitHubProvider) GetBookmarks(ctx context.Context, user, ref string, token *oauth2.Token) (string, string, error)
- func (p GitHubProvider) GetBranches(ctx context.Context, user string, token *oauth2.Token) ([]*Branch, error)
- func (p GitHubProvider) GetCommits(ctx context.Context, user string, token *oauth2.Token) ([]*Commit, error)
- func (p GitHubProvider) GetTags(ctx context.Context, user string, token *oauth2.Token) ([]*Tag, error)
- func (GitHubProvider) Name() string
- func (GitHubProvider) OAuth2Config(clientID, clientSecret, redirectURL string) *oauth2.Config
- func (p GitHubProvider) UpdateBookmarks(ctx context.Context, user string, token *oauth2.Token, ...) error
- type GitLabProvider
- func (GitLabProvider) CreateBookmarks(ctx context.Context, user string, token *oauth2.Token, branch, text string) error
- func (p GitLabProvider) CreateRepo(ctx context.Context, user string, token *oauth2.Token, name string) error
- func (GitLabProvider) CurrentUser(ctx context.Context, token *oauth2.Token) (*User, error)
- func (GitLabProvider) DefaultServer() string
- func (GitLabProvider) GetBookmarks(ctx context.Context, user, ref string, token *oauth2.Token) (string, string, error)
- func (GitLabProvider) GetBranches(ctx context.Context, user string, token *oauth2.Token) ([]*Branch, error)
- func (GitLabProvider) GetCommits(ctx context.Context, user string, token *oauth2.Token) ([]*Commit, error)
- func (GitLabProvider) GetTags(ctx context.Context, user string, token *oauth2.Token) ([]*Tag, error)
- func (GitLabProvider) Name() string
- func (GitLabProvider) OAuth2Config(clientID, clientSecret, redirectURL string) *oauth2.Config
- func (GitLabProvider) UpdateBookmarks(ctx context.Context, user string, token *oauth2.Token, ...) error
- type Provider
- type Tag
- type User
Constants ¶
This section is empty.
Variables ¶
var ( UseCssColumns bool Namespace string SiteTitle string GitServer string )
var ErrHandled = errors.New("handled")
ErrHandled is returned by handlers when they have already written a response and no further handlers should run.
var ErrRepoNotFound = errors.New("repository not found")
ErrRepoNotFound indicates that the bookmarks repository does not exist.
var ( FaviconCache = struct { sync.RWMutex cache map[string]*FavIcon }{/* contains filtered or unexported fields */} )
var RepoName = GetBookmarksRepoName()
Functions ¶
func BookmarksEditCreateAction ¶
func BookmarksEditCreateAction(w http.ResponseWriter, r *http.Request) error
func BookmarksEditSaveAction ¶
func BookmarksEditSaveAction(w http.ResponseWriter, r *http.Request) error
func CategoryEditSaveAction ¶ added in v1.0.16
func CategoryEditSaveAction(w http.ResponseWriter, r *http.Request) error
func CreateBookmarks ¶
func DefaultConfigPath ¶ added in v1.0.22
func DefaultConfigPath() string
DefaultConfigPath returns the path to the config file depending on environment and the effective user. If running as a non-root user and XDG variables are set, the config lives under the XDG config directory. Otherwise it falls back to /etc/gobookmarks/config.json.
func EditCategoryPage ¶ added in v1.0.16
func EditCategoryPage(w http.ResponseWriter, r *http.Request) error
func ExtractCategoryByIndex ¶ added in v1.0.16
ExtractCategoryByIndex returns the category text for the nth category (0 based)
func FaviconProxyHandler ¶ added in v1.0.4
func FaviconProxyHandler(w http.ResponseWriter, r *http.Request)
func GetBookmarks ¶
func GetBookmarksRepoName ¶ added in v1.0.2
func GetBookmarksRepoName() string
GetBookmarksRepoName returns the repository name based on the current configuration and build mode. When running a development build the name is suffixed with "-dev". The Namespace value is appended if supplied.
func GetFavicon ¶
func GetFavicon() []byte
func GetMainCSSData ¶
func GetMainCSSData() []byte
func LoadEnvFile ¶ added in v1.0.22
Lines should be in KEY=VALUE format and may be commented with '#'.
func MergeConfig ¶ added in v1.0.22
MergeConfig copies values from src into dst if they are non-zero.
func Oauth2CallbackPage ¶
func Oauth2CallbackPage(w http.ResponseWriter, r *http.Request) error
func ProviderNames ¶ added in v1.0.22
func ProviderNames() []string
func RegisterProvider ¶ added in v1.0.22
func RegisterProvider(p Provider)
func ReplaceCategoryByIndex ¶ added in v1.0.16
ReplaceCategoryByIndex replaces the nth category with newText
func SetProviderByName ¶ added in v1.0.22
SetProviderByName activates the named provider. It returns true if the provider exists.
func SetVersion ¶ added in v1.0.6
func SetVersion(pVersion, pCommit, pDate string)
func TaskDoneAutoRefreshPage ¶
func TaskDoneAutoRefreshPage(w http.ResponseWriter, r *http.Request) error
func UpdateBookmarks ¶
func UserLogoutAction ¶
func UserLogoutAction(w http.ResponseWriter, r *http.Request) error
Types ¶
type BookmarkBlock ¶ added in v1.0.15
type BookmarkBlock struct {
Columns []*BookmarkColumn
HR bool
}
type BookmarkCategory ¶
type BookmarkCategory struct {
Name string
Entries []*BookmarkEntry
Index int
}
type BookmarkColumn ¶
type BookmarkColumn struct {
Categories []*BookmarkCategory
}
type BookmarkEntry ¶
type BookmarkPage ¶ added in v1.0.15
type BookmarkPage struct {
Blocks []*BookmarkBlock
}
func PreprocessBookmarks ¶
func PreprocessBookmarks(bookmarks string) []*BookmarkPage
type Commit ¶ added in v1.0.22
type Config ¶ added in v1.0.22
type Config struct {
Oauth2ClientID string `json:"oauth2_client_id"`
Provider string `json:"provider"`
Oauth2Secret string `json:"oauth2_secret"`
ExternalURL string `json:"external_url"`
CssColumns bool `json:"css_columns"`
Namespace string `json:"namespace"`
Title string `json:"title"`
GitServer string `json:"git_server"`
}
Config holds runtime configuration values.
func LoadConfigFile ¶ added in v1.0.22
LoadConfigFile loads configuration from the given path if it exists.
type Configuration ¶
type Configuration struct {
// contains filtered or unexported fields
}
type ContextValues ¶
type ContextValues string
type GitHubProvider ¶ added in v1.0.22
type GitHubProvider struct{}
GitHubProvider implements Provider for GitHub.
func (GitHubProvider) CreateBookmarks ¶ added in v1.0.22
func (GitHubProvider) CreateRepo ¶ added in v1.0.23
func (GitHubProvider) CurrentUser ¶ added in v1.0.22
func (GitHubProvider) DefaultServer ¶ added in v1.0.23
func (GitHubProvider) DefaultServer() string
func (GitHubProvider) GetBookmarks ¶ added in v1.0.22
func (GitHubProvider) GetBranches ¶ added in v1.0.22
func (GitHubProvider) GetCommits ¶ added in v1.0.22
func (GitHubProvider) Name ¶ added in v1.0.22
func (GitHubProvider) Name() string
func (GitHubProvider) OAuth2Config ¶ added in v1.0.22
func (GitHubProvider) OAuth2Config(clientID, clientSecret, redirectURL string) *oauth2.Config
func (GitHubProvider) UpdateBookmarks ¶ added in v1.0.22
type GitLabProvider ¶ added in v1.0.22
type GitLabProvider struct{}
GitLabProvider implements Provider for GitLab.
The GitLab server URL can be overridden using the GitServer variable defined in settings.go.
func (GitLabProvider) CreateBookmarks ¶ added in v1.0.22
func (GitLabProvider) CreateRepo ¶ added in v1.0.23
func (GitLabProvider) CurrentUser ¶ added in v1.0.22
func (GitLabProvider) DefaultServer ¶ added in v1.0.23
func (GitLabProvider) DefaultServer() string
func (GitLabProvider) GetBookmarks ¶ added in v1.0.22
func (GitLabProvider) GetBranches ¶ added in v1.0.22
func (GitLabProvider) GetCommits ¶ added in v1.0.22
func (GitLabProvider) Name ¶ added in v1.0.22
func (GitLabProvider) Name() string
func (GitLabProvider) OAuth2Config ¶ added in v1.0.22
func (GitLabProvider) OAuth2Config(clientID, clientSecret, redirectURL string) *oauth2.Config
func (GitLabProvider) UpdateBookmarks ¶ added in v1.0.22
type Provider ¶ added in v1.0.22
type Provider interface {
Name() string
OAuth2Config(clientID, clientSecret, redirectURL string) *oauth2.Config
CurrentUser(ctx context.Context, token *oauth2.Token) (*User, error)
GetTags(ctx context.Context, user string, token *oauth2.Token) ([]*Tag, error)
GetBranches(ctx context.Context, user string, token *oauth2.Token) ([]*Branch, error)
GetCommits(ctx context.Context, user string, token *oauth2.Token) ([]*Commit, error)
GetBookmarks(ctx context.Context, user, ref string, token *oauth2.Token) (string, string, error)
UpdateBookmarks(ctx context.Context, user string, token *oauth2.Token, sourceRef, branch, text, expectSHA string) error
CreateBookmarks(ctx context.Context, user string, token *oauth2.Token, branch, text string) error
CreateRepo(ctx context.Context, user string, token *oauth2.Token, name string) error
DefaultServer() string
}
var ActiveProvider Provider


3. Goto the URL this app is deployed at, your private instance or: 

