handlers

package
v1.22.9 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: MIT Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const CookieSessionID = "sid"

CookieSessionID is the session id cookie

View Source
const CookieVisTokenValues = "vtv"

CookieVisTokenValues is the visibility token values cookie

Variables

View Source
var ReferrerRegex = compileReferrerRegex()

Functions

func AllowLocalhost added in v0.10.0

func AllowLocalhost() bool

AllowLocalhost returns the flag controlling if localhost is a valid origin

func CategoryChildren added in v1.0.0

func CategoryChildren(resp http.ResponseWriter, req *http.Request)

CategoryChildren returns info about the children of the given category

func CategoryDeleteEmpty added in v1.22.7

func CategoryDeleteEmpty(resp http.ResponseWriter, req *http.Request)

func CategoryInfo

func CategoryInfo(resp http.ResponseWriter, req *http.Request)

CategoryInfo returns info about the given category or category-value slug

func CategoryListEmpty added in v1.22.7

func CategoryListEmpty(resp http.ResponseWriter, req *http.Request)

func CategoryUpdate added in v1.4.0

func CategoryUpdate(resp http.ResponseWriter, req *http.Request)

CategoryUpdate updates a category. Must be admin.

func CategoryUpdateRelated added in v1.9.0

func CategoryUpdateRelated(resp http.ResponseWriter, req *http.Request)

CategoryUpdateRelated updates the related categories. Must be admin.

func DateChildren added in v1.0.0

func DateChildren(resp http.ResponseWriter, req *http.Request)

DateChildren returns info about the children of the given date

func DateDeleteEmpty added in v1.22.7

func DateDeleteEmpty(resp http.ResponseWriter, req *http.Request)

func DateListEmpty added in v1.22.7

func DateListEmpty(resp http.ResponseWriter, req *http.Request)

func DbCheckAndFixVisTokenCounts added in v1.20.4

func DbCheckAndFixVisTokenCounts(resp http.ResponseWriter, req *http.Request)

func DbSchemaUpdate added in v1.0.0

func DbSchemaUpdate(resp http.ResponseWriter, req *http.Request)

DbSchemaUpdate updates schema to latest version. Must be admin.

func DbSchemaVersion added in v1.0.0

func DbSchemaVersion(resp http.ResponseWriter, req *http.Request)

DbSchemaVersion returns info about the database schema version. Admin only.

func EventAdd added in v1.17.0

func EventAdd(resp http.ResponseWriter, req *http.Request)

func EventCount added in v1.18.6

func EventCount(resp http.ResponseWriter, req *http.Request)

Query event counts. Admin only.

func FolderChildren added in v1.0.0

func FolderChildren(resp http.ResponseWriter, req *http.Request)

FolderChildren returns info about the children of the given folder

func FolderDeleteEmpty added in v1.22.7

func FolderDeleteEmpty(resp http.ResponseWriter, req *http.Request)

func FolderInfo

func FolderInfo(resp http.ResponseWriter, req *http.Request)

FolderInfo returns info about the given folder path

func FolderListEmpty added in v1.22.7

func FolderListEmpty(resp http.ResponseWriter, req *http.Request)

func FolderUpdate added in v1.0.0

func FolderUpdate(resp http.ResponseWriter, req *http.Request)

FolderUpdate updates a folder. Must be admin.

func FolderVisibilityToken added in v0.11.0

func FolderVisibilityToken(resp http.ResponseWriter, req *http.Request)

FolderVisibilityToken can add or delete a visibility token on a folder. Admin only.

func GetDomain added in v0.10.0

func GetDomain() string

GetDomain returns the DOMAIN env var or a default

func GetSessionFromRequest

func GetSessionFromRequest(ctx context.Context, req *http.Request) (*docs.Session, error)

GetSessionFromRequest tries to get the active session associated with a request. Uses the session cookie.

func HomeGroups added in v1.0.0

func HomeGroups(resp http.ResponseWriter, req *http.Request)

HomeGroups returns a selection of groups for listing on the home page

func IsAdminSession

func IsAdminSession(ctx context.Context, req *http.Request) bool

IsAdminSession checks if the session associated with the request belongs to an admin user. If there is no session, fallbacks to indicating a non-admin session.

