debugger

package module
v0.0.0-...-00bc284 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2022 License: MIT Imports: 7 Imported by: 0

README

Hue Remote API Debugger

This application can be used to send CLIP commands to your Philips Hue bridge via its cloud connection to manipulate the lights in your home.

Local setup

  • First setup an application at developers.meethue.com
  • Then configure the proclaimed ClientID/Secret when running the app:
CALLBACK_URL="http://localhost:8080/hue_callback_url" \
HUE_CLIENT_ID=myclientid \
HUE_CLIENT_SECRET=myclientsecret \
HUE_APPID="myappid" \
go run ./cmd

App Engine flex setup

  • First setup an application at developers.meethue.com
  • Then configure the proclaimed ClientID/Secret in app-with-secrets.yaml and tweak the defaults:
cp app-with-secrets.example.yaml app-with-secrets.yaml
vim app-with-secrets.yaml
  • finally deploy to google: gcloud app deploy app-with-secrets.yaml --project PROJECT_ID

Credits

Documentation

Index

Constants

View Source
const (
	V1 = AuthVersion(1)
	V2 = AuthVersion(2)
)

Variables

This section is empty.

Functions

func MakeConfig

func MakeConfig(callbackURL, appID, clientID, clientSecret, apiEndPoint string, version AuthVersion) *oauth2.Config

MakeConfig sets-up the OAuth config

func ServeReverseProxy

func ServeReverseProxy(target string, res http.ResponseWriter, req *http.Request)

ServeReverseProxy acts as a reverse proxy for a given url

Types

type AuthVersion

type AuthVersion int

type Debugger

type Debugger struct {
	// HueOauthConfig specifies how to use OAuth
	HueOAuthConfig *oauth2.Config
	// APIEndpoint to use for proxying
	APIEndpoint string
	// Root, is the root url of the client application
	Root string
	// StateFn generator
	StateFn func() string
	// State validator
	ValidateState func(string) bool
}

func (Debugger) GetToken

func (d Debugger) GetToken(state string, code string) (*oauth2.Token, error)

GetToken retrieves an OAuth token from the API

func (Debugger) HandleHueCallback

func (d Debugger) HandleHueCallback(handler func(token *oauth2.Token, w http.ResponseWriter, r *http.Request)) func(w http.ResponseWriter, r *http.Request)

HandleHueCallback redirects to

func (Debugger) HandleHueLogin

func (d Debugger) HandleHueLogin(w http.ResponseWriter, r *http.Request)

HandleHueLogin redirects to Hue Login

func (Debugger) HandleRequestAndRedirect

func (d Debugger) HandleRequestAndRedirect(res http.ResponseWriter, req *http.Request)

HandleRequestAndRedirect Given a request send it to the appropriate url

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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