@pleasenobugs/server 0.0.0-stage → 0.1.0
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/LICENSE +21 -0
- package/README.md +50 -2
- package/dist/app.d.ts +27 -0
- package/dist/app.d.ts.map +1 -0
- package/dist/app.js +43 -0
- package/dist/app.js.map +1 -0
- package/dist/auth.d.ts +37 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +108 -0
- package/dist/auth.js.map +1 -0
- package/dist/board.d.ts +23 -0
- package/dist/board.d.ts.map +1 -0
- package/dist/board.js +45 -0
- package/dist/board.js.map +1 -0
- package/dist/bootstrap.d.ts +27 -0
- package/dist/bootstrap.d.ts.map +1 -0
- package/dist/bootstrap.js +41 -0
- package/dist/bootstrap.js.map +1 -0
- package/dist/importer.d.ts +50 -0
- package/dist/importer.d.ts.map +1 -0
- package/dist/importer.js +85 -0
- package/dist/importer.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/limit.d.ts +14 -0
- package/dist/limit.d.ts.map +1 -0
- package/dist/limit.js +32 -0
- package/dist/limit.js.map +1 -0
- package/dist/main.d.ts +3 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +171 -0
- package/dist/main.js.map +1 -0
- package/dist/memory-store.d.ts +59 -0
- package/dist/memory-store.d.ts.map +1 -0
- package/dist/memory-store.js +177 -0
- package/dist/memory-store.js.map +1 -0
- package/dist/projects.d.ts +64 -0
- package/dist/projects.d.ts.map +1 -0
- package/dist/projects.js +163 -0
- package/dist/projects.js.map +1 -0
- package/dist/router.d.ts +28 -0
- package/dist/router.d.ts.map +1 -0
- package/dist/router.js +391 -0
- package/dist/router.js.map +1 -0
- package/dist/sqlite-store.d.ts +61 -0
- package/dist/sqlite-store.d.ts.map +1 -0
- package/dist/sqlite-store.js +290 -0
- package/dist/sqlite-store.js.map +1 -0
- package/dist/store.d.ts +108 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +2 -0
- package/dist/store.js.map +1 -0
- package/dist/telemetry.d.ts +83 -0
- package/dist/telemetry.d.ts.map +1 -0
- package/dist/telemetry.js +174 -0
- package/dist/telemetry.js.map +1 -0
- package/package.json +53 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 lennylenders
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,51 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @pleasenobugs/server
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The [PleaseNoBugs](../../README.md) API. Run it on its own, or mount it into an
|
|
4
|
+
Express app you already have. Needs Node 22.13 or newer.
|
|
5
|
+
|
|
6
|
+
## Run it on its own
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npx @pleasenobugs/server create-project --name "My app" --origin https://my.app --owner "NQ07 ..."
|
|
10
|
+
npx @pleasenobugs/server
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
The first command prints a project id; put that in the widget. The second
|
|
14
|
+
starts the API on port 8787 with its data in `./pleasenobugs.db`.
|
|
15
|
+
|
|
16
|
+
| Variable | Default | What it does |
|
|
17
|
+
|---|---|---|
|
|
18
|
+
| `PORT` | `8787` | Where to listen. |
|
|
19
|
+
| `PNB_DB` | `./pleasenobugs.db` | The SQLite file. Back it up by copying it. |
|
|
20
|
+
| `PNB_DASHBOARD_ORIGINS` | none | Comma-separated origins allowed to run the dashboard. None means no dashboard; use `create-project`. |
|
|
21
|
+
| `PNB_TRUST_PROXY` | `0` | Proxies in front of the server. `1` behind Railway, Fly or a load balancer. |
|
|
22
|
+
| `PNB_PROJECT_NAME`, `PNB_PROJECT_ORIGINS`, `PNB_PROJECT_OWNER` | none | On an empty server, make the first project from these. Ignored once any project exists. Every start prints each project's id, and on Railway the line to paste. `PNB_PROJECT_LOGIN_MESSAGE` optionally adds an app login. |
|
|
23
|
+
| `PNB_TELEMETRY` | on | `off` stops the daily counts (see the main README). |
|
|
24
|
+
| `PNB_TELEMETRY_URL` | the PleaseNoBugs collector | Where the daily counts go. |
|
|
25
|
+
| `PNB_COLLECT` | off | `on` receives other servers' counts. Only the makers' server needs it. |
|
|
26
|
+
|
|
27
|
+
Node prints one `ExperimentalWarning` about SQLite at start. That is Node's
|
|
28
|
+
label for `node:sqlite`, which ships inside Node; nothing is wrong.
|
|
29
|
+
|
|
30
|
+
## Mount it in your own app
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
import express from 'express';
|
|
34
|
+
import { createRouter } from '@pleasenobugs/server';
|
|
35
|
+
import { SqliteStore } from '@pleasenobugs/server/sqlite';
|
|
36
|
+
|
|
37
|
+
const app = express();
|
|
38
|
+
app.use('/feedback', createRouter({ store: new SqliteStore('./feedback.db') }));
|
|
39
|
+
// → /feedback/v1/projects/:pid/posts, ...
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
The router brings its own CORS and JSON parsing.
|
|
43
|
+
|
|
44
|
+
## Another database
|
|
45
|
+
|
|
46
|
+
Implement the `Store` interface (`src/store.ts`) and add it to the list at the
|
|
47
|
+
top of `src/store.test.ts`. When that suite passes, it works.
|
|
48
|
+
|
|
49
|
+
## The API
|
|
50
|
+
|
|
51
|
+
[docs/api-v1.md](../../docs/api-v1.md).
|
package/dist/app.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
import { type RouterOptions } from './router.js';
|
|
3
|
+
export interface AppOptions extends RouterOptions {
|
|
4
|
+
/**
|
|
5
|
+
* How many proxies sit in front of the server, for Express's `trust proxy`.
|
|
6
|
+
* Behind Railway, Fly or a load balancer this is 1, or every caller shares
|
|
7
|
+
* the router's IP and the rate limiter throttles everybody at once.
|
|
8
|
+
*/
|
|
9
|
+
trustProxy?: number | boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Receive other installations' telemetry (`POST /telemetry`) and answer the
|
|
12
|
+
* totals (`GET /telemetry/summary`). Off everywhere but the one server the
|
|
13
|
+
* reports are sent to.
|
|
14
|
+
*/
|
|
15
|
+
collect?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A complete server: the router plus a health check, an app-wide rate limit
|
|
19
|
+
* and JSON errors. What `pleasenobugs-server` runs. A developer adding the
|
|
20
|
+
* board to an Express app they already have wants {@link createRouter} instead.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* import { createApp, MemoryStore } from '@pleasenobugs/server';
|
|
24
|
+
* createApp({ store: new MemoryStore() }).listen(8787);
|
|
25
|
+
*/
|
|
26
|
+
export declare function createApp(options: AppOptions): express.Express;
|
|
27
|
+
//# sourceMappingURL=app.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,EAAgB,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAG/D,MAAM,WAAW,UAAW,SAAQ,aAAa;IAC/C;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC9B;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,CAiC9D"}
|
package/dist/app.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import express from 'express';
|
|
2
|
+
import { rateLimit } from './limit.js';
|
|
3
|
+
import { createRouter } from './router.js';
|
|
4
|
+
import { telemetryRouter } from './telemetry.js';
|
|
5
|
+
/**
|
|
6
|
+
* A complete server: the router plus a health check, an app-wide rate limit
|
|
7
|
+
* and JSON errors. What `pleasenobugs-server` runs. A developer adding the
|
|
8
|
+
* board to an Express app they already have wants {@link createRouter} instead.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* import { createApp, MemoryStore } from '@pleasenobugs/server';
|
|
12
|
+
* createApp({ store: new MemoryStore() }).listen(8787);
|
|
13
|
+
*/
|
|
14
|
+
export function createApp(options) {
|
|
15
|
+
const app = express();
|
|
16
|
+
app.disable('x-powered-by');
|
|
17
|
+
app.set('trust proxy', options.trustProxy ?? false);
|
|
18
|
+
// Well above anything the widget does on its own: it reads the board when
|
|
19
|
+
// it opens and after every write. This is a ceiling on scripts.
|
|
20
|
+
app.use(rateLimit({ windowMs: 60_000, max: 300, name: 'all' }));
|
|
21
|
+
app.get('/health', (_req, res) => {
|
|
22
|
+
res.json({ ok: true });
|
|
23
|
+
});
|
|
24
|
+
app.use(createRouter(options));
|
|
25
|
+
if (options.collect)
|
|
26
|
+
app.use(telemetryRouter(options.store, options.now));
|
|
27
|
+
app.use((_req, res) => {
|
|
28
|
+
res.status(404).json({ error: 'not_found' });
|
|
29
|
+
});
|
|
30
|
+
// A body that is not JSON, or is too big, is the caller's mistake and says
|
|
31
|
+
// so. Anything else is ours, logged and answered without detail.
|
|
32
|
+
app.use((err, _req, res, _next) => {
|
|
33
|
+
const type = err?.type;
|
|
34
|
+
if (type === 'entity.parse.failed' || type === 'entity.too.large') {
|
|
35
|
+
res.status(400).json({ error: 'bad_request' });
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
console.error('[server]', err);
|
|
39
|
+
res.status(500).json({ error: 'internal' });
|
|
40
|
+
});
|
|
41
|
+
return app;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=app.js.map
|
package/dist/app.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,YAAY,EAAsB,MAAM,aAAa,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAiBjD;;;;;;;;GAQG;AACH,MAAM,UAAU,SAAS,CAAC,OAAmB;IAC3C,MAAM,GAAG,GAAG,OAAO,EAAE,CAAC;IACtB,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IAC5B,GAAG,CAAC,GAAG,CAAC,aAAa,EAAE,OAAO,CAAC,UAAU,IAAI,KAAK,CAAC,CAAC;IAEpD,0EAA0E;IAC1E,gEAAgE;IAChE,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE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th.d.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** The 32-byte hash the Keyguard actually signs for `message`. */
|
|
2
|
+
export declare function signedHash(message: string): Uint8Array;
|
|
3
|
+
/**
|
|
4
|
+
* Whether `signatureHex` signs `message` under `publicKeyHex`, and that key
|
|
5
|
+
* controls `address`. Never throws: anything malformed is simply false.
|
|
6
|
+
*/
|
|
7
|
+
export declare function verifySignature(message: string, address: string, publicKeyHex: string, signatureHex: string): Promise<boolean>;
|
|
8
|
+
export type ProofCheck = {
|
|
9
|
+
ok: true;
|
|
10
|
+
address: string;
|
|
11
|
+
origin: string;
|
|
12
|
+
}
|
|
13
|
+
/** `missing`: no header at all, which on a public route means a stranger.
|
|
14
|
+
* `invalid`: a header that does not hold up, which is always a refusal. */
|
|
15
|
+
| {
|
|
16
|
+
ok: false;
|
|
17
|
+
reason: 'missing' | 'invalid';
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Check an `Authorization` header against one project.
|
|
21
|
+
*
|
|
22
|
+
* @param header the raw `Authorization` header
|
|
23
|
+
* @param project the project id from the URL, or `DASHBOARD_PROJECT`
|
|
24
|
+
* @param requestOrigin the request's `Origin` header, when it has one
|
|
25
|
+
* @param appLogins the fixed login messages this project accepts (its
|
|
26
|
+
* `loginMessages`); empty for the dashboard, always
|
|
27
|
+
*
|
|
28
|
+
* Whether the origin is one the project *allows* is deliberately not decided
|
|
29
|
+
* here: that failure deserves its own error (`origin_not_allowed`), and this
|
|
30
|
+
* function knows nothing about projects.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* const check = await checkProof(req.header('authorization'), 'k7q2m9xw4p', req.header('origin'));
|
|
34
|
+
* if (check.ok) console.log(check.address, check.origin);
|
|
35
|
+
*/
|
|
36
|
+
export declare function checkProof(header: string | undefined, project: string, requestOrigin: string | undefined, now?: number, appLogins?: readonly string[]): Promise<ProofCheck>;
|
|
37
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAkCA,kEAAkE;AAClE,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,CAGtD;AAED;;;GAGG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,OAAO,CAAC,CAUlB;AAED,MAAM,MAAM,UAAU,GAClB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE;AAC/C;4EAC4E;GAC1E;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,SAAS,GAAG,SAAS,CAAA;CAAE,CAAC;AAWjD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,UAAU,CAC9B,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,GAAG,SAAS,EACjC,GAAG,GAAE,MAAmB,EACxB,SAAS,GAAE,SAAS,MAAM,EAAO,GAChC,OAAO,CAAC,UAAU,CAAC,CAkCrB"}
|
package/dist/auth.js
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { decodeProof, isNimiqAddress, loginMessage, normalizeAddress, normalizeOrigin, proofIsFresh, } from '@pleasenobugs/core';
|
|
3
|
+
/**
|
|
4
|
+
* Who is asking, proven by a Nimiq wallet signature.
|
|
5
|
+
*
|
|
6
|
+
* The Keyguard, which sits behind both Nimiq Pay and the Nimiq Hub, never signs
|
|
7
|
+
* a message's bytes directly: to stop a signed message ever doubling as a
|
|
8
|
+
* transaction it signs `SHA256("\x16Nimiq Signed Message:\n" + length + message)`.
|
|
9
|
+
* We rebuild exactly those bytes and check the Ed25519 signature against them.
|
|
10
|
+
*
|
|
11
|
+
* What makes this different from a single-app login is what goes *into* the
|
|
12
|
+
* message: the project and the origin (see `loginMessage` in core). The project
|
|
13
|
+
* comes from the URL, never from the proof, so a proof can only ever be checked
|
|
14
|
+
* against the board it was written for.
|
|
15
|
+
*/
|
|
16
|
+
const MSG_PREFIX = '\x16Nimiq Signed Message:\n';
|
|
17
|
+
let nimiqPromise = null;
|
|
18
|
+
/** Loaded on first use: it is WebAssembly, and a server that never sees a
|
|
19
|
+
* proof (tests of the public routes, a health check) has no need of it. */
|
|
20
|
+
function loadNimiq() {
|
|
21
|
+
if (!nimiqPromise)
|
|
22
|
+
nimiqPromise = import('@nimiq/core');
|
|
23
|
+
return nimiqPromise;
|
|
24
|
+
}
|
|
25
|
+
/** The 32-byte hash the Keyguard actually signs for `message`. */
|
|
26
|
+
export function signedHash(message) {
|
|
27
|
+
const data = MSG_PREFIX + message.length + message;
|
|
28
|
+
return new Uint8Array(createHash('sha256').update(Buffer.from(data, 'utf8')).digest());
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Whether `signatureHex` signs `message` under `publicKeyHex`, and that key
|
|
32
|
+
* controls `address`. Never throws: anything malformed is simply false.
|
|
33
|
+
*/
|
|
34
|
+
export async function verifySignature(message, address, publicKeyHex, signatureHex) {
|
|
35
|
+
try {
|
|
36
|
+
const Nimiq = await loadNimiq();
|
|
37
|
+
const pub = Nimiq.PublicKey.fromHex(publicKeyHex);
|
|
38
|
+
const sig = Nimiq.Signature.fromHex(signatureHex);
|
|
39
|
+
if (!pub.verify(sig, signedHash(message)))
|
|
40
|
+
return false;
|
|
41
|
+
return normalizeAddress(pub.toAddress().toUserFriendlyAddress()) === normalizeAddress(address);
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Proofs already verified, by the exact header and project. The widget polls,
|
|
49
|
+
* and an Ed25519 check per request per poll is work with no new answer in it.
|
|
50
|
+
* Freshness is still checked every time, so a cached proof expires on schedule.
|
|
51
|
+
* Bounded, oldest out, so a flood of junk headers cannot grow it.
|
|
52
|
+
*/
|
|
53
|
+
const verified = new Map();
|
|
54
|
+
const CACHE_MAX = 10_000;
|
|
55
|
+
/**
|
|
56
|
+
* Check an `Authorization` header against one project.
|
|
57
|
+
*
|
|
58
|
+
* @param header the raw `Authorization` header
|
|
59
|
+
* @param project the project id from the URL, or `DASHBOARD_PROJECT`
|
|
60
|
+
* @param requestOrigin the request's `Origin` header, when it has one
|
|
61
|
+
* @param appLogins the fixed login messages this project accepts (its
|
|
62
|
+
* `loginMessages`); empty for the dashboard, always
|
|
63
|
+
*
|
|
64
|
+
* Whether the origin is one the project *allows* is deliberately not decided
|
|
65
|
+
* here: that failure deserves its own error (`origin_not_allowed`), and this
|
|
66
|
+
* function knows nothing about projects.
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* const check = await checkProof(req.header('authorization'), 'k7q2m9xw4p', req.header('origin'));
|
|
70
|
+
* if (check.ok) console.log(check.address, check.origin);
|
|
71
|
+
*/
|
|
72
|
+
export async function checkProof(header, project, requestOrigin, now = Date.now(), appLogins = []) {
|
|
73
|
+
if (!header)
|
|
74
|
+
return { ok: false, reason: 'missing' };
|
|
75
|
+
const proof = decodeProof(header);
|
|
76
|
+
if (!proof || !isNimiqAddress(proof.address))
|
|
77
|
+
return { ok: false, reason: 'invalid' };
|
|
78
|
+
// An app login signs the app's own fixed message instead of ours. It is
|
|
79
|
+
// accepted only where the project listed that exact message, and it has no
|
|
80
|
+
// timestamp to expire on: the owner opted into that by listing it.
|
|
81
|
+
const appLogin = proof.message !== undefined;
|
|
82
|
+
if (appLogin ? !appLogins.includes(proof.message) : !proofIsFresh(proof.issued, now)) {
|
|
83
|
+
return { ok: false, reason: 'invalid' };
|
|
84
|
+
}
|
|
85
|
+
const origin = normalizeOrigin(proof.origin);
|
|
86
|
+
// A browser always says where a cross-origin request comes from, and a page
|
|
87
|
+
// cannot lie about it. A proof signed for one site and replayed from another
|
|
88
|
+
// fails here even before the signature is checked.
|
|
89
|
+
if (requestOrigin && normalizeOrigin(requestOrigin) !== origin) {
|
|
90
|
+
return { ok: false, reason: 'invalid' };
|
|
91
|
+
}
|
|
92
|
+
const address = normalizeAddress(proof.address);
|
|
93
|
+
const key = `${project}|${header}`;
|
|
94
|
+
if (verified.get(key) === address)
|
|
95
|
+
return { ok: true, address, origin };
|
|
96
|
+
const message = appLogin ? proof.message : loginMessage({ project, origin, issued: proof.issued });
|
|
97
|
+
if (!(await verifySignature(message, address, proof.publicKey, proof.signature))) {
|
|
98
|
+
return { ok: false, reason: 'invalid' };
|
|
99
|
+
}
|
|
100
|
+
if (verified.size >= CACHE_MAX) {
|
|
101
|
+
const oldest = verified.keys().next().value;
|
|
102
|
+
if (oldest !== undefined)
|
|
103
|
+
verified.delete(oldest);
|
|
104
|
+
}
|
|
105
|
+
verified.set(key, address);
|
|
106
|
+
return { ok: true, address, origin };
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=auth.js.map
|
package/dist/auth.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,WAAW,EACX,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,YAAY,GACb,MAAM,oBAAoB,CAAC;AAE5B;;;;;;;;;;;;GAYG;AAEH,MAAM,UAAU,GAAG,6BAA6B,CAAC;AAEjD,IAAI,YAAY,GAAiD,IAAI,CAAC;AACtE;4EAC4E;AAC5E,SAAS,SAAS;IAChB,IAAI,CAAC,YAAY;QAAE,YAAY,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;IACxD,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,kEAAkE;AAClE,MA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EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;IAC/G,IAAI,CAAC,CAAC,MAAM,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC;QACjF,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;IAC1C,CAAC;IACD,IAAI,QAAQ,CAAC,IAAI,IAAI,SAAS,EAAE,CAAC;QAC/B,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC;QAC5C,IAAI,MAAM,KAAK,SAAS;YAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACpD,CAAC;IACD,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAC3B,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;AACvC,CAAC"}
|
package/dist/board.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Post, Project, PublicProject } from '@pleasenobugs/core';
|
|
2
|
+
import type { PostWithVotes } from './store.js';
|
|
3
|
+
/**
|
|
4
|
+
* Trim a stored post down to what one reader may have.
|
|
5
|
+
*
|
|
6
|
+
* Everything left out is the point: the author's address never leaves, named
|
|
7
|
+
* or not, and neither does the list of who voted. A reader learns only whether
|
|
8
|
+
* they wrote it and whether they voted.
|
|
9
|
+
*
|
|
10
|
+
* @param row the stored post with its vote count
|
|
11
|
+
* @param reader the wallet asking, normalised, or null for a stranger
|
|
12
|
+
* @param name the author's display name, if they have one
|
|
13
|
+
* @param owner whether the reader owns the project, which adds the two
|
|
14
|
+
* owner-only fields
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* // An anonymous post keeps its text and loses its author entirely:
|
|
18
|
+
* toVisible({ ...row, anon: true }, someoneElse, 'Fons', false).who // → undefined
|
|
19
|
+
*/
|
|
20
|
+
export declare function toVisible(row: PostWithVotes, reader: string | null, name: string | undefined, owner: boolean): Post;
|
|
21
|
+
/** What a stranger may know about a project. Owners and origins stay in. */
|
|
22
|
+
export declare function publicProject(p: Project): PublicProject;
|
|
23
|
+
//# sourceMappingURL=board.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"board.d.ts","sourceRoot":"","sources":["../src/board.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,SAAS,CACvB,GAAG,EAAE,aAAa,EAClB,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,KAAK,EAAE,OAAO,GACb,IAAI,CAkBN;AAED,4EAA4E;AAC5E,wBAAgB,aAAa,CAAC,CAAC,EAAE,OAAO,GAAG,aAAa,CAEvD"}
|
package/dist/board.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trim a stored post down to what one reader may have.
|
|
3
|
+
*
|
|
4
|
+
* Everything left out is the point: the author's address never leaves, named
|
|
5
|
+
* or not, and neither does the list of who voted. A reader learns only whether
|
|
6
|
+
* they wrote it and whether they voted.
|
|
7
|
+
*
|
|
8
|
+
* @param row the stored post with its vote count
|
|
9
|
+
* @param reader the wallet asking, normalised, or null for a stranger
|
|
10
|
+
* @param name the author's display name, if they have one
|
|
11
|
+
* @param owner whether the reader owns the project, which adds the two
|
|
12
|
+
* owner-only fields
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* // An anonymous post keeps its text and loses its author entirely:
|
|
16
|
+
* toVisible({ ...row, anon: true }, someoneElse, 'Fons', false).who // → undefined
|
|
17
|
+
*/
|
|
18
|
+
export function toVisible(row, reader, name, owner) {
|
|
19
|
+
const out = {
|
|
20
|
+
id: row.id,
|
|
21
|
+
kind: row.kind,
|
|
22
|
+
text: row.text,
|
|
23
|
+
at: row.at,
|
|
24
|
+
status: row.status,
|
|
25
|
+
votes: row.votes,
|
|
26
|
+
voted: row.voted,
|
|
27
|
+
mine: reader !== null && row.author === reader,
|
|
28
|
+
};
|
|
29
|
+
if (!row.anon && name)
|
|
30
|
+
out.who = name;
|
|
31
|
+
if (row.reply)
|
|
32
|
+
out.reply = row.reply;
|
|
33
|
+
if (owner) {
|
|
34
|
+
if (row.context && Object.keys(row.context).length)
|
|
35
|
+
out.context = row.context;
|
|
36
|
+
if (row.hidden)
|
|
37
|
+
out.hidden = true;
|
|
38
|
+
}
|
|
39
|
+
return out;
|
|
40
|
+
}
|
|
41
|
+
/** What a stranger may know about a project. Owners and origins stay in. */
|
|
42
|
+
export function publicProject(p) {
|
|
43
|
+
return { id: p.id, name: p.name, rules: p.rules };
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=board.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"board.js","sourceRoot":"","sources":["../src/board.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,SAAS,CACvB,GAAkB,EAClB,MAAqB,EACrB,IAAwB,EACxB,KAAc;IAEd,MAAM,GAAG,GAAS;QAChB,EAAE,EAAE,GAAG,CAAC,EAAE;QACV,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,EAAE,EAAE,GAAG,CAAC,EAAE;QACV,MAAM,EAAE,GAAG,CAAC,MAAM;QAClB,KAAK,EAAE,GAAG,CAAC,KAAK;QAChB,KAAK,EAAE,GAAG,CAAC,KAAK;QAChB,IAAI,EAAE,MAAM,KAAK,IAAI,IAAI,GAAG,CAAC,MAAM,KAAK,MAAM;KAC/C,CAAC;IACF,IAAI,CAAC,GAAG,CAAC,IAAI,IAAI,IAAI;QAAE,GAAG,CAAC,GAAG,GAAG,IAAI,CAAC;IACtC,IAAI,GAAG,CAAC,KAAK;QAAE,GAAG,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC;IACrC,IAAI,KAAK,EAAE,CAAC;QACV,IAAI,GAAG,CAAC,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,MAAM;YAAE,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;QAC9E,IAAI,GAAG,CAAC,MAAM;YAAE,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC;IACpC,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,4EAA4E;AAC5E,MAAM,UAAU,aAAa,CAAC,CAAU;IACtC,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC;AACpD,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type Project } from '@pleasenobugs/core';
|
|
2
|
+
import type { Store } from './store.js';
|
|
3
|
+
/**
|
|
4
|
+
* Make the first project from environment variables, on a server that has
|
|
5
|
+
* none yet. This is what turns the "Deploy on Railway" button into one click:
|
|
6
|
+
* the developer fills three fields in the deploy form and the server is ready,
|
|
7
|
+
* with the project id in its log, no command line involved.
|
|
8
|
+
*
|
|
9
|
+
* PNB_PROJECT_NAME "My app"
|
|
10
|
+
* PNB_PROJECT_ORIGINS "https://my.app,http://localhost:5173"
|
|
11
|
+
* PNB_PROJECT_OWNER "NQ07 ..."
|
|
12
|
+
* PNB_PROJECT_LOGIN_MESSAGE optional, see "App logins"
|
|
13
|
+
*
|
|
14
|
+
* **Only on an empty server.** Once any project exists these variables are
|
|
15
|
+
* ignored, so changing them later never makes a second project, and a server
|
|
16
|
+
* restored from a backup is left alone.
|
|
17
|
+
*
|
|
18
|
+
* Answers what happened, so the caller can say it; never throws.
|
|
19
|
+
*/
|
|
20
|
+
export declare function bootstrapProject(store: Store, env: Record<string, string | undefined>): Promise<{
|
|
21
|
+
created: Project;
|
|
22
|
+
} | {
|
|
23
|
+
skipped: 'not_configured' | 'has_projects';
|
|
24
|
+
} | {
|
|
25
|
+
invalid: string;
|
|
26
|
+
}>;
|
|
27
|
+
//# sourceMappingURL=bootstrap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,gBAAgB,CACpC,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GACtC,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,gBAAgB,GAAG,cAAc,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAgBtG"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { isNimiqAddress } from '@pleasenobugs/core';
|
|
2
|
+
import { cleanLoginMessages, cleanName, cleanOrigins, newProject } from './projects.js';
|
|
3
|
+
/**
|
|
4
|
+
* Make the first project from environment variables, on a server that has
|
|
5
|
+
* none yet. This is what turns the "Deploy on Railway" button into one click:
|
|
6
|
+
* the developer fills three fields in the deploy form and the server is ready,
|
|
7
|
+
* with the project id in its log, no command line involved.
|
|
8
|
+
*
|
|
9
|
+
* PNB_PROJECT_NAME "My app"
|
|
10
|
+
* PNB_PROJECT_ORIGINS "https://my.app,http://localhost:5173"
|
|
11
|
+
* PNB_PROJECT_OWNER "NQ07 ..."
|
|
12
|
+
* PNB_PROJECT_LOGIN_MESSAGE optional, see "App logins"
|
|
13
|
+
*
|
|
14
|
+
* **Only on an empty server.** Once any project exists these variables are
|
|
15
|
+
* ignored, so changing them later never makes a second project, and a server
|
|
16
|
+
* restored from a backup is left alone.
|
|
17
|
+
*
|
|
18
|
+
* Answers what happened, so the caller can say it; never throws.
|
|
19
|
+
*/
|
|
20
|
+
export async function bootstrapProject(store, env) {
|
|
21
|
+
const { PNB_PROJECT_NAME, PNB_PROJECT_ORIGINS, PNB_PROJECT_OWNER, PNB_PROJECT_LOGIN_MESSAGE } = env;
|
|
22
|
+
if (!PNB_PROJECT_NAME && !PNB_PROJECT_ORIGINS && !PNB_PROJECT_OWNER)
|
|
23
|
+
return { skipped: 'not_configured' };
|
|
24
|
+
if ((await store.projects()).length > 0)
|
|
25
|
+
return { skipped: 'has_projects' };
|
|
26
|
+
const name = cleanName(PNB_PROJECT_NAME);
|
|
27
|
+
if (!name)
|
|
28
|
+
return { invalid: 'PNB_PROJECT_NAME' };
|
|
29
|
+
const origins = cleanOrigins((PNB_PROJECT_ORIGINS ?? '').split(',').map((s) => s.trim()).filter(Boolean));
|
|
30
|
+
if (!origins)
|
|
31
|
+
return { invalid: 'PNB_PROJECT_ORIGINS' };
|
|
32
|
+
if (!isNimiqAddress(PNB_PROJECT_OWNER))
|
|
33
|
+
return { invalid: 'PNB_PROJECT_OWNER' };
|
|
34
|
+
const loginMessages = cleanLoginMessages(PNB_PROJECT_LOGIN_MESSAGE ? [PNB_PROJECT_LOGIN_MESSAGE] : []);
|
|
35
|
+
if (!loginMessages)
|
|
36
|
+
return { invalid: 'PNB_PROJECT_LOGIN_MESSAGE' };
|
|
37
|
+
const created = newProject({ name, origins, owner: PNB_PROJECT_OWNER, loginMessages });
|
|
38
|
+
await store.putProject(created);
|
|
39
|
+
return { created };
|
|
40
|
+
}
|
|
41
|
+
//# sourceMapping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,GAAG,kBAAkB,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IACvG,IAAI,CAAC,aAAa;QAAE,OAAO,EAAE,OAAO,EAAE,2BAA2B,EAAE,CAAC;IAEpE,MAAM,OAAO,GAAG,UAAU,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,CAAC,CAAC;IACvF,MAAM,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IAChC,OAAO,EAAE,OAAO,EAAE,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type Project } from '@pleasenobugs/core';
|
|
2
|
+
import type { Store } from './store.js';
|
|
3
|
+
/**
|
|
4
|
+
* Bring an existing board in: posts, their votes and the names that go with
|
|
5
|
+
* them. For anybody moving from a board of their own, which is how Shitti got
|
|
6
|
+
* here.
|
|
7
|
+
*
|
|
8
|
+
* The file is one JSON object:
|
|
9
|
+
*
|
|
10
|
+
* ```json
|
|
11
|
+
* {
|
|
12
|
+
* "posts": [{
|
|
13
|
+
* "id": "post-1", "author": "NQ07 ...", "anon": false,
|
|
14
|
+
* "kind": "idea", "text": "Dark mode", "at": 1760000000000,
|
|
15
|
+
* "status": "planned", "votes": ["NQ07 ...", "NQ12 ..."],
|
|
16
|
+
* "reply": { "text": "Soon", "at": 1760000100000 },
|
|
17
|
+
* "answeredAt": 1760000100000, "hidden": false,
|
|
18
|
+
* "context": { "host": "nimiq-pay" }
|
|
19
|
+
* }],
|
|
20
|
+
* "names": { "NQ07 ...": "Fons" }
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* **It refuses rather than guesses.** A post with a field it cannot read stops
|
|
25
|
+
* the whole import before anything is written, and says which one: half an
|
|
26
|
+
* import is worse than none, because running it again afterwards would then
|
|
27
|
+
* have to work out which half it was.
|
|
28
|
+
*
|
|
29
|
+
* **Running it twice is harmless.** A post whose id exists is left alone,
|
|
30
|
+
* votes are a set, names are overwritten with the same name.
|
|
31
|
+
*
|
|
32
|
+
* Text is taken as it was, even past this project's `textMax`: those limits
|
|
33
|
+
* are about what people may write from now on, and cutting the end off
|
|
34
|
+
* somebody's old post to fit a new rule would be rewriting history.
|
|
35
|
+
*/
|
|
36
|
+
export interface ImportFile {
|
|
37
|
+
posts: unknown[];
|
|
38
|
+
names?: Record<string, unknown>;
|
|
39
|
+
}
|
|
40
|
+
export interface ImportReport {
|
|
41
|
+
imported: number;
|
|
42
|
+
skipped: number;
|
|
43
|
+
votes: number;
|
|
44
|
+
names: number;
|
|
45
|
+
}
|
|
46
|
+
/** Thrown before anything is written, naming the post that did not hold up. */
|
|
47
|
+
export declare class ImportError extends Error {
|
|
48
|
+
}
|
|
49
|
+
export declare function importBoard(store: Store, project: Project, file: unknown): Promise<ImportReport>;
|
|
50
|
+
//# sourceMappingURL=importer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"importer.d.ts","sourceRoot":"","sources":["../src/importer.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,OAAO,EACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAW,KAAK,EAAE,MAAM,YAAY,CAAC;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,OAAO,EAAE,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,+EAA+E;AAC/E,qBAAa,WAAY,SAAQ,KAAK;CAAG;AAEzC,wBAAsB,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,YAAY,CAAC,CAoEtG"}
|
package/dist/importer.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { NAME_MAX, POST_ID_MAX, cleanContext, isNimiqAddress, isPostKind, isPostStatus, normalizeAddress, } from '@pleasenobugs/core';
|
|
2
|
+
/** Thrown before anything is written, naming the post that did not hold up. */
|
|
3
|
+
export class ImportError extends Error {
|
|
4
|
+
}
|
|
5
|
+
export async function importBoard(store, project, file) {
|
|
6
|
+
if (!file || typeof file !== 'object' || !Array.isArray(file.posts)) {
|
|
7
|
+
throw new ImportError('The file needs a "posts" array.');
|
|
8
|
+
}
|
|
9
|
+
const { posts, names = {} } = file;
|
|
10
|
+
// Read everything first, write nothing until all of it holds up.
|
|
11
|
+
const rows = posts.map((raw, i) => {
|
|
12
|
+
const where = `posts[${i}]`;
|
|
13
|
+
if (!raw || typeof raw !== 'object')
|
|
14
|
+
throw new ImportError(`${where} is not an object.`);
|
|
15
|
+
const p = raw;
|
|
16
|
+
const id = p.id;
|
|
17
|
+
if (typeof id !== 'string' || !id || id.length > POST_ID_MAX)
|
|
18
|
+
throw new ImportError(`${where}.id`);
|
|
19
|
+
if (!isNimiqAddress(p.author))
|
|
20
|
+
throw new ImportError(`${where}.author (${id})`);
|
|
21
|
+
if (!isPostKind(p.kind))
|
|
22
|
+
throw new ImportError(`${where}.kind (${id})`);
|
|
23
|
+
if (typeof p.text !== 'string' || !p.text.trim())
|
|
24
|
+
throw new ImportError(`${where}.text (${id})`);
|
|
25
|
+
if (typeof p.at !== 'number' || !Number.isFinite(p.at))
|
|
26
|
+
throw new ImportError(`${where}.at (${id})`);
|
|
27
|
+
const status = p.status ?? 'open';
|
|
28
|
+
if (!isPostStatus(status))
|
|
29
|
+
throw new ImportError(`${where}.status (${id})`);
|
|
30
|
+
const votes = p.votes ?? [];
|
|
31
|
+
if (!Array.isArray(votes) || !votes.every(isNimiqAddress))
|
|
32
|
+
throw new ImportError(`${where}.votes (${id})`);
|
|
33
|
+
let reply;
|
|
34
|
+
if (p.reply !== undefined && p.reply !== null) {
|
|
35
|
+
const r = p.reply;
|
|
36
|
+
if (typeof r.text !== 'string' || typeof r.at !== 'number')
|
|
37
|
+
throw new ImportError(`${where}.reply (${id})`);
|
|
38
|
+
reply = { text: r.text, at: r.at };
|
|
39
|
+
}
|
|
40
|
+
const context = p.context === undefined ? null : cleanContext(p.context);
|
|
41
|
+
if (p.context !== undefined && context === null)
|
|
42
|
+
throw new ImportError(`${where}.context (${id})`);
|
|
43
|
+
const row = {
|
|
44
|
+
projectId: project.id,
|
|
45
|
+
id,
|
|
46
|
+
author: normalizeAddress(p.author),
|
|
47
|
+
anon: p.anon !== false,
|
|
48
|
+
kind: p.kind,
|
|
49
|
+
text: p.text.trim(),
|
|
50
|
+
at: p.at,
|
|
51
|
+
status,
|
|
52
|
+
...(reply ? { reply } : {}),
|
|
53
|
+
...(p.hidden === true ? { hidden: true } : {}),
|
|
54
|
+
...(context && Object.keys(context).length ? { context } : {}),
|
|
55
|
+
...(typeof p.answeredAt === 'number' ? { answeredAt: p.answeredAt } : {}),
|
|
56
|
+
};
|
|
57
|
+
return { row, votes: votes.map((v) => normalizeAddress(v)) };
|
|
58
|
+
});
|
|
59
|
+
const namePairs = Object.entries(names).map(([address, name]) => {
|
|
60
|
+
if (!isNimiqAddress(address) || typeof name !== 'string')
|
|
61
|
+
throw new ImportError(`names["${address}"]`);
|
|
62
|
+
return [normalizeAddress(address), name.trim().slice(0, NAME_MAX)];
|
|
63
|
+
});
|
|
64
|
+
const report = { imported: 0, skipped: 0, votes: 0, names: 0 };
|
|
65
|
+
for (const { row, votes } of rows) {
|
|
66
|
+
if (await store.createPost(row))
|
|
67
|
+
report.imported++;
|
|
68
|
+
else
|
|
69
|
+
report.skipped++;
|
|
70
|
+
for (const voter of votes) {
|
|
71
|
+
if (voter === row.author)
|
|
72
|
+
continue; // createPost already counted the author
|
|
73
|
+
await store.vote(project.id, row.id, voter, true);
|
|
74
|
+
report.votes++;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
for (const [address, name] of namePairs) {
|
|
78
|
+
if (!name)
|
|
79
|
+
continue;
|
|
80
|
+
await store.setName(project.id, address, name);
|
|
81
|
+
report.names++;
|
|
82
|
+
}
|
|
83
|
+
return report;
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=importer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"importer.js","sourceRoot":"","sources":["../src/importer.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,cAAc,EACd,UAAU,EACV,YAAY,EACZ,gBAAgB,GAEjB,MAAM,oBAAoB,CAAC;AAgD5B,+EAA+E;AAC/E,MAAM,OAAO,WAAY,SAAQ,KAAK;CAAG;AAEzC,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,KAAY,EAAE,OAAgB,EAAE,IAAa;IAC7E,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAE,IAAmB,CAAC,KAAK,CAAC,EAAE,CAAC;QACpF,MAAM,IAAI,WAAW,CAAC,iCAAiC,CAAC,CAAC;IAC3D,CAAC;IACD,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,EAAE,EAAE,GAAG,IAAkB,CAAC;IAEjD,iEAAiE;IACjE,MAAM,IAAI,GAAwC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE;QACrE,MAAM,KAAK,GAAG,SAAS,CAAC,GAAG,CAAC;QAC5B,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ;YAAE,MAAM,IAAI,WAAW,CAAC,GAAG,KAAK,oBAAoB,CAAC,CAAC;QACzF,MAAM,CAAC,GAAG,GAA8B,CAAC;QACzC,M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,KAAK,MAAM,KAAK,IAAI,KAAK,EAAE,CAAC;YAC1B,IAAI,KAAK,KAAK,GAAG,CAAC,MAAM;gBAAE,SAAS,CAAC,wCAAwC;YAC5E,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;YAClD,MAAM,CAAC,KAAK,EAAE,CAAC;QACjB,CAAC;IACH,CAAC;IACD,KAAK,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,SAAS,EAAE,CAAC;QACxC,IAAI,CAAC,IAAI;YAAE,SAAS;QACpB,MAAM,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;QAC/C,MAAM,CAAC,KAAK,EAAE,CAAC;IACjB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { createApp, type AppOptions } from './app.js';
|
|
2
|
+
export { createRouter, type RouterOptions } from './router.js';
|
|
3
|
+
export { MemoryStore } from './memory-store.js';
|
|
4
|
+
export type { Store, PostRow, PostWithVotes, PostPatch } from './store.js';
|
|
5
|
+
export { checkProof, verifySignature, signedHash, type ProofCheck } from './auth.js';
|
|
6
|
+
export { newProject, parseOrigin } from './projects.js';
|
|
7
|
+
export { rateLimit } from './limit.js';
|
|
8
|
+
export { importBoard, ImportError, type ImportFile, type ImportReport } from './importer.js';
|
|
9
|
+
export { bootstrapProject } from './bootstrap.js';
|
|
10
|
+
export { buildReport, readReport, sendReport, summarize, telemetryRouter, type TelemetryReport, type TelemetrySummary, } from './telemetry.js';
|
|
11
|
+
export type { ProjectStats, TelemetryRow } from './store.js';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,YAAY,EAAE,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,UAAU,EAAE,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AACrF,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,KAAK,UAAU,EAAE,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7F,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EACL,WAAW,EACX,UAAU,EACV,UAAU,EACV,SAAS,EACT,eAAe,EACf,KAAK,eAAe,EACpB,KAAK,gBAAgB,GACtB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC"}
|