gwi

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

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

Go to latest
Published: Nov 9, 2022 License: GPL-2.0 Imports: 16 Imported by: 0

README

This project delivers various handlers to be used in your server, with that you can customize all pages and paths.

Usage

The simplest way of using this project is the following example:

package main

import (
	"net/http"

	"blmayer.dev/gwi"
)

func main() {
	g, _ := gwi.NewGwi("templates", "git")
	// handle error

	err := http.ListenAndServe(":8080", g.Handle())
	// handle err
}

This will use all default handlers, giving you an index page with a list of git repositories in folder git.

Each handler can be specified as well:

func main() {
	...

	http.Handle("/git", g.IndexHandler)
}

This will register the index page in /git instead of /.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommitInfo

type CommitInfo struct {
	Creator  string
	Name     string
	CloneURL string
	Ref      string
	Commit   *object.Commit
	Patch    string
}

type Config

type Config struct {
	Domain    string
	PagesRoot string
	Root      string
	CGIRoot   string
	CGIPrefix string
}

type File

type File struct {
	*object.File
	Size int64
}

type FileVault

type FileVault struct {
	Users []User
	// contains filtered or unexported fields
}

func NewFileVault

func NewFileVault(path, salt string) (FileVault, error)

func (FileVault) Mix

func (f FileVault) Mix(data string) string

func (FileVault) Validate

func (f FileVault) Validate(login, pass string) bool

type Gwi

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

func NewFromConfig

func NewFromConfig(config Config, vault Vault) (Gwi, error)

func (*Gwi) BranchesHandler

func (g *Gwi) BranchesHandler(w http.ResponseWriter, r *http.Request)

func (*Gwi) CommitHandler

func (g *Gwi) CommitHandler(w http.ResponseWriter, r *http.Request)

func (*Gwi) CommitsHandler

func (g *Gwi) CommitsHandler(w http.ResponseWriter, r *http.Request)

func (*Gwi) FileHandler

func (g *Gwi) FileHandler(w http.ResponseWriter, r *http.Request)

func (*Gwi) GitCGIHandler

func (g *Gwi) GitCGIHandler(w http.ResponseWriter, r *http.Request)

func (*Gwi) Handle

func (g *Gwi) Handle() http.Handler

func (*Gwi) IndexHandler

func (g *Gwi) IndexHandler(w http.ResponseWriter, r *http.Request)

func (*Gwi) Private

func (g *Gwi) Private(h http.HandlerFunc) http.HandlerFunc

func (*Gwi) RepoListHandler

func (g *Gwi) RepoListHandler(w http.ResponseWriter, r *http.Request)

func (*Gwi) TreeHandler

func (g *Gwi) TreeHandler(w http.ResponseWriter, r *http.Request)

func (*Gwi) UserListHandler

func (g *Gwi) UserListHandler(w http.ResponseWriter, r *http.Request)

type RepoInfo

type RepoInfo struct {
	Name     string
	Ref      string
	Desc     string
	CloneURL string
	Creator  string
	Files    []File
	Owners   []string
	Commits  []*object.Commit
	Branches []*plumbing.Reference
	Readme   template.HTML
	License  template.HTML
}

type User

type User struct {
	Login string
	Pass  string
}

type Vault

type Vault interface {
	Validate(login, pass string) bool
}

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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