func KeywordChildren added in v1.0.0

func KeywordChildren(resp http.ResponseWriter, req *http.Request)

KeywordChildren returns info about the children of the given keyword

func KeywordDeleteEmpty added in v1.22.7

func KeywordDeleteEmpty(resp http.ResponseWriter, req *http.Request)

func KeywordInfo

func KeywordInfo(resp http.ResponseWriter, req *http.Request)

KeywordInfo returns info about the given keyword slug

func KeywordListEmpty added in v1.22.7

func KeywordListEmpty(resp http.ResponseWriter, req *http.Request)

func KeywordUpdate added in v1.4.0

func KeywordUpdate(resp http.ResponseWriter, req *http.Request)

KeywordUpdate updates a keyword. Must be admin.

func LocationChildren added in v1.0.0

func LocationChildren(resp http.ResponseWriter, req *http.Request)

LocationChildren returns info about the children of the given location

func LocationDeleteEmpty added in v1.22.7

func LocationDeleteEmpty(resp http.ResponseWriter, req *http.Request)

func LocationInfo

func LocationInfo(resp http.ResponseWriter, req *http.Request)

LocationInfo returns info about the given location slug

func LocationListEmpty added in v1.22.7

func LocationListEmpty(resp http.ResponseWriter, req *http.Request)

func LocationUpdate added in v1.4.0

func LocationUpdate(resp http.ResponseWriter, req *http.Request)

LocationUpdate updates a location. Must be admin.

func NotifyDeletePhotoTask

func NotifyDeletePhotoTask(resp http.ResponseWriter, req *http.Request)

NotifyDeletePhotoTask is the handler for deleting photo tasks

func NotifyFinalizePhotoTask

func NotifyFinalizePhotoTask(resp http.ResponseWriter, req *http.Request)

NotifyFinalizePhotoTask is the handler for finalizing photo tasks

func NotifyMasterStorageUpdates

func NotifyMasterStorageUpdates(resp http.ResponseWriter, req *http.Request)

NotifyMasterStorageUpdates handles storage notifications from the photo master bucket

func PhotoGetMetadata

func PhotoGetMetadata(resp http.ResponseWriter, req *http.Request)

PhotoGetMetadata returns metadata for a photo. For groups, returns both the id and the display string.

func PhotoList

func PhotoList(resp http.ResponseWriter, req *http.Request)

PhotoList responds with a listing of photos for the given parameters

func PhotoRandom added in v1.0.0

func PhotoRandom(resp http.ResponseWriter, req *http.Request)

PhotoRandom responds with a random photo selection for the given parameters

func PhotoResize

func PhotoResize(resp http.ResponseWriter, req *http.Request)

PhotoResize returns a resized version of a photo

func SetAuth

func SetAuth(auth Auth)

SetAuth sets the Auth object to use

func SetHomeGroupCountThreshold added in v1.0.0

func SetHomeGroupCountThreshold(t int)

SetHomeGroupCountThreshold changes the threshold (intended for testing)

func SetTasks

func SetTasks(tasks Tasks)

SetTasks sets the task implementation to use

func SitemapGenerate added in v1.12.0

func SitemapGenerate(resp http.ResponseWriter, req *http.Request)

SitemapGenerate generates the sitemap. Must be admin.

func SitemapGet added in v1.12.0

func SitemapGet(resp http.ResponseWriter, req *http.Request)

SitemapGet retrieves the sitemap. Must have been generated.

func TimelineGroupChildren added in v1.6.0

func TimelineGroupChildren(resp http.ResponseWriter, req *http.Request)

TimelineGroupChildren returns info about the children of the given timeline group

func TimelineGroupCreate added in v1.6.0

func TimelineGroupCreate(resp http.ResponseWriter, req *http.Request)

TimelineGroupCreate handles timeline group creation. Admin only.

func TimelineGroupDelete added in v1.7.0

func TimelineGroupDelete(resp http.ResponseWriter, req *http.Request)

TimelineGroupDelete deletes a timeline group. Admin only.

func TimelineGroupInfo added in v1.6.0

func TimelineGroupInfo(resp http.ResponseWriter, req *http.Request)

