Skip to content
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

Draft
wants to merge 309 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
309 commits
Select commit Hold shift + click to select a range
14752cc
Missing comma
Jermolene Jan 26, 2024
f5fdd79
Refresh when creating bags and recipes to get the change instantly
Jermolene Jan 26, 2024
62b2fe3
Add an error when creating a recipe with no bags
Jermolene Jan 26, 2024
84c8a9b
Fix typo
Jermolene Jan 26, 2024
41a5bcc
Fix canonical URI handling
Jermolene Jan 26, 2024
85607f7
Query fixes
Jermolene Jan 28, 2024
51e6466
Allow tilde character in bag and recipe names
Jermolene Jan 28, 2024
4204ff3
A few more tests
Jermolene Jan 28, 2024
3283d38
First draft of a command to read tiddlers, bags and recipes from an a…
Jermolene Jan 28, 2024
4b6872a
Fix typo
Jermolene Jan 29, 2024
262a730
Move the database file into a "store" directory inside the wiki folder
Jermolene Jan 29, 2024
6675358
WIP: Add a multipart/form-data convenience function
Jermolene Feb 2, 2024
2c810fa
Add barebones support for timing HTTP response generation times
Jermolene Feb 2, 2024
f925f03
Introduce $tw.mws for MWS globals
Jermolene Feb 5, 2024
c26acfd
Add NOT NULL constraint to all columns
Jermolene Feb 5, 2024
f2267e2
Merge branch 'master' into multi-wiki-support
Jermolene Feb 16, 2024
59b425f
Update to better-sqlite3 v9.4.1
Jermolene Feb 16, 2024
8edefff
WIP: Support for streaming multipart form data to the file system
Jermolene Feb 16, 2024
6f8a3b9
mws-load command: more validation tiddler files
Jermolene Feb 16, 2024
2d4b334
Merge branch 'master' into multi-wiki-support
Jermolene Feb 19, 2024
bab14b7
Logging
Jermolene Feb 19, 2024
6503fb4
Simple performance logging
Jermolene Feb 20, 2024
b8c1c6c
Allow backslashes in trailing API path components
Jermolene Feb 21, 2024
1eecfb6
Less logging
Jermolene Feb 21, 2024
0d22bf8
Update to latest better-sqlite3
Jermolene Feb 22, 2024
790f431
MWS: Use transactions when modifying multiple resources (#7991)
hoelzro Feb 22, 2024
3fca823
MWS: Add support for node-sqlite-wasm alongside better-sqlite3 (#7996)
Jermolene Feb 22, 2024
a33705e
Fix error
Jermolene Feb 22, 2024
310b5f0
Whitespace
Jermolene Feb 22, 2024
3c58788
Merge branch 'master' into multi-wiki-support
Jermolene Feb 22, 2024
3ad87df
Allow wiki engine to be configured
Jermolene Feb 22, 2024
2361880
createBag should optionally set access control data
Jermolene Feb 23, 2024
f926516
Commands to load and save tiddlers, bags and recipes as a JSON archive
Jermolene Feb 23, 2024
3276703
Fix failing tests
Jermolene Feb 23, 2024
61b5412
Rename mws-load|save to mws-load|save-archive
Jermolene Feb 23, 2024
066e553
Introduce command to load tiddler folders into a bag
Jermolene Feb 23, 2024
b1edbed
Fix bag static HTML to show emoji correctly
Jermolene Feb 23, 2024
343cc33
Add a test tiddler with emoji title
Jermolene Feb 24, 2024
d5aa74d
Improve manual transaction handling
Jermolene Feb 24, 2024
1c0341d
Merge branch 'master' into multi-wiki-support
Jermolene Feb 24, 2024
630b985
Add note about transaction handling
Jermolene Feb 25, 2024
6724fa8
Run the tests on both node-sqlite3-wasm and better-sqlite3
Jermolene Feb 25, 2024
83229ac
Add a config tiddler for selecting the SQLite engine
Jermolene Feb 25, 2024
dd9a3bf
Re-enable loading the tw5.com docs tiddlers
Jermolene Feb 25, 2024
e614e29
Default to better-sqlite3
Jermolene Feb 25, 2024
d7d0733
Remove accidentally committed database file
Jermolene Feb 25, 2024
de4fe13
Unconditionally decrement transaction depth (#8008)
hoelzro Feb 26, 2024
9facf4a
Fix incorrect encoding of description when creating bags and recipes
Jermolene Feb 28, 2024
d97ddf1
Merge branch 'master' into multi-wiki-support
Jermolene Feb 28, 2024
4f9ff1a
Missed closing tag
Jermolene Feb 28, 2024
5fe41fc
Reorder test tiddlers
Jermolene Feb 28, 2024
1a28ec7
Rename upload manager to multipart form manager
Jermolene Feb 28, 2024
8a209d6
Fix typo
Jermolene Mar 1, 2024
89ae201
Merge branch 'master' into multi-wiki-support
Jermolene Mar 4, 2024
2ba3643
Merge branch 'master' into multi-wiki-support
Jermolene Mar 7, 2024
abde67e
MWS: Add support for large tiddlers to be stored as attachment files
Jermolene Mar 10, 2024
3335e87
Remove unneeded option
Jermolene Mar 10, 2024
e355848
Fix mws-save-archive command name
Jermolene Mar 10, 2024
f4ac2b9
Remove unneeded plugins from tw5.com edition
Jermolene Mar 10, 2024
5802834
Remove unneeded highlight plugin from multiwikiserver edition
Jermolene Mar 10, 2024
e3b2776
Update comment
Jermolene Mar 10, 2024
0f5dfb8
Refactor multipart form handling for more reusability
Jermolene Mar 10, 2024
54ff044
MWS: store level tests (#8021)
hoelzro Mar 11, 2024
9df625c
Reorganise JS modules into subdirectories
Jermolene Mar 11, 2024
8b5c374
Refactor command module filenames
Jermolene Mar 11, 2024
24413c5
The listen command shouldn't return until the server is listening
Jermolene Mar 11, 2024
a443e5f
Add new command to test local or remote server via HTTP
Jermolene Mar 11, 2024
f906442
Add npm start command
Jermolene Mar 12, 2024
d6807cb
Update MWS plugin readme
Jermolene Mar 12, 2024
8b6642b
Update the root readme that is visible on GitHub
Jermolene Mar 12, 2024
bc45a16
Fix readme build
Jermolene Mar 12, 2024
c9ab184
TODOs before merging
Jermolene Mar 12, 2024
b923be5
Merge branch 'master' into multi-wiki-support
Jermolene Mar 13, 2024
3da773c
Add HTTP tests to npm test command
Jermolene Mar 13, 2024
e553539
Clarify that process.exit() is a hack
Jermolene Mar 13, 2024
2916cb6
Clarify comment
Jermolene Mar 14, 2024
501f574
Update readme
Jermolene Mar 14, 2024
f675733
POST /wiki/:bag_name/bags/:bag_name/tiddlers/ should also return JSON
Jermolene Mar 15, 2024
9b59ae2
Add an HTTP test for multipart form data upload
Jermolene Mar 15, 2024
d518675
Get rid of some console.logs
Jermolene Mar 15, 2024
b4855b2
Merge branch 'master' into multi-wiki-support
Jermolene Mar 16, 2024
347aa4d
Tests should cover tiddler_ids
Jermolene Mar 17, 2024
69cc45b
Refactor the database engine specific code
Jermolene Mar 17, 2024
dea739f
Introduce delete markers for deleted tiddlers
Jermolene Mar 17, 2024
faa4b97
More consistent variable naming
Jermolene Mar 17, 2024
7eaa9b8
Database methods that mutate tables should return IDs
Jermolene Mar 17, 2024
3d485f0
Expose tiddler_ids in bag and recipe listings
Jermolene Mar 17, 2024
09de919
Typo
Jermolene Mar 17, 2024
f606e33
Stop using the existing core server infrastructure
Jermolene Mar 18, 2024
6a673e6
Stop syncing state tiddlers to the admin wiki
Jermolene Mar 18, 2024
259b3dc
Add a new static index route
Jermolene Mar 18, 2024
1c64646
Fix quit command to work gracefully
Jermolene Mar 19, 2024
6063256
Create new static index route with ability to create/update bags and …
Jermolene Mar 20, 2024
957329d
Add store directories to gitignore
Jermolene Mar 20, 2024
38ee942
Don't do full debug logging during tests
Jermolene Mar 20, 2024
9b3ca52
Introduce multiwikiclient plugin
Jermolene Mar 20, 2024
ae8ef30
Get rid of those annoying missing image icons
Jermolene Mar 20, 2024
cae9dbf
Fix colours in static renderings
Jermolene Mar 20, 2024
6154de0
Rename misnamed route
Jermolene Mar 20, 2024
891f0fd
Fix page body class in static pages
Jermolene Mar 20, 2024
60e6c8b
Fix etag handling
Jermolene Mar 20, 2024
808b944
Fix multipart form data POST test
Jermolene Mar 20, 2024
eaebeb8
Include bagname in tiddler Etags
Jermolene Mar 20, 2024
3aa5607
Stop storing bag and revision details as tiddler fields
Jermolene Mar 20, 2024
1f63bcb
Remove some templates that are no longer needed
Jermolene Mar 20, 2024
52f7638
Remove code relating to revision and bag as fields
Jermolene Mar 22, 2024
08649dd
More efficient syncing
Jermolene Mar 23, 2024
a2012dc
Typo in comment
Jermolene Mar 23, 2024
e66b67d
Only turn binary tiddlers into attachments
Jermolene Mar 23, 2024
8091db3
Merge branch 'master' into multi-wiki-support
Jermolene Mar 23, 2024
6c9b924
GET recipes/name/tiddlers.json should use include_deleted parameter
Jermolene Mar 24, 2024
8198574
Remove code that is unneeded for the moment
Jermolene Mar 24, 2024
708e219
Fix syncing
Jermolene Mar 24, 2024
7a0c434
First pass at SSE support
Jermolene Mar 25, 2024
b58cfe6
SSE client: better state management to avoid multiple connections
Jermolene Mar 25, 2024
d1bb715
Expose the connection status in the UI
Jermolene Mar 25, 2024
464d17b
Update last known tiddler ID for events delivered via SSE
Jermolene Mar 25, 2024
4b1affe
Load streamed tiddlers immediately, rather than scheduling a load
Jermolene Mar 25, 2024
37f6930
Quit command should abort any pending commands
Jermolene Mar 25, 2024
cca1f21
Undo unneeded changes to image widget
Jermolene Mar 25, 2024
fcffff3
npm start should use mws-listen
Jermolene Mar 25, 2024
8a2111f
Update GettingStarted
Jermolene Mar 26, 2024
baee0bb
Fix broken updating of last_known_tiddler_id from streamed data
Jermolene Mar 26, 2024
f2947e7
Filter updates from the server
Jermolene Mar 26, 2024
ad528d6
Fix get wiki crash when serving a recipe with no tiddlers in it
Jermolene Mar 27, 2024
d51ad80
Incoming updates filter should exclude tiddlers prefixed $:/StoryList…
Jermolene Mar 28, 2024
51cdca6
Merge branch 'master' into multi-wiki-support
Jermolene Apr 3, 2024
28a8314
Merge branch 'master' into multi-wiki-support
Jermolene Apr 12, 2024
ce79a4a
Add bag indicator to tiddler info panel
Jermolene Apr 12, 2024
131a5ab
Protect against syncing client state tiddlers to the server
Jermolene Apr 12, 2024
9ba4556
Add support for the plugin library
Jermolene Apr 14, 2024
cc4cb04
Turn on WAL mode for better-sqlite3
Jermolene Apr 14, 2024
db9978f
Syncer should only save existing tiddlers if they have changed
Jermolene Apr 16, 2024
2e4980b
Add some error checking
Jermolene Apr 16, 2024
516a17a
More debugging
Jermolene Apr 16, 2024
471ba99
Debugging
Jermolene Apr 16, 2024
129bbe4
Debugging
Jermolene Apr 16, 2024
aafe775
Debugging
Jermolene Apr 16, 2024
ea318ba
Fix file separator for Windows
Jermolene Apr 16, 2024
268aaeb
Logging
Jermolene Apr 16, 2024
d8eb5cb
Merge branch 'master' into multi-wiki-support
Jermolene May 20, 2024
92a1c56
Merge branch 'master' into multi-wiki-support
Jermolene May 21, 2024
87f4a52
Mark MWS plugins as experimental
Jermolene May 21, 2024
3c7f060
Temporarily Disable SSE
Jermolene May 22, 2024
4c2c726
Make usage of SSE be configurable
Jermolene May 22, 2024
33fb857
Merge branch 'master' into multi-wiki-support
Jermolene May 22, 2024
b4564e3
Merge branch 'master' into multi-wiki-support
Jermolene May 26, 2024
a37d501
Tentative fix for SSE issue
Jermolene May 27, 2024
9b6d677
Fix revision comparisons
Jermolene May 27, 2024
d8fd9af
Fix string vs. number confusion for revisions
Jermolene May 28, 2024
e396334
Disable SSE by default
Jermolene May 28, 2024
109d92a
Update readme
Jermolene May 28, 2024
d03ad0b
Merge branch 'master' into multi-wiki-support
Jermolene May 29, 2024
3c36e4b
Merge branch 'master' into multi-wiki-support
Jermolene May 31, 2024
049951e
Merge branch 'master' into multi-wiki-support
Jermolene May 31, 2024
3f30cb4
Merge branch 'master' into multi-wiki-support
Jermolene May 31, 2024
b8f463d
Merge branch 'master' into multi-wiki-support
Jermolene May 31, 2024
2b2fd4b
Merge branch 'master' into multi-wiki-support
Jermolene Jun 8, 2024
38e1ea8
Merge branch 'master' into multi-wiki-support
Jermolene Jun 22, 2024
0ff3875
Update readme.tid
Jermolene Jun 24, 2024
e9cbb51
Merge branch 'master' into multi-wiki-support
Jermolene Jun 28, 2024
d1edf64
Merge branch 'master' into multi-wiki-support
Jermolene Jul 5, 2024
f1d0e52
New commands
Jermolene Jul 5, 2024
39b7a4f
Adds 'created' field to attachment meta.json file (#8356)
PotOfCoffee2Go Jul 9, 2024
5b53a14
Use $tw.utils.encodeURIComponentExtended for consistency with encodeu…
Jermolene Jul 10, 2024
9e2962b
Merge branch 'master' into multi-wiki-support
Jermolene Jul 10, 2024
e9f3145
Fix failing tests
Jermolene Jul 10, 2024
882438d
Merge branch 'master' into multi-wiki-support
Jermolene Jul 15, 2024
b4664bd
getBagTiddlerStream should return bagname
Jermolene Jul 16, 2024
066771e
Allow attachment handling to be switched off
Jermolene Jul 16, 2024
97db75e
Merge branch 'master' into multi-wiki-support
Jermolene Jul 26, 2024
adb2ffc
Update package.json
Jermolene Jul 31, 2024
2819b53
Merge branch 'master' into multi-wiki-support
Jermolene Jul 31, 2024
6492ed3
Merge branch 'master' into multi-wiki-support
Jermolene Aug 6, 2024
edc32c5
Merge branch 'master' into multi-wiki-support
Jermolene Aug 19, 2024
9eb28a0
Merge branch 'master' into multi-wiki-support
Jermolene Aug 22, 2024
535c440
Remove extraneous storylist tiddler
Jermolene Aug 22, 2024
eac8a2c
Merge branch 'master' into multi-wiki-support
Jermolene Aug 27, 2024
3287dce
MWS: fix editing attachment tiddlers (#8455)
webplusai Aug 28, 2024
8a5a684
Clean ups from #8456
Jermolene Aug 28, 2024
c733116
Merge branch 'master' into multi-wiki-support
Jermolene Aug 28, 2024
90848a1
Change for the sake of CI
Jermolene Aug 29, 2024
a930411
Handle directory creation if doesn't exist for test store (#8562)
webplusai Aug 30, 2024
b698b3e
revert playwright test (#8573)
webplusai Aug 30, 2024
4050ba5
Avoid optional chaining syntax
Jermolene Sep 11, 2024
a9c124c
Whitespace clean up
Jermolene Sep 20, 2024
0f4f60f
Fix load wiki folder command
Jermolene Sep 20, 2024
6e7efeb
Merge branch 'master' into multi-wiki-support
Jermolene Sep 20, 2024
d0b5f41
MWS icon remove redundant paths (#8621)
pmario Sep 30, 2024
517dae8
Merge branch 'master' into multi-wiki-support
Jermolene Sep 30, 2024
6dd6b7b
Refactor conditional function definitions
Jermolene Sep 30, 2024
d0575d6
Merge branch 'master' into multi-wiki-support
Jermolene Oct 17, 2024
5d6ddae
Fix plugin bag names
Jermolene Oct 17, 2024
6a7612d
MWS authentication (#8596)
webplusai Oct 30, 2024
c7531e5
Add user profile management and account deletion functionality (#8712)
webplusai Oct 30, 2024
ad901a9
Merge branch 'master' into multi-wiki-support
Jermolene Nov 6, 2024
3a5f67d
Update dependencies
Jermolene Nov 6, 2024
316bd65
Add success and error message feedback for user profile operations (#…
webplusai Nov 8, 2024
e873518
Admin configuration for anonymous read-write operations (#8736)
webplusai Nov 14, 2024
8ac2730
Merge branch 'master' into multi-wiki-support
Jermolene Nov 15, 2024
386af03
Add multiwikidocs edition and CI to build it
Jermolene Nov 15, 2024
8d53a37
Docs: Fix CI by including a favicon
Jermolene Nov 15, 2024
f61a131
Transparent background for favicon
Jermolene Nov 15, 2024
12e48af
update multiwiki server documentation (#8748)
webplusai Nov 15, 2024
ffbf24a
CI: We don't need to run the tests when building mws.tiddlywiki.com
Jermolene Nov 15, 2024
a6c5b86
Docs: Copy content from tiddlywiki.com
Jermolene Nov 15, 2024
31a7d64
Docs: Move documentation from plugin into multiwikidocs edition
Jermolene Nov 15, 2024
0f558a1
Move manage-acl page control into multiwikiclient plugin
Jermolene Nov 15, 2024
c1a441b
Style tweak
Jermolene Nov 15, 2024
aa0d59e
Docs: Add basic system tiddlers
Jermolene Nov 15, 2024
520188d
Tweak favicon
Jermolene Nov 16, 2024
7c4d0d7
Docs: Add table of contents and custom palette
Jermolene Nov 16, 2024
07c3081
[MWS] Move test dependencies to devDep. Update better-sqlite3 to late…
pmario Nov 17, 2024
9362121
Typo
Jermolene Nov 17, 2024
83f7b90
Retain original tiddler paths to try to get the contribution banner w…
Jermolene Nov 17, 2024
3836a5d
Styles for the improvement banner
Jermolene Nov 17, 2024
b198270
Merge branch 'master' into multi-wiki-support
Jermolene Nov 18, 2024
e85cfde
Merge branch 'master' into multi-wiki-support
Jermolene Nov 18, 2024
d925670
Add troubleshooting instructions
Jermolene Nov 18, 2024
4dc2486
Fix issue with default user role on create, profile navigation issue …
webplusai Nov 19, 2024
9f48e75
#8757 add exception handling to creating new users & roles functions …
webplusai Nov 20, 2024
a697a66
#8754 fix user edit form success/error message cleanup issue (#8764)
webplusai Nov 20, 2024
266b32b
#8755 correct READ permission description (#8767)
webplusai Nov 21, 2024
0cd2190
#8756 main page recipes (#8766)
webplusai Nov 21, 2024
ac59af1
Add some information about SQLite
Jermolene Nov 27, 2024
d7eb39c
#8776 resolve server crash on delete role in use (#8796)
webplusai Dec 5, 2024
8defedd
#8771 fixed form reset issue on create user form (#8805)
webplusai Dec 6, 2024
cb6c471
Merge branch 'master' into multi-wiki-support
Jermolene Dec 9, 2024
2735ce2
Update dependencies
Jermolene Dec 9, 2024
e3ce053
Fix attachment size check
Jermolene Dec 9, 2024
239aacf
Fix streaming of attachment tiddlers from recipe URIs
Jermolene Dec 10, 2024
ab5a487
Fix spelling of "anonymous"
Jermolene Dec 10, 2024
a00e3e7
#8774 fix add user form errors and error message clean up (#8813)
webplusai Dec 10, 2024
ae5bd9d
#8812 resolve issue with anonymous access (#8814)
webplusai Dec 11, 2024
67232aa
Feature/#8812 anon access fix (#8815)
webplusai Dec 14, 2024
060bea8
Fix Jack's aspect ratio in the favicon
Jermolene Dec 14, 2024
e48ea2d
#8818 fix default checkbox checked value issue on anon config modal (…
webplusai Dec 17, 2024
d0a3c79
Add MWS documentation wiki
Jermolene Dec 21, 2024
02a9fdc
Merge branch 'master' into multi-wiki-support
Jermolene Dec 21, 2024
1c56488
#8833 fix issue with multiple user sessions (#8845)
webplusai Dec 22, 2024
0198eb2
#8832 fix favicon and access control issue (#8846)
webplusai Dec 22, 2024
1d65f00
#8832 fixed blocked access to view wiki anonymously without admin acc…
webplusai Dec 23, 2024
1f1b785
#8828 update mws documentation (#8848)
webplusai Dec 23, 2024
faf5d69
#8849 fixed 403 error on ACL page (#8851)
webplusai Dec 23, 2024
ddfc8c4
#8850 relocate Manage ACL button (#8852)
webplusai Dec 23, 2024
d72a4c9
#8854 fix acl error in anon mode (#8857)
webplusai Dec 23, 2024
b8f2800
#8862 fix bug with ACL permissions (#8864)
webplusai Dec 24, 2024
6d44849
#8856 fix profile button rendering for guest users (#8865)
webplusai Dec 24, 2024
2a9f646
#8858 fix issue with anonymous wiki access (#8869)
webplusai Dec 25, 2024
b4583ef
#8867 add login as guest button (#8873)
webplusai Dec 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
branches:
- master
- tiddlywiki-com
- multi-wiki-support
env:
NODE_VERSION: "22"
jobs:
Expand Down Expand Up @@ -82,3 +83,14 @@ jobs:
- run: "./bin/build-tw-org.sh"
env:
GH_TOKEN: ${{ secrets.GITHUBPUSHTOKEN }}
build-mws-tiddlywiki-com:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/multi-wiki-support'
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: "${{ env.NODE_VERSION }}"
- run: "./bin/build-mws-site.sh"
env:
GH_TOKEN: ${{ secrets.GITHUBPUSHTOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
tmp/
output/
node_modules/
store/
/test-results/
/playwright-report/
/playwright/.cache/
$__StoryList.tid
/editions/test/test-store/*
4 changes: 4 additions & 0 deletions TODO BEFORE MERGING THIS PR.md
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`)
97 changes: 97 additions & 0 deletions bin/build-mws-site.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
2 changes: 2 additions & 0 deletions bin/ci-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

# test TiddlyWiki5 for tiddlywiki.com

npm install
Copy link
Member

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


node ./tiddlywiki.js \
./editions/test \
--verbose \
Expand Down
1 change: 1 addition & 0 deletions bin/readme-bld.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ fi

# tw5.com readmes
node $TW5_BUILD_TIDDLYWIKI \
+plugins/tiddlywiki/multiwikiserver \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does readme-bld.sh need the multiwikiserver plugin?

Copy link
Member Author

Choose a reason for hiding this comment

The 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 . \
Expand Down
7 changes: 7 additions & 0 deletions core/modules/commander.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ Commander.prototype.log = function(str) {
}
};

/*
Clear pending commands
*/
Commander.prototype.clearCommands = function() {
this.commandTokens = this.commandTokens.slice(0,this.nextToken);
};

/*
Write a string if verbose flag is set
*/
Expand Down
8 changes: 6 additions & 2 deletions core/modules/commands/listen.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var Server = require("$:/core/modules/server/server.js").Server;

exports.info = {
name: "listen",
synchronous: true,
synchronous: false,
namedParameterMode: true,
mandatoryParameters: []
};
Expand All @@ -38,7 +38,11 @@ Command.prototype.execute = function() {
wiki: this.commander.wiki,
variables: self.params
});
var nodeServer = this.server.listen();
var nodeServer = this.server.listen(null,null,null,{
callback: function() {
self.callback();
}
});
$tw.hooks.invokeHook("th-server-command-post-start",this.server,nodeServer,"tiddlywiki");
return null;
};
Expand Down
37 changes: 37 additions & 0 deletions core/modules/commands/quit.js
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;

})();
5 changes: 5 additions & 0 deletions core/modules/server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,11 @@ Server.prototype.listen = function(port,host,prefix) {
}
// Display the port number after we've started listening (the port number might have been specified as zero, in which case we will get an assigned port)
server.on("listening",function() {
// Stop listening when we get the "th-quit" hook
$tw.hooks.addHook("th-quit",function() {
server.close();
});
// Log listening details
var address = server.address(),
url = self.protocol + "://" + (address.family === "IPv6" ? "[" + address.address + "]" : address.address) + ":" + address.port + prefix;
$tw.utils.log("Serving on " + url,"brown/orange");
Expand Down
10 changes: 9 additions & 1 deletion core/modules/syncer.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,11 @@ Save an incoming tiddler in the store, and updates the associated tiddlerInfo
Syncer.prototype.storeTiddler = function(tiddlerFields) {
// Save the tiddler
var tiddler = new $tw.Tiddler(tiddlerFields);
this.wiki.addTiddler(tiddler);
// Only save the tiddler if it has changed
var existingTiddler = this.wiki.getTiddler(tiddlerFields.title);
if(!existingTiddler || !existingTiddler.isEqual(tiddler)) {
this.wiki.addTiddler(tiddler);
}
// Save the tiddler revision and changeCount details
this.tiddlerInfo[tiddlerFields.title] = {
revision: this.getTiddlerRevision(tiddlerFields.title),
Expand Down Expand Up @@ -556,6 +560,7 @@ SaveTiddlerTask.prototype.run = function(callback) {
// Invoke the callback
callback(null);
},{
syncer: self.syncer,
tiddlerInfo: self.syncer.tiddlerInfo[self.title]
});
} else {
Expand Down Expand Up @@ -586,6 +591,7 @@ DeleteTiddlerTask.prototype.run = function(callback) {
// Invoke the callback
callback(null);
},{
syncer: self.syncer,
tiddlerInfo: self.syncer.tiddlerInfo[this.title]
});
};
Expand Down Expand Up @@ -614,6 +620,8 @@ LoadTiddlerTask.prototype.run = function(callback) {
}
// Invoke the callback
callback(null);
},{
syncer: self.syncer
});
};

Expand Down
2 changes: 1 addition & 1 deletion core/modules/widgets/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,4 @@ ImageWidget.prototype.refresh = function(changedTiddlers) {

exports.image = ImageWidget;

})();
})();
Copy link
Member

@pmario pmario Apr 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought, we wanted remove the "covering" function?

41 changes: 41 additions & 0 deletions editions/multiwikidocs/tiddlers/Bags and Recipes.tid
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

15 changes: 15 additions & 0 deletions editions/multiwikidocs/tiddlers/Database Engines.tid
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">>
6 changes: 6 additions & 0 deletions editions/multiwikidocs/tiddlers/DefaultTiddlers.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
title: $:/DefaultTiddlers

HelloThere
Installation
Usage
Reference
19 changes: 19 additions & 0 deletions editions/multiwikidocs/tiddlers/HelloThere.tid
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.
19 changes: 19 additions & 0 deletions editions/multiwikidocs/tiddlers/Installation using Git.tid
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">>
Loading
Loading