Version: v0.0.0-...-472bb51 Latest Latest

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

Go to latest
Published: Jun 21, 2021 License: MIT Imports: 18 Imported by: 0




View Source
const (
	API_USER_AGENT   = "myHomeErth/8 CFNetwork/1209 Darwin/20.2.0"
	CLIENT_USERAGENT = "iPhone11,6 | iOS 14.3 | erth | 6.4.6 (build 3) | %s | 2 | %s"

	API_HA_NETWORK = "http://supervisor/network/info"

	API_AUTH_LOGIN            = "https://myhome.novotelecom.ru/auth/v2/login/%s"
	API_AUTH_CONFIRMATION     = "https://myhome.novotelecom.ru/auth/v2/confirmation/%s"
	API_AUTH_CONFIRMATION_SMS = "https://myhome.novotelecom.ru/auth/v2/auth/%s/confirmation"

	API_AUTH = "https://api-auth.domru.ru/v1/person/auth"

	API_CAMERAS           = "https://myhome.novotelecom.ru/rest/v1/forpost/cameras"
	API_OPEN_DOOR         = "https://myhome.novotelecom.ru/rest/v1/places/%s/accesscontrols/%s/actions"
	API_FINANCES          = "https://myhome.novotelecom.ru/rest/v1/subscribers/profiles/finances"
	API_SUBSCRIBER_PLACES = "https://myhome.novotelecom.ru/rest/v1/subscriberplaces"
	API_VIDEO_SNAPSHOT    = "https://myhome.novotelecom.ru/rest/v1/places/%s/accesscontrols/%s/videosnapshots"
	API_CAMERA_GET_STREAM = "https://myhome.novotelecom.ru/rest/v1/forpost/cameras/%s/video?&LightStream=0"
	API_REFRESH_SESSION   = "https://myhome.novotelecom.ru/auth/v2/session/refresh"
	API_EVENTS            = "https://myhome.novotelecom.ru/rest/v1/places/%s/events?allowExtentedActions=true"
	API_OPERATORS         = "https://myhome.novotelecom.ru/public/v1/operators"


This section is empty.


This section is empty.


type Account

type Account struct {
	OperatorID   int64  `json:"operatorId"`
	SubscriberID int64  `json:"subscriberId"`
	AccountID    string `json:"accountId"`
	PlaceID      int64  `json:"placeId"`
	Address      string `json:"address"`
	ProfileID    string `json:"profileId"`

type AccountsPageData

type AccountsPageData struct {
	Accounts      []Account
	Phone         string
	HassioIngress string
	LoginError    string

type Cameras

type Cameras struct {
	Data []struct {
		ID       int    `json:"ID"`
		Name     string `json:"Name"`
		IsActive int    `json:"IsActive"`
	} `json:"data"`

type ConfirmRequest

type ConfirmRequest struct {
	Confirm      string `json:"confirm1"`
	SubscriberID int64  `json:"subscriberId"`
	Login        string `json:"login"`
	OperatorID   int64  `json:"operatorId"`
	AccountID    string `json:"accountId"`
	ProfileID    string `json:"profileId"`

type ConfirmResponse

type ConfirmResponse struct {
	OperatorID   int64  `json:"operatorId"`
	TokenType    string `json:"tokenType"`
	AccessToken  string `json:"accessToken"`
	RefreshToken string `json:"refreshToken"`

type HAConfig

type HAConfig struct {
	Result string `json:"result"`
	Data   struct {
		Interfaces []struct {
			Ipv4 struct {
				Address []string `json:"address"`
			} `json:"ipv4"`
		} `json:"interfaces"`
	} `json:"data"`

type Handler

type Handler struct {
	Config       *config.Config
	UserAccounts []Account
	Account      *Account

	TemplateFs embed.FS

func NewHandlers

func NewHandlers(config *config.Config, templateFs embed.FS) (h *Handler)

func (*Handler) Accounts

func (h *Handler) Accounts(username *string) (a []Account, err error)

Accounts ...

func (*Handler) AccountsHandler

func (h *Handler) AccountsHandler(w http.ResponseWriter, r *http.Request)

AccountsHandler ...

func (*Handler) Cameras

func (h *Handler) Cameras() (string, error)

Cameras ...

func (*Handler) CamerasHandler

func (h *Handler) CamerasHandler(w http.ResponseWriter, r *http.Request)

CamerasHandler ...

func (*Handler) Door

func (h *Handler) Door(r *http.Request) (string, error)

Door ...

func (*Handler) DoorHandler

func (h *Handler) DoorHandler(w http.ResponseWriter, r *http.Request)

DoorHandler ...

func (*Handler) Events

func (h *Handler) Events(w http.ResponseWriter, r *http.Request) (string, error)

Events ...

func (*Handler) EventsHandler

func (h *Handler) EventsHandler(w http.ResponseWriter, r *http.Request)

EventsHandler ...

func (*Handler) Finances

func (h *Handler) Finances() (string, error)

Finances ...

func (*Handler) FinancesHandler

func (h *Handler) FinancesHandler(w http.ResponseWriter, r *http.Request)

FinancesHandler ...

func (*Handler) HANetwork

func (h *Handler) HANetwork() (string, error)

HANetwork ...

func (*Handler) HomeHandler

func (h *Handler) HomeHandler(w http.ResponseWriter, r *http.Request)

HomeHandler ...

func (*Handler) LoginAddressHandler

func (h *Handler) LoginAddressHandler(w http.ResponseWriter, r *http.Request)

LoginAddressHandler ...

func (*Handler) LoginHandler

func (h *Handler) LoginHandler(w http.ResponseWriter, r *http.Request)

LoginHandler ...

func (*Handler) LoginSMSHandler

func (h *Handler) LoginSMSHandler(w http.ResponseWriter, r *http.Request)

LoginSMSHandler ...

func (*Handler) Operators

func (h *Handler) Operators() (string, error)

Operators ...

func (*Handler) OperatorsHandler

func (h *Handler) OperatorsHandler(w http.ResponseWriter, r *http.Request)

OperatorsHandler ...

func (*Handler) Places

func (h *Handler) Places() (string, error)

Places ...

func (*Handler) PlacesHandler

func (h *Handler) PlacesHandler(w http.ResponseWriter, r *http.Request)

PlacesHandler ...

func (*Handler) Refresh

func (h *Handler) Refresh(refreshToken *string) (string, string, error)

Refresh ...

func (*Handler) RequestCode

func (h *Handler) RequestCode(username *string, account Account) (result bool, err error)

RequestCode ...

func (*Handler) SendCode

func (h *Handler) SendCode(r *http.Request) (authToken, refreshToken string, err error)

SendCode ...

func (*Handler) SnapshotHandler

func (h *Handler) SnapshotHandler(w http.ResponseWriter, r *http.Request)

SnapshotHandler ...

func (*Handler) Stream

func (h *Handler) Stream(r *http.Request) (string, error)

Stream ...

func (*Handler) StreamHandler

func (h *Handler) StreamHandler(w http.ResponseWriter, r *http.Request)

StreamHandler ...

type Header struct {
	// contains filtered or unexported fields

Header ...

func WithHeader

func WithHeader(rt http.RoundTripper) Header

WithHeader ...

func (Header) RoundTrip

func (h Header) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip ...

type HomePageData

type HomePageData struct {
	HassioIngress string
	HostIP        string
	Port          string
	LoginError    string
	Phone         string
	Token         string
	RefreshToken  string
	Cameras       Cameras
	Places        Places

type LoginPageData

type LoginPageData struct {
	LoginError    string
	Phone         string
	HassioIngress string

type Places

type Places struct {
	Data []struct {
		ID    int `json:"id"`
		Place struct {
			ID      int `json:"id"`
			Address struct {
				VisibleAddress string `json:"visibleAddress"`
			} `json:"address"`
			AccessControls []struct {
				ID   int    `json:"id"`
				Name string `json:"name"`
			} `json:"accessControls"`
		} `json:"place"`
		Subscriber struct {
			ID        int    `json:"id"`
			Name      string `json:"name"`
			AccountID string `json:"accountId"`
		} `json:"subscriber"`
		Blocked bool `json:"blocked"`
	} `json:"data"`

type SMSPageData

type SMSPageData struct {
	Phone         string
	Index         string
	HassioIngress string
	LoginError    string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL