walkhub

package module
v0.0.0-...-fe3a513 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2018 License: AGPL-3.0 Imports: 39 Imported by: 1

README

WalkHub is looking for a maintainer and no longer supported. Pronovix (pronovix.com), the company that originally sponsored WalkHub’s development has focussed its activities around developer portals (API documentation) and is as a result unfortunately unable to provide any support for the project. The code is available as is, and we hope a developer with an interest in the project might be able to still use the code.

WalkHub

Walkthrough tutorials designed for web applications and websites. Add a record button and help center to your web application.

Check the landing page for more information.

Getting started

Dependencies

Configuration

cp config.json.minimal config.json
$EDITOR config.json

Any configuration value can be overridden with an environment variable.

Docker

The official Docker image uses an empty configuration file. You either have to provide all configuration through environment variables, or you have to create an image and replace the empty configuration file.

Mandatory values
  • db: connection string to the PostgreSQL database
  • secret: 32 bytes long random byte sequence, encoded with hex encoding
  • cookiesecret: 32 bytes long random byte sequence, encoded with hex encoding
  • baseurl: the url where WalkHub will be. A default is set in the example config files.

At least one of the following authentication providers are mandatory:

  • google: OAuth2 tokens for Google (see config.json.sample.full)
  • pwauth: password authentication

If password authentication is enabled, then SMTP credentials are mandatory:

  • smtp: SMTP credentials (see config.json.sample.full). Only PLAIN authentication (RFC4616) is supported.
Optional values

If unsure, leave them empty.

  • host: host to listen on. Defaults to localhost.
  • port: port to listen on. Defaults to 8080.
  • letsencrypthost: enables letsencrypt on the specified host. Default is empty.
  • httpaddr: enables HTTP to HTTPS automatic redirection. The format of the address is host:port.
  • httporigin: if this is set, the HTTP requests will be forced to a separate domain.
  • redirectall: redirects all HTTP requests to HTTPS if the server is running in HTTPS mode. If this is set to false, only a few pages will be enabled in HTTP mode
  • contentpages: path to a JSON file that describes custom pages. The JSON file is a simple dictionary, where the key is the path (see react-router for the syntax) and the value is the require() path for the component
  • frontpagecomponent: overrides the component for the front page
  • footercomponent: overrides the component for the footer
  • extrabuild: a javascript file that exports a single function. This function can alter the webpack config.
  • menuitems: path to a JSON file that describes menu paths. Only change this if you want to change the menu of the site. See js/components/wrappers/app.js for more info on the structure.
  • googleanalyticsaccount: enables Google Analytics.
  • mailchimp: mailchimp-related configuration. If set, new users will be added to a mailing list.
  • metricsaddresses: comma separated whitelist of addresses from where the /metrics endpoint is accessible
  • languages: list of languages for the user interface

Build & Run

First you have to build the assets:

npm install
npm run build

Run the server:

go run cmd/walkhub/main.go

Quick start with Docker compose

This is a basic configuration to launch WalkHub locally. DO NOT use this in production. To maximize security for your GMail account, it is highly recommended to enable 2-factor authentication and create an app password for WalkHub.

web:
	image: pronovix/walkhub-service
	restart: always
	ports:
		- "8080:8080"
	links:
		- db
	environment:
		HOST: "0.0.0.0"
		DB: "host=db dbname=postgres user=docker password=docker sslmode=disable"
		BASEURL: "http://localhost:8080/"
		SECRET: "0000000000000000000000000000000000000000000000000000000000000000"
		COOKIESECRET: "0000000000000000000000000000000000000000000000000000000000000000"
		PWAUTH: "true"
		SMTP_ADDR: "smtp.gmail.com:587"
		SMTP_IDENTITY: ""
		SMTP_USERNAME: "<your gmail address>"
		SMTP_PASSWORD: "<your gmail password>"
		SMTP_FROM: "<your gmail address>"
		SMTP_HOST: "smtp.gmail.com"
db:
	image: postgres:latest
	restart: always
	environment:
		POSTGRES_PASSWORD: docker
		POSTGRES_USER: docker

On startup the frontend assets will be built, and the server starts. You can visit the site at http://localhost:8080 after 20-40 seconds, depending on your hardware.

Contribution

Feel free to open an issue or a pull request if you have questions / bugs / patches.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var UserDelegate = &auth.SessionUserDelegate{}
View Source
var WalkthroughNotFoundError = errors.New("walkthrough is not found")

Functions

func DBLog

func DBLog(db ab.DB, ec *ab.EntityController, logtype, message string) error

Types

type EmbedLog

type EmbedLog struct {
	UUID    string    `dbtype:"uuid" dbdefault:"uuid_generate_v4()" json:"uuid"`
	IPAddr  string    `json:"ip"`
	Created time.Time `json:"created"`
	Site    string    `json:"site"`
	Mail    string    `json:"mail"`
}

func (*EmbedLog) GetID

func (el *EmbedLog) GetID() string

func (*EmbedLog) Validate

func (el *EmbedLog) Validate() error

type GoogleUserDelegate

type GoogleUserDelegate struct {
}

func (*GoogleUserDelegate) Convert

func (gud *GoogleUserDelegate) Convert(u *plus.Person) (ab.Entity, error)

func (*GoogleUserDelegate) ResolveUniqueID

func (gud *GoogleUserDelegate) ResolveUniqueID(db ab.DB, entity ab.Entity) (string, error)

type Log

type Log struct {
	UUID    string    `dbtype:"uuid" dbdefault:"uuid_generate_v4()" json:"uuid"`
	Type    string    `json:"type"`
	Message string    `json:"message"`
	Created time.Time `dbdefault:"now()" json:"created"`
}

func (*Log) GetID

func (l *Log) GetID() string

type LogService

type LogService struct {
	BaseURL string
}

type PasswordDelegate

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

func NewPasswordDelegate

func NewPasswordDelegate(db ab.DB, ec *ab.EntityController) *PasswordDelegate

func (*PasswordDelegate) Get2FAIssuer

func (d *PasswordDelegate) Get2FAIssuer() string

func (*PasswordDelegate) GetAuthID

func (d *PasswordDelegate) GetAuthID(entity ab.Entity) string

func (*PasswordDelegate) GetDBErrorConverter

func (d *PasswordDelegate) GetDBErrorConverter() func(err *pq.Error) ab.VerboseError

func (*PasswordDelegate) GetEmail

func (d *PasswordDelegate) GetEmail(entity ab.Entity) string

func (*PasswordDelegate) GetPassword

func (d *PasswordDelegate) GetPassword() auth.Password

func (*PasswordDelegate) LoadUser

func (d *PasswordDelegate) LoadUser(uuid string) (ab.Entity, error)

func (*PasswordDelegate) LoadUserByMail

func (d *PasswordDelegate) LoadUserByMail(mail string) (ab.Entity, error)

type Screening

type Screening struct {
	UUID      string    `dbtype:"uuid" dbdefault:"uuid_generate_v4()" json:"uuid"`
	WID       string    `dbtype:"uuid" json:"wid"`
	UID       string    `dbtype:"uuid" json:"uid"`
	Steps     uint      `dbtype:"smallint" json:"steps"`
	Created   time.Time `dbdefault:"now()" json:"created"`
	Published bool      `json:"published"`
}

func LoadActualScreeningForWalkthrough

func LoadActualScreeningForWalkthrough(db ab.DB, ec *ab.EntityController, wid string) (*Screening, error)

func (*Screening) GIFPath

func (s *Screening) GIFPath() string

func (*Screening) GetID

func (s *Screening) GetID() string

func (*Screening) ScreenshotPath

func (s *Screening) ScreenshotPath(step uint) string

type SiteinfoService

type SiteinfoService struct {
	BaseURLs []string
	// contains filtered or unexported fields
}

func NewSiteinfoService

func NewSiteinfoService(baseurls ...string) *SiteinfoService

func (*SiteinfoService) Register

func (sis *SiteinfoService) Register(srv *ab.Server) error

func (*SiteinfoService) SchemaInstalled

func (sis *SiteinfoService) SchemaInstalled(db ab.DB) bool

func (*SiteinfoService) SchemaSQL

func (sis *SiteinfoService) SchemaSQL() string

type Step

type Step struct {
	Title         string `json:"title"`
	Description   string `json:"description"`
	StepHighlight string `json:"highlight"`
	Command       string `json:"cmd"`
	Arg0          string `json:"arg0"`
	Arg1          string `json:"arg1"`
}

type User

type User struct {
	UUID     string `dbtype:"uuid" dbdefault:"uuid_generate_v4()"`
	Name     string `constructor:"true"`
	Mail     string `constructor:"true"`
	Admin    bool
	Created  time.Time
	LastSeen time.Time
}

func (*User) GetID

func (u *User) GetID() string

type WalkhubServer

type WalkhubServer struct {
	*ab.Server
	BaseURL        string
	HTTPAddr       string
	HTTPOrigin     string
	RedirectAll    bool
	EnforceDomains bool
	CustomPaths    []string
	PWAuth         bool

	AuthCreds struct {
		SMTP struct {
			Addr                               string
			Identity, Username, Password, Host string
			From                               string
		}
		Google auth.OAuthCredentials
	}
	// contains filtered or unexported fields
}

func NewServer

func NewServer(cfg *viper.Viper) (*WalkhubServer, error)

func (*WalkhubServer) Start

func (s *WalkhubServer) Start(addr string, certfile string, keyfile string) error

type Walkthrough

type Walkthrough struct {
	Revision    string    `dbtype:"uuid" dbdefault:"uuid_generate_v4()" json:"revision"`
	UUID        string    `dbtype:"uuid" dbdefault:"uuid_generate_v4()" json:"uuid"`
	UID         string    `dbtype:"uuid" json:"uid"`
	Name        string    `constructor:"true" json:"name"`
	Description string    `dbtype:"text" json:"description"`
	Steps       []Step    `dbtype:"jsonb" json:"steps"`
	Updated     time.Time `json:"updated"`
	Published   bool      `json:"published"`
}

func LoadActualRevision

func LoadActualRevision(db ab.DB, ec *ab.EntityController, UUID string) (*Walkthrough, error)

func LoadActualRevisions

func LoadActualRevisions(db ab.DB, ec *ab.EntityController, uuids []string) ([]*Walkthrough, error)

func LoadAllActualWalkthroughs

func LoadAllActualWalkthroughs(db ab.DB, ec *ab.EntityController, start, limit int) ([]*Walkthrough, error)

func (*Walkthrough) Delete

func (e *Walkthrough) Delete(db ab.DB) error

func (*Walkthrough) GetID

func (w *Walkthrough) GetID() string

func (*Walkthrough) Insert

func (e *Walkthrough) Insert(db ab.DB) error

func (*Walkthrough) Update

func (e *Walkthrough) Update(db ab.DB) error

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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