branding

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 24, 2026 License: Apache-2.0 Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package branding keeps the workspace's name, browser title and logo (Phase 21). Unset values fall back to SynCloud's own name and the logos in web/public.

Index

Constants

View Source
const (
	// DefaultName is the workspace name until one is set.
	DefaultName = "SynCloud"
	// MaxLogoBytes is the largest logo upload.
	MaxLogoBytes = 512 << 10
)
View Source
const (
	SizeFavic = 32
	SizeApple = 180
)

Image sizes made from the uploaded logo.

Variables

This section is empty.

Functions

func DecodeDataURL

func DecodeDataURL(s string) ([]byte, error)

DecodeDataURL accepts "data:image/png;base64,…" or bare base64.

Types

type Branding

type Branding struct {
	Name    string `json:"name"`
	Title   string `json:"title"` // the browser tab; defaults to Name
	// Version changes with every logo upload (cache busting).
	Version string `json:"version"`
}

Branding is what the API shows (public).

type ErrInvalid

type ErrInvalid struct{ Err error }

ErrInvalid wraps validation errors.

func (ErrInvalid) Error

func (e ErrInvalid) Error() string

type Images

type Images struct {

Images are the PNG renditions of the logo.

func Render

func Render(data []byte) (*Images, error)

Render decodes an image and makes the logo, favicon and touch icon. Non-square images are centred on a transparent square.

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func New

func New(st *store.Store) *Manager

func (*Manager) Get

func (m *Manager) Get() Branding

Get returns the branding with defaults applied.

func (*Manager) Images

func (m *Manager) Images() *Images

Images returns the logo renditions (nil = the defaults).

func (*Manager) Load

func (m *Manager) Load(ctx context.Context) error

Load reads the stored branding.

func (m *Manager) RemoveLogo(ctx context.Context) (Branding, error)

RemoveLogo goes back to the default logo.

func (m *Manager) SetLogo(ctx context.Context, data []byte) (Branding, error)

SetLogo validates an uploaded image (PNG, JPEG or WebP; no SVG) and stores square PNG renditions of it.

func (*Manager) SetText

func (m *Manager) SetText(ctx context.Context, name, title string) (Branding, error)

SetText sets the name and title ("" = the default).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL