newsd

package module
v0.0.0-...-cb29121 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: AGPL-3.0 Imports: 17 Imported by: 0

README

newsd

newsd is a lightweight multi-user news aggregator supporting RSS and Atom feeds.

Achtung!

newsd is a work-in-progress and is likely not stable enough to be used in production. Development stopped for a while but restarted due to an increasing amount of frustration trying to keep my RSS feeds synced up across several devices. Most work is focused on cleaning up the code base and implementing enough of the Google Reader API so newsd could be used entirely through it.

Notably, authentication is currently extremely broken because I've only been doing local testing on my machine. Other notable lack of features include no folders support, shoddy favicon handling, and poor error handling.

Google Reader API

newsd has partial and broken read-only support for anything that supports the Google Reader API. This is very much a work in progress. Do not expect everything to work; I've only tested this with NetNewsWire (iOS).

When configuring, the API url will be at <newsd url>/api/gr. Use your normal username and password to login.

Documentation

Overview

Package newsd implements the backend of newsd.

Index

Constants

View Source
const (
	ErrNotModified   httpError = 304
	ErrNotFound      httpError = 404
	ErrNotAcceptable httpError = 406
)

Variables

View Source
var (
	// DatabasePath is the path to the database.
	// In the future I would like to add PostgreSQL support so this may be
	// deprecated.
	DatabasePath = "./newsd.db"

	// CheckEvery specifies the interval to check for feeds that need to be
	// updated.
	CheckEvery = time.Minute * 15

	// WorkerSize is the amount of free web workers for fetching feeds.
	WorkerSize = runtime.NumCPU() * 2

	// QueueSize is the amount of channels that can be enqueued for update
	// at once.
	QueueSize = 1000
)

Configuration section. This is to be configured by cmd/newsd.

View Source
var (
	// UserAgent is the user agent that is used to connect to web servers.
	// It should identify us in some way.
	UserAgent = "newsd/%s go/%s"
)

Functions

This section is empty.

Types

type Engine

type Engine struct {
	DB database.Driver
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context) (*Engine, error)

func (*Engine) FetchFavicon

func (e *Engine) FetchFavicon(ctx context.Context, u string, ifModifiedSince time.Time) (database.Favicon, error)

FetchFavicon attemps to find a favicon of a given URL.

The URL given is merely a hint; it will be tried first, but if an icon is unable to be found, /favicon.ico and / are tried to find the actual favicon path.

func (*Engine) FetchUrl

func (e *Engine) FetchUrl(ctx context.Context, url string, opts ...FetchOptions) (*http.Response, error)

FetchUrl fetches a URL and returns an error if the response code is not 200.

If the response code is 304, errNotModified is returned.

If err is nil, the response is returned as is. It is up to the caller to handle closing the response body.

func (*Engine) SaveFavicon

func (e *Engine) SaveFavicon(ctx context.Context, u string) error

func (*Engine) UpdateChannel

func (e *Engine) UpdateChannel(ctx context.Context, user int64, u string) (database.Channel, error)

type FetchOptions

type FetchOptions struct {
	Accept          string
	IfModifiedSince time.Time // if modified since
}

Directories

Path Synopsis
Package api implements a portion of the Google Reader API.
Package api implements a portion of the Google Reader API.
cmd
Package frontend implements the frontend of newsd.
Package frontend implements the frontend of newsd.

Jump to

Keyboard shortcuts

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