@nymphjs/tilmeld-setup 1.0.0-beta.12 → 1.0.0-beta.121
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 +478 -0
- package/README.md +6 -5
- package/app/index.ts +9 -3
- package/app/src/App.svelte +148 -77
- 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/app/theme/_smui-theme.scss +5 -5
- package/dist/app/index.css +105 -0
- package/dist/app/index.js +43615 -3
- package/dist/app/smui.css +1 -29
- package/dist/index.d.ts +5 -3
- package/dist/index.js +19 -20
- package/dist/index.js.map +1 -1
- package/jest.config.js +31 -5
- package/package.json +67 -59
- package/rollup.config.mjs +36 -0
- package/src/index.ts +26 -21
- package/static/index.html +4 -1
- package/test.mjs +13 -12
- package/tsconfig.json +13 -1
- package/tsconfig.server.json +6 -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,4 +1,6 @@
|
|
|
1
|
-
import { NymphOptions } from '@nymphjs/client';
|
|
2
|
-
import { Nymph } from '@nymphjs/nymph';
|
|
3
|
-
export declare function setup(options: NymphOptions, nymph: Nymph
|
|
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;
|
|
4
6
|
export default setup;
|
package/dist/index.js
CHANGED
|
@@ -1,17 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
const app = (0, express_1.default)();
|
|
11
|
-
if (!nymph.tilmeld) {
|
|
12
|
-
throw new Error('You need to configure Tilmeld on your Nymph instance first.');
|
|
13
|
-
}
|
|
14
|
-
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/index';
|
|
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);
|
|
15
10
|
app.use('/verify', async (request, response, next) => {
|
|
16
11
|
if (!tilmeld.config.verifyEmail || request.query.action == null) {
|
|
17
12
|
next();
|
|
@@ -74,6 +69,7 @@ function setup(options, nymph) {
|
|
|
74
69
|
printError(500, 'An error occurred.');
|
|
75
70
|
return;
|
|
76
71
|
case 'verify':
|
|
72
|
+
// Verify new user's email address.
|
|
77
73
|
if (user.secret == null || request.query.secret !== user.secret) {
|
|
78
74
|
printError(500, 'An error occurred.');
|
|
79
75
|
return;
|
|
@@ -85,6 +81,7 @@ function setup(options, nymph) {
|
|
|
85
81
|
delete user.secret;
|
|
86
82
|
break;
|
|
87
83
|
case 'verifychange':
|
|
84
|
+
// Email address change.
|
|
88
85
|
if (user.newEmailSecret == null ||
|
|
89
86
|
user.newEmailAddress == null ||
|
|
90
87
|
request.query.secret !== user.newEmailSecret) {
|
|
@@ -110,6 +107,7 @@ function setup(options, nymph) {
|
|
|
110
107
|
delete user.newEmailSecret;
|
|
111
108
|
break;
|
|
112
109
|
case 'cancelchange':
|
|
110
|
+
// Cancel an email address change.
|
|
113
111
|
if (user.cancelEmailSecret == null ||
|
|
114
112
|
user.cancelEmailAddress == null ||
|
|
115
113
|
request.query.secret !== user.cancelEmailSecret) {
|
|
@@ -119,7 +117,7 @@ function setup(options, nymph) {
|
|
|
119
117
|
if (tilmeld.config.emailRateLimit !== '' &&
|
|
120
118
|
user.emailChangeDate != null &&
|
|
121
119
|
user.emailChangeDate <
|
|
122
|
-
((
|
|
120
|
+
(strtotime('-' + tilmeld.config.emailRateLimit) || 0) * 1000) {
|
|
123
121
|
printError(400, "That email change cancellation link has expired. Please contact an administrator if you can't access your account.");
|
|
124
122
|
return;
|
|
125
123
|
}
|
|
@@ -154,14 +152,15 @@ function setup(options, nymph) {
|
|
|
154
152
|
});
|
|
155
153
|
app.get('/options.js', async (_request, response) => {
|
|
156
154
|
response.type('text/javascript');
|
|
157
|
-
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)};`);
|
|
158
158
|
});
|
|
159
|
-
app.use('/app',
|
|
159
|
+
app.use('/app', express.static(__dirname + '/app', {
|
|
160
160
|
fallthrough: true,
|
|
161
161
|
}));
|
|
162
|
-
app.use(
|
|
162
|
+
app.use(express.static(__dirname + '/../static', { fallthrough: false }));
|
|
163
163
|
return app;
|
|
164
164
|
}
|
|
165
|
-
|
|
166
|
-
exports.default = setup;
|
|
165
|
+
export default setup;
|
|
167
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":"
|
|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mts}',
|
|
5
|
+
'<rootDir>/src/**/?(*.)(spec|test).{js,ts,jsx,tsx,mjs,mts}',
|
|
6
|
+
],
|
|
7
|
+
transform: {
|
|
8
|
+
'^.+\\.(ts|tsx|mts)$': [
|
|
9
|
+
'@swc/jest',
|
|
10
|
+
{
|
|
11
|
+
jsc: {
|
|
12
|
+
parser: {
|
|
13
|
+
syntax: 'typescript',
|
|
14
|
+
tsx: true,
|
|
15
|
+
decorators: true,
|
|
16
|
+
},
|
|
17
|
+
target: 'es2023',
|
|
18
|
+
},
|
|
19
|
+
module: {
|
|
20
|
+
type: 'commonjs',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
transformIgnorePatterns: ['[/\\\\]node_modules[/\\\\].+\\.(js|jsx|mjs)$'],
|
|
26
|
+
moduleDirectories: ['node_modules', 'src'],
|
|
27
|
+
moduleNameMapper: {
|
|
28
|
+
'^(\\.|\\.\\.)\\/(.+)\\.js': '$1/$2',
|
|
29
|
+
},
|
|
6
30
|
};
|
|
31
|
+
|
|
32
|
+
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.121",
|
|
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,78 +14,86 @@
|
|
|
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
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"test
|
|
20
|
+
"watch:app": "NODE_ENV=\"development\" rollup -c --watch",
|
|
21
|
+
"prepublish": "npm run clean && npm run build",
|
|
22
|
+
"typecheck": "npx tsc --noEmit",
|
|
23
|
+
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --passWithNoTests",
|
|
24
|
+
"test:watch": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --passWithNoTests --watch"
|
|
24
25
|
},
|
|
25
26
|
"publishConfig": {
|
|
26
27
|
"access": "public"
|
|
27
28
|
},
|
|
29
|
+
"homepage": "https://nymph.io",
|
|
28
30
|
"repository": {
|
|
29
31
|
"type": "git",
|
|
30
|
-
"url": "
|
|
32
|
+
"url": "https://forge.sciactive.com/sciactive/nymphjs.git",
|
|
33
|
+
"directory": "packages/tilmeld-setup"
|
|
31
34
|
},
|
|
32
|
-
"author": "Hunter Perrin <hperrin@
|
|
35
|
+
"author": "Hunter Perrin <hperrin@port87.com>",
|
|
33
36
|
"bugs": {
|
|
34
|
-
"url": "https://
|
|
37
|
+
"url": "https://forge.sciactive.com/sciactive/nymphjs/issues"
|
|
35
38
|
},
|
|
36
39
|
"license": "Apache-2.0",
|
|
37
40
|
"dependencies": {
|
|
38
|
-
"@nymphjs/nymph": "^1.0.0-beta.
|
|
39
|
-
"@nymphjs/tilmeld": "^1.0.0-beta.
|
|
40
|
-
"express": "^
|
|
41
|
-
"locutus": "^
|
|
41
|
+
"@nymphjs/nymph": "^1.0.0-beta.121",
|
|
42
|
+
"@nymphjs/tilmeld": "^1.0.0-beta.121",
|
|
43
|
+
"express": "^5.2.1",
|
|
44
|
+
"locutus": "^3.0.36"
|
|
42
45
|
},
|
|
43
46
|
"devDependencies": {
|
|
44
47
|
"@material/elevation": "^14.0.0",
|
|
45
48
|
"@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
|
-
"@
|
|
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
|
-
"jest": "^
|
|
79
|
-
"
|
|
80
|
-
"svelte": "^
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"
|
|
49
|
+
"@mdi/js": "^7.4.47",
|
|
50
|
+
"@nymphjs/client": "^1.0.0-beta.121",
|
|
51
|
+
"@nymphjs/driver-sqlite3": "^1.0.0-beta.121",
|
|
52
|
+
"@nymphjs/query-parser": "^1.0.0-beta.121",
|
|
53
|
+
"@nymphjs/server": "^1.0.0-beta.121",
|
|
54
|
+
"@nymphjs/tilmeld-client": "^1.0.0-beta.121",
|
|
55
|
+
"@nymphjs/tilmeld-components": "^1.0.0-beta.121",
|
|
56
|
+
"@rollup/plugin-commonjs": "^29.0.3",
|
|
57
|
+
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
58
|
+
"@rollup/plugin-sucrase": "^5.1.0",
|
|
59
|
+
"@rollup/plugin-typescript": "^12.3.0",
|
|
60
|
+
"@smui/button": "^9.0.2",
|
|
61
|
+
"@smui/card": "^9.0.2",
|
|
62
|
+
"@smui/checkbox": "^9.0.2",
|
|
63
|
+
"@smui/circular-progress": "^9.0.2",
|
|
64
|
+
"@smui/common": "^9.0.2",
|
|
65
|
+
"@smui/data-table": "^9.0.2",
|
|
66
|
+
"@smui/dialog": "^9.0.2",
|
|
67
|
+
"@smui/drawer": "^9.0.2",
|
|
68
|
+
"@smui/fab": "^9.0.2",
|
|
69
|
+
"@smui/form-field": "^9.0.2",
|
|
70
|
+
"@smui/icon-button": "^9.0.2",
|
|
71
|
+
"@smui/layout-grid": "^9.0.2",
|
|
72
|
+
"@smui/list": "^9.0.2",
|
|
73
|
+
"@smui/menu": "^9.0.2",
|
|
74
|
+
"@smui/paper": "^9.0.2",
|
|
75
|
+
"@smui/radio": "^9.0.2",
|
|
76
|
+
"@smui/tab": "^9.0.2",
|
|
77
|
+
"@smui/tab-bar": "^9.0.2",
|
|
78
|
+
"@smui/textfield": "^9.0.2",
|
|
79
|
+
"@smui/top-app-bar": "^9.0.2",
|
|
80
|
+
"@swc/core": "^1.16.1",
|
|
81
|
+
"@swc/jest": "^0.2.39",
|
|
82
|
+
"@tsconfig/recommended": "^1.0.13",
|
|
83
|
+
"@tsconfig/svelte": "^5.0.8",
|
|
84
|
+
"@types/express": "^5.0.6",
|
|
85
|
+
"@types/jest": "^30.0.0",
|
|
86
|
+
"@types/locutus": "^0.0.8",
|
|
87
|
+
"cross-env": "^10.1.0",
|
|
88
|
+
"jest": "^30.4.2",
|
|
89
|
+
"navigo": "^8.11.1",
|
|
90
|
+
"rollup": "^4.62.5",
|
|
91
|
+
"rollup-plugin-postcss": "^4.0.2",
|
|
92
|
+
"rollup-plugin-svelte": "^7.2.3",
|
|
93
|
+
"smui-theme": "^9.0.3",
|
|
94
|
+
"svelte": "^5.56.10",
|
|
95
|
+
"tslib": "^2.8.1",
|
|
96
|
+
"typescript": "^7.0.2"
|
|
89
97
|
},
|
|
90
|
-
"gitHead": "
|
|
98
|
+
"gitHead": "74e39aff81353d16831656431e97b66ac6effc18"
|
|
91
99
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import svelte from 'rollup-plugin-svelte';
|
|
2
|
+
import resolve from '@rollup/plugin-node-resolve';
|
|
3
|
+
// This doesn't work with TS7
|
|
4
|
+
// import typescript from '@rollup/plugin-typescript';
|
|
5
|
+
import sucrase from '@rollup/plugin-sucrase';
|
|
6
|
+
import commonjs from '@rollup/plugin-commonjs';
|
|
7
|
+
import postcss from 'rollup-plugin-postcss';
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
input: 'app/index.ts',
|
|
11
|
+
output: {
|
|
12
|
+
file: 'dist/app/index.js',
|
|
13
|
+
format: 'iife',
|
|
14
|
+
},
|
|
15
|
+
plugins: [
|
|
16
|
+
resolve({
|
|
17
|
+
browser: true,
|
|
18
|
+
exportConditions: ['svelte'],
|
|
19
|
+
extensions: ['.svelte', '.mjs', '.js', '.json', '.node'],
|
|
20
|
+
dedupe: ['svelte'],
|
|
21
|
+
}),
|
|
22
|
+
commonjs(),
|
|
23
|
+
// typescript(),
|
|
24
|
+
sucrase({
|
|
25
|
+
exclude: ['node_modules/**'],
|
|
26
|
+
include: ['**/*.ts', '**/*.tsx', '**/*.mts'],
|
|
27
|
+
transforms: ['typescript'],
|
|
28
|
+
}),
|
|
29
|
+
svelte({
|
|
30
|
+
emitCss: true,
|
|
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/
|
|
3
|
-
import { NymphOptions } from '@nymphjs/client';
|
|
4
|
-
import { Nymph } from '@nymphjs/nymph';
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
import { strtotime } from 'locutus/php/datetime/index';
|
|
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 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 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 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,14 +199,18 @@ export 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
|
|
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,20 @@
|
|
|
2
2
|
"extends": "@tsconfig/svelte/tsconfig.json",
|
|
3
3
|
|
|
4
4
|
"compilerOptions": {
|
|
5
|
+
"types": ["jest"],
|
|
6
|
+
"module": "nodenext",
|
|
7
|
+
"moduleResolution": "nodenext",
|
|
8
|
+
"lib": ["DOM", "es2023"],
|
|
9
|
+
"target": "es2023",
|
|
5
10
|
"noImplicitAny": true,
|
|
6
|
-
"strict": true
|
|
11
|
+
"strict": true,
|
|
12
|
+
|
|
13
|
+
"removeComments": false,
|
|
14
|
+
"sourceMap": true,
|
|
15
|
+
"rootDir": "app/",
|
|
16
|
+
"outDir": "dist/app",
|
|
17
|
+
"resolveJsonModule": true,
|
|
18
|
+
"declaration": true
|
|
7
19
|
},
|
|
8
20
|
"include": ["app/**/*"],
|
|
9
21
|
"exclude": ["node_modules/*"]
|
package/tsconfig.server.json
CHANGED
|
@@ -2,10 +2,13 @@
|
|
|
2
2
|
"extends": "@tsconfig/recommended/tsconfig.json",
|
|
3
3
|
|
|
4
4
|
"compilerOptions": {
|
|
5
|
-
"
|
|
6
|
-
"
|
|
5
|
+
"types": ["node", "jest"],
|
|
6
|
+
"module": "nodenext",
|
|
7
|
+
"moduleResolution": "nodenext",
|
|
8
|
+
"lib": ["es2023"],
|
|
9
|
+
"target": "es2023",
|
|
7
10
|
"noImplicitAny": true,
|
|
8
|
-
"removeComments":
|
|
11
|
+
"removeComments": false,
|
|
9
12
|
"sourceMap": true,
|
|
10
13
|
"outDir": "dist",
|
|
11
14
|
"resolveJsonModule": true,
|