@geekity/cms 0.22.0 → 0.24.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/README.md +19 -4
- package/admin/pages/documents/editor.njk +18 -0
- package/admin/static/editor.js +1 -1
- package/dist/admin/comments.js +2 -2
- package/dist/admin/comments.js.map +1 -1
- package/dist/admin/documents.d.ts +36 -7
- package/dist/admin/documents.d.ts.map +1 -1
- package/dist/admin/documents.js +140 -29
- package/dist/admin/documents.js.map +1 -1
- package/dist/admin/editor-layout.d.ts +1 -1
- package/dist/admin/editor-layout.d.ts.map +1 -1
- package/dist/admin/editor-layout.js +6 -1
- package/dist/admin/editor-layout.js.map +1 -1
- package/dist/admin/event-field.d.ts +26 -0
- package/dist/admin/event-field.d.ts.map +1 -0
- package/dist/admin/event-field.js +74 -0
- package/dist/admin/event-field.js.map +1 -0
- package/dist/admin/federation.js +3 -3
- package/dist/admin/federation.js.map +1 -1
- package/dist/admin/media.js +2 -2
- package/dist/admin/media.js.map +1 -1
- package/dist/admin/preview.d.ts.map +1 -1
- package/dist/admin/preview.js +16 -1
- package/dist/admin/preview.js.map +1 -1
- package/dist/admin/store.d.ts +9 -0
- package/dist/admin/store.d.ts.map +1 -1
- package/dist/admin/store.js +16 -5
- package/dist/admin/store.js.map +1 -1
- package/dist/avatars/avatars.js +1 -1
- package/dist/avatars/avatars.js.map +1 -1
- package/dist/comments/policy.d.ts +10 -0
- package/dist/comments/policy.d.ts.map +1 -1
- package/dist/comments/policy.js +12 -0
- package/dist/comments/policy.js.map +1 -1
- package/dist/comments/records.d.ts +5 -1
- package/dist/comments/records.d.ts.map +1 -1
- package/dist/comments/records.js +16 -2
- package/dist/comments/records.js.map +1 -1
- package/dist/content/event.d.ts +40 -0
- package/dist/content/event.d.ts.map +1 -0
- package/dist/content/event.js +51 -0
- package/dist/content/event.js.map +1 -0
- package/dist/content/handles.d.ts +22 -0
- package/dist/content/handles.d.ts.map +1 -0
- package/dist/content/handles.js +68 -0
- package/dist/content/handles.js.map +1 -0
- package/dist/content/markdown.d.ts +8 -2
- package/dist/content/markdown.d.ts.map +1 -1
- package/dist/content/markdown.js +55 -5
- package/dist/content/markdown.js.map +1 -1
- package/dist/content/parser.d.ts +3 -0
- package/dist/content/parser.d.ts.map +1 -1
- package/dist/content/parser.js +1 -1
- package/dist/content/parser.js.map +1 -1
- package/dist/content/post-type.d.ts +12 -8
- package/dist/content/post-type.d.ts.map +1 -1
- package/dist/content/post-type.js +12 -2
- package/dist/content/post-type.js.map +1 -1
- package/dist/content/rsvp.d.ts +29 -0
- package/dist/content/rsvp.d.ts.map +1 -0
- package/dist/content/rsvp.js +49 -0
- package/dist/content/rsvp.js.map +1 -0
- package/dist/content/save.d.ts +2 -1
- package/dist/content/save.d.ts.map +1 -1
- package/dist/content/save.js +10 -3
- package/dist/content/save.js.map +1 -1
- package/dist/content/store.d.ts +11 -4
- package/dist/content/store.d.ts.map +1 -1
- package/dist/content/store.js +15 -4
- package/dist/content/store.js.map +1 -1
- package/dist/content/sync.d.ts.map +1 -1
- package/dist/content/sync.js +7 -6
- package/dist/content/sync.js.map +1 -1
- package/dist/env.d.ts +3 -0
- package/dist/env.d.ts.map +1 -1
- package/dist/federation/article.d.ts +9 -3
- package/dist/federation/article.d.ts.map +1 -1
- package/dist/federation/article.js +90 -34
- package/dist/federation/article.js.map +1 -1
- package/dist/federation/cited-post.d.ts +13 -0
- package/dist/federation/cited-post.d.ts.map +1 -0
- package/dist/federation/cited-post.js +75 -0
- package/dist/federation/cited-post.js.map +1 -0
- package/dist/federation/delivery.d.ts.map +1 -1
- package/dist/federation/delivery.js +31 -2
- package/dist/federation/delivery.js.map +1 -1
- package/dist/federation/handles.d.ts +28 -0
- package/dist/federation/handles.d.ts.map +1 -0
- package/dist/federation/handles.js +65 -0
- package/dist/federation/handles.js.map +1 -0
- package/dist/federation/inbox.d.ts +2 -1
- package/dist/federation/inbox.d.ts.map +1 -1
- package/dist/federation/inbox.js +11 -3
- package/dist/federation/inbox.js.map +1 -1
- package/dist/federation/mount.d.ts.map +1 -1
- package/dist/federation/mount.js +18 -2
- package/dist/federation/mount.js.map +1 -1
- package/dist/federation/profiles.d.ts.map +1 -1
- package/dist/federation/profiles.js +2 -8
- package/dist/federation/profiles.js.map +1 -1
- package/dist/federation/site-loaders.d.ts +15 -0
- package/dist/federation/site-loaders.d.ts.map +1 -0
- package/dist/federation/site-loaders.js +19 -0
- package/dist/federation/site-loaders.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -1
- package/dist/index.js.map +1 -1
- package/dist/indieauth/client.js +2 -2
- package/dist/indieauth/client.js.map +1 -1
- package/dist/micropub/create.d.ts +2 -1
- package/dist/micropub/create.d.ts.map +1 -1
- package/dist/micropub/create.js +57 -8
- package/dist/micropub/create.js.map +1 -1
- package/dist/micropub/endpoint.d.ts.map +1 -1
- package/dist/micropub/endpoint.js +12 -4
- package/dist/micropub/endpoint.js.map +1 -1
- package/dist/micropub/update.d.ts +3 -0
- package/dist/micropub/update.d.ts.map +1 -1
- package/dist/micropub/update.js +29 -4
- package/dist/micropub/update.js.map +1 -1
- package/dist/web/context.d.ts +32 -4
- package/dist/web/context.d.ts.map +1 -1
- package/dist/web/context.js +28 -1
- package/dist/web/context.js.map +1 -1
- package/dist/web/conversation.d.ts +26 -1
- package/dist/web/conversation.d.ts.map +1 -1
- package/dist/web/conversation.js +67 -10
- package/dist/web/conversation.js.map +1 -1
- package/dist/web/documents.d.ts +12 -0
- package/dist/web/documents.d.ts.map +1 -1
- package/dist/web/documents.js +20 -0
- package/dist/web/documents.js.map +1 -1
- package/dist/web/errors.d.ts.map +1 -1
- package/dist/web/errors.js +5 -3
- package/dist/web/errors.js.map +1 -1
- package/dist/web/feed-item.d.ts.map +1 -1
- package/dist/web/feed-item.js +8 -3
- package/dist/web/feed-item.js.map +1 -1
- package/dist/web/llms.d.ts +8 -0
- package/dist/web/llms.d.ts.map +1 -1
- package/dist/web/llms.js +25 -7
- package/dist/web/llms.js.map +1 -1
- package/dist/web/maintenance.d.ts.map +1 -1
- package/dist/web/maintenance.js +5 -2
- package/dist/web/maintenance.js.map +1 -1
- package/dist/web/negotiate.d.ts +4 -2
- package/dist/web/negotiate.d.ts.map +1 -1
- package/dist/web/negotiate.js +17 -7
- package/dist/web/negotiate.js.map +1 -1
- package/dist/web/render.d.ts +3 -0
- package/dist/web/render.d.ts.map +1 -1
- package/dist/web/render.js +39 -6
- package/dist/web/render.js.map +1 -1
- package/dist/web/routes.d.ts.map +1 -1
- package/dist/web/routes.js +67 -25
- package/dist/web/routes.js.map +1 -1
- package/dist/web/templates.d.ts +4 -1
- package/dist/web/templates.d.ts.map +1 -1
- package/dist/web/templates.js +11 -0
- package/dist/web/templates.js.map +1 -1
- package/dist/webmention/cited-picture.d.ts +11 -4
- package/dist/webmention/cited-picture.d.ts.map +1 -1
- package/dist/webmention/cited-picture.js +22 -13
- package/dist/webmention/cited-picture.js.map +1 -1
- package/dist/webmention/cited-start.d.ts +10 -0
- package/dist/webmention/cited-start.d.ts.map +1 -0
- package/dist/webmention/cited-start.js +21 -0
- package/dist/webmention/cited-start.js.map +1 -0
- package/dist/webmention/fetch-public.d.ts +2 -2
- package/dist/webmention/fetch-public.d.ts.map +1 -1
- package/dist/webmention/fetch-public.js +1 -1
- package/dist/webmention/fetch-public.js.map +1 -1
- package/dist/webmention/html.d.ts +2 -0
- package/dist/webmention/html.d.ts.map +1 -1
- package/dist/webmention/html.js +6 -0
- package/dist/webmention/html.js.map +1 -1
- package/dist/webmention/index.d.ts +2 -1
- package/dist/webmention/index.d.ts.map +1 -1
- package/dist/webmention/index.js +1 -0
- package/dist/webmention/index.js.map +1 -1
- package/dist/webmention/microformats.d.ts +25 -2
- package/dist/webmention/microformats.d.ts.map +1 -1
- package/dist/webmention/microformats.js +38 -4
- package/dist/webmention/microformats.js.map +1 -1
- package/dist/webmention/pingback.d.ts +42 -0
- package/dist/webmention/pingback.d.ts.map +1 -0
- package/dist/webmention/pingback.js +229 -0
- package/dist/webmention/pingback.js.map +1 -0
- package/dist/webmention/receive.d.ts +20 -2
- package/dist/webmention/receive.d.ts.map +1 -1
- package/dist/webmention/receive.js +25 -16
- package/dist/webmention/receive.js.map +1 -1
- package/dist/webmention/reply-context.d.ts +65 -18
- package/dist/webmention/reply-context.d.ts.map +1 -1
- package/dist/webmention/reply-context.js +403 -99
- package/dist/webmention/reply-context.js.map +1 -1
- package/dist/webmention/reply-contexts.d.ts +3 -1
- package/dist/webmention/reply-contexts.d.ts.map +1 -1
- package/dist/webmention/reply-contexts.js +53 -17
- package/dist/webmention/reply-contexts.js.map +1 -1
- package/dist/webmention/routes.d.ts.map +1 -1
- package/dist/webmention/routes.js +2 -0
- package/dist/webmention/routes.js.map +1 -1
- package/dist/webmention/service.d.ts +11 -0
- package/dist/webmention/service.d.ts.map +1 -1
- package/dist/webmention/service.js +27 -6
- package/dist/webmention/service.js.map +1 -1
- package/dist/webmention/syndication.d.ts +6 -0
- package/dist/webmention/syndication.d.ts.map +1 -1
- package/dist/webmention/syndication.js +12 -0
- package/dist/webmention/syndication.js.map +1 -1
- package/package.json +7 -7
- package/themes/default/README.md +127 -37
- package/themes/default/layouts/410.njk +10 -0
- package/themes/default/layouts/base.njk +3 -0
- package/themes/default/layouts/page.njk +7 -0
- package/themes/default/layouts/post.njk +7 -4
- package/themes/default/layouts/search.njk +1 -1
- package/themes/default/partials/cited-page.njk +7 -0
- package/themes/default/partials/conversation.njk +25 -5
- package/themes/default/partials/event.njk +27 -0
- package/themes/default/partials/jsonld.njk +28 -0
- package/themes/default/partials/post-list.njk +5 -2
- package/themes/default/partials/reply-context.njk +24 -4
- package/themes/default/partials/rsvp.njk +7 -0
- package/themes/default/src/style.css +20 -0
- package/themes/default/static/style.css +35 -0
|
@@ -60,14 +60,23 @@ export type WebmentionRequest =
|
|
|
60
60
|
/** Not a webmention at all, with the reason a sender is told. */
|
|
61
61
|
| {
|
|
62
62
|
readonly ok: false;
|
|
63
|
+
readonly problem: RequestProblem;
|
|
63
64
|
readonly message: string;
|
|
64
65
|
};
|
|
66
|
+
/**
|
|
67
|
+
* Which half of a refused pair was wrong, which a pingback's fault code is read
|
|
68
|
+
* off: the source, a target that is no page here, a target on somebody else's
|
|
69
|
+
* site, or a pair that names one page twice.
|
|
70
|
+
*/
|
|
71
|
+
export type RequestProblem = 'source' | 'target' | 'elsewhere' | 'same';
|
|
65
72
|
/** What {@link checkWebmentionRequest} needs to answer. */
|
|
66
73
|
export interface CheckWebmentionOptions {
|
|
67
74
|
/** The site's public origin. */
|
|
68
75
|
readonly baseUrl: string;
|
|
69
76
|
/** The public document one of this site's paths names, or `undefined`. */
|
|
70
77
|
readonly documentAt: (pathname: string) => Document | undefined;
|
|
78
|
+
/** The public post a URL elsewhere is one of the syndicated copies of (TASK-197). */
|
|
79
|
+
readonly syndicatedAt?: ((url: string) => Document | undefined) | undefined;
|
|
71
80
|
}
|
|
72
81
|
/**
|
|
73
82
|
* Whether a submitted `source` and `target` are worth going and looking at.
|
|
@@ -113,13 +122,15 @@ export type WebmentionOutcome =
|
|
|
113
122
|
readonly comment: PostComment;
|
|
114
123
|
readonly created: boolean;
|
|
115
124
|
}
|
|
116
|
-
/**
|
|
125
|
+
/** Nothing is stored from the source any more, and what it left is gone. */
|
|
117
126
|
| {
|
|
118
127
|
readonly kind: 'deleted';
|
|
128
|
+
readonly why: NotStored;
|
|
119
129
|
}
|
|
120
|
-
/**
|
|
130
|
+
/** Nothing is stored from the source, and there was nothing to remove. */
|
|
121
131
|
| {
|
|
122
132
|
readonly kind: 'ignored';
|
|
133
|
+
readonly why: NotStored;
|
|
123
134
|
}
|
|
124
135
|
/** The source could not be read this time; whatever is stored stands. */
|
|
125
136
|
| {
|
|
@@ -138,4 +149,11 @@ export type WebmentionOutcome =
|
|
|
138
149
|
* server having a bad afternoon must not delete what it said last week.
|
|
139
150
|
*/
|
|
140
151
|
export declare function verifyWebmention(options: VerifyWebmentionOptions): Promise<WebmentionOutcome>;
|
|
152
|
+
/**
|
|
153
|
+
* Why a source left nothing behind: it is not there, it does not link here, or
|
|
154
|
+
* it was thrown away, by the checker or by a moderator deleting the entry while
|
|
155
|
+
* this was deciding. A pingback is told which; a webmention, answered before
|
|
156
|
+
* any of it was known, never is.
|
|
157
|
+
*/
|
|
158
|
+
export type NotStored = 'gone' | 'unlinked' | 'discarded';
|
|
141
159
|
//# sourceMappingURL=receive.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"receive.d.ts","sourceRoot":"","sources":["../../src/webmention/receive.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"receive.d.ts","sourceRoot":"","sources":["../../src/webmention/receive.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAmB,MAAM,wBAAwB,CAAC;AAC9F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAMvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,qEAAqE;AACrE,eAAO,MAAM,iBAAiB,QAAS,CAAC;AAExC,sEAAsE;AACtE,MAAM,WAAW,kBAAkB;IACjC,sCAAsC;IACtC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,kDAAkD;IAClD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,kCAAkC;IAClC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,kEAAkE;IAClE,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,wCAAwC;IACxC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,qCAAqC;IACrC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SA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
2
3
|
import { sanitizeCommentHtml } from '../web/sanitize.js';
|
|
3
4
|
import { readCapped, WEBMENTION_USER_AGENT } from './discovery.js';
|
|
@@ -43,31 +44,37 @@ export const VERIFY_TIMEOUT_MS = 15_000;
|
|
|
43
44
|
* a stranger's server.
|
|
44
45
|
*/
|
|
45
46
|
export function checkWebmentionRequest(source, target, options) {
|
|
46
|
-
if (source.trim() === ''
|
|
47
|
-
return refuse('A webmention needs
|
|
48
|
-
|
|
47
|
+
if (source.trim() === '')
|
|
48
|
+
return refuse('source', 'A webmention needs a source.');
|
|
49
|
+
if (target.trim() === '')
|
|
50
|
+
return refuse('target', 'A webmention needs a target.');
|
|
49
51
|
const from = webUrl(source);
|
|
50
52
|
const to = webUrl(target);
|
|
51
53
|
if (from === undefined)
|
|
52
|
-
return refuse('The source is not an http or https URL.');
|
|
54
|
+
return refuse('source', 'The source is not an http or https URL.');
|
|
53
55
|
if (to === undefined)
|
|
54
|
-
return refuse('The target is not an http or https URL.');
|
|
55
|
-
if (from.href === to.href)
|
|
56
|
-
return refuse('The source and the target are the same page.');
|
|
56
|
+
return refuse('target', 'The target is not an http or https URL.');
|
|
57
|
+
if (from.href === to.href) {
|
|
58
|
+
return refuse('same', 'The source and the target are the same page.');
|
|
59
|
+
}
|
|
57
60
|
// A source on a loopback or private address is not somebody else's page: it
|
|
58
61
|
// is this network, and fetching it would make the site a way of reaching
|
|
59
62
|
// machines nobody outside can reach. This stops the obvious spelling of that
|
|
60
63
|
// and not a name that resolves to one — a receiver that has to be sure needs
|
|
61
64
|
// to check the address it actually connects to.
|
|
62
65
|
if (isPrivateHost(from.hostname))
|
|
63
|
-
return refuse('The source is not a public URL.');
|
|
66
|
+
return refuse('source', 'The source is not a public URL.');
|
|
64
67
|
const site = webUrl(options.baseUrl);
|
|
65
68
|
if (site === undefined || to.origin !== site.origin) {
|
|
66
|
-
|
|
69
|
+
const original = options.syndicatedAt?.(to.href);
|
|
70
|
+
if (original !== undefined) {
|
|
71
|
+
return { ok: true, source: from.href, target: to.href, document: original };
|
|
72
|
+
}
|
|
73
|
+
return refuse('elsewhere', 'The target is not a page on this site.');
|
|
67
74
|
}
|
|
68
75
|
const document = options.documentAt(to.pathname);
|
|
69
76
|
if (document === undefined)
|
|
70
|
-
return refuse('There is no page here at that address.');
|
|
77
|
+
return refuse('target', 'There is no page here at that address.');
|
|
71
78
|
return { ok: true, source: from.href, target: to.href, document };
|
|
72
79
|
}
|
|
73
80
|
/**
|
|
@@ -90,10 +97,11 @@ export async function verifyWebmention(options) {
|
|
|
90
97
|
return { kind: 'unreachable', reason: fetched.reason };
|
|
91
98
|
}
|
|
92
99
|
if (fetched.kind === 'gone' || !mentions(fetched, incoming)) {
|
|
100
|
+
const why = fetched.kind === 'gone' ? 'gone' : 'unlinked';
|
|
93
101
|
if (held === undefined)
|
|
94
|
-
return { kind: 'ignored' };
|
|
102
|
+
return { kind: 'ignored', why };
|
|
95
103
|
await deleteComment(records, held.id);
|
|
96
|
-
return { kind: 'deleted' };
|
|
104
|
+
return { kind: 'deleted', why };
|
|
97
105
|
}
|
|
98
106
|
const entry = fetched.html
|
|
99
107
|
? sourceEntry(fetched.body, fetched.url, incoming.target)
|
|
@@ -135,6 +143,7 @@ export async function verifyWebmention(options) {
|
|
|
135
143
|
url: incoming.source,
|
|
136
144
|
// A page has nobody to ask, and no address to ask them at.
|
|
137
145
|
notify: false,
|
|
146
|
+
...rsvpField(entry?.rsvp),
|
|
138
147
|
};
|
|
139
148
|
const outcome = await intakeComment({
|
|
140
149
|
records,
|
|
@@ -158,8 +167,8 @@ export async function verifyWebmention(options) {
|
|
|
158
167
|
// A source nobody was holding anything from leaves nothing behind, and one
|
|
159
168
|
// whose entry went while this was deciding has already been dealt with.
|
|
160
169
|
return outcome.kind === 'discarded' && outcome.removed
|
|
161
|
-
? { kind: 'deleted' }
|
|
162
|
-
: { kind: 'ignored' };
|
|
170
|
+
? { kind: 'deleted', why: 'discarded' }
|
|
171
|
+
: { kind: 'ignored', why: 'discarded' };
|
|
163
172
|
}
|
|
164
173
|
/** Fetch a source page, following redirects and reading no more than a page. */
|
|
165
174
|
async function readSource(source) {
|
|
@@ -233,8 +242,8 @@ function paragraph(text) {
|
|
|
233
242
|
return '';
|
|
234
243
|
return `<p>${text.replaceAll('&', '&').replaceAll('<', '<').replaceAll('>', '>')}</p>`;
|
|
235
244
|
}
|
|
236
|
-
function refuse(message) {
|
|
237
|
-
return { ok: false, message };
|
|
245
|
+
function refuse(problem, message) {
|
|
246
|
+
return { ok: false, problem, message };
|
|
238
247
|
}
|
|
239
248
|
function messageOf(error) {
|
|
240
249
|
return error instanceof Error ? error.message : String(error);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"receive.js","sourceRoot":"","sources":["../../src/webmention/receive.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"receive.js","sourceRoot":"","sources":["../../src/webmention/receive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAItF,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,qEAAqE;AACrE,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC;AA+CxC;;;;;;;GAOG;AACH,MAAM,UAAU,sBAAsB,CACpC,MAAc,EACd,MAAc,EACd,OAA+B;IAE/B,IAAI,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE;QAAE,OAAO,MAAM,CAAC,QAAQ,EAAE,8BAA8B,CAAC,C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CAAC;QACP,OAAO,MAAM,CAAC;IAChB,CAAC;AACH,CAAC;AAED,yDAAyD;AACzD,SAAS,SAAS,CAAC,IAAY;IAC7B,IAAI,IAAI,KAAK,EAAE;QAAE,OAAO,EAAE,CAAC;IAC3B,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,CAAC;AACnG,CAAC;AAED,SAAS,MAAM,CAAC,OAAuB,EAAE,OAAe;IACtD,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;AACzC,CAAC;AAED,SAAS,SAAS,CAAC,KAAc;IAC/B,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CitedPicture, PictureSource } from './cited-picture.ts';
|
|
1
|
+
import type { CitedImage, CitedPicture, PictureSource } from './cited-picture.ts';
|
|
2
2
|
import type { HostLookup } from './public-address.ts';
|
|
3
3
|
/**
|
|
4
4
|
* Reply context: what a reply shows of the post it answers (TASK-123).
|
|
@@ -20,30 +20,76 @@ export declare const REPLY_CONTEXT_MAX_BYTES = 1000000;
|
|
|
20
20
|
export interface ReplyContext {
|
|
21
21
|
/** The post answered: the reply's own `in-reply-to`, whatever it redirected to. */
|
|
22
22
|
readonly url: string;
|
|
23
|
+
/**
|
|
24
|
+
* The original `url` is a copy of, when the copy names it and it lists the
|
|
25
|
+
* copy back as its `u-syndication` (TASK-197). Every other field then
|
|
26
|
+
* describes the original.
|
|
27
|
+
*/
|
|
28
|
+
readonly original?: string;
|
|
23
29
|
/** Its title, when it has one of its own; a note's name is its text. */
|
|
24
30
|
readonly name?: string;
|
|
25
31
|
/** A short excerpt of what it says, or the page's description. */
|
|
26
32
|
readonly text?: string;
|
|
27
|
-
/** Who wrote it
|
|
28
|
-
readonly author?:
|
|
29
|
-
readonly name: string;
|
|
30
|
-
readonly url?: string;
|
|
31
|
-
};
|
|
33
|
+
/** Who wrote it. */
|
|
34
|
+
readonly author?: CitedAuthor;
|
|
32
35
|
/** When it says it was published, as an ISO 8601 instant. */
|
|
33
36
|
readonly published?: string;
|
|
34
37
|
/** The site it is on, its `og:site_name`, kept only when it names no author. */
|
|
35
38
|
readonly site?: string;
|
|
39
|
+
/**
|
|
40
|
+
* When an event starts (TASK-198): an ISO 8601 instant when the page gives
|
|
41
|
+
* a zone, else the date, or the date and time, as the page wrote them, which
|
|
42
|
+
* no reader's zone may move.
|
|
43
|
+
*/
|
|
44
|
+
readonly start?: string;
|
|
45
|
+
/** Where an event takes place, as the page names it. */
|
|
46
|
+
readonly location?: string;
|
|
36
47
|
/** Its picture, copied into the site's uploads (TASK-252). */
|
|
37
48
|
readonly picture?: CitedPicture;
|
|
38
49
|
}
|
|
50
|
+
export interface CitedAuthor {
|
|
51
|
+
readonly name: string;
|
|
52
|
+
/** Their page, when that is an http(s) URL. */
|
|
53
|
+
readonly url?: string;
|
|
54
|
+
/** Their fediverse handle, `user@host`, when the post is a fediverse object. */
|
|
55
|
+
readonly handle?: string;
|
|
56
|
+
/** Their avatar, copied into the site's uploads like a picture (TASK-199). */
|
|
57
|
+
readonly photo?: CitedImage;
|
|
58
|
+
}
|
|
39
59
|
export type ReplyContextFetch = {
|
|
40
60
|
readonly ok: true;
|
|
41
61
|
readonly context: ReplyContext;
|
|
42
62
|
readonly picture?: PictureSource;
|
|
63
|
+
/** Where the author's avatar is, for the caller to copy. */
|
|
64
|
+
readonly authorPhoto?: string;
|
|
43
65
|
} | {
|
|
44
66
|
readonly ok: false;
|
|
45
67
|
readonly reason: string;
|
|
46
68
|
};
|
|
69
|
+
/**
|
|
70
|
+
* A fediverse post as a citation shows it, read from the ActivityPub object a
|
|
71
|
+
* cited page links. `html` is its content, markup and all.
|
|
72
|
+
*/
|
|
73
|
+
export interface FediversePost {
|
|
74
|
+
readonly name?: string;
|
|
75
|
+
readonly html?: string;
|
|
76
|
+
readonly author?: {
|
|
77
|
+
readonly name: string;
|
|
78
|
+
readonly url?: string;
|
|
79
|
+
readonly handle?: string;
|
|
80
|
+
readonly photo?: string;
|
|
81
|
+
};
|
|
82
|
+
readonly published?: string;
|
|
83
|
+
/** Its first image attachment. */
|
|
84
|
+
readonly image?: string;
|
|
85
|
+
/** Its `url`: the page it is shown at, which a bridged post points at its original with. */
|
|
86
|
+
readonly url?: string;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Read the ActivityPub object at a URL, or `undefined` when it is none. The
|
|
90
|
+
* signal aborts at the cited page's one deadline.
|
|
91
|
+
*/
|
|
92
|
+
export type FediverseLookup = (url: string, signal: AbortSignal) => Promise<FediversePost | undefined>;
|
|
47
93
|
/** What {@link fetchReplyContext} needs. */
|
|
48
94
|
export interface FetchReplyContextOptions {
|
|
49
95
|
/** How host names are resolved before they are trusted. */
|
|
@@ -52,16 +98,22 @@ export interface FetchReplyContextOptions {
|
|
|
52
98
|
readonly timeoutMs?: number | undefined;
|
|
53
99
|
/** Defaults to {@link REPLY_CONTEXT_MAX_BYTES}. */
|
|
54
100
|
readonly maxBytes?: number | undefined;
|
|
101
|
+
/** How a fediverse object is read; without one, none is. */
|
|
102
|
+
readonly fediverse?: FediverseLookup | undefined;
|
|
55
103
|
}
|
|
56
104
|
/**
|
|
57
105
|
* Fetch a page a post cites and read what it says about itself. A known
|
|
58
106
|
* provider's oEmbed endpoint is asked first, and the page is read only when
|
|
59
|
-
* that names nothing. Any other page is read, and
|
|
60
|
-
*
|
|
107
|
+
* that names nothing. Any other page is read, and when it has no `h-entry` it
|
|
108
|
+
* is also asked about through the ActivityPub object and the oEmbed endpoint
|
|
109
|
+
* it links. Each source fills only what the ones before it left empty:
|
|
110
|
+
* `h-entry`, ActivityPub, oEmbed, JSON-LD, then the page's own metadata. A
|
|
111
|
+
* silo copy of a post on another site is described by that original instead,
|
|
112
|
+
* when the original lists the copy as its own (TASK-197).
|
|
61
113
|
*
|
|
62
114
|
* Only http and https, only public hosts (every redirect hop is checked, and a
|
|
63
115
|
* name is refused when any address it resolves to is private), one timeout
|
|
64
|
-
* over the whole exchange, every
|
|
116
|
+
* over the whole exchange, every other request included, no more of a page
|
|
65
117
|
* than the byte limit, and no oEmbed answer over it. Nothing throws.
|
|
66
118
|
*/
|
|
67
119
|
export declare function fetchReplyContext(target: string, options: FetchReplyContextOptions): Promise<ReplyContextFetch>;
|
|
@@ -75,15 +127,10 @@ export interface Oembed {
|
|
|
75
127
|
}
|
|
76
128
|
/**
|
|
77
129
|
* What a target page says about itself, or `undefined` when it says nothing a
|
|
78
|
-
* preview could show
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
* its date. A page with no `h-entry` is described by its oEmbed title and
|
|
83
|
-
* author when `oembed` holds them, then its `og:title`, `<title>` and
|
|
84
|
-
* description metadata, where a title that is only a site suffix is none.
|
|
85
|
-
* Everything comes out as plain text; the theme escapes it like any other
|
|
86
|
-
* string.
|
|
130
|
+
* preview could show: the sources {@link fetchReplyContext} reads from a page
|
|
131
|
+
* alone, its `h-entry`, the oEmbed answer when `oembed` holds one, its JSON-LD
|
|
132
|
+
* and its metadata. Everything comes out as plain text; the theme escapes it
|
|
133
|
+
* like any other string.
|
|
87
134
|
*/
|
|
88
135
|
export declare function readReplyContext(html: string, target: string, base?: string, oembed?: Oembed): ReplyContext | undefined;
|
|
89
136
|
//# sourceMappingURL=reply-context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reply-context.d.ts","sourceRoot":"","sources":["../../src/webmention/reply-context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"reply-context.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