@tiddlywiki/mws 0.0.15 → 0.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -34
- package/dist/server.d.ts +20 -9
- package/dist/server.js +3920 -379
- package/dist/server.js.map +1 -1
- package/editions/mws-docs/tiddlers/$__StoryList.tid +1 -3
- package/editions/mws-docs/tiddlers/2025-02-18 - User Management.md +56 -0
- package/editions/mws-docs/tiddlers/2025-02-18 - User Management.md.meta +5 -0
- package/editions/mws-docs/tiddlers/2025-04-03 - Phases of Development.md +64 -0
- package/editions/mws-docs/tiddlers/2025-04-03 - Phases of Development.md.meta +5 -0
- package/editions/mws-docs/tiddlers/2025-04-13 - Plugins.md +18 -0
- package/editions/mws-docs/tiddlers/2025-04-13 - Plugins.md.meta +5 -0
- package/editions/mws-docs/tiddlers/2025-05-04.md +13 -0
- package/editions/mws-docs/tiddlers/2025-05-04.md.meta +5 -0
- package/editions/mws-docs/tiddlers/2025-05-06.md +19 -0
- package/editions/mws-docs/tiddlers/2025-05-06.md.meta +5 -0
- package/editions/mws-docs/tiddlers/Access Control.md +17 -0
- package/editions/mws-docs/tiddlers/Access Control.md.meta +5 -0
- package/editions/mws-docs/tiddlers/Application Access & Security.md +98 -0
- package/editions/mws-docs/tiddlers/Application Access & Security.md.meta +5 -0
- package/editions/mws-docs/tiddlers/Checklists and Features.md +15 -0
- package/editions/mws-docs/tiddlers/Checklists and Features.md.meta +5 -0
- package/editions/mws-docs/tiddlers/HTTP API.md +17 -0
- package/editions/mws-docs/tiddlers/HTTP API.md.meta +5 -0
- package/editions/mws-docs/tiddlers/Installation.tid +11 -2
- package/editions/mws-docs/tiddlers/MWS Architecture.md +15 -0
- package/editions/mws-docs/tiddlers/MWS Architecture.md.meta +5 -0
- package/editions/mws-docs/tiddlers/Moduler Design.md +5 -0
- package/editions/mws-docs/tiddlers/Moduler Design.md.meta +1 -1
- package/editions/mws-docs/tiddlers/Notes.tid +5 -0
- package/editions/mws-docs/tiddlers/Reference.md +0 -149
- package/editions/mws-docs/tiddlers/Reference.md.meta +4 -1
- package/editions/mws-docs/tiddlers/Usage.tid +3 -3
- package/editions/mws-docs/tiddlers/system/$__palettes_MUI-Dark +173 -0
- package/editions/mws-docs/tiddlers/system/$__palettes_MUI-Dark.meta +6 -0
- package/editions/mws-docs/tiddlers/system/$__palettes_MUI-Light +172 -0
- package/editions/mws-docs/tiddlers/system/$__palettes_MUI-Light.meta +6 -0
- package/package.json +11 -20
- package/plugins/client/tiddlers/readme.tid +0 -3
- package/react-user-mgmt/public/main.js +32 -32
- package/react-user-mgmt/public/main.js.map +4 -4
- package/react-user-mgmt/public/stats.json +1 -1
- package/scripts.mjs +34 -0
- package/.env-cmdrc +0 -5
package/README.md
CHANGED
|
@@ -1,8 +1,22 @@
|
|
|
1
1
|
# MultiWikiServer
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Multiple users, multiple wikis for TiddlyWiki.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
- Bag & Recipe system for storing tiddlers.
|
|
6
|
+
- User and Role management with ACL.
|
|
7
|
+
- Multiple database engines supported, using Prisma.
|
|
8
|
+
- Third-party OAuth and password-based login.
|
|
9
|
+
|
|
10
|
+
## Flexible and Extendible
|
|
11
|
+
|
|
12
|
+
- Plugins can add routes and hooks.
|
|
13
|
+
- Abstractions everywhere, allowing flexibility.
|
|
14
|
+
- The source code is fully typed and easy to navigate.
|
|
15
|
+
- Admin endpoints can also be called from the CLI.
|
|
16
|
+
|
|
17
|
+
Most of these features are still in development.
|
|
18
|
+
|
|
19
|
+
## How to run
|
|
6
20
|
|
|
7
21
|
The init command creates a new folder and installs what you need to get started.
|
|
8
22
|
|
|
@@ -36,42 +50,15 @@ If there are any database changes, MWS should pick them up and apply them. The c
|
|
|
36
50
|
If you want to work on the project,
|
|
37
51
|
|
|
38
52
|
- `git clone https://github.com/TiddlyWiki/MultiWikiServer`
|
|
39
|
-
- `
|
|
53
|
+
- `cd MultiWikiServer`
|
|
54
|
+
- `npm install` or `npm run install-android`
|
|
40
55
|
- `cd react-user-mgmt`
|
|
41
56
|
- `npm install`
|
|
42
57
|
- `cd ..`
|
|
43
|
-
- `npm run certs` - if you want https
|
|
58
|
+
- `npm run certs` - if you want https (unix only)
|
|
44
59
|
- `npm start` - this runs the build and test every time, but it's pretty fast
|
|
45
60
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
### The Server
|
|
49
|
-
|
|
50
|
-
- Supports HTTP and HTTPS listeners. All requests are funneled into one stack.
|
|
51
|
-
- Uses abstractions and state objects to make the server as flexible as possible.
|
|
52
|
-
- Supports overriding classes to implement custom handling of various features.
|
|
53
|
-
- All of the features from the old MWS branch have been converted to the new system.
|
|
54
|
-
|
|
55
|
-
### The Store
|
|
56
|
-
|
|
57
|
-
- Written using Prisma and entirely promise-based.
|
|
58
|
-
- Swapping to a different database engine should be a breeze. For sqlite it uses the libsql adapter, which also allows connections to libsql servers.
|
|
59
|
-
- The tiddler text attachment system, which stores some tiddler bodies on the file system, is promise-based and can be modified to store files in the cloud.
|
|
60
|
-
|
|
61
|
-
### The Features
|
|
62
|
-
|
|
63
|
-
- Bag & Recipe system for storing tiddlers.
|
|
64
|
-
- User and Role management with ACL.
|
|
65
|
-
- Attachment system for storing binary tiddlers on the file system.
|
|
66
|
-
- Various import and export commands (currently still in development).
|
|
67
|
-
- Customization of these features should be quite easy as they are fairly self-contained. The TypeScript code is fully typed and easy to navigate.
|
|
68
|
-
|
|
69
|
-
### Planned (hopefully) for the future
|
|
70
|
-
|
|
71
|
-
- AuthJS or a similar integration that supports third-party OAuth (you can already write your own).
|
|
72
|
-
- Compiling filters to SQL to optimize memory on both the client and server.
|
|
73
|
-
- Support for other database and storage systems. Most likely MariaDB and Postgres.
|
|
74
|
-
- Additional recipe strategies with features like prefixed bags and namespaces.
|
|
75
|
-
- Server rendering of pages, for a more wikipedia-like experience.
|
|
61
|
+
The development wiki will be active at http://localhost:8080/dev
|
|
76
62
|
|
|
63
|
+
You can change the listeners as explained in the mws.dev.mjs file.
|
|
77
64
|
|
package/dist/server.d.ts
CHANGED
|
@@ -5,12 +5,13 @@ import { PassThrough, Writable } from 'node:stream';
|
|
|
5
5
|
import * as z from 'zod';
|
|
6
6
|
import { z as z$1, ZodEffects } from 'zod';
|
|
7
7
|
import { PrismaClient, Prisma } from '@prisma/client';
|
|
8
|
-
import { ITXClientDenyList, Types } from '@prisma/client/runtime/library';
|
|
9
8
|
import * as fs from 'fs';
|
|
10
9
|
import * as tiddlywiki from 'tiddlywiki';
|
|
11
|
-
import { TW } from 'tiddlywiki';
|
|
12
|
-
import
|
|
10
|
+
import { TW, TiddlerFieldModule } from 'tiddlywiki';
|
|
11
|
+
import { ITXClientDenyList, Types } from '@prisma/client/runtime/library';
|
|
12
|
+
import * as commander from 'commander';
|
|
13
13
|
import { SqlMigrationAwareDriverAdapterFactory, SqlDriverAdapter } from '@prisma/driver-adapter-utils';
|
|
14
|
+
import * as http2 from 'node:http2';
|
|
14
15
|
import * as http2$1 from 'http2';
|
|
15
16
|
import { OutgoingHttpHeaders, IncomingHttpHeaders as IncomingHttpHeaders$1, IncomingMessage as IncomingMessage$1, ServerResponse as ServerResponse$1 } from 'node:http';
|
|
16
17
|
|
|
@@ -226,6 +227,7 @@ declare class StartupCommander {
|
|
|
226
227
|
config: MWSConfig;
|
|
227
228
|
$tw: TW;
|
|
228
229
|
PasswordService: PasswordService;
|
|
230
|
+
fieldModules: Record<string, TiddlerFieldModule>;
|
|
229
231
|
constructor(config: MWSConfig, $tw: TW, PasswordService: PasswordService);
|
|
230
232
|
init(): Promise<void>;
|
|
231
233
|
wikiPath: string;
|
|
@@ -266,6 +268,8 @@ Parse a sequence of commands
|
|
|
266
268
|
*/
|
|
267
269
|
declare class Commander extends StartupCommander {
|
|
268
270
|
constructor(config: MWSConfig, $tw: TW, PasswordService: PasswordService);
|
|
271
|
+
program: commander.Command;
|
|
272
|
+
init(): Promise<void>;
|
|
269
273
|
create_mws_listen: (params: string[]) => Command;
|
|
270
274
|
/**
|
|
271
275
|
* The promise of the current execution.
|
|
@@ -283,6 +287,8 @@ declare class Commander extends StartupCommander {
|
|
|
283
287
|
static initCommands(moduleType?: string): void;
|
|
284
288
|
addCommandTokens(params: string[]): void;
|
|
285
289
|
execute(commandTokens: string[]): Promise<void>;
|
|
290
|
+
executeInternal(commandTokens: string[]): Promise<void>;
|
|
291
|
+
setPromise(): void;
|
|
286
292
|
executeNextCommand(): void;
|
|
287
293
|
extractNamedParameters(params: string[], mandatoryParameters?: string[]): any;
|
|
288
294
|
}
|
|
@@ -293,7 +299,7 @@ declare class StateObject<B extends BodyFormat = BodyFormat, M extends AllowedMe
|
|
|
293
299
|
/** The bodyformat that ended up taking precedence. This should be correctly typed. */
|
|
294
300
|
bodyFormat: B;
|
|
295
301
|
user: AuthUser;
|
|
296
|
-
|
|
302
|
+
router: Router;
|
|
297
303
|
tiddlerCache: Router["tiddlerCache"];
|
|
298
304
|
z: typeof z;
|
|
299
305
|
STREAM_ENDED: typeof STREAM_ENDED;
|
|
@@ -331,7 +337,7 @@ declare class StateObject<B extends BodyFormat = BodyFormat, M extends AllowedMe
|
|
|
331
337
|
/** The array of Route tree nodes the request matched. */
|
|
332
338
|
routePath: RouteMatch[],
|
|
333
339
|
/** The bodyformat that ended up taking precedence. This should be correctly typed. */
|
|
334
|
-
bodyFormat: B, user: AuthUser,
|
|
340
|
+
bodyFormat: B, user: AuthUser, router: Router, tiddlerCache: Router["tiddlerCache"]);
|
|
335
341
|
okUser(): void;
|
|
336
342
|
okAdmin(): void;
|
|
337
343
|
$transaction: <T>(fn: (prisma: PrismaTxnClient) => Promise<T>) => Promise<T>;
|
|
@@ -779,15 +785,18 @@ declare const BodyFormats: readonly ["stream", "string", "json", "buffer", "www-
|
|
|
779
785
|
type BodyFormat = typeof BodyFormats[number];
|
|
780
786
|
declare class Router {
|
|
781
787
|
private rootRoute;
|
|
782
|
-
private commander;
|
|
783
788
|
private tiddlerCache;
|
|
784
789
|
static makeRouter(commander: Commander, enableDevServer: boolean): Promise<Router>;
|
|
785
|
-
pathPrefix: string;
|
|
786
790
|
enableBrowserCache: boolean;
|
|
787
791
|
enableGzip: boolean;
|
|
788
792
|
csrfDisable: boolean;
|
|
793
|
+
siteConfig: SiteConfig;
|
|
794
|
+
get pathPrefix(): string;
|
|
789
795
|
engine: Commander["engine"];
|
|
790
796
|
private SessionManager;
|
|
797
|
+
PasswordService: Commander["PasswordService"];
|
|
798
|
+
fieldModules: Commander["$tw"]["Tiddler"]["fieldModules"];
|
|
799
|
+
AttachmentService: Commander["AttachmentService"];
|
|
791
800
|
constructor(rootRoute: rootRoute$1, commander: Commander, tiddlerCache: CacheState);
|
|
792
801
|
handleIncomingRequest(req: http.IncomingMessage | http2$1.Http2ServerRequest, res: http.ServerResponse | http2$1.Http2ServerResponse): void;
|
|
793
802
|
handle(streamer: Streamer): Promise<void | typeof STREAM_ENDED>;
|
|
@@ -885,8 +894,10 @@ interface SiteConfig extends MWSConfigConfig {
|
|
|
885
894
|
storePath: string;
|
|
886
895
|
/**
|
|
887
896
|
* The path prefix is a essentially folder mount point.
|
|
888
|
-
*
|
|
889
|
-
*
|
|
897
|
+
*
|
|
898
|
+
* It starts with a slash, and ends without a slash (`"/dev"`).
|
|
899
|
+
*
|
|
900
|
+
* If there is not a prefix, it is an empty string (`""`).
|
|
890
901
|
*/
|
|
891
902
|
pathPrefix: string;
|
|
892
903
|
}
|