@nymphjs/tilmeld-setup 1.0.0-beta.11 → 1.0.0-beta.111
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/CHANGELOG.md +442 -0
- package/README.md +6 -5
- package/app/index.ts +9 -3
- package/app/src/App.svelte +143 -71
- package/app/src/nymph.ts +1 -1
- package/app/src/routes/GroupEdit.svelte +638 -0
- package/app/src/routes/Groups.svelte +201 -0
- package/app/src/{Intro.svelte → routes/Intro.svelte} +14 -1
- package/app/src/routes/NotFound.svelte +9 -0
- package/app/src/routes/UserEdit.svelte +1202 -0
- package/app/src/routes/Users.svelte +201 -0
- package/dist/app/index.css +105 -0
- package/dist/app/index.d.ts +1 -0
- package/dist/app/index.js +41288 -3
- package/dist/app/smui.css +1 -29
- package/dist/app/src/nymph.d.ts +6 -0
- package/dist/index.d.ts +6 -3
- package/dist/index.js +19 -18
- package/dist/index.js.map +1 -1
- package/jest.config.js +11 -2
- package/package.json +58 -54
- package/rollup.config.mjs +36 -0
- package/src/index.ts +28 -21
- package/src/type/locutus.d.ts +3 -0
- package/static/index.html +4 -1
- package/test.mjs +13 -12
- package/tsconfig.json +11 -1
- package/tsconfig.server.json +5 -3
- package/typedoc.json +5 -0
- package/app/src/GroupEdit.svelte +0 -570
- package/app/src/Groups.svelte +0 -159
- package/app/src/UserEdit.svelte +0 -902
- package/app/src/Users.svelte +0 -159
- package/dist/app/index.js.LICENSE.txt +0 -114
- package/dist/app/index.js.map +0 -1
- package/webpack.config.js +0 -38
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
import { NymphOptions } from '@nymphjs/client';
|
|
2
|
-
import { Nymph } from '@nymphjs/nymph';
|
|
3
|
-
export
|
|
1
|
+
import type { NymphOptions } from '@nymphjs/client';
|
|
2
|
+
import type { Nymph } from '@nymphjs/nymph';
|
|
3
|
+
export declare function setup(options: NymphOptions, nymph: Nymph, { allowRegistration }?: {
|
|
4
|
+
allowRegistration?: boolean;
|
|
5
|
+
}): import("express-serve-static-core").Express;
|
|
6
|
+
export default setup;
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
if (!nymph.tilmeld) {
|
|
11
|
-
throw new Error('You need to configure Tilmeld on your Nymph instance first.');
|
|
12
|
-
}
|
|
13
|
-
const tilmeld = nymph.tilmeld;
|
|
1
|
+
import { dirname } from 'node:path';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
import express from 'express';
|
|
4
|
+
import strtotime from 'locutus/php/datetime/strtotime.js';
|
|
5
|
+
import { enforceTilmeld } from '@nymphjs/tilmeld';
|
|
6
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
7
|
+
export function setup(options, nymph, { allowRegistration = false } = {}) {
|
|
8
|
+
const app = express();
|
|
9
|
+
const tilmeld = enforceTilmeld(nymph);
|
|
14
10
|
app.use('/verify', async (request, response, next) => {
|
|
15
11
|
if (!tilmeld.config.verifyEmail || request.query.action == null) {
|
|
16
12
|
next();
|
|
@@ -73,6 +69,7 @@ function setup(options, nymph) {
|
|
|
73
69
|
printError(500, 'An error occurred.');
|
|
74
70
|
return;
|
|
75
71
|
case 'verify':
|
|
72
|
+
// Verify new user's email address.
|
|
76
73
|
if (user.secret == null || request.query.secret !== user.secret) {
|
|
77
74
|
printError(500, 'An error occurred.');
|
|
78
75
|
return;
|
|
@@ -84,6 +81,7 @@ function setup(options, nymph) {
|
|
|
84
81
|
delete user.secret;
|
|
85
82
|
break;
|
|
86
83
|
case 'verifychange':
|
|
84
|
+
// Email address change.
|
|
87
85
|
if (user.newEmailSecret == null ||
|
|
88
86
|
user.newEmailAddress == null ||
|
|
89
87
|
request.query.secret !== user.newEmailSecret) {
|
|
@@ -109,6 +107,7 @@ function setup(options, nymph) {
|
|
|
109
107
|
delete user.newEmailSecret;
|
|
110
108
|
break;
|
|
111
109
|
case 'cancelchange':
|
|
110
|
+
// Cancel an email address change.
|
|
112
111
|
if (user.cancelEmailSecret == null ||
|
|
113
112
|
user.cancelEmailAddress == null ||
|
|
114
113
|
request.query.secret !== user.cancelEmailSecret) {
|
|
@@ -118,7 +117,7 @@ function setup(options, nymph) {
|
|
|
118
117
|
if (tilmeld.config.emailRateLimit !== '' &&
|
|
119
118
|
user.emailChangeDate != null &&
|
|
120
119
|
user.emailChangeDate <
|
|
121
|
-
((
|
|
120
|
+
(strtotime('-' + tilmeld.config.emailRateLimit) || 0) * 1000) {
|
|
122
121
|
printError(400, "That email change cancellation link has expired. Please contact an administrator if you can't access your account.");
|
|
123
122
|
return;
|
|
124
123
|
}
|
|
@@ -153,13 +152,15 @@ function setup(options, nymph) {
|
|
|
153
152
|
});
|
|
154
153
|
app.get('/options.js', async (_request, response) => {
|
|
155
154
|
response.type('text/javascript');
|
|
156
|
-
response.send(`window.nymphOptions = ${JSON.stringify(options)}
|
|
155
|
+
response.send(`window.nymphOptions = ${JSON.stringify(options)};\n` +
|
|
156
|
+
`window.allowRegistration = ${JSON.stringify(allowRegistration)};\n` +
|
|
157
|
+
`window.appUrl = ${JSON.stringify(tilmeld.config.appUrl)};`);
|
|
157
158
|
});
|
|
158
|
-
app.use('/app',
|
|
159
|
+
app.use('/app', express.static(__dirname + '/app', {
|
|
159
160
|
fallthrough: true,
|
|
160
161
|
}));
|
|
161
|
-
app.use(
|
|
162
|
+
app.use(express.static(__dirname + '/../static', { fallthrough: false }));
|
|
162
163
|
return app;
|
|
163
164
|
}
|
|
164
|
-
|
|
165
|
+
export default setup;
|
|
165
166
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","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BACR,KAAK,cAAc;oBACjB,YAAY,CACV,6CAA6C,EAC7C,OAAO,CAAC,MAAM,CAAC,oBAAoB,CACpC,CAAC;oBACF,MAAM;YACV,CAAC;QACH,CAAC;aAAM,CAAC;YACN,UAAU,CAAC,GAAG,EAAE,oBAAoB,CAAC,CAAC;QACxC,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,GAAG,CAAC,GAAG,CAAC,aAAa,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE;QAClD,QAAQ,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QACjC,QAAQ,CAAC,IAAI,CACX,yBAAyB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK;YACnD,8BAA8B,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,KAAK;YACpE,mBAAmB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAC9D,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,GAAG,CAAC,GAAG,CACL,MAAM,EACN,OAAO,CAAC,MAAM,CAAC,SAAS,GAAG,MAAM,EAAE;QACjC,WAAW,EAAE,IAAI;KAClB,CAAC,CACH,CAAC;IACF,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,GAAG,YAAY,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;IAE1E,OAAO,GAAG,CAAC;AACb,CAAC;AAED,eAAe,KAAK,CAAC"}
|
package/jest.config.js
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
|
+
import { createDefaultEsmPreset } from 'ts-jest';
|
|
2
|
+
|
|
3
|
+
const presetConfig = createDefaultEsmPreset();
|
|
4
|
+
|
|
1
5
|
/** @type {import('ts-jest').JestConfigWithTsJest} */
|
|
2
|
-
|
|
3
|
-
|
|
6
|
+
const jestConfig = {
|
|
7
|
+
...presetConfig,
|
|
4
8
|
testEnvironment: 'node',
|
|
5
9
|
rootDir: 'src/',
|
|
10
|
+
moduleNameMapper: {
|
|
11
|
+
'^(\\.|\\.\\.)\\/(.+)\\.js': '$1/$2',
|
|
12
|
+
},
|
|
6
13
|
};
|
|
14
|
+
|
|
15
|
+
export default jestConfig;
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nymphjs/tilmeld-setup",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
4
|
-
"description": "
|
|
5
|
-
"type": "
|
|
3
|
+
"version": "1.0.0-beta.111",
|
|
4
|
+
"description": "Nymph.js - Tilmeld Setup App",
|
|
5
|
+
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"keywords": [
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
"clean": "test -d dist && rm -r dist || true",
|
|
15
15
|
"build": "npm run build:server && npm run build:app && npm run build:app:theme",
|
|
16
16
|
"build:server": "tsc -p tsconfig.server.json",
|
|
17
|
-
"build:app": "
|
|
17
|
+
"build:app": "NODE_ENV=\"production\" rollup -c",
|
|
18
18
|
"build:app:theme": "smui-theme compile dist/app/smui.css -i app/theme",
|
|
19
19
|
"watch:server": "tsc --watch -p tsconfig.server.json",
|
|
20
|
-
"watch:app": "
|
|
21
|
-
"
|
|
20
|
+
"watch:app": "NODE_ENV=\"development\" rollup -c --watch",
|
|
21
|
+
"prepublish": "npm run clean && npm run build",
|
|
22
22
|
"test": "jest",
|
|
23
23
|
"test:watch": "jest --watch"
|
|
24
24
|
},
|
|
@@ -35,57 +35,61 @@
|
|
|
35
35
|
},
|
|
36
36
|
"license": "Apache-2.0",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@nymphjs/nymph": "^1.0.0-beta.
|
|
39
|
-
"@nymphjs/tilmeld": "^1.0.0-beta.
|
|
40
|
-
"express": "^
|
|
41
|
-
"locutus": "^2.0.
|
|
38
|
+
"@nymphjs/nymph": "^1.0.0-beta.111",
|
|
39
|
+
"@nymphjs/tilmeld": "^1.0.0-beta.111",
|
|
40
|
+
"express": "^5.2.1",
|
|
41
|
+
"locutus": "^2.0.39"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@material/elevation": "^14.0.0",
|
|
45
45
|
"@material/typography": "^14.0.0",
|
|
46
|
-
"@mdi/js": "^7.
|
|
47
|
-
"@nymphjs/client": "^1.0.0-beta.
|
|
48
|
-
"@nymphjs/driver-sqlite3": "^1.0.0-beta.
|
|
49
|
-
"@nymphjs/query-parser": "^1.0.0-beta.
|
|
50
|
-
"@nymphjs/server": "^1.0.0-beta.
|
|
51
|
-
"@nymphjs/tilmeld-client": "^1.0.0-beta.
|
|
52
|
-
"@nymphjs/tilmeld-components": "^1.0.0-beta.
|
|
53
|
-
"@
|
|
54
|
-
"@
|
|
55
|
-
"@
|
|
56
|
-
"@smui/
|
|
57
|
-
"@smui/
|
|
58
|
-
"@smui/
|
|
59
|
-
"@smui/
|
|
60
|
-
"@smui/
|
|
61
|
-
"@smui/
|
|
62
|
-
"@smui/
|
|
63
|
-
"@smui/
|
|
64
|
-
"@smui/
|
|
65
|
-
"@smui/
|
|
66
|
-
"@smui/
|
|
67
|
-
"@smui/
|
|
68
|
-
"@smui/
|
|
69
|
-
"@smui/
|
|
70
|
-
"@smui/
|
|
71
|
-
"@smui/
|
|
72
|
-
"@smui/
|
|
73
|
-
"@
|
|
74
|
-
"@
|
|
75
|
-
"@
|
|
76
|
-
"@
|
|
77
|
-
"@
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"
|
|
46
|
+
"@mdi/js": "^7.4.47",
|
|
47
|
+
"@nymphjs/client": "^1.0.0-beta.111",
|
|
48
|
+
"@nymphjs/driver-sqlite3": "^1.0.0-beta.111",
|
|
49
|
+
"@nymphjs/query-parser": "^1.0.0-beta.111",
|
|
50
|
+
"@nymphjs/server": "^1.0.0-beta.111",
|
|
51
|
+
"@nymphjs/tilmeld-client": "^1.0.0-beta.111",
|
|
52
|
+
"@nymphjs/tilmeld-components": "^1.0.0-beta.111",
|
|
53
|
+
"@rollup/plugin-commonjs": "^29.0.0",
|
|
54
|
+
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
55
|
+
"@rollup/plugin-typescript": "^12.3.0",
|
|
56
|
+
"@smui/button": "^8.0.3",
|
|
57
|
+
"@smui/card": "^8.0.3",
|
|
58
|
+
"@smui/checkbox": "^8.0.3",
|
|
59
|
+
"@smui/circular-progress": "^8.0.3",
|
|
60
|
+
"@smui/common": "^8.0.3",
|
|
61
|
+
"@smui/data-table": "^8.0.3",
|
|
62
|
+
"@smui/dialog": "^8.0.3",
|
|
63
|
+
"@smui/drawer": "^8.0.3",
|
|
64
|
+
"@smui/fab": "^8.0.3",
|
|
65
|
+
"@smui/form-field": "^8.0.3",
|
|
66
|
+
"@smui/icon-button": "^8.0.3",
|
|
67
|
+
"@smui/layout-grid": "^8.0.3",
|
|
68
|
+
"@smui/list": "^8.0.3",
|
|
69
|
+
"@smui/menu": "^8.0.3",
|
|
70
|
+
"@smui/paper": "^8.0.3",
|
|
71
|
+
"@smui/radio": "^8.0.3",
|
|
72
|
+
"@smui/tab": "^8.0.3",
|
|
73
|
+
"@smui/tab-bar": "^8.0.3",
|
|
74
|
+
"@smui/textfield": "^8.0.3",
|
|
75
|
+
"@smui/top-app-bar": "^8.0.3",
|
|
76
|
+
"@tsconfig/recommended": "^1.0.13",
|
|
77
|
+
"@tsconfig/svelte": "^5.0.7",
|
|
78
|
+
"@types/express": "^5.0.6",
|
|
79
|
+
"@types/jest": "^30.0.0",
|
|
80
|
+
"@types/locutus": "^0.0.8",
|
|
81
|
+
"jest": "^30.2.0",
|
|
82
|
+
"navigo": "^8.11.1",
|
|
83
|
+
"rollup": "^4.57.1",
|
|
84
|
+
"rollup-plugin-postcss": "^4.0.2",
|
|
85
|
+
"rollup-plugin-svelte": "^7.2.3",
|
|
86
|
+
"smui-theme": "^8.0.3",
|
|
87
|
+
"svelte": "^5.50.3",
|
|
88
|
+
"svelte-check": "^4.3.6",
|
|
89
|
+
"svelte-preprocess": "^6.0.3",
|
|
90
|
+
"ts-jest": "^29.4.6",
|
|
91
|
+
"tslib": "^2.8.1",
|
|
92
|
+
"typescript": "^5.9.3"
|
|
89
93
|
},
|
|
90
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "8028358367d8fd89bb434f122b243bec4c71f2e1"
|
|
91
95
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import svelte from 'rollup-plugin-svelte';
|
|
2
|
+
import resolve from '@rollup/plugin-node-resolve';
|
|
3
|
+
import typescript from '@rollup/plugin-typescript';
|
|
4
|
+
import commonjs from '@rollup/plugin-commonjs';
|
|
5
|
+
import { sveltePreprocess } from 'svelte-preprocess';
|
|
6
|
+
import postcss from 'rollup-plugin-postcss';
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
input: 'app/index.ts',
|
|
10
|
+
output: {
|
|
11
|
+
file: 'dist/app/index.js',
|
|
12
|
+
format: 'iife',
|
|
13
|
+
},
|
|
14
|
+
plugins: [
|
|
15
|
+
resolve({
|
|
16
|
+
browser: true,
|
|
17
|
+
exportConditions: ['svelte'],
|
|
18
|
+
extensions: ['.svelte', '.mjs', '.js', '.json', '.node'],
|
|
19
|
+
dedupe: ['svelte'],
|
|
20
|
+
}),
|
|
21
|
+
commonjs(),
|
|
22
|
+
typescript(),
|
|
23
|
+
svelte({
|
|
24
|
+
emitCss: true,
|
|
25
|
+
preprocess: sveltePreprocess({
|
|
26
|
+
typescript: {
|
|
27
|
+
verbatimModuleSyntax: true,
|
|
28
|
+
tsconfigFile: 'tsconfig.json',
|
|
29
|
+
},
|
|
30
|
+
}),
|
|
31
|
+
}),
|
|
32
|
+
postcss({
|
|
33
|
+
extract: true,
|
|
34
|
+
}),
|
|
35
|
+
],
|
|
36
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
|
+
import { dirname } from 'node:path';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
1
3
|
import express from 'express';
|
|
2
|
-
import strtotime from 'locutus/php/datetime/strtotime';
|
|
3
|
-
import { NymphOptions } from '@nymphjs/client';
|
|
4
|
-
import { Nymph } from '@nymphjs/nymph';
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
import strtotime from 'locutus/php/datetime/strtotime.js';
|
|
5
|
+
import type { NymphOptions } from '@nymphjs/client';
|
|
6
|
+
import type { Nymph } from '@nymphjs/nymph';
|
|
7
|
+
import { enforceTilmeld } from '@nymphjs/tilmeld';
|
|
8
|
+
|
|
9
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
10
|
+
|
|
11
|
+
export function setup(
|
|
12
|
+
options: NymphOptions,
|
|
13
|
+
nymph: Nymph,
|
|
14
|
+
{ allowRegistration = false }: { allowRegistration?: boolean } = {},
|
|
15
|
+
) {
|
|
8
16
|
const app = express();
|
|
9
|
-
|
|
10
|
-
if (!nymph.tilmeld) {
|
|
11
|
-
throw new Error(
|
|
12
|
-
'You need to configure Tilmeld on your Nymph instance first.'
|
|
13
|
-
);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const tilmeld = nymph.tilmeld as Tilmeld;
|
|
17
|
+
const tilmeld = enforceTilmeld(nymph);
|
|
17
18
|
|
|
18
19
|
app.use('/verify', async (request, response, next) => {
|
|
19
20
|
if (!tilmeld.config.verifyEmail || request.query.action == null) {
|
|
@@ -95,7 +96,7 @@ export default function setup(options: NymphOptions, nymph: Nymph) {
|
|
|
95
96
|
if (tilmeld.config.unverifiedAccess) {
|
|
96
97
|
user.groups = await nymph.getEntities(
|
|
97
98
|
{ class: tilmeld.Group, skipAc: true },
|
|
98
|
-
{ type: '&', equal: ['defaultSecondary', true] }
|
|
99
|
+
{ type: '&', equal: ['defaultSecondary', true] },
|
|
99
100
|
);
|
|
100
101
|
}
|
|
101
102
|
user.enabled = true;
|
|
@@ -151,7 +152,7 @@ export default function setup(options: NymphOptions, nymph: Nymph) {
|
|
|
151
152
|
) {
|
|
152
153
|
printError(
|
|
153
154
|
400,
|
|
154
|
-
"That email change cancellation link has expired. Please contact an administrator if you can't access your account."
|
|
155
|
+
"That email change cancellation link has expired. Please contact an administrator if you can't access your account.",
|
|
155
156
|
);
|
|
156
157
|
return;
|
|
157
158
|
}
|
|
@@ -175,19 +176,19 @@ export default function setup(options: NymphOptions, nymph: Nymph) {
|
|
|
175
176
|
default:
|
|
176
177
|
printSuccess(
|
|
177
178
|
'Your account has been verified.',
|
|
178
|
-
tilmeld.config.verifyRedirect
|
|
179
|
+
tilmeld.config.verifyRedirect,
|
|
179
180
|
);
|
|
180
181
|
break;
|
|
181
182
|
case 'verifychange':
|
|
182
183
|
printSuccess(
|
|
183
184
|
'Your new email address has been verified.',
|
|
184
|
-
tilmeld.config.verifyChangeRedirect
|
|
185
|
+
tilmeld.config.verifyChangeRedirect,
|
|
185
186
|
);
|
|
186
187
|
break;
|
|
187
188
|
case 'cancelchange':
|
|
188
189
|
printSuccess(
|
|
189
190
|
'The email address change has been canceled.',
|
|
190
|
-
tilmeld.config.cancelChangeRedirect
|
|
191
|
+
tilmeld.config.cancelChangeRedirect,
|
|
191
192
|
);
|
|
192
193
|
break;
|
|
193
194
|
}
|
|
@@ -198,16 +199,22 @@ export default function setup(options: NymphOptions, nymph: Nymph) {
|
|
|
198
199
|
|
|
199
200
|
app.get('/options.js', async (_request, response) => {
|
|
200
201
|
response.type('text/javascript');
|
|
201
|
-
response.send(
|
|
202
|
+
response.send(
|
|
203
|
+
`window.nymphOptions = ${JSON.stringify(options)};\n` +
|
|
204
|
+
`window.allowRegistration = ${JSON.stringify(allowRegistration)};\n` +
|
|
205
|
+
`window.appUrl = ${JSON.stringify(tilmeld.config.appUrl)};`,
|
|
206
|
+
);
|
|
202
207
|
});
|
|
203
208
|
|
|
204
209
|
app.use(
|
|
205
210
|
'/app',
|
|
206
211
|
express.static(__dirname + '/app', {
|
|
207
212
|
fallthrough: true,
|
|
208
|
-
})
|
|
213
|
+
}),
|
|
209
214
|
);
|
|
210
215
|
app.use(express.static(__dirname + '/../static', { fallthrough: false }));
|
|
211
216
|
|
|
212
217
|
return app;
|
|
213
218
|
}
|
|
219
|
+
|
|
220
|
+
export default setup;
|
package/static/index.html
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!
|
|
1
|
+
<!doctype html>
|
|
2
2
|
<head>
|
|
3
3
|
<title>Tilmeld Setup App</title>
|
|
4
4
|
|
|
@@ -24,6 +24,9 @@
|
|
|
24
24
|
<!-- SMUI CSS -->
|
|
25
25
|
<link rel="stylesheet" href="app/smui.css" />
|
|
26
26
|
|
|
27
|
+
<!-- App CSS -->
|
|
28
|
+
<link rel="stylesheet" href="app/index.css" />
|
|
29
|
+
|
|
27
30
|
<style>
|
|
28
31
|
html,
|
|
29
32
|
body {
|
package/test.mjs
CHANGED
|
@@ -2,11 +2,8 @@ import express from 'express';
|
|
|
2
2
|
import { SQLite3Driver } from '@nymphjs/driver-sqlite3';
|
|
3
3
|
import { Nymph } from '@nymphjs/nymph';
|
|
4
4
|
import { Tilmeld } from '@nymphjs/tilmeld';
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
const createServer = server.default;
|
|
9
|
-
const setup = setupApp.default;
|
|
5
|
+
import createServer from '@nymphjs/server';
|
|
6
|
+
import setup from './dist/index.js';
|
|
10
7
|
|
|
11
8
|
const nymph = new Nymph(
|
|
12
9
|
{},
|
|
@@ -20,12 +17,13 @@ const nymph = new Nymph(
|
|
|
20
17
|
cookiePath: '/',
|
|
21
18
|
setupPath: '/user',
|
|
22
19
|
emailUsernames: false,
|
|
20
|
+
domainSupport: true,
|
|
23
21
|
clientEnabledUIDs: ['test'],
|
|
24
22
|
verifyRedirect: 'http://localhost:8080',
|
|
25
23
|
verifyChangeRedirect: 'http://localhost:8080',
|
|
26
24
|
cancelChangeRedirect: 'http://localhost:8080',
|
|
27
25
|
jwtSecret: 'shhhhh',
|
|
28
|
-
})
|
|
26
|
+
}),
|
|
29
27
|
);
|
|
30
28
|
|
|
31
29
|
const app = express();
|
|
@@ -37,11 +35,14 @@ app.use(
|
|
|
37
35
|
{
|
|
38
36
|
restUrl: 'http://localhost:8080/rest',
|
|
39
37
|
},
|
|
40
|
-
nymph
|
|
41
|
-
|
|
38
|
+
nymph,
|
|
39
|
+
{
|
|
40
|
+
allowRegistration: true,
|
|
41
|
+
},
|
|
42
|
+
),
|
|
42
43
|
);
|
|
43
44
|
|
|
44
|
-
app.listen(8080)
|
|
45
|
-
|
|
46
|
-
console.log('
|
|
47
|
-
|
|
45
|
+
app.listen(8080, () => {
|
|
46
|
+
console.log('App is loaded. Go here in your browser:');
|
|
47
|
+
console.log(' http://localhost:8080/user/');
|
|
48
|
+
});
|
package/tsconfig.json
CHANGED
|
@@ -2,8 +2,18 @@
|
|
|
2
2
|
"extends": "@tsconfig/svelte/tsconfig.json",
|
|
3
3
|
|
|
4
4
|
"compilerOptions": {
|
|
5
|
+
"module": "ES2022",
|
|
6
|
+
"moduleResolution": "node",
|
|
7
|
+
"lib": ["DOM", "ES2022"],
|
|
8
|
+
"target": "ES2022",
|
|
5
9
|
"noImplicitAny": true,
|
|
6
|
-
"strict": true
|
|
10
|
+
"strict": true,
|
|
11
|
+
|
|
12
|
+
"removeComments": false,
|
|
13
|
+
"sourceMap": true,
|
|
14
|
+
"outDir": "dist/app",
|
|
15
|
+
"resolveJsonModule": true,
|
|
16
|
+
"declaration": true
|
|
7
17
|
},
|
|
8
18
|
"include": ["app/**/*"],
|
|
9
19
|
"exclude": ["node_modules/*"]
|
package/tsconfig.server.json
CHANGED
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
"extends": "@tsconfig/recommended/tsconfig.json",
|
|
3
3
|
|
|
4
4
|
"compilerOptions": {
|
|
5
|
-
"
|
|
6
|
-
"
|
|
5
|
+
"module": "ES2022",
|
|
6
|
+
"moduleResolution": "node",
|
|
7
|
+
"lib": ["ES2022"],
|
|
8
|
+
"target": "ES2022",
|
|
7
9
|
"noImplicitAny": true,
|
|
8
|
-
"removeComments":
|
|
10
|
+
"removeComments": false,
|
|
9
11
|
"sourceMap": true,
|
|
10
12
|
"outDir": "dist",
|
|
11
13
|
"resolveJsonModule": true,
|