Documentation
¶
Index ¶
- Constants
- Variables
- func AddCategoryPage(w http.ResponseWriter, r *http.Request) error
- func AppendQueryParams(rawURL string, params ...string) string
- func AppendTab(bookmarks, name, text string) string
- 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 CategoryAddSaveAction(w http.ResponseWriter, r *http.Request) error
- func CategoryEditSaveAction(w http.ResponseWriter, r *http.Request) error
- func CategoryMoveBeforeAction(w http.ResponseWriter, r *http.Request) error
- func CategoryMoveEndAction(w http.ResponseWriter, r *http.Request) error
- func CategoryMoveNewColumnAction(w http.ResponseWriter, r *http.Request) error
- func ConfiguredProviderNames() []string
- 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 DefaultSessionKeyPath(writing bool) string
- func DisableCssColumnsAction(w http.ResponseWriter, r *http.Request) error
- func EditCategoryPage(w http.ResponseWriter, r *http.Request) error
- func EditPagePage(w http.ResponseWriter, r *http.Request) error
- func EditTabPage(w http.ResponseWriter, r *http.Request) error
- func EnableCssColumnsAction(w http.ResponseWriter, r *http.Request) error
- func ExtractCategoryByIndex(bookmarks string, index int) (string, error)
- func ExtractPage(bookmarks string, tabIdx, pageIdx int) (string, string, error)
- func ExtractTab(bookmarks, name string) (string, error)
- func ExtractTabByIndex(bookmarks string, idx int) (string, error)
- func FaviconProxyHandler(w http.ResponseWriter, r *http.Request)
- func GetAdjacentCommits(ctx context.Context, user string, token *oauth2.Token, ref, sha string) (string, string, error)
- 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 GitLoginAction(w http.ResponseWriter, r *http.Request) error
- func GitSignupAction(w http.ResponseWriter, r *http.Request) error
- func JoinURL(base, elem string) string
- func LoadEnvFile(path string) error
- func LoginWithProvider(w http.ResponseWriter, r *http.Request) error
- func MergeConfig(dst *Config, src Config)
- func MoveEntryAction(w http.ResponseWriter, r *http.Request) error
- func MovePageAction(w http.ResponseWriter, r *http.Request) error
- func MoveTabAction(w http.ResponseWriter, r *http.Request) error
- func NewFuncs(r *http.Request) template.FuncMap
- func NewSystemError(msg string, err error) error
- func NewUserError(msg string, err error) error
- func Oauth2CallbackPage(w http.ResponseWriter, r *http.Request) error
- func OpenDB() (*sql.DB, error)
- func PageEditSaveAction(w http.ResponseWriter, r *http.Request) error
- func PageFragmentFromIndex(pageStr string) string
- func ProviderNames() []string
- func RegisterProvider(p Provider)
- func ReplaceCategoryByIndex(bookmarks string, index int, newText string) (string, error)
- func ReplaceTab(bookmarks, name, newName, newText string) (string, error)
- func ReplaceTabByIndex(bookmarks string, idx int, newName, newText string) (string, error)
- func SP(s string) *string
- func SetProviderOrder(order []string)
- func SetVersion(pVersion, pCommit, pDate string)
- func SqlLoginAction(w http.ResponseWriter, r *http.Request) error
- func SqlSignupAction(w http.ResponseWriter, r *http.Request) error
- func StartEditMode(w http.ResponseWriter, r *http.Request) error
- func StopEditMode(w http.ResponseWriter, r *http.Request) error
- func TabEditHref(tab int, ref, name string) string
- func TabEditPath(tab int) string
- func TabEditSaveAction(w http.ResponseWriter, r *http.Request) error
- func TabFromRequest(r *http.Request) int
- func TabHref(tab int, ref string) string
- func TabPath(tab int) 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 AdjacentCommitProvider
- type BookmarkBlock
- type BookmarkCategory
- type BookmarkColumn
- type BookmarkEntry
- type BookmarkList
- func (b *BookmarkList) AddTab(t *BookmarkTab)
- func (b *BookmarkList) InsertTab(idx int, t *BookmarkTab)
- func (tabs BookmarkList) MoveCategory(fromIndex, toIndex int, newColumn bool, destPage *BookmarkPage, destCol int) error
- func (tabs BookmarkList) MoveCategoryBefore(fromIndex, beforeIndex int) error
- func (tabs BookmarkList) MoveCategoryNewColumn(fromIndex int, page *BookmarkPage, destCol int) error
- func (tabs BookmarkList) MoveCategoryToEnd(fromIndex int, page *BookmarkPage, colIdx int) error
- func (b BookmarkList) MoveTab(i, j int)
- func (b BookmarkList) Sha() string
- func (b BookmarkList) String() string
- func (b BookmarkList) SwitchTabs(i, j int)
- type BookmarkPage
- type BookmarkTab
- func (t *BookmarkTab) AddPage(p *BookmarkPage)
- func (t *BookmarkTab) DisplayName() string
- func (t *BookmarkTab) IndexName() string
- func (t *BookmarkTab) InsertPage(idx int, p *BookmarkPage)
- func (t *BookmarkTab) MovePage(i, j int)
- func (t *BookmarkTab) Sha() string
- func (t *BookmarkTab) String() string
- func (t *BookmarkTab) SwitchPages(i, j int)
- type Branch
- type Commit
- type Config
- type Configuration
- type ContextValues
- type CoreData
- type FavIcon
- type GitHubProvider
- func (GitHubProvider) Config(clientID, clientSecret, redirectURL string) *oauth2.Config
- 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, ref string, ...) ([]*Commit, error)
- func (p GitHubProvider) GetTags(ctx context.Context, user string, token *oauth2.Token) ([]*Tag, error)
- func (GitHubProvider) Name() string
- func (p GitHubProvider) RepoExists(ctx context.Context, user string, token *oauth2.Token, name string) (bool, error)
- func (p GitHubProvider) UpdateBookmarks(ctx context.Context, user string, token *oauth2.Token, ...) error
- type GitLabProvider
- func (GitLabProvider) Config(clientID, clientSecret, redirectURL string) *oauth2.Config
- 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, ref string, ...) ([]*Commit, error)
- func (GitLabProvider) GetTags(ctx context.Context, user string, token *oauth2.Token) ([]*Tag, error)
- func (GitLabProvider) Name() string
- func (p GitLabProvider) RepoExists(ctx context.Context, user string, token *oauth2.Token, name string) (bool, error)
- func (GitLabProvider) UpdateBookmarks(ctx context.Context, user string, token *oauth2.Token, ...) error
- type GitProvider
- func (GitProvider) AdjacentCommits(ctx context.Context, user string, token *oauth2.Token, ref, sha string) (string, string, error)
- func (GitProvider) CheckPassword(ctx context.Context, user, password string) (bool, error)
- func (GitProvider) Config(clientID, clientSecret, redirectURL string) *oauth2.Config
- func (GitProvider) CreateBookmarks(ctx context.Context, user string, token *oauth2.Token, branch, text string) error
- func (GitProvider) CreateRepo(ctx context.Context, user string, token *oauth2.Token, name string) error
- func (GitProvider) CreateUser(ctx context.Context, user, password string) error
- func (GitProvider) CurrentUser(ctx context.Context, token *oauth2.Token) (*User, error)
- func (GitProvider) DefaultServer() string
- func (GitProvider) GetBookmarks(ctx context.Context, user, ref string, token *oauth2.Token) (string, string, error)
- func (GitProvider) GetBranches(ctx context.Context, user string, token *oauth2.Token) ([]*Branch, error)
- func (GitProvider) GetCommits(ctx context.Context, user string, token *oauth2.Token, ref string, ...) ([]*Commit, error)
- func (GitProvider) GetTags(ctx context.Context, user string, token *oauth2.Token) ([]*Tag, error)
- func (GitProvider) Name() string
- func (GitProvider) RepoExists(ctx context.Context, user string, token *oauth2.Token, name string) (bool, error)
- func (GitProvider) SetPassword(ctx context.Context, user, password string) error
- func (GitProvider) UpdateBookmarks(ctx context.Context, user string, token *oauth2.Token, ...) error
- type PasswordHandler
- type Provider
- type ProviderCreds
- type SQLProvider
- func (p SQLProvider) AdjacentCommits(ctx context.Context, user string, token *oauth2.Token, ref, sha string) (string, string, error)
- func (p SQLProvider) CheckPassword(ctx context.Context, user, password string) (bool, error)
- func (SQLProvider) Config(clientID, clientSecret, redirectURL string) *oauth2.Config
- func (p SQLProvider) CreateBookmarks(ctx context.Context, user string, token *oauth2.Token, branch, text string) error
- func (p SQLProvider) CreateRepo(ctx context.Context, user string, token *oauth2.Token, name string) error
- func (p SQLProvider) CreateUser(ctx context.Context, user, password string) error
- func (SQLProvider) CurrentUser(ctx context.Context, token *oauth2.Token) (*User, error)
- func (SQLProvider) DefaultServer() string
- func (p SQLProvider) GetBookmarks(ctx context.Context, user, ref string, token *oauth2.Token) (string, string, error)
- func (p SQLProvider) GetBranches(ctx context.Context, user string, token *oauth2.Token) ([]*Branch, error)
- func (p SQLProvider) GetCommits(ctx context.Context, user string, token *oauth2.Token, ref string, ...) ([]*Commit, error)
- func (p SQLProvider) GetTags(ctx context.Context, user string, token *oauth2.Token) ([]*Tag, error)
- func (SQLProvider) Name() string
- func (p SQLProvider) RepoExists(ctx context.Context, user string, token *oauth2.Token, name string) (bool, error)
- func (p SQLProvider) SetPassword(ctx context.Context, user, password string) error
- func (p SQLProvider) UpdateBookmarks(ctx context.Context, user string, token *oauth2.Token, ...) error
- type SystemError
- type TabInfo
- type TabWithPages
- type Tag
- type User
- type UserError
Constants ¶
const ( DefaultFaviconCacheSize int64 = 20 * 1024 * 1024 // 20MB DefaultFaviconCacheMaxAge time.Duration = 24 * time.Hour DefaultCommitsPerPage int = 100 )
const ( TaskSave = "Save & Back" TaskSaveAndDone = "Save" TaskSaveAndStopEditing = "Save & Stop Editing" )
Variables ¶
var ( SessionStore sessions.Store SessionName string )
var ( UseCssColumns bool DevMode bool Namespace string SiteTitle string GithubServer string GitlabServer string GithubClientID string GithubClientSecret string GitlabClientID string GitlabClientSecret string OauthRedirectURL string FaviconCacheDir string FaviconCacheSize int64 LocalGitPath string DBConnectionProvider string DBConnectionString string CommitsPerPage int )
var ErrHandled = errors.New("handled")
ErrHandled is returned by handlers when they have already written a response and no further handlers should run.
var ErrNoProvider = errors.New("no provider selected")
ErrNoProvider indicates that no provider was selected for the request.
var ErrRepoNotFound = errors.New("repository not found")
ErrRepoNotFound indicates that the bookmarks repository does not exist.
var ErrSignedOut = errors.New("signed out")
ErrSignedOut indicates that the OAuth token is no longer valid and the user must authenticate again.
var ErrUserExists = errors.New("user already exists")
ErrUserExists indicates that a user already exists when attempting signup.
var ErrUserNotFound = errors.New("user not found")
ErrUserNotFound indicates that a user does not exist when attempting to set a password.
var ( FaviconCache = struct { sync.RWMutex cache map[string]*FavIcon }{/* contains filtered or unexported fields */} )
var RepoName = GetBookmarksRepoName()
Functions ¶
func AddCategoryPage ¶ added in v1.4.0
func AddCategoryPage(w http.ResponseWriter, r *http.Request) error
func AppendQueryParams ¶ added in v1.8.0
AppendQueryParams appends key/value query params to the provided URL string.
func BookmarksEditCreateAction ¶
func BookmarksEditCreateAction(w http.ResponseWriter, r *http.Request) error
func BookmarksEditSaveAction ¶
func BookmarksEditSaveAction(w http.ResponseWriter, r *http.Request) error
func CategoryAddSaveAction ¶ added in v1.4.0
func CategoryAddSaveAction(w http.ResponseWriter, r *http.Request) error
func CategoryEditSaveAction ¶ added in v1.0.16
func CategoryEditSaveAction(w http.ResponseWriter, r *http.Request) error
func CategoryMoveBeforeAction ¶ added in v1.3.0
func CategoryMoveBeforeAction(w http.ResponseWriter, r *http.Request) error
func CategoryMoveEndAction ¶ added in v1.3.0
func CategoryMoveEndAction(w http.ResponseWriter, r *http.Request) error
func CategoryMoveNewColumnAction ¶ added in v1.3.0
func CategoryMoveNewColumnAction(w http.ResponseWriter, r *http.Request) error
func ConfiguredProviderNames ¶ added in v1.3.0
func ConfiguredProviderNames() []string
ConfiguredProviderNames returns the list of providers that are both compiled in and configured for use. A provider is considered configured when providerCreds returns non-nil.
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 DefaultSessionKeyPath ¶ added in v1.3.0
DefaultSessionKeyPath returns the location of the session key file. User installs store it under XDG state or ~/.local/state. System-wide installations use /var/lib/gobookmarks/session.key. DefaultSessionKeyPath returns the path used to read or write the session key depending on the value of writing. When writing it chooses the path appropriate for the current user. When reading it checks the usual locations and returns the first existing file, falling back to the writing location if none are found.
func DisableCssColumnsAction ¶ added in v1.4.0
func DisableCssColumnsAction(w http.ResponseWriter, r *http.Request) error
DisableCssColumnsAction stores a session flag to use table layout.
func EditCategoryPage ¶ added in v1.0.16
func EditCategoryPage(w http.ResponseWriter, r *http.Request) error
func EditPagePage ¶ added in v1.3.0
func EditPagePage(w http.ResponseWriter, r *http.Request) error
func EditTabPage ¶ added in v1.0.24
func EditTabPage(w http.ResponseWriter, r *http.Request) error
func EnableCssColumnsAction ¶ added in v1.4.0
func EnableCssColumnsAction(w http.ResponseWriter, r *http.Request) error
EnableCssColumnsAction stores a session flag to use CSS column layout.
func ExtractCategoryByIndex ¶ added in v1.0.16
ExtractCategoryByIndex returns the category text for the nth category (0 based)
func ExtractPage ¶ added in v1.8.0
ExtractPage returns the text and name for a page located at tabIdx/pageIdx.
func ExtractTab ¶ added in v1.0.24
ExtractTab returns the text for a tab by name including the 'Tab:' line.
func ExtractTabByIndex ¶ added in v1.8.0
ExtractTabByIndex returns the text for a tab by position including the tab header if present.
func FaviconProxyHandler ¶ added in v1.0.4
func FaviconProxyHandler(w http.ResponseWriter, r *http.Request)
func GetAdjacentCommits ¶ added in v1.5.2
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 GitLoginAction ¶ added in v1.0.24
func GitLoginAction(w http.ResponseWriter, r *http.Request) error
func GitSignupAction ¶ added in v1.0.24
func GitSignupAction(w http.ResponseWriter, r *http.Request) error
func JoinURL ¶ added in v1.0.26
JoinURL joins base and elem ensuring there is exactly one slash between them. Additional leading or trailing slashes are removed from elem.
func LoadEnvFile ¶ added in v1.0.22
Lines should be in KEY=VALUE format and may be commented with '#'.
func LoginWithProvider ¶ added in v1.0.24
func LoginWithProvider(w http.ResponseWriter, r *http.Request) error
func MergeConfig ¶ added in v1.0.22
MergeConfig copies values from src into dst if they are non-zero.
func MoveEntryAction ¶ added in v1.3.0
func MoveEntryAction(w http.ResponseWriter, r *http.Request) error
func MovePageAction ¶ added in v1.3.0
func MovePageAction(w http.ResponseWriter, r *http.Request) error
func MoveTabAction ¶ added in v1.3.0
func MoveTabAction(w http.ResponseWriter, r *http.Request) error
func NewSystemError ¶ added in v1.5.3
NewSystemError creates a SystemError with the provided display message and underlying cause.
func NewUserError ¶ added in v1.5.3
NewUserError creates a UserError with the provided display message and underlying cause.
func Oauth2CallbackPage ¶
func Oauth2CallbackPage(w http.ResponseWriter, r *http.Request) error
func PageEditSaveAction ¶ added in v1.3.0
func PageEditSaveAction(w http.ResponseWriter, r *http.Request) error
func PageFragmentFromIndex ¶ added in v1.8.0
PageFragmentFromIndex converts a zero-based page index string to a 1-based fragment identifier.
func ProviderNames ¶ added in v1.0.22
func ProviderNames() []string
ProviderNames returns the list of registered provider names in the order set by SetProviderOrder. The returned slice should not be modified.
func RegisterProvider ¶ added in v1.0.22
func RegisterProvider(p Provider)
RegisterProvider registers a Provider by name. The order providers are registered is tracked but the final ordering returned by ProviderNames may be modified via SetProviderOrder.
func ReplaceCategoryByIndex ¶ added in v1.0.16
ReplaceCategoryByIndex replaces the nth category with newText
func ReplaceTab ¶ added in v1.0.24
ReplaceTab replaces the tab with name with newName and newText. newText should not include the leading 'Tab:' line.
func ReplaceTabByIndex ¶ added in v1.8.0
ReplaceTabByIndex replaces the tab at index idx with a new name and text. newText should not include the leading 'Tab:' line.
func SetProviderOrder ¶ added in v1.5.1
func SetProviderOrder(order []string)
SetProviderOrder updates the order in which providers are returned by ProviderNames. Names not recognized are ignored. Any registered providers not mentioned remain at the end in alphabetical order.
func SetVersion ¶ added in v1.0.6
func SetVersion(pVersion, pCommit, pDate string)
func SqlLoginAction ¶ added in v1.5.0
func SqlLoginAction(w http.ResponseWriter, r *http.Request) error
func SqlSignupAction ¶ added in v1.5.0
func SqlSignupAction(w http.ResponseWriter, r *http.Request) error
func StartEditMode ¶ added in v1.3.0
func StartEditMode(w http.ResponseWriter, r *http.Request) error
StartEditMode enables edit mode by adding an "edit=1" query parameter.
func StopEditMode ¶ added in v1.3.0
func StopEditMode(w http.ResponseWriter, r *http.Request) error
StopEditMode disables edit mode by removing the "edit" query parameter.
func TabEditHref ¶ added in v1.8.0
TabEditHref builds the link to edit a tab at the semantic path.
func TabEditPath ¶ added in v1.8.0
TabEditPath returns the edit endpoint for a tab index.
func TabEditSaveAction ¶ added in v1.0.24
func TabEditSaveAction(w http.ResponseWriter, r *http.Request) error
func TabFromRequest ¶ added in v1.8.0
TabFromRequest extracts the tab index from either the path parameters or the query string.
func TabPath ¶ added in v1.8.0
TabPath returns the semantic path for a tab index (0 is the root tab).
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 AdjacentCommitProvider ¶ added in v1.5.2
type AdjacentCommitProvider interface {
AdjacentCommits(ctx context.Context, user string, token *oauth2.Token, ref, sha string) (string, string, error)
}
AdjacentCommitProvider optionally provides methods to navigate commit history.
type BookmarkBlock ¶ added in v1.0.15
type BookmarkBlock struct {
Columns []*BookmarkColumn
HR bool
}
BookmarkBlock groups columns and optional horizontal rule.
func (*BookmarkBlock) Sha ¶ added in v1.3.0
func (b *BookmarkBlock) Sha() string
func (*BookmarkBlock) String ¶ added in v1.3.0
func (b *BookmarkBlock) String() string
String serializes the block.
type BookmarkCategory ¶
type BookmarkCategory struct {
Name string
Entries []*BookmarkEntry
Index int
}
BookmarkCategory groups entries together.
func (*BookmarkCategory) DisplayName ¶ added in v1.3.0
func (c *BookmarkCategory) DisplayName() string
DisplayName returns a useful name for the category.
func (*BookmarkCategory) MoveEntry ¶ added in v1.3.0
func (c *BookmarkCategory) MoveEntry(i, j int)
MoveEntry moves an entry within the category from index i to j.
func (*BookmarkCategory) Sha ¶ added in v1.3.0
func (c *BookmarkCategory) Sha() string
func (*BookmarkCategory) String ¶ added in v1.3.0
func (c *BookmarkCategory) String() string
String serializes the category.
type BookmarkColumn ¶
type BookmarkColumn struct {
Categories []*BookmarkCategory
}
BookmarkColumn contains a list of categories.
func (*BookmarkColumn) AddCategory ¶ added in v1.3.0
func (c *BookmarkColumn) AddCategory(cat *BookmarkCategory)
AddCategory appends a category to the column.
func (*BookmarkColumn) InsertCategory ¶ added in v1.3.0
func (c *BookmarkColumn) InsertCategory(idx int, cat *BookmarkCategory)
InsertCategory inserts a category at the given index.
func (*BookmarkColumn) Sha ¶ added in v1.3.0
func (c *BookmarkColumn) Sha() string
func (*BookmarkColumn) String ¶ added in v1.3.0
func (c *BookmarkColumn) String() string
String serializes the column.
func (*BookmarkColumn) SwitchCategories ¶ added in v1.3.0
func (c *BookmarkColumn) SwitchCategories(i, j int)
SwitchCategories swaps two categories in the column.
type BookmarkEntry ¶
BookmarkEntry represents a single link.
func (*BookmarkEntry) DisplayName ¶ added in v1.3.0
func (e *BookmarkEntry) DisplayName() string
DisplayName returns a useful name for the entry.
func (*BookmarkEntry) Sha ¶ added in v1.3.0
func (e *BookmarkEntry) Sha() string
func (*BookmarkEntry) String ¶ added in v1.3.0
func (e *BookmarkEntry) String() string
String serializes the entry.
type BookmarkList ¶ added in v1.3.0
type BookmarkList []*BookmarkTab
Bookmarks is a collection of tabs.
func ParseBookmarks ¶ added in v1.3.0
func ParseBookmarks(bookmarks string) BookmarkList
ParseBookmarks converts the textual bookmark representation into a BookmarkList structure.
func ValidateBookmarks ¶ added in v1.8.0
func ValidateBookmarks(bookmarks string) (BookmarkList, error)
ValidateBookmarks parses the provided text and ensures it contains at least one tab of bookmarks.
func (*BookmarkList) AddTab ¶ added in v1.3.0
func (b *BookmarkList) AddTab(t *BookmarkTab)
AddTab appends a tab to the list.
func (*BookmarkList) InsertTab ¶ added in v1.3.0
func (b *BookmarkList) InsertTab(idx int, t *BookmarkTab)
InsertTab inserts a tab at the given index.
func (BookmarkList) MoveCategory ¶ added in v1.3.0
func (tabs BookmarkList) MoveCategory(fromIndex, toIndex int, newColumn bool, destPage *BookmarkPage, destCol int) error
MoveCategory moves the category at fromIndex so it appears before toIndex. If toIndex equals the total number of categories, the item is moved to the end. When newColumn is true a new column directive is inserted before the moved category.
func (BookmarkList) MoveCategoryBefore ¶ added in v1.3.0
func (tabs BookmarkList) MoveCategoryBefore(fromIndex, beforeIndex int) error
MoveCategoryBefore moves the category at fromIndex so it appears before beforeIndex.
func (BookmarkList) MoveCategoryNewColumn ¶ added in v1.3.0
func (tabs BookmarkList) MoveCategoryNewColumn(fromIndex int, page *BookmarkPage, destCol int) error
MoveCategoryNewColumn moves the category into a new column inserted after the specified column index on the given page. When page is nil the category is moved to a new column on the last page. If destCol is negative the column is appended to the end of the page.
func (BookmarkList) MoveCategoryToEnd ¶ added in v1.3.0
func (tabs BookmarkList) MoveCategoryToEnd(fromIndex int, page *BookmarkPage, colIdx int) error
MoveCategoryToEnd moves the category to the end of the specified column.
func (BookmarkList) MoveTab ¶ added in v1.3.0
func (b BookmarkList) MoveTab(i, j int)
MoveTab moves a tab from index i to j in the list.
func (BookmarkList) Sha ¶ added in v1.3.0
func (b BookmarkList) Sha() string
func (BookmarkList) String ¶ added in v1.3.0
func (b BookmarkList) String() string
String serializes the bookmark list back into textual form.
func (BookmarkList) SwitchTabs ¶ added in v1.3.0
func (b BookmarkList) SwitchTabs(i, j int)
SwitchTabs swaps two tabs in the list.
type BookmarkPage ¶ added in v1.0.15
type BookmarkPage struct {
Blocks []*BookmarkBlock
Name string
}
BookmarkPage contains a number of blocks.
func FindPageBySha ¶ added in v1.3.0
func FindPageBySha(tabs BookmarkList, sha string) *BookmarkPage
FindPageBySha returns the page matching the sha.
func PageForCategory ¶ added in v1.3.0
func PageForCategory(tabs BookmarkList, index int) *BookmarkPage
PageForCategory returns the page containing the category with the given index.
func (*BookmarkPage) DisplayName ¶ added in v1.3.0
func (p *BookmarkPage) DisplayName() string
DisplayName returns a useful name for the page.
func (*BookmarkPage) IndexName ¶ added in v1.3.0
func (p *BookmarkPage) IndexName() string
IndexName returns a name suitable for the navigation index.
func (*BookmarkPage) IsEmpty ¶ added in v1.4.0
func (p *BookmarkPage) IsEmpty() bool
IsEmpty returns true if the page contains no categories.
func (*BookmarkPage) Sha ¶ added in v1.3.0
func (p *BookmarkPage) Sha() string
func (*BookmarkPage) String ¶ added in v1.3.0
func (p *BookmarkPage) String() string
String serializes the page (excluding the Page line).
type BookmarkTab ¶ added in v1.3.0
type BookmarkTab struct {
Name string
Pages []*BookmarkPage
}
BookmarkTab represents a tab of pages.
func (*BookmarkTab) AddPage ¶ added in v1.3.0
func (t *BookmarkTab) AddPage(p *BookmarkPage)
AddPage appends a page to the tab.
func (*BookmarkTab) DisplayName ¶ added in v1.3.0
func (t *BookmarkTab) DisplayName() string
DisplayName returns a useful name for the tab.
func (*BookmarkTab) IndexName ¶ added in v1.3.0
func (t *BookmarkTab) IndexName() string
IndexName returns a name suitable for the navigation index.
func (*BookmarkTab) InsertPage ¶ added in v1.3.0
func (t *BookmarkTab) InsertPage(idx int, p *BookmarkPage)
InsertPage inserts a page at the given index.
func (*BookmarkTab) MovePage ¶ added in v1.3.0
func (t *BookmarkTab) MovePage(i, j int)
MovePage moves a page from index i to j within the tab.
func (*BookmarkTab) Sha ¶ added in v1.3.0
func (t *BookmarkTab) Sha() string
func (*BookmarkTab) String ¶ added in v1.3.0
func (t *BookmarkTab) String() string
String serializes the tab including Tab/Page directives.
func (*BookmarkTab) SwitchPages ¶ added in v1.3.0
func (t *BookmarkTab) SwitchPages(i, j int)
SwitchPages swaps two pages within the tab.
type Commit ¶ added in v1.0.22
type Config ¶ added in v1.0.22
type Config struct {
GithubClientID string `json:"github_client_id"`
GithubSecret string `json:"github_secret"`
GitlabClientID string `json:"gitlab_client_id"`
GitlabSecret string `json:"gitlab_secret"`
ExternalURL string `json:"external_url"`
CssColumns bool `json:"css_columns"`
DevMode *bool `json:"dev_mode"`
Namespace string `json:"namespace"`
Title string `json:"title"`
GithubServer string `json:"github_server"`
GitlabServer string `json:"gitlab_server"`
FaviconCacheDir string `json:"favicon_cache_dir"`
FaviconCacheSize int64 `json:"favicon_cache_size"`
LocalGitPath string `json:"local_git_path"`
SessionKey string `json:"session_key"`
DBConnectionProvider string `json:"db_connection_provider"`
DBConnectionString string `json:"db_connection_string"`
ProviderOrder []string `json:"provider_order"`
CommitsPerPage int `json:"commits_per_page"`
}
Config holds runtime configuration values.
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) Config ¶ added in v1.0.24
func (GitHubProvider) Config(clientID, clientSecret, redirectURL string) *oauth2.Config
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) RepoExists ¶ added in v1.0.24
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 GitlabServer variable defined in settings.go.
func (GitLabProvider) Config ¶ added in v1.0.24
func (GitLabProvider) Config(clientID, clientSecret, redirectURL string) *oauth2.Config
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) RepoExists ¶ added in v1.0.24
func (GitLabProvider) UpdateBookmarks ¶ added in v1.0.22
type GitProvider ¶ added in v1.0.24
type GitProvider struct{}
GitProvider implements Provider using local git repositories.
func (GitProvider) AdjacentCommits ¶ added in v1.5.2
func (GitProvider) CheckPassword ¶ added in v1.0.24
CheckPassword verifies the provided password against the stored bcrypt hash.
func (GitProvider) Config ¶ added in v1.0.24
func (GitProvider) Config(clientID, clientSecret, redirectURL string) *oauth2.Config
func (GitProvider) CreateBookmarks ¶ added in v1.0.24
func (GitProvider) CreateRepo ¶ added in v1.0.24
func (GitProvider) CreateUser ¶ added in v1.0.24
func (GitProvider) CreateUser(ctx context.Context, user, password string) error
CreateUser writes a bcrypt hash for the given user. It returns ErrUserExists if the password file already exists.
func (GitProvider) CurrentUser ¶ added in v1.0.24
func (GitProvider) DefaultServer ¶ added in v1.0.24
func (GitProvider) DefaultServer() string
func (GitProvider) GetBookmarks ¶ added in v1.0.24
func (GitProvider) GetBranches ¶ added in v1.0.24
func (GitProvider) GetCommits ¶ added in v1.0.24
func (GitProvider) Name ¶ added in v1.0.24
func (GitProvider) Name() string
func (GitProvider) RepoExists ¶ added in v1.0.24
func (GitProvider) SetPassword ¶ added in v1.0.24
func (GitProvider) SetPassword(ctx context.Context, user, password string) error
SetPassword updates the password for an existing user. ErrUserNotFound is returned when no password file exists.
func (GitProvider) UpdateBookmarks ¶ added in v1.0.24
type PasswordHandler ¶ added in v1.0.24
type PasswordHandler interface {
CreateUser(ctx context.Context, user, password string) error
SetPassword(ctx context.Context, user, password string) error
CheckPassword(ctx context.Context, user, password string) (bool, error)
}
PasswordHandler is implemented by providers that manage passwords. PasswordHandler manages user accounts for providers that do not rely on external authentication.
CreateUser registers a new account and returns ErrUserExists if the user is already present. SetPassword updates the password for an existing user and returns ErrUserNotFound when the account does not exist.
type Provider ¶ added in v1.0.22
type Provider interface {
Name() string
Config(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, ref string, page, perPage int) ([]*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
RepoExists(ctx context.Context, user string, token *oauth2.Token, name string) (bool, error)
DefaultServer() string
}
func GetProvider ¶ added in v1.0.22
type ProviderCreds ¶ added in v1.0.24
type SQLProvider ¶ added in v1.5.0
type SQLProvider struct{}
func (SQLProvider) AdjacentCommits ¶ added in v1.5.2
func (SQLProvider) CheckPassword ¶ added in v1.5.0
func (SQLProvider) Config ¶ added in v1.5.0
func (SQLProvider) Config(clientID, clientSecret, redirectURL string) *oauth2.Config
func (SQLProvider) CreateBookmarks ¶ added in v1.5.0
func (SQLProvider) CreateRepo ¶ added in v1.5.0
func (SQLProvider) CreateUser ¶ added in v1.5.0
func (p SQLProvider) CreateUser(ctx context.Context, user, password string) error
func (SQLProvider) CurrentUser ¶ added in v1.5.0
func (SQLProvider) DefaultServer ¶ added in v1.5.0
func (SQLProvider) DefaultServer() string
func (SQLProvider) GetBookmarks ¶ added in v1.5.0
func (SQLProvider) GetBranches ¶ added in v1.5.0
func (SQLProvider) GetCommits ¶ added in v1.5.0
func (SQLProvider) Name ¶ added in v1.5.0
func (SQLProvider) Name() string
func (SQLProvider) RepoExists ¶ added in v1.5.0
func (SQLProvider) SetPassword ¶ added in v1.5.0
func (p SQLProvider) SetPassword(ctx context.Context, user, password string) error
func (SQLProvider) UpdateBookmarks ¶ added in v1.5.0
type SystemError ¶ added in v1.5.3
SystemError represents a server-side failure that prevents the request from completing. The message is shown on a dedicated error page while the underlying error is logged for debugging.
func (SystemError) Error ¶ added in v1.5.3
func (e SystemError) Error() string
func (SystemError) Unwrap ¶ added in v1.5.3
func (e SystemError) Unwrap() error
type TabInfo ¶ added in v1.3.0
type TabInfo struct {
Index int
Name string
IndexName string
Href string
EditHref string
LastPageSha string
}
TabInfo is used by templates to display tab navigation with indexes.
type TabWithPages ¶ added in v1.8.7
type TabWithPages struct {
TabInfo
Pages []*BookmarkPage
}
TabWithPages extends TabInfo with the tab's rendered pages.
type UserError ¶ added in v1.5.3
UserError wraps an error message intended for display to the user. It satisfies the error interface so it can be returned like a normal error. UserError describes an error that has a user facing message. The wrapped error can be inspected using errors.As/Is.
Source Files
¶
- authHandlers.go
- autoRefreshPage.go
- bookmarkActionHandlers.go
- bookmarkCategoryEdit.go
- bookmarkNames.go
- bookmarkPageEdit.go
- bookmarkTabEdit.go
- bookmark_model.go
- bookmark_sha.go
- categoryAddHandlers.go
- categoryEditHandlers.go
- config.go
- core.go
- data_embedded.go
- db.go
- devHandlers.go
- editModeHandlers.go
- errors.go
- faviconProxy.go
- funcs.go
- moveHandlers.go
- pageEditHandlers.go
- pointer_utils.go
- provider.go
- provider_access.go
- provider_git.go
- provider_github.go
- provider_gitlab.go
- provider_sql.go
- repo.go
- session_utils.go
- settings.go
- tabEditHandlers.go
- tab_utils.go
- tasks.go
- urlutils.go











