hub

package
v0.0.0-...-480dc5f Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: AGPL-3.0 Imports: 25 Imported by: 0

Documentation

Overview

Package hub provides privacy-preserving reverse geocoding and other backend services.

Copyright (c) 2018 - 2024 PhotoPrism UG. All rights reserved.

This program is free software: you can redistribute it and/or modify
it under Version 3 of the GNU Affero General Public License (the "AGPL"):
<https://docs.photoprism.app/license/agpl>

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

The AGPL is supplemented by our Trademark and Brand Guidelines,
which describe how our Brand Assets may be used:
<https://www.photoprism.app/trademark>

Feel free to send an email to hello@photoprism.app if you have questions, want to support our work, or just want to say hello.

Additional information can be found in our Developer Guide: <https://docs.photoprism.app/developer-guide/>

Index

Constants

This section is empty.

Variables

View Source
var FeedbackURL = ServiceURL + "/%s/feedback"
View Source
var ServiceURL = "https://my.photoprism.app/v1/hello"

Functions

func ApiHost

func ApiHost() string

ApiHost returns the backend host name.

Types

type Config

type Config struct {
	Version  string `json:"version" yaml:"-"`
	FileName string `json:"-" yaml:"-"`
	Key      string `json:"key" yaml:"Key"`
	Secret   string `json:"secret" yaml:"Secret"`
	Session  string `json:"session" yaml:"Session"`

	Status    Status `json:"status" yaml:"Status"`
	Serial    string `json:"serial" yaml:"Serial"`
	Env       string `json:"-" yaml:"-"`
	UserAgent string `json:"-" yaml:"-"`
	PartnerID string `json:"-" yaml:"-"`
	// contains filtered or unexported fields
}

Config represents backend api credentials for maps & geodata.

func NewConfig

func NewConfig(version, fileName, serial, env, userAgent, partnerId string) *Config

NewConfig creates a new backend api credentials instance.

func (*Config) Customer

func (c *Config) Customer() string

Customer returns the customer name.

func (*Config) DecodeSession

func (c *Config) DecodeSession(cached bool) (Session, error)

DecodeSession decodes backend api session data.

func (*Config) Load

func (c *Config) Load() error

Load backend api credentials from a YAML file.

func (*Config) MapKey

func (c *Config) MapKey() string

MapKey returns the maps api key.

func (*Config) Membership

func (c *Config) Membership() string

Membership returns the membership level as string.

func (*Config) Propagate

func (c *Config) Propagate()

Propagate updates backend api credentials in other packages.

func (*Config) ReSync

func (c *Config) ReSync(token string) (err error)

ReSync renews backend api credentials with an optional token.

func (*Config) Sanitize

func (c *Config) Sanitize()

Sanitize verifies and sanitizes backend api credentials.

func (*Config) Save

func (c *Config) Save() error

Save backend api credentials to a YAML file.

func (*Config) SendFeedback

func (c *Config) SendFeedback(f form.Feedback) (err error)

SendFeedback sends a feedback message.

func (*Config) Sponsor

func (c *Config) Sponsor() bool

Sponsor reports if you support the project.

func (*Config) Tier

func (c *Config) Tier() int

Tier returns the membership tier.

func (*Config) Update

func (c *Config) Update() error

Update renews backend api credentials without a token.

type Feedback

type Feedback struct {
	Category      string `json:"Category"`
	Subject       string `json:"Subject"`
	Message       string `json:"Message"`
	UserName      string `json:"UserName"`
	UserEmail     string `json:"UserEmail"`
	UserAgent     string `json:"UserAgent"`
	ApiKey        string `json:"ApiKey"`
	ClientVersion string `json:"ClientVersion"`
	ClientSerial  string `json:"ClientSerial"`
	ClientOS      string `json:"ClientOS"`
	ClientArch    string `json:"ClientArch"`
	ClientCPU     int    `json:"ClientCPU"`
	ClientEnv     string `json:"ClientEnv"`
	PartnerID     string `json:"PartnerID"`
}

func NewFeedback

func NewFeedback(version, serial, env, partnerId string) *Feedback

NewFeedback creates a new hub feedback instance.

type Request

type Request struct {
	ClientVersion string `json:"ClientVersion"`
	ClientSerial  string `json:"ClientSerial"`
	ClientOS      string `json:"ClientOS"`
	ClientArch    string `json:"ClientArch"`
	ClientCPU     int    `json:"ClientCPU"`
	ClientEnv     string `json:"ClientEnv"`
	PartnerID     string `json:"PartnerID"`
	ApiToken      string `json:"ApiToken"`
}

Request represents basic environment specs for debugging.

func NewRequest

func NewRequest(version, serial, env, partnerId, token string) *Request

NewRequest creates a new backend key request instance.

type Session

type Session struct {
	Tier      int
	MapKey    string
	Customer  string `json:",omitempty"`
	ExpiresAt string
}

Session represents backend api session data.

func (*Session) Expired

func (p *Session) Expired() bool

Expired tests if the api session is expired.

type Status

type Status string
const (
	StatusUnknown   Status = ""
	StatusNew       Status = "unregistered"
	StatusCommunity Status = "ce"
)

Directories

Path Synopsis
Package places provides global location information to enrich metadata with location details.
Package places provides global location information to enrich metadata with location details.

Jump to

Keyboard shortcuts

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