Documentation
¶
Index ¶
- Constants
- Variables
- func AddLocalStore(path string)
- func AddLocalStores(path []string)
- func AutoSetCachePath()
- func CanAddLocalStores(path string) bool
- func DefaultConfigLocation() string
- func DeleteConfigIn(in string) error
- func GetCachePath() string
- func GetCertFile() string
- func GetClearCacheExit() bool
- func GetClearDatabaseWhenExit() bool
- func GetConfigPath() string
- func GetDebug() bool
- func GetDefaultMode() string
- func GetDisableLAN() bool
- func GetEnableDatabase() bool
- func GetEnableTLS() bool
- func GetEnableUpload() bool
- func GetExcludePath() []string
- func GetHomeDirectoryConfig() string
- func GetHost() string
- func GetJwtSigningKey() string
- func GetKeyFile() string
- func GetLocalStoresList() []string
- func GetLogFileName() string
- func GetLogFilePath() string
- func GetLogToFile() bool
- func GetMaxScanDepth() int
- func GetMinImageNum() int
- func GetOpenBrowser() bool
- func GetPassword() string
- func GetPort() int
- func GetPrintAllPossibleQRCode() bool
- func GetProgramDirectoryConfig() string
- func GetQrcodeURL() string
- func GetStaticFileMode() bool
- func GetStores() []stores.Store
- func GetSupportFileType() []string
- func GetSupportMediaType() []string
- func GetSupportTemplateFile() []string
- func GetTimeout() int
- func GetTimeoutLimitForScan() int
- func GetUploadPath() string
- func GetUseCache() bool
- func GetUsername() string
- func GetVersion() string
- func GetWorkingDirectoryConfig() string
- func GetZipFileTextEncoding() string
- func InitCfgStores()
- func ReplaceLocalStores(pathList []string)
- func SaveConfig(to string) error
- func SetByExecutableFilename()
- func SetCachePath(path string)
- func SetClearCacheExit(clearCacheExit bool)
- func SetClearDatabaseWhenExit(clearDatabaseWhenExit bool)
- func SetConfigPath(path string)
- func SetDebug(debug bool)
- func SetDisableLAN(disableLAN bool)
- func SetEnableDatabase(enableDatabase bool)
- func SetHost(host string)
- func SetOpenBrowser(openBrowser bool)
- func SetPort(port int)
- func SetUploadPath(path string)
- func SetUseCache(useCache bool)
- func UpdateConfigByJson(jsonString string) error
- func WriteConfigFile() error
- type Config
- func (c *Config) AddStringArrayConfig(fieldName, addValue string) ([]string, error)
- func (c *Config) DeleteStringArrayConfig(fieldName, deleteValue string) ([]string, error)
- func (c *Config) GetClearDatabaseWhenExit() bool
- func (c *Config) GetDebug() bool
- func (c *Config) GetEnableDatabase() bool
- func (c *Config) GetExcludePath() []string
- func (c *Config) GetLocalStores() []string
- func (c *Config) GetMaxScanDepth() int
- func (c *Config) GetMinImageNum() int
- func (c *Config) GetStores() []stores.Store
- func (c *Config) GetSupportFileType() []string
- func (c *Config) GetSupportMediaType() []string
- func (c *Config) GetSupportTemplateFile() []string
- func (c *Config) GetTimeoutLimitForScan() int
- func (c *Config) GetTopStoreName() string
- func (c *Config) GetZipFileTextEncoding() string
- func (c *Config) SetConfigValue(fieldName, fieldValue string) error
- type FrpClientConfig
- type Status
- type UploadDirOption
- type WebPServerConfig
Constants ¶
View Source
const ( HomeDirectory = "HomeDirectory" WorkingDirectory = "WorkingDirectory" ProgramDirectory = "ProgramDirectory" )
Variables ¶
View Source
var CfgStatus = Status{}
View Source
var Mutex sync.Mutex
View Source
var Server *http.Server
Functions ¶
func AddLocalStores ¶ added in v1.0.0
func AddLocalStores(path []string)
AddLocalStores 添加本地书库(多个路径)
func AutoSetCachePath ¶ added in v1.0.0
func AutoSetCachePath()
func CanAddLocalStores ¶ added in v1.0.0
CanAddLocalStores 检查本地书库路径是否可添加
func DefaultConfigLocation ¶ added in v1.0.0
func DefaultConfigLocation() string
DefaultConfigLocation 判断当前配置文件应该保存到哪里。 逻辑:
- 是否在HomeDirectory已有 config.toml
- 否则是否在WorkingDirectory已有 config.toml
- 否则是否在ProgramDirectory已有 config.toml 若都没有,则返回 "HomeDirectory"。
返回:location字符串
func DeleteConfigIn ¶
func GetCachePath ¶ added in v1.0.0
func GetCachePath() string
func GetCertFile ¶ added in v1.0.0
func GetCertFile() string
func GetClearCacheExit ¶ added in v1.0.0
func GetClearCacheExit() bool
func GetClearDatabaseWhenExit ¶ added in v1.0.0
func GetClearDatabaseWhenExit() bool
func GetConfigPath ¶ added in v1.0.0
func GetConfigPath() string
func GetDefaultMode ¶ added in v1.0.0
func GetDefaultMode() string
func GetDisableLAN ¶ added in v1.0.0
func GetDisableLAN() bool
func GetEnableDatabase ¶ added in v1.0.0
func GetEnableDatabase() bool
func GetEnableTLS ¶ added in v1.0.0
func GetEnableTLS() bool
func GetEnableUpload ¶ added in v1.0.0
func GetEnableUpload() bool
func GetExcludePath ¶ added in v1.0.0
func GetExcludePath() []string
func GetHomeDirectoryConfig ¶ added in v1.0.0
func GetHomeDirectoryConfig() string
func GetJwtSigningKey ¶ added in v1.0.0
func GetJwtSigningKey() string
GetJwtSigningKey JWT令牌签名key,目前是用户名+密码(如果两者都设置了的话)
func GetKeyFile ¶ added in v1.0.0
func GetKeyFile() string
func GetLocalStoresList ¶ added in v1.0.0
func GetLocalStoresList() []string
func GetLogFileName ¶ added in v1.0.0
func GetLogFileName() string
func GetLogFilePath ¶ added in v1.0.0
func GetLogFilePath() string
func GetLogToFile ¶ added in v1.0.0
func GetLogToFile() bool
func GetMaxScanDepth ¶ added in v1.0.0
func GetMaxScanDepth() int
func GetMinImageNum ¶ added in v1.0.0
func GetMinImageNum() int
func GetOpenBrowser ¶ added in v1.0.0
func GetOpenBrowser() bool
func GetPrintAllPossibleQRCode ¶ added in v1.0.0
func GetPrintAllPossibleQRCode() bool
func GetProgramDirectoryConfig ¶ added in v1.0.0
func GetProgramDirectoryConfig() string
func GetQrcodeURL ¶
func GetQrcodeURL() string
func GetStaticFileMode ¶ added in v1.0.0
func GetStaticFileMode() bool
func GetSupportFileType ¶ added in v1.0.0
func GetSupportFileType() []string
func GetSupportMediaType ¶ added in v1.0.0
func GetSupportMediaType() []string
func GetSupportTemplateFile ¶ added in v1.0.0
func GetSupportTemplateFile() []string
func GetTimeout ¶ added in v1.0.0
func GetTimeout() int
func GetTimeoutLimitForScan ¶ added in v1.0.0
func GetTimeoutLimitForScan() int
func GetUploadPath ¶ added in v1.0.0
func GetUploadPath() string
func GetUseCache ¶ added in v1.0.0
func GetUseCache() bool
func GetVersion ¶ added in v1.0.0
func GetVersion() string
func GetWorkingDirectoryConfig ¶ added in v1.0.0
func GetWorkingDirectoryConfig() string
func GetZipFileTextEncoding ¶ added in v1.0.0
func GetZipFileTextEncoding() string
func ReplaceLocalStores ¶ added in v1.0.0
func ReplaceLocalStores(pathList []string)
ReplaceLocalStores 替换现有的“本地”类型的书库,保留其他类型的书库
func SaveConfig ¶
func SetByExecutableFilename ¶ added in v1.0.0
func SetByExecutableFilename()
SetByExecutableFilename 通过执行文件名设置默认网页模板参数
func SetCachePath ¶ added in v1.0.0
func SetCachePath(path string)
func SetClearCacheExit ¶ added in v1.0.0
func SetClearCacheExit(clearCacheExit bool)
func SetClearDatabaseWhenExit ¶ added in v1.0.0
func SetClearDatabaseWhenExit(clearDatabaseWhenExit bool)
func SetConfigPath ¶ added in v1.0.0
func SetConfigPath(path string)
func SetDisableLAN ¶ added in v1.0.0
func SetDisableLAN(disableLAN bool)
func SetEnableDatabase ¶ added in v1.0.0
func SetEnableDatabase(enableDatabase bool)
func SetOpenBrowser ¶ added in v1.0.0
func SetOpenBrowser(openBrowser bool)
func SetUploadPath ¶ added in v1.0.0
func SetUploadPath(path string)
func SetUseCache ¶ added in v1.0.0
func SetUseCache(useCache bool)
func UpdateConfigByJson ¶ added in v1.0.0
UpdateConfigByJson 使用 JSON 字符串反序列化将更新的配置解析为映射,遍历映射并更新配置,减少重复的代码。
Types ¶
type Config ¶
type Config struct {
AutoRescan bool `json:"AutoRescan" comment:"刷新页面时,是否自动重新扫描书籍是否存在"`
CachePath string `json:"CachePath" comment:"本地图片缓存位置,默认系统临时文件夹"`
CertFile string `json:"CertFile" comment:"TLS/SSL 证书文件路径 (default: ~/.config/.comigo/cert.crt)"`
ClearCacheExit bool `json:"ClearCacheExit" comment:"退出程序的时候,清理web图片缓存"`
ClearDatabaseWhenExit bool `json:"ClearDatabaseWhenExit" comment:"启用本地数据库时,扫描完成后,清除不存在的书籍。"`
ConfigPath string `json:"-" toml:"-" comment:"用户指定的的yaml设置文件路径"`
Debug bool `json:"Debug" comment:"开启Debug模式"`
DefaultMode string `json:"DefaultMode" comment:"默认阅读模式,默认为空,可以设置为scroll或flip"`
DisableLAN bool `json:"DisableLAN" comment:"只在本机提供阅读服务,不对外共享"`
EnableDatabase bool `json:"EnableDatabase" comment:"启用本地数据库,保存扫描到的书籍数据。"`
EnableTLS bool `json:"EnableTLS" comment:"是否启用HTTPS协议。需要设置证书于key文件。"`
EnableUpload bool `json:"EnableUpload" comment:"启用上传功能"`
ExcludePath []string `json:"ExcludePath" comment:"扫描书籍的时候,需要排除的文件或文件夹的名字"`
GenerateMetaData bool `json:"GenerateMetaData" toml:"GenerateMetaData" comment:"生成书籍元数据"`
Host string `json:"Host" comment:"自定义二维码显示的主机名"`
KeyFile string `json:"KeyFile" comment:"TLS/SSL key文件路径 (default: ~/.config/.comigo/key.key)"`
LocalStores []string `json:"LocalStores" comment:"本地书库文件夹"`
LogFileName string `json:"LogFileName" comment:"Log文件名"`
LogFilePath string `json:"LogFilePath" comment:"Log文件的保存位置"`
LogToFile bool `json:"LogToFile" comment:"是否保存程序Log到本地文件。默认不保存。"`
MaxScanDepth int `json:"MaxScanDepth" comment:"最大扫描深度"`
MinImageNum int `json:"MinImageNum" comment:"压缩包或文件夹内,至少有几张图片,才算作书籍"`
OpenBrowser bool `json:"OpenBrowser" comment:"是否同时打开浏览器,windows默认true,其他默认false"`
Password string `json:"Password" comment:"登录界面需要的密码。"`
Port int `` /* 279-byte string literal not displayed */
PrintAllPossibleQRCode bool `json:"PrintAllPossibleQRCode" comment:"扫描完成后,打印所有可能的阅读链接二维码"`
Stores []stores.Store `json:"BookStores" toml:"-" comment:"书库设置"`
SupportFileType []string `json:"SupportFileType" comment:"支持的书籍压缩包后缀"`
SupportMediaType []string `json:"SupportMediaType" comment:"扫描压缩包时,用于统计图片数量的图片文件后缀"`
SupportTemplateFile []string `json:"SupportTemplateFile" comment:"支持的模板文件类型,默认为html"`
StaticFileMode bool `` /* 201-byte string literal not displayed */
Timeout int `json:"Timeout" comment:"cookie过期的时间。单位为分钟。默认60*24*30分钟后过期。"`
TimeoutLimitForScan int `` /* 130-byte string literal not displayed */
UploadDirOption UploadDirOption `` /* 132-byte string literal not displayed */
UploadPath string `json:"UploadPath" comment:"指定上传路径时,上传文件的存储位置"`
UseCache bool `json:"UseCache" comment:"开启本地图片缓存,可以加快二次读取,但会占用硬盘空间"`
Username string `json:"Username" comment:"登录界用的用户名。"`
ZipFileTextEncoding string `json:"ZipFileTextEncoding" comment:"非utf-8编码的ZIP文件,尝试用什么编码解析,默认GBK"`
}
Config Comigo全局配置
func (*Config) AddStringArrayConfig ¶ added in v1.0.0
AddStringArrayConfig 往指定的 []string 字段中添加一个新字符串
func (*Config) DeleteStringArrayConfig ¶ added in v1.0.0
DeleteStringArrayConfig 从指定的 []string 字段中删除某个字符串
func (*Config) GetClearDatabaseWhenExit ¶ added in v1.0.0
func (*Config) GetEnableDatabase ¶ added in v1.0.0
func (*Config) GetExcludePath ¶ added in v1.0.0
func (*Config) GetLocalStores ¶ added in v1.0.0
func (*Config) GetMaxScanDepth ¶ added in v1.0.0
func (*Config) GetMinImageNum ¶ added in v1.0.0
func (*Config) GetSupportFileType ¶ added in v1.0.0
func (*Config) GetSupportMediaType ¶ added in v1.0.0
func (*Config) GetSupportTemplateFile ¶ added in v1.0.0
func (*Config) GetTimeoutLimitForScan ¶ added in v1.0.0
func (*Config) GetTopStoreName ¶ added in v1.0.0
func (*Config) GetZipFileTextEncoding ¶ added in v1.0.0
func (*Config) SetConfigValue ¶ added in v1.0.0
SetConfigValue 根据字段名和字符串形式的值,来更新 Config 的相应字段。 如果字段名不存在,则返回错误。如果字段类型不在支持范围内,也返回错误。
type FrpClientConfig ¶ added in v1.0.0
type FrpClientConfig struct {
FrpcCommand string `comment:"手动设定frpc可执行程序的路径,默认为frpc"`
ServerAddr string
ServerPort int
Token string
FrpType string //本地转发端口设置
RemotePort int
RandomRemotePort bool
}
FrpClientConfig frp客户端配置
type Status ¶
type Status struct {
// 当前生效的配置文件路径 None、HomeDirectory、WorkingDirectory、ProgramDirectory
// 设置读取顺序:None(默认值) -> HomeDirectory -> ProgramDirectory -> WorkingDirectory
In string
Path struct {
// 对应配置文件的绝对路径
WorkingDirectory string
HomeDirectory string
ProgramDirectory string
}
}
func (*Status) SetConfigStatus ¶ added in v1.0.0
type UploadDirOption ¶ added in v1.0.0
type UploadDirOption int
Source Files
¶
Click to show internal directories.
Click to hide internal directories.