Code Monkey home page Code Monkey logo

twserver-go's Introduction

twserver-go

A TiddlyWiki HTTP Server written in Go.

Features

  • Automatic backup on each save.
  • Customizable settings.
  • Easy to deploy.
  • Works on macOS, Linux and Windows.

Getting started

Prerequisites

Setup

  • Download the latest build for your platform.
  • Extract the archive.
  • cd into the directory that was just created.
  • Put the TiddlyWiki's empty.html file inside the www subfolder.
  • Rename the empty.html file to index.html.
  • Run the server: ./twserver.
  • Open your web browser and browse to: http://localhost:8080

Customizing

All server settings can be tweaked using a configuration file located beside the server binary. The configuration file must use the same name as the binary and saved with the .json extension.

  • Create a configuration file in JSON format (on Linux/macOS):
touch twserver.json
  • Open the file with your favorite text editor and write the following values (default):
{
  "Host": "",
  "Port": 8080,
  "DocumentRootDir": "./www",
  "IndexFile": "index.html",
  "BackupDir": "./backup",
  "BackupFileFormat": ":name:.:date:.html",
  "ServeDirs": [],
  "LogFileName": "./logs/twserver.log",
  "LogMaxSize": 4,
  "LogMaxBackups": 16,
  "LogMaxAge": 28,
  "LogCompress": true
}
  • Tweak the values as needed, save the file and restart the server.

By default, the HTTP server only serves the index file and rejects any other request. To serve one or more custom directories containing extra resources (such as images), you have to add them by tweaking the ServeDirs value in the configuration file.

  • Example: Add the images directory located in ./images and accessed via the URL <wiki_url>/img/:
{
  "ServeDirs": [
    {
      "URL": "/img/",
      "Path": "./images"
    }
  ]
}
  • Any image from the ./images directory can now be reached via <wiki_url>/img/ and displayed inside any wiki post.

Building

Building is done with the go tool. If you have setup your GOPATH correctly, the following should work:

go get github.com/k4rian/twserver-go
go build -ldflags "-w -s" github.com/k4rian/twserver-go

Dependencies

The rotating logging system is powered by lumberjack:

gopkg.in/natefinch/lumberjack.v2="v2.2.1"

Docker Image

A Docker image is available on Docker Hub under k4rian/twserver and its corresponding source repository on GitHub.

License

MIT

twserver-go's People

Contributors

k4rian avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

twserver-go's Issues

[BUG] Delete a tiddler does not trigger a save

When you create a new tiddler, twserver-go triggers a save
BUT when you delete a tiddler twserver-go does not trigger a save and you have to manually click on save!

It seems some of actions need to manually click on the save button

[IDEA] Add Support with Subfolder and Other Wiki Names

First many thanks for this amazing portable tool!

Two suggestion:

  1. support subfolders for Tiddlywikis
  2. support for other names e.g (mywiki.html instead of index.html)

The subfolder can be set up and used but backup does not work!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.