cmd

package
v0.0.0-...-ca5cfa8 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const URISeparator = "\n"

Variables

View Source
var AccountsCmd = &cli.Command{
	Name:  "accounts",
	Usage: "Accounts helper",
	Subcommands: []*cli.Command{
		exportAccountsMetadataCmd,
		importAccountsMetadataCmd,
		generateKeysCmd,
	},
}
View Source
var BootstrapCmd = &cli.Command{
	Name:  "bootstrap",
	Usage: "Bootstrap a new postgres or bolt database helper",
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:  "root",
			Usage: "root account of postgres server (default: postgres)",
			Value: "postgres",
		},
		&cli.StringFlag{
			Name:  "sql",
			Usage: "path to the queries for initializing the database",
			Value: "postgres",
		},
		&cli.StringFlag{
			Name:  "key-type",
			Usage: fmt.Sprintf("Type of keys to generate: %v", []string{fedbox.KeyTypeED25519, fedbox.KeyTypeRSA}),
			Value: fedbox.KeyTypeED25519,
		},
	},
	Action: bootstrapAct(&ctl),
	Subcommands: []*cli.Command{
		reset,
	},
}
View Source
var FixStorageCollectionsCmd = &cli.Command{
	Name:   "fix-storage",
	Usage:  "Fix storage collections helper",
	Action: fixStorageCollectionsAct(&ctl),
}
View Source
var OAuth2Cmd = &cli.Command{
	Name:  "oauth",
	Usage: "OAuth2 client and access token helper",
	Subcommands: []*cli.Command{
		client,
		token,
	},
}
View Source
var PubCmd = &cli.Command{
	Name:    "pub",
	Aliases: []string{"ap"},
	Usage:   "ActivityPub management helper",
	Subcommands: []*cli.Command{
		actorsCmd,
		addObjectCmd,
		listObjectsCmd,
		showObjectCmd,
		delObjectsCmd,
		moveObjectsCmd,
		copyObjectsCmd,
		exportCmd,
		importCmd,
	},
}

Functions

func AddKeyToItem

func AddKeyToItem(metaSaver storage.MetadataTyper, it vocab.Item, typ string) error

func Before

func Before(c *cli.Context) error

func Bootstrap

func Bootstrap(conf config.Options, service vocab.Item) error

func ByName

func ByName(names ...string) url.Values

func ByType

func ByType(types ...vocab.ActivityVocabularyType) url.Values

func ByURL

func ByURL(urls ...vocab.IRI) url.Values

func CreateService

func CreateService(r s.FullStorage, self vocab.Item) (err error)

func Errf

func Errf(s string, par ...any)

func FilterFlags

func FilterFlags() []cli.Flag

func IRIWithFilters

func IRIWithFilters(iri vocab.IRI, searchParams ...url.Values) vocab.IRI

func LoadFilters

func LoadFilters(c *cli.Context) (*filters.Filters, error)

func NewApp

func NewApp(version string) *cli.App

func Reset

func Reset(conf config.Options) error

func SearchActorsIRI

func SearchActorsIRI(baseIRI vocab.IRI, searchParams ...url.Values) vocab.IRI

Types

type Control

type Control struct {
	Conf    config.Options
	Logger  lw.Logger
	Service vocab.Actor
	Storage st.FullStorage
}

func New

func New(db st.FullStorage, conf config.Options, l lw.Logger) *Control

func (*Control) Add

func (c *Control) Add(types []string) (vocab.ItemCollection, error)

func (*Control) AddActor

func (c *Control) AddActor(p *vocab.Person, pw []byte, author vocab.Actor) (*vocab.Person, error)

func (*Control) AddClient

func (c *Control) AddClient(pw []byte, redirect []string, u any) (string, error)

func (*Control) AddObject

func (c *Control) AddObject(p *vocab.Object, author vocab.Actor) (*vocab.Object, error)

func (*Control) CopyObjects

func (c *Control) CopyObjects(to vocab.IRI, from ...vocab.Item) error

func (*Control) DeleteClient

func (c *Control) DeleteClient(id string) error

func (*Control) DeleteObjects

func (c *Control) DeleteObjects(reason string, inReplyTo []string, ids ...string) error

func (*Control) GenAuthToken

func (c *Control) GenAuthToken(clientID, actorIdentifier string, _ any) (string, error)

func (*Control) List

func (c *Control) List(iris vocab.IRIs, types ...string) (vocab.ItemCollection, error)

func (*Control) ListClients

func (c *Control) ListClients() ([]osin.Client, error)

func (*Control) MoveObjects

func (c *Control) MoveObjects(to vocab.IRI, from ...vocab.Item) error

Jump to

Keyboard shortcuts

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