Documentation
¶
Index ¶
- Constants
- Variables
- func CleanupSnapshot(snapshotRoot string) error
- func CodeLanguageForName(name string) string
- func CreateSnapshot(paths StatePaths, shareID string, sourcePath string, isDir bool) (string, error)
- func EnsurePrivateFile(path string) error
- func ExternalShareBaseURL(publicPort int) (string, error)
- func GenerateShareID() (string, error)
- func LoadOrCreateSecret(path string) ([]byte, error)
- func LocalTailscaleIPv4() (string, error)
- func LocalTailscaleMagicDNS() (string, error)
- func RenderDirectoryPage(title string, entries []DirEntry, breadcrumbs []Breadcrumb) (string, error)
- func RenderMarkdownDocument(source []byte) (string, map[string]any, error)
- func RenderMarkdownPreviewPage(title string, rendered string, rawURL string, breadcrumbs []Breadcrumb, ...) (string, error)
- func RenderPreviewPage(baseName string, kind PreviewKind, rawURL string, breadcrumbs []Breadcrumb) string
- func ResolveScopedPath(root string, rel string) (string, error)
- func RewriteMarkdownLinks(rendered string, currentRel string, resolver markdownLinkResolver) (string, error)
- func RewriteServePreviewImageSources(rendered string, externalBase string) (string, error)
- func ShareToken(secret []byte, shareID string, tokenBytes int) string
- func ValidateMode(mode string) string
- func ValidateShareToken(secret []byte, shareID string, token string, tokenBytes int) bool
- type Breadcrumb
- type Client
- func (c *Client) CreateShare(req CreateShareRequest) (ShareResponse, error)
- func (c *Client) GetShare(id string) (ShareResponse, error)
- func (c *Client) Health() error
- func (c *Client) ListShares() ([]ShareResponse, error)
- func (c *Client) RenewShare(id string, expiresIn time.Duration) (ShareResponse, error)
- func (c *Client) RevokeShare(id string) error
- type CreateShareRequest
- type Daemon
- type DaemonConfig
- type DirEntry
- type MarkdownDirectoryShareAnalysis
- type MarkdownPreviewField
- type MarkdownPreviewTag
- type PreviewKind
- type RenewShareRequest
- type Share
- type ShareResponse
- type StatePaths
- type Store
- func (s *Store) Close() error
- func (s *Store) CreateShare(share Share) error
- func (s *Store) ExpiredShares(now time.Time) ([]Share, error)
- func (s *Store) GetShare(id string) (Share, error)
- func (s *Store) ListShares(activeOnly bool) ([]Share, error)
- func (s *Store) RenewShare(id string, expiresAt time.Time) error
- func (s *Store) RevokeShare(id string) error
- func (s *Store) RevokeSharesByPath(absPath string) (int64, error)
- func (s *Store) TouchLastServed(id string, ts time.Time) error
Constants ¶
View Source
const ( ModeLive = "live" ModeSnapshot = "snapshot" )
View Source
const ( DefaultAdminAddr = "127.0.0.1:39125" DefaultPublicPort = 39124 )
View Source
const DefaultTokenBytes = 8
Variables ¶
View Source
var ErrNotFound = errors.New("not found")
Functions ¶
func CleanupSnapshot ¶
func CodeLanguageForName ¶
func CreateSnapshot ¶
func EnsurePrivateFile ¶
func ExternalShareBaseURL ¶
func GenerateShareID ¶
func LoadOrCreateSecret ¶
func LocalTailscaleIPv4 ¶
func LocalTailscaleMagicDNS ¶
func RenderDirectoryPage ¶
func RenderDirectoryPage(title string, entries []DirEntry, breadcrumbs []Breadcrumb) (string, error)
func RenderMarkdownDocument ¶
func RenderPreviewPage ¶
func RenderPreviewPage(baseName string, kind PreviewKind, rawURL string, breadcrumbs []Breadcrumb) string
func RewriteMarkdownLinks ¶
func ValidateMode ¶
Types ¶
type Breadcrumb ¶
Breadcrumb represents a single segment in the navigation path.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) CreateShare ¶
func (c *Client) CreateShare(req CreateShareRequest) (ShareResponse, error)
func (*Client) ListShares ¶
func (c *Client) ListShares() ([]ShareResponse, error)
func (*Client) RenewShare ¶
func (*Client) RevokeShare ¶
type CreateShareRequest ¶
type CreateShareRequest struct {
}
type Daemon ¶
type Daemon struct {
// contains filtered or unexported fields
}
func NewDaemon ¶
func NewDaemon(cfg DaemonConfig) (*Daemon, error)
func (*Daemon) ExternalBaseURL ¶
func (*Daemon) PublicBaseURL ¶
type DaemonConfig ¶
type DaemonConfig struct {
Paths StatePaths
AdminAddr string
PublicPort int
TokenBytes int
ExternalURL string
}
type MarkdownDirectoryShareAnalysis ¶
type MarkdownDirectoryShareAnalysis struct {
}
func AnalyzeMarkdownForDirectoryShare ¶
func AnalyzeMarkdownForDirectoryShare(source []byte) (MarkdownDirectoryShareAnalysis, error)
type MarkdownPreviewField ¶
type MarkdownPreviewTag ¶
type MarkdownPreviewTag struct {
Label string
}
type PreviewKind ¶
type PreviewKind string
const ( PreviewCode PreviewKind = "code" PreviewDiff PreviewKind = "diff" PreviewMarkdown PreviewKind = "markdown" PreviewHTML PreviewKind = "html" PreviewCSV PreviewKind = "csv" PreviewPDF PreviewKind = "pdf" PreviewImage PreviewKind = "image" PreviewAudio PreviewKind = "audio" PreviewVideo PreviewKind = "video" PreviewBinary PreviewKind = "binary" )
func ClassifyPreviewKind ¶
func ClassifyPreviewKind(name string) PreviewKind
type RenewShareRequest ¶
type RenewShareRequest struct {
}
type Share ¶
type Share struct {
}
func (Share) ToResponse ¶
func (s Share) ToResponse(baseURL string, token string) ShareResponse
type ShareResponse ¶
type ShareResponse struct {
}
type StatePaths ¶
type StatePaths struct {
BaseDir string
DBPath string
SecretPath string
SnapshotsDir string
LogsDir string
}
func DefaultStatePaths ¶
func DefaultStatePaths() (StatePaths, error)
func (StatePaths) Ensure ¶
func (p StatePaths) Ensure() error
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) CreateShare ¶
func (*Store) RevokeShare ¶
func (*Store) RevokeSharesByPath ¶
Click to show internal directories.
Click to hide internal directories.