TimelineGroupInfo returns info about the given timeline group

func TimelineGroupSync added in v1.6.0

func TimelineGroupSync(resp http.ResponseWriter, req *http.Request)

TimelineGroupSync syncs a timeline group. Admin only.

func TimelineGroupUpdate added in v1.6.0

func TimelineGroupUpdate(resp http.ResponseWriter, req *http.Request)

TimelineGroupUpdate updates a timeline group. Must be admin.

func TimelineGroupUpdateFilter added in v1.6.0

func TimelineGroupUpdateFilter(resp http.ResponseWriter, req *http.Request)

TimelineGroupUpdateFilter updates the filter for a timeline group. Must be admin.

func TimelineGroupVisibilityToken added in v1.6.0

func TimelineGroupVisibilityToken(resp http.ResponseWriter, req *http.Request)

TimelineGroupVisibilityToken can add or delete a visibility token on a timeline group. Admin only.

func UserAdd

func UserAdd(resp http.ResponseWriter, req *http.Request)

UserAdd adds a new user

func UserLogin

func UserLogin(resp http.ResponseWriter, req *http.Request)

UserLogin attempts to login a user

func UserLogout

func UserLogout(resp http.ResponseWriter, req *http.Request)

UserLogout ends the active session

func UserSessionRefresh

func UserSessionRefresh(resp http.ResponseWriter, req *http.Request)

UserSessionRefresh refreshes the active session

func VisibilityActivateLink(resp http.ResponseWriter, req *http.Request)

VisibilityActivateLink activates a visibility token link.

func VisibilityCreate added in v0.11.0

func VisibilityCreate(resp http.ResponseWriter, req *http.Request)

VisibilityCreate creates a new visibility token. Admin only.

func VisibilityCreateLink(resp http.ResponseWriter, req *http.Request)

VisibilityCreateLink creates a new link on a visibility token. Admin only.

func VisibilityHasTokens added in v1.5.0

func VisibilityHasTokens(resp http.ResponseWriter, req *http.Request)

VisibilityHasTokens checks if the vis token value cookie has a value. Does not validate that the tokens are valid.

func VisibilityList added in v0.11.0

func VisibilityList(resp http.ResponseWriter, req *http.Request)

VisibilityList returns a list of all visibility tokens. Admin only.

func VisibilityTokensClear added in v1.5.0

func VisibilityTokensClear(resp http.ResponseWriter, req *http.Request)

VisibilityTokensClear clears any active tokens.

func VisibilityUpdateLink(resp http.ResponseWriter, req *http.Request)

VisibilityUpdateLink updates an existing visibility token link. Admin only.

Types

type Auth

type Auth interface {
	CheckServiceAccountAuthorization(ctx context.Context, req *http.Request) bool
}

Auth interface for authorization checks. This interface is here to allow for testing to substitute something different.

func GetOrCreateAuth added in v1.6.0

func GetOrCreateAuth() (Auth, error)

GetOrCreateAuth gets the Auth object to use. Creates it if it does not exist.

func NewAuth

func NewAuth() (Auth, error)

NewAuth creates a new real implementation of the Auth interface

type GetID added in v1.22.8

type GetID interface {
	GetID() string
}

Interface needed for sorting below. Intended to match GroupBase.

type SortByReverseId added in v1.22.8

type SortByReverseId[T GetID] []T

SortByReverseId - sorter to sort documents by reverse ID order

func (SortByReverseId[T]) Len added in v1.22.8

func (s SortByReverseId[T]) Len() int

func (SortByReverseId[T]) Less added in v1.22.8

func (s SortByReverseId[T]) Less(i, j int) bool

func (SortByReverseId[T]) Swap added in v1.22.8

func (s SortByReverseId[T]) Swap(i, j int)

type Tasks

type Tasks interface {
	CreateTask(ctx context.Context, req *taskspb.CreateTaskRequest) error
}

Tasks is a wrapper interface around the Google Cloud Tasks client

func GetTasks

func GetTasks() Tasks

GetTasks returns the task implementation to use

func NewTasks

func NewTasks() (Tasks, error)

NewTasks creates a new real implementation for Tasks

Jump to

Keyboard shortcuts

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