Documentation
¶
Index ¶
- Constants
- Variables
- func CleanPath(path string) string
- func EmailToSubdomainHash(email string) string
- func GetOwner(path string) string
- func IsOwner(path string, user string) bool
- func IsValidDatasite(user string) bool
- func IsValidPath(path string) bool
- func IsValidRelPath(path string) bool
- type BlobError
- type BlobURL
- type DatasiteService
- func (d *DatasiteService) GetSubdomainMapping() *SubdomainMapping
- func (d *DatasiteService) GetView(user string) []*blob.BlobInfo
- func (d *DatasiteService) ReloadVanityDomains(email string) error
- func (d *DatasiteService) Shutdown(ctx context.Context) error
- func (d *DatasiteService) Start(ctx context.Context) error
- type SettingsYAML
- type SubdomainMapping
- func (s *SubdomainMapping) AddMapping(email string) string
- func (s *SubdomainMapping) AddVanityDomain(domain string, email string, path string)
- func (s *SubdomainMapping) ClearVanityDomains(email string)
- func (s *SubdomainMapping) GetAllMappings() map[string]string
- func (s *SubdomainMapping) GetAllVanityDomains() map[string]*VanityDomainConfig
- func (s *SubdomainMapping) GetEmailByHash(hash string) (string, error)
- func (s *SubdomainMapping) GetHashByEmail(email string) (string, error)
- func (s *SubdomainMapping) GetMapping(domain string) *VanityDomainConfig
- func (s *SubdomainMapping) GetVanityDomain(domain string) (*VanityDomainConfig, bool)
- func (s *SubdomainMapping) HasDatasite(email string) bool
- func (s *SubdomainMapping) LoadMappings(emails []string)
- func (s *SubdomainMapping) RemoveMapping(email string)
- func (s *SubdomainMapping) RemoveVanityDomain(domain string)
- type VanityDomainConfig
Constants ¶
const (
SettingsFileName = "settings.yaml"
)
Variables ¶
var ( ErrSubdomainNotFound = errors.New("subdomain not found") ErrEmailNotFound = errors.New("email not found") )
var (
ErrNoSettingsYAML = errors.New("no settings.yaml found")
)
var (
PathSep = string(filepath.Separator)
)
Functions ¶
func EmailToSubdomainHash ¶ added in v0.6.1
EmailToSubdomainHash generates a subdomain-safe hash from an email address
func IsOwner ¶
IsOwner checks if the user is the owner of the path The underlying assumption here is that owner is the prefix of the path
func IsValidDatasite ¶
func IsValidPath ¶
IsValidPath checks if the path is a valid datasite path i.e. must start with a datasite email followed by a slash
func IsValidRelPath ¶ added in v0.6.1
Types ¶
type DatasiteService ¶
type DatasiteService struct {
// contains filtered or unexported fields
}
func NewDatasiteService ¶
func NewDatasiteService(blobSvc blob.Service, aclSvc *acl.ACLService, domain string) *DatasiteService
func (*DatasiteService) GetSubdomainMapping ¶ added in v0.6.1
func (d *DatasiteService) GetSubdomainMapping() *SubdomainMapping
GetSubdomainMapping returns the subdomain mapping service
func (*DatasiteService) ReloadVanityDomains ¶ added in v0.6.1
func (d *DatasiteService) ReloadVanityDomains(email string) error
ReloadVanityDomains reloads vanity domain configurations for a specific email
type SettingsYAML ¶ added in v0.6.1
SettingsYAML represents the structure of a settings.yaml file
func ParseSettingsYAML ¶ added in v0.6.1
func ParseSettingsYAML(r io.Reader) (*SettingsYAML, error)
ParseSettingsYAML parses a settings.yaml file from a reader
type SubdomainMapping ¶ added in v0.6.1
type SubdomainMapping struct {
// contains filtered or unexported fields
}
SubdomainMapping handles bidirectional mapping between email hashes and emails
func NewSubdomainMapping ¶ added in v0.6.1
func NewSubdomainMapping() *SubdomainMapping
NewSubdomainMapping creates a new subdomain mapping service
func (*SubdomainMapping) AddMapping ¶ added in v0.6.1
func (s *SubdomainMapping) AddMapping(email string) string
AddMapping adds a mapping between an email and its hash
func (*SubdomainMapping) AddVanityDomain ¶ added in v0.6.1
func (s *SubdomainMapping) AddVanityDomain(domain string, email string, path string)
AddVanityDomain adds a vanity domain mapping
func (*SubdomainMapping) ClearVanityDomains ¶ added in v0.6.1
func (s *SubdomainMapping) ClearVanityDomains(email string)
ClearVanityDomains clears all vanity domain mappings for a specific email
func (*SubdomainMapping) GetAllMappings ¶ added in v0.6.1
func (s *SubdomainMapping) GetAllMappings() map[string]string
GetAllMappings returns all current mappings
func (*SubdomainMapping) GetAllVanityDomains ¶ added in v0.6.1
func (s *SubdomainMapping) GetAllVanityDomains() map[string]*VanityDomainConfig
GetAllVanityDomains returns all vanity domain mappings
func (*SubdomainMapping) GetEmailByHash ¶ added in v0.6.1
func (s *SubdomainMapping) GetEmailByHash(hash string) (string, error)
GetEmailByHash returns the email for a given hash
func (*SubdomainMapping) GetHashByEmail ¶ added in v0.6.1
func (s *SubdomainMapping) GetHashByEmail(email string) (string, error)
GetHashByEmail returns the hash for a given email
func (*SubdomainMapping) GetMapping ¶ added in v0.6.1
func (s *SubdomainMapping) GetMapping(domain string) *VanityDomainConfig
GetMapping returns the mapping for a domain (unified method for both hash and vanity domains)
func (*SubdomainMapping) GetVanityDomain ¶ added in v0.6.1
func (s *SubdomainMapping) GetVanityDomain(domain string) (*VanityDomainConfig, bool)
GetVanityDomain returns the configuration for a vanity domain
func (*SubdomainMapping) HasDatasite ¶ added in v0.6.1
func (s *SubdomainMapping) HasDatasite(email string) bool
HasDatasite checks if a datasite (email) is already in the mapping
func (*SubdomainMapping) LoadMappings ¶ added in v0.6.1
func (s *SubdomainMapping) LoadMappings(emails []string)
LoadMappings loads mappings from a list of emails (e.g., from datasites)
func (*SubdomainMapping) RemoveMapping ¶ added in v0.6.1
func (s *SubdomainMapping) RemoveMapping(email string)
RemoveMapping removes a mapping by email
func (*SubdomainMapping) RemoveVanityDomain ¶ added in v0.6.1
func (s *SubdomainMapping) RemoveVanityDomain(domain string)
RemoveVanityDomain removes a vanity domain mapping
type VanityDomainConfig ¶ added in v0.6.1
type VanityDomainConfig struct {
Email string
Path string // Custom path within the datasite (e.g., "/blog", "/portfolio/2024")
}
VanityDomainConfig stores the configuration for a vanity domain