app

package
v0.0.0-...-5b391e0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2020 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package app provides models that are needed by x.

Index

Constants

View Source
const DefaultHNFrontPageArticlesCount = 30

DefaultHNFrontPageArticlesCount is now 30

View Source
const EightHrs = 8 * 60 * 60 * time.Second

EightHrs in seconds

Variables

View Source
var BgColors = []string{"aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "blanchedalmond", "burlywood", "chartreuse"}

BgColors is the background colors for front-end

Functions

This section is empty.

Types

type Bringer

type Bringer interface {
	SetContext(context.Context)
	Bring([]int) ([]*Item, error) // accepts empty slices
	GetURL(interface{}) string
	GetDiscussLink(interface{}) string
	GetSource() string
}

Bringer brings a list of things from other portals

type Config

type Config struct {
	RunHTTPS                     bool   `json:"runHTTPS"`
	AutoCertCacheDir             string `json:"autoCertCacheDir"`
	HTTPPort                     string `json:"HTTPPort"`
	EncryptKey                   string `json:"encKey"`
	IndexTemplatePath            string `json:"indexTemplatePath"`
	AppDatabasePath              string `json:"appDatabasePath"`
	StaticResourcesDirectoryPath string `json:"staticResourcesDirPath"`
	BlogResourcesDirectoryPath   string `json:"blogResourcesDirPath"`

	RateLimit          string `json:"rateLimit"`
	RobotsTextFilePath string `json:"robotsTxtPath"`

	EnableCors    bool `json:"enableCors"`
	HaveRobotsTxt bool `json:"haveRobotsTxt"`
	PingGoogle    bool `json:"pingGoogle"`
	FetchPreviews bool `json:"fetchPreviews"`
}

Config is required configuration for app

type Item

type Item struct {
	//ID is item's unique id.
	ID int `json:"id"`
	//By is the username of the item's author.
	By string `json:"by"`
	//Title of the story, poll or job.
	Title string `json:"title"`
	//URL of the story.
	URL string `json:"url"`
	//Deleted denotes if the item is deleted.
	Deleted bool `json:"deleted"`
	//Dead denotes if the item is dead.
	Dead bool `json:"dead"`
	//DiscussLink is where the discussion on this item goes.
	DiscussLink string `json:"discussLink"`
	//Added is the time of addition of item.
	Added int `json:"added"`
	//Domain is the domain from where the story is delivered.
	Domain string `json:"domain"`

	//EncryptedURL is the URL encrypted using key from config.
	EncryptedURL string `json:"encryptedURL"`
	//EncryptedDiscussLink is the URL encrypted using key from config.
	EncryptedDiscussLink string `json:"encryptedDiscussLink"`

	//Description of the item.
	Description string `json:"description"`
	//Source of the item
	Source string `json:"source"`
}

Item is HN item

type Lynx

type Lynx struct {
	ID     int
	Output string
	Err    error
}

Lynx contains the id of the url, output of the content visited by lynx and any error

type PeriodicBringer

type PeriodicBringer interface {
	Bring() <-chan Bringer
}

PeriodicBringer gives us a bringer periodically

type TempStore

type TempStore struct {
	sync.RWMutex
	// Tmpl is the template.
	Tmpl *template.Template
	// BgColor of the rendered template.
	BgColor string
}

TempStore is temp storage for app

Jump to

Keyboard shortcuts

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