webhook

package module
v0.17.4 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: MIT Imports: 13 Imported by: 0

README

webhook

webhook

✨ 你说得对,但是 webhook 是基于 weibo-webhook 改良的分布式博文收集终端 ✨

文档 · 下载

使用

本库的使用脚本正火速编写中,敬请期待!

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidConfig = errors.New("webhook: invalid configuration")

Functions

func Initial added in v0.15.0

func Initial(c *Config) (addr string, err error)

func SetConfig added in v0.14.0

func SetConfig(c *Config) error

Set sets c as the global config.

func Shutdown added in v0.15.0

func Shutdown()

Types

type Config

type Config struct {
	Filename string         `toml:"-"      yaml:"-"      json:"-"`      // 配置文件保存路径
	Path     Path           `toml:"path"   yaml:"path"   json:"path"`   // 各文件路径
	Server   Server         `toml:"server" yaml:"server" json:"server"` // 服务器参数
	Role     Role           `toml:"role"   yaml:"role"   json:"role "`  // 权限组
	Extra    map[string]any `toml:"extra"  yaml:"extra"  json:"extra"`  // 额外项
}

webhook 配置

func Global added in v0.15.0

func Global() *Config

func (*Config) Export added in v0.15.0

func (c *Config) Export() (err error)

func (*Config) Import added in v0.15.0

func (c *Config) Import() (err error)

type Path added in v0.4.1

type Path struct {
	Root   string `toml:"root"   yaml:"root"   json:"root"   default:"resource"`               // 程序根目录
	Logs   string `toml:"logs"   yaml:"logs"   json:"logs"   default:"logs"     join:"Root"`   // 记录文件夹
	UserDB string `toml:"userDB" yaml:"userDB" json:"userDB" default:"users.db" join:"Root"`   // 用户数据库文件
	BlogDB string `toml:"blogDB" yaml:"blogDB" json:"blogDB" default:"blogs.db" join:"Root"`   // 博文数据库文件
	Public string `toml:"public" yaml:"public" json:"public" default:"public"   join:"Root"`   // 公开文件夹
	Backup string `toml:"backup" yaml:"backup" json:"backup" default:"backup"   join:"Public"` // 博文数据库备份文件夹

	Full *Path `toml:"-" yaml:"-" json:"-"` // 以上字段的全路径 通过 utils.NewJoin 函数拼接
}

func (*Path) AfterInitial added in v0.15.0

func (p *Path) AfterInitial() (err error)

func (*Path) CopyBlogDB added in v0.15.0

func (p *Path) CopyBlogDB()

type Role added in v0.15.0

type Role struct {
	Owner string   `toml:"owner" yaml:"owner" json:"owner"` // 所有者
	Admin []string `toml:"admin" yaml:"admin" json:"admin"` // 管理员
}

type Server added in v0.14.0

type Server struct {
	Mode string `toml:"mode" yaml:"mode" json:"mode" default:"release"` // 模式
	Host string `toml:"host" yaml:"host" json:"host" default:"0.0.0.0"` // 主机
	Port uint16 `toml:"port" yaml:"port" json:"port" default:"9000"`    // 端口
}

func (Server) Addr added in v0.15.0

func (s Server) Addr() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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