-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce "Multi Wiki Server" Plugin #7915
base: master
Are you sure you want to change the base?
Changes from all commits
14752cc
f5fdd79
62b2fe3
84c8a9b
41a5bcc
85607f7
51e6466
4204ff3
3283d38
4b6872a
262a730
6675358
2c810fa
f925f03
c26acfd
f2267e2
59b425f
8edefff
6f8a3b9
2d4b334
bab14b7
6503fb4
b8c1c6c
1eecfb6
0d22bf8
790f431
3fca823
a33705e
310b5f0
3c58788
3ad87df
2361880
f926516
3276703
61b5412
066e553
b1edbed
343cc33
d5aa74d
1c0341d
630b985
6724fa8
83229ac
dd9a3bf
e614e29
d7d0733
de4fe13
9facf4a
d97ddf1
4f9ff1a
5fe41fc
1a28ec7
8a209d6
89ae201
2ba3643
abde67e
3335e87
e355848
f4ac2b9
5802834
e3b2776
0f5dfb8
54ff044
9df625c
8b5c374
24413c5
a443e5f
f906442
d6807cb
8b6642b
bc45a16
c9ab184
b923be5
3da773c
e553539
2916cb6
501f574
f675733
9b59ae2
d518675
b4855b2
347aa4d
69cc45b
dea739f
faa4b97
7eaa9b8
3d485f0
09de919
f606e33
6a673e6
259b3dc
1c64646
6063256
957329d
38ee942
9b3ca52
ae8ef30
cae9dbf
6154de0
891f0fd
60e6c8b
808b944
eaebeb8
3aa5607
1f63bcb
52f7638
08649dd
a2012dc
e66b67d
8091db3
6c9b924
8198574
708e219
7a0c434
b58cfe6
d1bb715
464d17b
4b1affe
37f6930
cca1f21
fcffff3
8a2111f
baee0bb
f2947e7
ad528d6
d51ad80
51cdca6
28a8314
ce79a4a
131a5ab
9ba4556
cc4cb04
db9978f
2e4980b
516a17a
471ba99
129bbe4
aafe775
ea318ba
268aaeb
d8eb5cb
92a1c56
87f4a52
3c7f060
4c2c726
33fb857
b4564e3
a37d501
9b6d677
d8fd9af
e396334
109d92a
d03ad0b
3c36e4b
049951e
3f30cb4
b8f463d
2b2fd4b
38e1ea8
0ff3875
e9cbb51
d1edf64
f1d0e52
39b7a4f
5b53a14
9e2962b
e9f3145
882438d
b4664bd
066771e
97db75e
adb2ffc
2819b53
6492ed3
edc32c5
9eb28a0
535c440
eac8a2c
3287dce
8a5a684
c733116
90848a1
a930411
b698b3e
4050ba5
a9c124c
0f4f60f
6e7efeb
d0b5f41
517dae8
6dd6b7b
d0575d6
5d6ddae
6a7612d
c7531e5
ad901a9
3a5f67d
316bd65
e873518
8ac2730
386af03
8d53a37
f61a131
12e48af
ffbf24a
a6c5b86
31a7d64
0f558a1
c1a441b
aa0d59e
520188d
7c4d0d7
07c3081
9362121
83f7b90
3836a5d
b198270
e85cfde
d925670
4dc2486
9f48e75
a697a66
266b32b
0cd2190
ac59af1
d7eb39c
8defedd
cb6c471
2735ce2
e3ce053
239aacf
ab5a487
a00e3e7
ae5bd9d
67232aa
060bea8
e48ea2d
d0a3c79
02a9fdc
1c56488
0198eb2
1d65f00
1f1b785
faf5d69
ddfc8c4
d72a4c9
b8f2800
6d44849
2a9f646
b4583ef
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
The `multi-wiki-support` branch includes some changes that are not intended to be merged into the `master` branch: | ||
|
||
* Readme update (see `editions/tw5.com/tiddlers/readme/ReadMe.tid`) | ||
* Remove `multiwikiserver` plugin from `readme-bld.sh` (see `bin/readme-bld.sh`) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
#!/bin/bash | ||
|
||
# Build mws.tiddlywiki.com assets. | ||
|
||
# Default to the version of TiddlyWiki installed in this repo | ||
|
||
if [ -z "$MWSTWCOM_BUILD_TIDDLYWIKI" ]; then | ||
MWSTWCOM_BUILD_TIDDLYWIKI=./tiddlywiki.js | ||
fi | ||
|
||
echo "Using MWSTWCOM_BUILD_TIDDLYWIKI as [$MWSTWCOM_BUILD_TIDDLYWIKI]" | ||
|
||
# Set up the build details | ||
|
||
if [ -z "$MWSTWCOM_BUILD_DETAILS" ]; then | ||
MWSTWCOM_BUILD_DETAILS="$(git symbolic-ref --short HEAD)-$(git rev-parse HEAD) from $(git remote get-url origin)" | ||
fi | ||
|
||
echo "Using MWSTWCOM_BUILD_DETAILS as [$MWSTWCOM_BUILD_DETAILS]" | ||
|
||
if [ -z "$MWSTWCOM_BUILD_COMMIT" ]; then | ||
MWSTWCOM_BUILD_COMMIT="$(git rev-parse HEAD)" | ||
fi | ||
|
||
echo "Using MWSTWCOM_BUILD_COMMIT as [$MWSTWCOM_BUILD_COMMIT]" | ||
|
||
# Set up the build output directory | ||
|
||
if [ -z "$MWSTWCOM_BUILD_OUTPUT" ]; then | ||
MWSTWCOM_BUILD_OUTPUT=$(mktemp -d) | ||
fi | ||
|
||
mkdir -p $MWSTWCOM_BUILD_OUTPUT | ||
|
||
if [ ! -d "$MWSTWCOM_BUILD_OUTPUT" ]; then | ||
echo 'A valid MWSTWCOM_BUILD_OUTPUT environment variable must be set' | ||
exit 1 | ||
fi | ||
|
||
echo "Using MWSTWCOM_BUILD_OUTPUT as [$MWSTWCOM_BUILD_OUTPUT]" | ||
|
||
# Pull existing GitHub pages content | ||
|
||
git clone --depth=1 --branch=main "https://github.com/TiddlyWiki/mws.tiddlywiki.com-gh-pages.git" $MWSTWCOM_BUILD_OUTPUT | ||
|
||
# Make the CNAME file that GitHub Pages requires | ||
|
||
echo "mws.tiddlywiki.com" > $MWSTWCOM_BUILD_OUTPUT/CNAME | ||
|
||
# Delete any existing static content | ||
|
||
mkdir -p $MWSTWCOM_BUILD_OUTPUT/static | ||
rm $MWSTWCOM_BUILD_OUTPUT/static/* | ||
|
||
# Put the build details into a .tid file so that it can be included in each build (deleted at the end of this script) | ||
|
||
echo -e -n "title: $:/build\ncommit: $MWSTWCOM_BUILD_COMMIT\n\n$MWSTWCOM_BUILD_DETAILS\n" > $MWSTWCOM_BUILD_OUTPUT/build.tid | ||
|
||
###################################################### | ||
# | ||
# mws.tiddlywiki.com distribution | ||
# | ||
###################################################### | ||
|
||
# /index.html Main site | ||
# /favicon.ico Favicon for main site | ||
# /static.html Static rendering of default tiddlers | ||
# /alltiddlers.html Static rendering of all tiddlers | ||
# /static/* Static single tiddlers | ||
# /static/static.css Static stylesheet | ||
# /static/favicon.ico Favicon for static pages | ||
node $MWSTWCOM_BUILD_TIDDLYWIKI \ | ||
editions/multiwikidocs \ | ||
--verbose \ | ||
--version \ | ||
--load $MWSTWCOM_BUILD_OUTPUT/build.tid \ | ||
--output $MWSTWCOM_BUILD_OUTPUT \ | ||
--build favicon static index \ | ||
|| exit 1 | ||
|
||
# Delete the temporary build tiddler | ||
|
||
rm $MWSTWCOM_BUILD_OUTPUT/build.tid || exit 1 | ||
|
||
# Push output back to GitHub | ||
|
||
# Exit script immediately if any command fails | ||
set -e | ||
|
||
pushd $MWSTWCOM_BUILD_OUTPUT | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "GitHub Actions" | ||
git add -A . | ||
git commit --message "GitHub build: $GITHUB_RUN_NUMBER of $TW5_BUILD_BRANCH ($(date +'%F %T %Z'))" | ||
git remote add deploy "https://[email protected]/TiddlyWiki/mws.tiddlywiki.com-gh-pages.git" &>/dev/null | ||
git push deploy main &>/dev/null | ||
popd |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ fi | |
|
||
# tw5.com readmes | ||
node $TW5_BUILD_TIDDLYWIKI \ | ||
+plugins/tiddlywiki/multiwikiserver \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why does readme-bld.sh need the multiwikiserver plugin? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a temporary measure while the PR is in development. It allows us to include content from the MWS plugin in the readme. |
||
editions/tw5.com \ | ||
--verbose \ | ||
--output . \ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/*\ | ||
title: $:/core/modules/commands/quit.js | ||
type: application/javascript | ||
module-type: command | ||
|
||
Immediately ends the TiddlyWiki process | ||
|
||
\*/ | ||
(function(){ | ||
|
||
/*jslint node: true, browser: true */ | ||
/*global $tw: false */ | ||
"use strict"; | ||
|
||
exports.info = { | ||
name: "quit", | ||
synchronous: true | ||
}; | ||
|
||
var Command = function(params,commander,callback) { | ||
var self = this; | ||
this.params = params; | ||
this.commander = commander; | ||
this.callback = callback; | ||
}; | ||
|
||
Command.prototype.execute = function() { | ||
// Clear any pending commands | ||
this.commander.clearCommands(); | ||
// We don't actually quit, we just issue the "th-quit" hook to give listeners a chance to exit | ||
$tw.hooks.invokeHook("th-quit"); | ||
return null; | ||
}; | ||
|
||
exports.Command = Command; | ||
|
||
})(); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -163,4 +163,4 @@ ImageWidget.prototype.refresh = function(changedTiddlers) { | |
|
||
exports.image = ImageWidget; | ||
|
||
})(); | ||
})(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought, we wanted remove the "covering" function? |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
created: 20240309135835396 | ||
modified: 20240309142156125 | ||
title: Bags and Recipes | ||
type: text/vnd.tiddlywiki | ||
|
||
The bags and recipes model is a reference architecture for how tiddlers can be shared between multiple wikis. It was first introduced by TiddlyWeb in 2008. | ||
|
||
The principles of bags and recipes can be simply stated: | ||
|
||
# Tiddlers are stored in named "bags" | ||
# Bags have access controls that determines which users can read or write to them | ||
# Recipes are named lists of bags, ordered from lowest priority to highest | ||
# The tiddlers within a recipe are accumulated in turn from each bag in the recipe in order of increasing priority. Thus, if there are multiple tiddlers with the same title in different bags then the one from the highest priority bag will be used as the recipe tiddler | ||
# Wikis are composed by splicing the tiddlers from the corresponding recipe into the standard TW5 HTML template | ||
|
||
A very simple example of the recipe/bag model might be for a single user who maintains the following bags: | ||
|
||
* ''recipes'' - tiddlers related to cooking recipes | ||
* ''work'' - tiddlers related to work | ||
* ''app'' - common tiddlers for customising TiddlyWiki | ||
|
||
Those bags would be used with the following recipes: | ||
|
||
* ''recipes'' --> recipes, app - wiki for working with recipes, with common custom components | ||
* ''work'' --> work, app - wiki for working with work, with common custom components | ||
* ''app'' --> app - wiki for maintaining custom components | ||
|
||
All of this will work dynamically, so changes to the app bag will instantly ripple into the affected hosted wikis. | ||
|
||
A more complex example might be for a teacher working with a group of students: | ||
|
||
* ''student-{name}'' bag for each students work | ||
* ''teacher-course'' bag for the coursework, editable by the teacher | ||
* ''teacher-tools'' bag for custom tools used by the teacher | ||
|
||
Those bags would be exposed through the following hosted wikis: | ||
|
||
* ''student-{name}'' hosted wiki for each students work, including the coursework material | ||
* ''teacher-course'' hosted wiki for the coursework, editable by the teacher | ||
* ''teacher'' hosted wiki for the teacher, bringing together all the bags, giving them an overview of all the students work | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
title: Database Engines | ||
tags: Reference | ||
|
||
MWS uses [[SQLite]] for data storage. It supports choosing between two "database engines" that are based on two different npm modules: | ||
|
||
* [[better-sqlite3|https://www.npmjs.com/package/better-sqlite3]] is written partially in C/C++ and so requires compilation for the target platform | ||
* [[node-sqlite3-wasm|https://www.npmjs.com/package/node-sqlite3-wasm]] is written entirely in JavaScript and does not require compilation, but does require a WebAssembly-capable Node.js host. This is not currently possible on some platforms such as iOS/iPadOS | ||
|
||
By default `npm install` will install both database engines. By default it will use `better-sqlite3`. To switch to using `node-sqlite3-wasm`, set the system configuration tiddler `$:/config/MultiWikiServer/Engine` to `wasm` (the default value is `better`). Note that this tiddler resides in the [[Administration Wiki]]. | ||
|
||
!! Avoiding Installation Errors | ||
|
||
If you encounter errors during `npm install` related to `gyp` or `prebuild`, you may be able to avoid them by using `node-sqlite3-wasm` instead of `better-sqlite3`. However, it will be necessary to manually install `node-sqlite3-wasm` and its dependencies. This can be done by running the following commands in your terminal: | ||
|
||
<<.copy-code-to-clipboard "npm install node-sqlite3-wasm">> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
title: $:/DefaultTiddlers | ||
|
||
HelloThere | ||
Installation | ||
Usage | ||
Reference |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
title: HelloThere | ||
tags: TableOfContents | ||
|
||
!! ~TiddlyWiki is Growing Up | ||
|
||
<span class="tc-float-right">[img width=200 [MWS Banner.png]]</span> | ||
~MultiWikiServer is a new development that drastically improves ~TiddlyWiki's capabilities when running as a server under Node.js. It brings ~TiddlyWiki up to par with common web-based tools like ~WordPress or ~MediaWiki by supporting multiple wikis and multiple users at the same time. | ||
|
||
Features under development include: | ||
|
||
* Hosting multiple wikis at once, using the [[Bags and Recipes]] mechanism for sharing data between them | ||
* Based on [[SQLite|MWS and SQLite]] for performance and reliability | ||
* Robust built-in synchronisation handlers for syncing data to the filesystem | ||
* Flexible authentication and authorisation options | ||
* Improved handling of file uploads and attachments, allowing gigabyte video files to be uploaded and streamed | ||
* Instantaneous synchronisation of changes between the server and all connected clients | ||
* Workflow processing on the server, for example to automatically compress images, or to archive webpages | ||
|
||
MWS is currently [[under development at GitHub|https://github.com/TiddlyWiki/TiddlyWiki5/pull/7915]] but it is already functional and usable. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
title: Installation using Git | ||
tags: Installation | ||
modified: 20241105133737778 | ||
created: 20241105133737778 | ||
|
||
These instructions require basic knowledge both of the terminal and of Git. There are also [[alternative instructions without using Git|Installation]]. | ||
|
||
# Clone the code from GitHub with: <<.copy-code-to-clipboard "git clone -b multi-wiki-support --single-branch https://github.com/TiddlyWiki/TiddlyWiki5">> | ||
# Open a terminal window and set the current directory to the root of the downloaded folder | ||
# Install the dependencies with the command: <<.copy-code-to-clipboard "npm install">> | ||
# Start the server with the command: <<.copy-code-to-clipboard "npm start">> | ||
# To use MWS, visit http://localhost:8080 in a browser on the same computer | ||
# When you have finished using MWS, stop the server with <kbd>ctrl-C</kbd> | ||
|
||
See [[Troubleshooting]] if you encounter any errors. | ||
|
||
To update your copy of MWS with newer changes from ~GitHub, run the following command: | ||
|
||
<<.copy-code-to-clipboard "git pull">> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In line 15 there is
npm install playwright ...
which is also added to package.json, which is installed here. -- I think line 15 is redundant