app

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2022 License: GPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OutputTypeJSON = "json"
	OutputTypeText = "text"
)

Variables

View Source
var (
	ErrNotTested   = errors.New("warning, EZ-Login 3000 is not tested on this OS, if it doesn't work, use manual login method")
	ErrUnsupported = errors.New("EZ-Login 3000 is not supported on this OS, please use the manual login method")
)
View Source
var (
	ErrInvalidInput = errors.New("no valid input")
)
View Source
var ErrNothingToDo = errors.New("no valid input and no list flags specified")

Functions

func AuthReset added in v2.1.0

func AuthReset(cacheDir string) error

AuthReset removes the cached credentials.

func CacheDir added in v2.1.0

func CacheDir() string

func Dump added in v2.1.0

func Dump(ctx context.Context, cfg Config, prov auth.Provider) error

func Export added in v2.1.0

func Export(ctx context.Context, cfg Config, prov auth.Provider) error

Export performs the full export of slack workspace in slack export compatible format.

func InitProvider added in v2.1.0

func InitProvider(ctx context.Context, cacheDir string, workspace string, creds Credentials) (auth.Provider, error)

InitProvider initialises the auth.Provider depending on provided slack credentials. It returns auth.Provider or an error. The logic diagram is available in the doc/diagrams/auth_flow.puml.

If the creds is empty, it attempts to load the stored credentials. If it finds them, it returns an initialised credentials provider. If not - it returns the auth provider according to the type of credentials determined by creds.AuthProvider, and saves them to an AES-256-CFB encrypted storage.

The storage is encrypted using the hash of the unique machine-ID, supplied by the operating system (see package encio), it makes it impossible to transfer and use the stored credentials on another machine (including virtual), even another operating system on the same machine, unless it's a clone of the source operating system on which the credentials storage was created.

func Run added in v2.1.0

func Run(ctx context.Context, cfg Config, prov auth.Provider) error

Run starts the Slackdump.

Types

type Config

type Config struct {
	ListFlags ListFlags

	Input  Input  // parameters of the input
	Output Output // " " output

	Oldest TimeValue // oldest time to dump conversations from
	Latest TimeValue // latest time to dump conversations to

	FilenameTemplate string

	ExportName string

	Options slackdump.Options
}

func (Config) Logger added in v2.1.0

func (cfg Config) Logger() logger.Interface

func (*Config) Validate

func (p *Config) Validate() error

Validate checks if the command line parameters have valid values.

type Credentials added in v2.1.0

type Credentials interface {
	IsEmpty() bool
	AuthProvider(ctx context.Context, workspace string) (auth.Provider, error)
}

type Input

type Input struct {
	List *structures.EntityList // Include channels
}

func (*Input) IsValid

func (in *Input) IsValid() bool

type ListFlags

type ListFlags struct {
	Users    bool
	Channels bool
}

func (ListFlags) FlagsPresent

func (lf ListFlags) FlagsPresent() bool

type Output

type Output struct {
	Filename string
	Format   string // output format
	Base     string // base directory or zip file
}

func (Output) FormatValid

func (out Output) FormatValid() bool

func (Output) IsText

func (out Output) IsText() bool

type SlackCreds added in v2.0.3

type SlackCreds struct {
	Token  string
	Cookie string
}

SlackCreds holds the Token and Cookie reference.

func (SlackCreds) AuthProvider added in v2.0.3

func (c SlackCreds) AuthProvider(ctx context.Context, workspace string) (auth.Provider, error)

AuthProvider returns the appropriate auth Provider depending on the values of the token and cookie.

func (SlackCreds) IsEmpty added in v2.1.0

func (c SlackCreds) IsEmpty() bool

func (SlackCreds) Type added in v2.0.3

func (c SlackCreds) Type(ctx context.Context) (auth.Type, error)

Type returns the authentication type that should be used for the current slack creds. If the auth type wasn't tested on the system that the slackdump is being executed on it will return the valid type and ErrNotTested, so that this unfortunate fact could be relayed to the end-user. If the type of the authentication determined is not supported for the current system, it will return ErrUnsupported.

type TimeValue

type TimeValue time.Time

TimeValue satisfies flag.Value, used for command line parsing.

func (*TimeValue) Set

func (tv *TimeValue) Set(s string) error

func (*TimeValue) String

func (tv *TimeValue) String() string

Directories

Path Synopsis
Package ui contains some common UI elements, that use Survey library.
Package ui contains some common UI elements, that use Survey library.

Jump to

Keyboard shortcuts

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