Coder Social home page Coder Social logo

tiddly's Introduction

TiddlyWiki App Engine Server

This is a minimal Google App Engine app, written in Go, that can serve as the back end for a personal TiddlyWiki

The TiddlyWiki5 implementation has a number of back end options. This app implements the backend expected by the “TiddlyWeb and TiddlySpace components” plugin.

The usual way to deploy TiddlyWeb is to run a fairly complex Python web server program. I'd rather not. Instead I implemented a minimal Go server that responds appropriately to the (relatively few) needed JSON API calls.

Authentication

The TiddlyWeb JSON API envisions a multiuser system in which different users have access to different sets of tiddlers. This Go server contains none of that: it assumes that all users have full access to everything, although it does record who created which tiddlers. The only access control is that the app.yaml here requires HTTPS and administrator login for all URLs, and as a “belt and suspenders” measure, the app itself also refuses to serve to non-admins, as checked by user.IsAdmin.

See the "Re Authentication" comment in tiddly.go for information about making the server publicly read-only (it's not quite perfect).

Data model

The app stores the current tiddlers in Cloud Datastore as Tiddler entities.

The app also stores every version of every tiddler as TiddlerHistory entities, if WriteTiddlerHistory == true in the Go code, by default it is false. Currently nothing reads the TiddlerHistory, but in case of a mistake that wipes out important Tiddler contents it should be possible to reconstruct lost data from the TiddlerHistory.

The TiddlyWiki downloaded as index.html that runs in the browser downloads (through the JSON API) a master list of all tiddlers and their metadata when the page first loads and then lazily fetches individual tiddler content on demand.

Deployment

Create an Google App Engine standard app and deploy with

gcloud app deploy app.yaml --project your-app --version your-version-id

Then visit https://your-app.appspot.com/. As noted above, only admins will have access to the content.

Plugins

TiddlyWiki supports extension through plugins. Plugins need to be in the downloaded index.html, not lazily like other tiddlers. Therefore, installing a plugin means updating a local copy of index.html and redeploying it to the server.

Macros

TiddlyWiki allows tiddlers with the tag $:/tags/Macro to contain global macro definitions made available to all tiddlers. The lazy loading of tiddler bodies interferes with this: something has to load the tiddler body before the macros it contains take effect. To work around this, the app includes the body of all macro tiddlers in the initial tiddler list (which otherwise does not contain bodies). This is sufficient to make macros take effect on reload.

For some reason, no such special hack is needed for $:/tags/Stylesheet tiddlers.

Synchronization

If you set Control Panel > Info > Basics > Default tiddlers by clicking “retain story ordering”, then the story list (the list of tiddlers shown on the page) is written to the server as it changes and is polled back from the server every 60 seconds. This means that if you have the web site open in two different browsers (for example, at home and at work), changes to what you're viewing in one propagate to the other.

TiddlyWiki base image

The TiddlyWiki code is stored in and served from index.html, which (as you can see by clicking on the Tools tab) is TiddlyWiki version 5.1.13.

Plugins must be pre-baked into the TiddlyWiki file, not stored on the server as lazily loaded Tiddlers. The index.html in this directory is 5.1.13 with the TiddlyWeb and Markdown plugins added. The TiddlyWeb plugin is required, so that index.html talks back to the server for content.

The process for preparing a new index.html is:

  • Open tiddlywiki-5.1.13.html in your web browser.
  • Click the control panel (gear) icon.
  • Click the Plugins tab.
  • Click "Get more plugins".
  • Click "Open plugin library".
  • Type "tiddlyweb" into the search box. The "TiddlyWeb and TiddlySpace components" should appear.
  • Click Install. A bar at the top of the page should say "Please save and reload for the changes to take effect."
  • Click the icon next to save, and an updated file will be downloaded.
  • Open the downloaded file in the web browser.
  • Repeat, adding any more plugins.
  • Copy the final download to index.html.

tiddly's People

Contributors

elliott5 avatar rsc avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

tiddly's Issues

Draft with content into the datastore. Is it normal?

Dear Prof. Elliott,

I made a test with your tiddly-master and saw a peculiar activity.

When I add a Tiddler, it goes to the datastore with content and some "Draft ..." tiddlers registered.

But, when I remove this particular Tiddler from the Tiddlywiki platform, It remais empty into the datastore. But the other Draft tiddlers remains with content. I dont see them into my tiddly. But it is strange to see them into the datastore.

consulta_do_armazenamento_de_dados_-_c0nt4t0s3t433f4s

Is it normal?

Sincerely yours,

Dino

Add bulk tiddler upload

See requirement in issue: #1

Use the standard TiddlyWiki "ExportAll", in one of the formats, then import it as a single file.

How to upload a large existing wiki?

This issue created from an original post on the TiddlyWiki google group by Dino, which contains some very fine diagrams and images.

Hi Elliot,

I've tested your script and it is working very well for my personal application.

I just need to ask you two things:

First, I manage a file with more than 2300 tiddlers. For using this personal archive, I would like to know:
Do I have to import and prepare the file with the 2300+ tiddlers before the upload (alternative 1)? Or do I have to prepare an empty file (with plugins) and import the 2300+ tiddlers after the upload and online (alternative 2)?

What could I do?

And second, I tried to manage this personal file online. When I try to access or reload the file I always receive the following message. And I have to wait some 20/30 seconds before use the online file.

Dont you know any (browser) local storage that could speed this access?

I would like to thank you for your valuable work.

Sincerely yours,

Dino

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.