rwtxt

package module
v1.8.6 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2021 License: MIT Imports: 25 Imported by: 1

README

rwtxt
Build Status Version

A cms for absolute minimalists. Try it at rwtxt.com.

rwtxt is an open-source website where you can store any text online for easy sharing and quick recall. In more specific terms, it is a light-weight and fast content management system (CMS) where you write in Markdown with emphasis on reading.

rwtxt builds off cowyo, a similar app I made previously. In improving with rwtxt I aimed to avoid second-system syndrome: I got rid of features I never used in cowyo (self-destruction, encryption, locking), while integrating a useful new feature not available previously: you can create domains. A domain is basically a personalized namespace where you can write private/public posts that are searchable. I personally use rwtxt to collect and jot notes for work, personal, coding - each which has its own searchable and indexed domain.

rwtxt is backed by a single sqlite3 database, so it's portable and very easy to backup. It's written in Go and all the assets are bundled so you can just download a single binary and start writing. You can also try the online version: rwtxt.com.

Usage

Reading. You can share rwtxt links to read them on another computer. rwtxt is organized in domains - places where you can privately or publicly store your text. If the domain is private, you must be signed in to read, even you have the permalink.

You can easily create your own domain in 10 seconds. When you make a new domain it will be private by default, so only you can view/search/edit your own text.

Once you make a domain you will see an option to make your domain public so that anyone can view/search it. However, only people with the domain password can edit in your domain - making rwtxt useful as a password-protected wiki. (The one exception is the /public domain, which anyone can edit/view - making rwtxt useful as a pastebin).

Writing. To write in rwtxt, just create a new page and click "Edit", or goto a URL for the thing you want to write about - like rwtxt.com/public/write-something. When you write in rwtxt you can format your text in Markdown.

In addition, writing triple backtick code blocks:

```javascript
console.log("hello, world");
```

produces code highlighted with prism.js:

console.log("hello, world");

Deleting. You can easily delete your page. Just erase all the content from it and it will disappear forever within 10 seconds.

Install

You can easily install and run rwtxt on your own computer.

You can download a binary for the latest release.

Or you can install from source. First, make sure to install Go. Then clone the repo:

$ git clone https://github.com/schollz/rwtxt.git

Then you can make it with:

$ make

And then run it!

$ export PATH="${PATH}:${GOPATH}/bin"
$ rwtxt

Docker

You can also easily install and run with Docker.

$ docker pull schollz/rwtxt

Then run by using docker

$ docker run -v /place/to/store/data:/data -p 8000:8152 schollz/rwtxt

In this case -p 8000:8152 will have rwtxt will be running on port 8000.

Notice

By using rwtxt.com you agree to the terms of service.

License

MIT

Documentation

Index

Constants

View Source
const DefaultBind = ":8152"

Variables

This section is empty.

Functions

This section is empty.

Types

type Config added in v1.4.2

type Config struct {
	Bind            string // interface:port to listen on, defaults to DefaultBind.
	Private         bool
	ResizeWidth     int
	ResizeOnUpload  bool
	ResizeOnRequest bool
	OrderByCreated  bool
}

type Payload

type Payload struct {
	ID        string `json:"id,omitempty"`
	DomainKey string `json:"domain_key,omitempty"`
	Domain    string `json:"domain,omitempty"`
	Data      string `json:"data,omitempty"`
	Slug      string `json:"slug,omitempty"`
	Message   string `json:"message,omitempty"`
	Success   bool   `json:"success"`
}

type RWTxt added in v1.2.0

type RWTxt struct {
	Config Config
	// contains filtered or unexported fields
}

func New added in v1.2.0

func New(fs *db.FileSystem, configUser ...Config) (*RWTxt, error)

func (*RWTxt) Handle added in v1.2.0

func (rwt *RWTxt) Handle(w http.ResponseWriter, r *http.Request) (err error)

func (*RWTxt) Handler added in v1.2.0

func (rwt *RWTxt) Handler(w http.ResponseWriter, r *http.Request)

func (*RWTxt) Serve added in v1.2.0

func (rwt *RWTxt) Serve() (err error)

type TemplateRender

type TemplateRender struct {
	Title              string
	Page               string
	Rendered           template.HTML
	File               db.File
	IntroText          template.JS
	Rows               int
	RandomUUID         string
	Domain             string
	DomainID           int
	DomainKey          string
	DomainIsPrivate    bool
	DomainIsPublic     bool
	PrivateEnvironment bool
	DomainValue        template.HTMLAttr
	DomainList         []string
	DomainKeys         map[string]string
	DefaultDomain      string
	SignedIn           bool
	Message            string
	NumResults         int
	Files              []db.File
	MostActiveList     []db.File
	SimilarFiles       []db.File
	AllFiles           []db.File
	Search             string
	DomainExists       bool
	ShowCookieMessage  bool
	EditOnly           bool
	Languages          []string
	LanguageJS         []template.JS

	RWTxtConfig Config
	RenderTime  time.Time
	UTCOffset   int
	Options     db.DomainOptions
	CustomIntro template.HTML
	CustomCSS   template.CSS
	// contains filtered or unexported fields
}

func NewTemplateRender added in v1.2.0

func NewTemplateRender(rwt *RWTxt) *TemplateRender

Directories

Path Synopsis
cmd
pkg
db

Jump to

Keyboard shortcuts

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