Documentation
¶
Index ¶
- Constants
- Variables
- func DispatchDownloadTTL(executionTimeoutSeconds int) time.Duration
- func FileAccessURL(fileID uuid.UUID, ttl time.Duration, key []byte) (string, error)
- func FileIDFromSignedURL(raw string) (uuid.UUID, bool)
- func FileIDsInMarkdown(markdown string) []uuid.UUID
- func FileRef(id uuid.UUID) string
- func HTTPImageURLs(markdown string) []string
- func HTTPResourceURLs(markdown string) []string
- func IsGitHubImageHost(host string) bool
- func IsGitHubImageURL(raw string) bool
- func MarkdownLinkLabel(name string) string
- func ObjectKey(installationID, scope string, ...) (string, error)
- func ParseFileID(raw string) (uuid.UUID, bool)
- func PublicBaseURL() string
- func ReplaceURL(markdown, from, to string) string
- func ResolveDownloadURL(ctx context.Context, provider Provider, storageKey string, fileID uuid.UUID, ...) (string, error)
- func RewriteFileRefs(markdown string, urls map[uuid.UUID]string) string
- func RewriteSignedFileURLs(markdown string, replace func(uuid.UUID) (string, bool)) string
- func SetCurrent(provider Provider)
- func SignFileAccess(fileID uuid.UUID, expires int64, key []byte) (string, error)
- func SignedFileURLs(text string) []string
- func SigningKey() ([]byte, error)
- func StableExpiry(ttl time.Duration) time.Time
- func VerifyFileAccess(fileID uuid.UUID, expires int64, sig string, key []byte) error
- type ObjectInfo
- type Provider
- type PutOptions
Constants ¶
View Source
const ( SignedURLMarkerParam = "sp_file" SignedURLMarkerValue = "1" )
View Source
const ( ScopeApp = "app" ScopeOrganization = "organization" ScopeWorkspace = "workspace" ScopeTask = "task" )
View Source
const ( ProviderGCS = "gcs" ProviderS3 = "s3" ProviderAzure = "azure" ProviderFilesystem = "filesystem" )
View Source
const FileRefScheme = "sp-file"
View Source
const (
UIDownloadTTL = time.Hour
)
Variables ¶
Functions ¶
func DispatchDownloadTTL ¶
func FileAccessURL ¶
func FileIDsInMarkdown ¶
func HTTPImageURLs ¶
func HTTPResourceURLs ¶
HTTPResourceURLs returns http and https targets from markdown links, image tags, and anchor tags. Image-only callers use HTTPImageURLs.
func IsGitHubImageHost ¶
func IsGitHubImageURL ¶
func MarkdownLinkLabel ¶
func PublicBaseURL ¶
func PublicBaseURL() string
func ReplaceURL ¶
func ResolveDownloadURL ¶
func RewriteSignedFileURLs ¶
func SetCurrent ¶
func SetCurrent(provider Provider)
func SignFileAccess ¶
func SignedFileURLs ¶
func SigningKey ¶
func StableExpiry ¶
StableExpiry rounds the signed-URL end time up to a bucket so remints in the same window return the same URL. That keeps <img> src stable while a chat poll refreshes the work order.
Types ¶
type ObjectInfo ¶
type Provider ¶
type Provider interface {
Name() string
Put(ctx context.Context, key string, r io.Reader, opts PutOptions) error
Get(ctx context.Context, key string) (io.ReadCloser, error)
GetRange(ctx context.Context, key string, offset, length int64) (io.ReadCloser, error)
Head(ctx context.Context, key string) (*ObjectInfo, error)
Delete(ctx context.Context, key string) error
// SignedGetURL returns a time-limited HTTPS GET for the object.
// Filesystem returns ErrSignedURLUnsupported; callers mint an HMAC file URL.
SignedGetURL(ctx context.Context, key string, ttl time.Duration) (string, error)
}
Provider stores opaque object bytes. Catalog metadata lives in Postgres.
type PutOptions ¶
Click to show internal directories.
Click to hide internal directories.