services

package
v0.0.0-...-547982a Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2020 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackupFile

type BackupFile struct {
	FilesLocation string
	Name          string
	FileData      []byte
}

BackupFile BackupFile

type BackupFiles

type BackupFiles struct {
	ContentStoreFiles  *[]BackupFile
	TemplateStoreFiles *[]BackupFile
	ImageFiles         *[]BackupFile
	TemplateFiles      *BackupFile
}

BackupFiles BackupFiles

type Captcha

type Captcha struct {
	Secret   string `json:"secret"`
	Response string `json:"response"`
	Remoteip string `json:"remoteip"`
}

Captcha Captcha

type CaptchaResponse

type CaptchaResponse struct {
	Success     bool      `json:"success"`
	ChallengeTs time.Time `json:"challenge_ts"`
	Hostname    string    `json:"hostname"`
	ErrorCodes  []string  `json:"error-codes"`
	Code        int       `json:"code"`
}

CaptchaResponse res

type CmsService

type CmsService struct {
	Store              ds.JSONDatastore
	TemplateStore      ds.JSONDatastore
	ContentStorePath   string
	TemplateStorePath  string
	TemplateFilePath   string
	TemplateFullPath   string
	MailSender         ml.Sender
	Log                *lg.Logger
	ImagePath          string
	ImageFullPath      string
	CaptchaHost        string
	MockCaptcha        bool
	MockCaptchaSuccess bool
	MockCaptchaCode    int
	HitTotal           int
	ContentHits        map[string]int64
	HitLimit           int
	// contains filtered or unexported fields
}

CmsService service

func (*CmsService) ActivateTemplate

func (c *CmsService) ActivateTemplate(name string) bool

ActivateTemplate ActivateTemplate

func (*CmsService) AddContent

func (c *CmsService) AddContent(content *Content) *Response

AddContent add content

func (*CmsService) AddImage

func (c *CmsService) AddImage(name string, fileData []byte) bool

AddImage AddImage

func (*CmsService) AddTemplate

func (c *CmsService) AddTemplate(tpl *Template) bool

AddTemplate AddTemplate

func (*CmsService) AddTemplateFile

func (c *CmsService) AddTemplateFile(name string, originalFileName string, fileData []byte) bool

AddTemplateFile AddTemplateFile

func (*CmsService) DeleteContent

func (c *CmsService) DeleteContent(name string) *Response

DeleteContent delete content

func (*CmsService) DeleteImage

func (c *CmsService) DeleteImage(name string) bool

DeleteImage DeleteImage

func (*CmsService) DeleteTemplate

func (c *CmsService) DeleteTemplate(name string) bool

DeleteTemplate DeleteTemplate

func (*CmsService) DeleteTemplateFile

func (c *CmsService) DeleteTemplateFile(namedir string) bool

DeleteTemplateFile delete template files

func (*CmsService) DownloadBackups

func (c *CmsService) DownloadBackups() (bool, *[]byte)

DownloadBackups DownloadBackups

func (*CmsService) ExtractFile

func (c *CmsService) ExtractFile(t *TemplateFile) bool

ExtractFile extract

func (*CmsService) GetActiveTemplateName

func (c *CmsService) GetActiveTemplateName() string

GetActiveTemplateName GetActiveTemplateName

func (*CmsService) GetContent

func (c *CmsService) GetContent(name string) (bool, *Content)

GetContent get content

func (*CmsService) GetContentList

func (c *CmsService) GetContentList(published bool) *[]Content

GetContentList get content list by client

func (*CmsService) GetImageList

func (c *CmsService) GetImageList() *[]Image

GetImageList GetImageList

func (*CmsService) GetImagePath

func (c *CmsService) GetImagePath(imageName string) string

GetImagePath GetImagePath

func (*CmsService) GetNew

func (c *CmsService) GetNew() Service

GetNew GetNew

func (*CmsService) GetTemplateList

func (c *CmsService) GetTemplateList() *[]Template

GetTemplateList GetTemplateList

func (*CmsService) HitCheck

func (c *CmsService) HitCheck()

HitCheck HitCheck

func (*CmsService) SaveHits

func (c *CmsService) SaveHits()

SaveHits SaveHits

func (*CmsService) SendCaptchaCall

func (c *CmsService) SendCaptchaCall(cap Captcha) *CaptchaResponse

SendCaptchaCall SendCaptchaCall

func (*CmsService) SendMail

func (c *CmsService) SendMail(mailer *ml.Mailer) bool

SendMail SendMail

func (*CmsService) UpdateContent

func (c *CmsService) UpdateContent(content *Content) *Response

UpdateContent add content

func (*CmsService) UploadBackups

func (c *CmsService) UploadBackups(bk *[]byte) bool

UploadBackups UploadBackups

type Content

type Content struct {
	Name              string    `json:"name"`
	Title             string    `json:"title"`
	Subject           string    `json:"subject"`
	Author            string    `json:"author"`
	CreateDate        time.Time `json:"createDate"`
	ModifiedDate      time.Time `json:"modifiedDate"`
	Hits              int64     `json:"hits"`
	MetaAuthorName    string    `json:"metaAuthorName"`
	MetaDesc          string    `json:"metaDesc"`
	MetaKeyWords      string    `json:"metaKeyWords"`
	MetaRobotKeyWords string    `json:"metaRobotKeyWords"`
	Text              string    `json:"text"`
	TextHTML          template.HTML
	Archived          bool `json:"archived"`
	Visible           bool `json:"visible"`
	UseModifiedDate   bool
	BlogPost          bool `json:"blogPost"`
}

Content content

type Image

type Image struct {
	Name     string
	ImageURL string
}

Image Image

type PageHead struct {
	Title        string
	MetaAuthor   string
	MetaDesc     string
	MetaKeyWords string
}

PageHead used for page head

type Response

type Response struct {
	Success  bool   `json:"success"`
	Name     string `json:"name"`
	FailCode int    `json:"failCode"`
}

Response res

type Service

type Service interface {
	AddContent(content *Content) *Response
	UpdateContent(content *Content) *Response
	GetContent(name string) (bool, *Content)
	GetContentList(published bool) *[]Content
	DeleteContent(name string) *Response

	AddImage(name string, fileData []byte) bool
	GetImagePath(imageName string) string
	GetImageList() *[]Image
	DeleteImage(name string) bool

	SendMail(mailer *ml.Mailer) bool

	SendCaptchaCall(cap Captcha) *CaptchaResponse

	AddTemplateFile(name string, originalFileName string, fileData []byte) bool
	AddTemplate(tpl *Template) bool
	ActivateTemplate(name string) bool
	GetActiveTemplateName() string
	GetTemplateList() *[]Template
	DeleteTemplate(name string) bool

	ExtractFile(tFile *TemplateFile) bool
	DeleteTemplateFile(name string) bool

	UploadBackups(bk *[]byte) bool
	DownloadBackups() (bool, *[]byte)

	SaveHits()

	HitCheck()
}

Service Service

type Template

type Template struct {
	Name       string `json:"name"`
	Active     bool   `json:"active"`
	ScreenShot string `json:"screenShot"`
}

Template template

type TemplateFile

type TemplateFile struct {
	Name             string
	OriginalFileName string
	FileData         []byte
}

TemplateFile TemplateFile

Jump to

Keyboard shortcuts

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