@geekity/cms 0.25.0 → 0.27.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 +2 -1
- package/admin/pages/documents/editor.njk +3 -0
- package/admin/pages/plugins/confirm.njk +42 -0
- package/admin/pages/plugins/installed.njk +85 -3
- package/admin/static/admin.css +15 -0
- package/admin/static/editor-actions.js +13 -3
- package/dist/admin/documents.d.ts +3 -0
- package/dist/admin/documents.d.ts.map +1 -1
- package/dist/admin/documents.js +12 -3
- package/dist/admin/documents.js.map +1 -1
- package/dist/admin/editor-actions.d.ts.map +1 -1
- package/dist/admin/editor-actions.js +20 -1
- package/dist/admin/editor-actions.js.map +1 -1
- package/dist/admin/plugins.d.ts +6 -0
- package/dist/admin/plugins.d.ts.map +1 -1
- package/dist/admin/plugins.js +274 -3
- package/dist/admin/plugins.js.map +1 -1
- package/dist/admin/taxonomy.d.ts +4 -1
- package/dist/admin/taxonomy.d.ts.map +1 -1
- package/dist/admin/taxonomy.js +11 -7
- package/dist/admin/taxonomy.js.map +1 -1
- package/dist/admin/templates.d.ts +1 -0
- package/dist/admin/templates.d.ts.map +1 -1
- package/dist/admin/templates.js +1 -0
- package/dist/admin/templates.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +55 -19
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +8 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -0
- package/dist/config.js.map +1 -1
- package/dist/content/parser.d.ts.map +1 -1
- package/dist/content/parser.js +2 -1
- package/dist/content/parser.js.map +1 -1
- package/dist/content/store.d.ts +21 -3
- package/dist/content/store.d.ts.map +1 -1
- package/dist/content/store.js +169 -42
- package/dist/content/store.js.map +1 -1
- package/dist/content/tags.d.ts +26 -0
- package/dist/content/tags.d.ts.map +1 -0
- package/dist/content/tags.js +41 -0
- package/dist/content/tags.js.map +1 -0
- package/dist/federation/article.d.ts.map +1 -1
- package/dist/federation/article.js +3 -1
- package/dist/federation/article.js.map +1 -1
- package/dist/notify.js +2 -2
- package/dist/notify.js.map +1 -1
- package/dist/plugin.d.ts +19 -0
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +8 -0
- package/dist/plugin.js.map +1 -1
- package/dist/plugins/changes.d.ts +31 -0
- package/dist/plugins/changes.d.ts.map +1 -0
- package/dist/plugins/changes.js +40 -0
- package/dist/plugins/changes.js.map +1 -0
- package/dist/plugins/install.d.ts +30 -3
- package/dist/plugins/install.d.ts.map +1 -1
- package/dist/plugins/install.js +43 -15
- package/dist/plugins/install.js.map +1 -1
- package/dist/plugins/manage.d.ts +32 -0
- package/dist/plugins/manage.d.ts.map +1 -0
- package/dist/plugins/manage.js +101 -0
- package/dist/plugins/manage.js.map +1 -0
- package/dist/plugins/registry.js +1 -1
- package/dist/plugins/registry.js.map +1 -1
- package/dist/plugins/upgrade.d.ts +54 -0
- package/dist/plugins/upgrade.d.ts.map +1 -0
- package/dist/plugins/upgrade.js +240 -0
- package/dist/plugins/upgrade.js.map +1 -0
- package/dist/web/routes.d.ts.map +1 -1
- package/dist/web/routes.js +25 -12
- package/dist/web/routes.js.map +1 -1
- package/dist/web/taxonomy.d.ts +7 -1
- package/dist/web/taxonomy.d.ts.map +1 -1
- package/dist/web/taxonomy.js +24 -8
- package/dist/web/taxonomy.js.map +1 -1
- package/package.json +4 -1
- package/themes/default/README.md +2 -2
- package/themes/default/layouts/base.njk +1 -1
- package/themes/default/layouts/tag.njk +1 -1
- package/themes/default/partials/tags.njk +1 -1
package/README.md
CHANGED
|
@@ -96,7 +96,7 @@ site (or `npx geekity`, or a `package.json` script, which is how the generated
|
|
|
96
96
|
| `geekity maintenance on`, `off`, `status` | Take the public site down on purpose with a 503 and `Retry-After`, or bring it back, without a restart. `on --until <time>` names when it should be back. |
|
|
97
97
|
| `geekity strip-metadata` | Remove location and camera metadata from files already in `content/uploads`. See [The media library](#the-media-library). |
|
|
98
98
|
| `geekity user add <name>` | Create an admin account, so a site can get its first login without the setup screen. |
|
|
99
|
-
| `geekity plugin add <package>`, `remove` | Install a plugin package's bundle from the npm registry into the plugins folder (`GEEKITY_PLUGINS_DIR`), or delete
|
|
99
|
+
| `geekity plugin add <package>`, `remove` | Install a plugin package's bundle from the npm registry into the plugins folder (`GEEKITY_PLUGINS_DIR`), or delete a disabled one. Reload on the Plugins screen loads the change. |
|
|
100
100
|
| `geekity --help`, `-h` | The same table, on the terminal. |
|
|
101
101
|
| `geekity --version` | The installed version. |
|
|
102
102
|
|
|
@@ -1488,6 +1488,7 @@ says otherwise.
|
|
|
1488
1488
|
| Users: username, email, argon2id password hash, profile | `data/users.json`, mode `0600` | Until the user is deleted. |
|
|
1489
1489
|
| The apps a user signed in to with IndieAuth: app, scopes, hashes of its tokens, when they expire | `data/indieauth-tokens.json`, mode `0600` | Until the user is deleted, or 60 days after the app last refreshed. |
|
|
1490
1490
|
| Recent IndieAuth and Micropub requests: app, username, what it sent (no secrets, values cut short), the answer | `data/indieauth-activity.json`, mode `0600` | The last 100 requests, none older than 14 days. |
|
|
1491
|
+
| Plugins added, updated and removed on Admin > Plugins: the username, when, the package and its versions | `data/plugin-changes.json`, mode `0600` | The last 200 changes. |
|
|
1491
1492
|
| An index of all of the above, and sessions, reset tokens and spent link tokens | `data/geekity.db` | A cache of the files. Sessions and tokens are pruned when they expire. |
|
|
1492
1493
|
| Client addresses in the rate limits | Memory | Until the window passes or the site restarts. |
|
|
1493
1494
|
| Where and when a photo or video was taken, and the camera or phone (EXIF, XMP, IPTC, a video's `©xyz`) | Removed from `content/uploads/` on upload | Never stored. Older uploads keep it until `geekity strip-metadata`; git history keeps the old bytes until rewritten. |
|
|
@@ -57,6 +57,9 @@
|
|
|
57
57
|
</label>
|
|
58
58
|
</li>
|
|
59
59
|
</template>
|
|
60
|
+
<template data-editor-choice-group>
|
|
61
|
+
<li class="pt-1 text-sm font-semibold first:pt-0" data-choice-group></li>
|
|
62
|
+
</template>
|
|
60
63
|
<div class="flex gap-2">
|
|
61
64
|
{{ button('Accept', color='primary') }}
|
|
62
65
|
{{ button('Dismiss', style='ghost') }}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{% extends "layouts/shell.njk" %}
|
|
2
|
+
{% from "components/button.njk" import button, buttonLink %}
|
|
3
|
+
{% from "components/card.njk" import card, cardActions %}
|
|
4
|
+
{% import "components/fields.njk" as fields %}
|
|
5
|
+
|
|
6
|
+
{% block title %}{{ title }}{% endblock %}
|
|
7
|
+
|
|
8
|
+
{% block content %}
|
|
9
|
+
<h1 class="mb-6 text-2xl font-bold">{{ title }}</h1>
|
|
10
|
+
|
|
11
|
+
<div class="max-w-prose">
|
|
12
|
+
{% call card() %}
|
|
13
|
+
<ul class="list-disc ps-5">
|
|
14
|
+
{% for line in lines %}<li class="break-words">{{ line }}</li>{% endfor %}
|
|
15
|
+
</ul>
|
|
16
|
+
|
|
17
|
+
{% if ready %}
|
|
18
|
+
<p class="text-sm">The site keeps running the plugins it has until you reload.</p>
|
|
19
|
+
{% if problems.password %}
|
|
20
|
+
{% call fields.summary('Nothing was changed. Fix the field marked below and try again.') %}
|
|
21
|
+
{{ fields.problem('plugin-confirm-password', problems.password) }}
|
|
22
|
+
{% endcall %}
|
|
23
|
+
{% endif %}
|
|
24
|
+
<form method="post" action="{{ postUrl }}">
|
|
25
|
+
<input type="hidden" name="csrf_token" value="{{ csrfToken }}" />
|
|
26
|
+
{% if plugin %}<input type="hidden" name="{{ field }}" value="{{ plugin }}" />{% endif %}
|
|
27
|
+
{{ fields.password('plugin-confirm-password', passwordField, 'Your password',
|
|
28
|
+
error=problems.password, autocomplete='current-password', required=true,
|
|
29
|
+
autofocus=true) }}
|
|
30
|
+
{% call cardActions() %}
|
|
31
|
+
{{ buttonLink('Cancel', backUrl, style='ghost') }}
|
|
32
|
+
{{ button(buttonLabel, type='submit', color='error' if danger else 'primary') }}
|
|
33
|
+
{% endcall %}
|
|
34
|
+
</form>
|
|
35
|
+
{% else %}
|
|
36
|
+
{% call cardActions() %}
|
|
37
|
+
{{ buttonLink('Back to Plugins', backUrl) }}
|
|
38
|
+
{% endcall %}
|
|
39
|
+
{% endif %}
|
|
40
|
+
{% endcall %}
|
|
41
|
+
</div>
|
|
42
|
+
{% endblock %}
|
|
@@ -10,6 +10,9 @@
|
|
|
10
10
|
{% from "components/badge.njk" import status %}
|
|
11
11
|
{% from "components/button.njk" import button %}
|
|
12
12
|
{% from "components/card.njk" import card, cardActions %}
|
|
13
|
+
{% from "components/button.njk" import buttonLink %}
|
|
14
|
+
{% import "components/fields.njk" as fields %}
|
|
15
|
+
{% from "components/table.njk" import table %}
|
|
13
16
|
|
|
14
17
|
{% block title %}Plugins{% endblock %}
|
|
15
18
|
|
|
@@ -50,6 +53,57 @@
|
|
|
50
53
|
</div>
|
|
51
54
|
{% endif %}
|
|
52
55
|
|
|
56
|
+
{% if installer == 'on' %}
|
|
57
|
+
<div class="mb-8 grid grid-cols-1 items-start gap-6 xl:grid-cols-2">
|
|
58
|
+
{% call card(title="Add plugin") %}
|
|
59
|
+
<p class="text-sm">
|
|
60
|
+
A plugin runs as the site, with access to everything under <code>data/</code>,
|
|
61
|
+
the accounts and keys and other plugins' secrets. Add only plugins you trust.
|
|
62
|
+
</p>
|
|
63
|
+
{% if addProblems.package or addProblems.password %}
|
|
64
|
+
{% call fields.summary('Nothing was installed. Fix the fields marked below and try again.') %}
|
|
65
|
+
{{ fields.problem('plugin-package', addProblems.package) }}
|
|
66
|
+
{{ fields.problem('plugin-add-password', addProblems.password) }}
|
|
67
|
+
{% endcall %}
|
|
68
|
+
{% endif %}
|
|
69
|
+
<form id="plugin-add" method="post" action="{{ add.url }}">
|
|
70
|
+
<input type="hidden" name="csrf_token" value="{{ csrfToken }}" />
|
|
71
|
+
{{ fields.text('plugin-package', 'package', 'Package', value=add.package,
|
|
72
|
+
hint='An npm package name, such as @geekity/plugin-llm.', error=addProblems.package,
|
|
73
|
+
required=true,
|
|
74
|
+
spellcheck='false', autocomplete='off') }}
|
|
75
|
+
{{ fields.text('plugin-version', 'version', 'Version (optional)', value=add.version,
|
|
76
|
+
hint='A version, a range or a dist-tag. Empty takes latest.', spellcheck='false',
|
|
77
|
+
autocomplete='off') }}
|
|
78
|
+
{{ fields.password('plugin-add-password', 'password', 'Your password',
|
|
79
|
+
error=addProblems.password, autocomplete='current-password', required=true) }}
|
|
80
|
+
{% call cardActions() %}
|
|
81
|
+
{{ button('Add plugin', type='submit', color='primary') }}
|
|
82
|
+
{% endcall %}
|
|
83
|
+
</form>
|
|
84
|
+
{% endcall %}
|
|
85
|
+
|
|
86
|
+
{% call card(title="Updates") %}
|
|
87
|
+
<p class="text-sm">
|
|
88
|
+
{% if checkedAt %}Last checked {{ checkedAt }}.{% else %}Not checked since this server started.{% endif %}
|
|
89
|
+
Update installs the newest version this site can run.
|
|
90
|
+
</p>
|
|
91
|
+
<form method="post" action="{{ checkUrl }}">
|
|
92
|
+
<input type="hidden" name="csrf_token" value="{{ csrfToken }}" />
|
|
93
|
+
{% call cardActions() %}
|
|
94
|
+
{{ button('Check for updates', type='submit') }}
|
|
95
|
+
{% if updateAllUrl %}{{ buttonLink('Update all', updateAllUrl, color='primary') }}{% endif %}
|
|
96
|
+
{% endcall %}
|
|
97
|
+
</form>
|
|
98
|
+
{% endcall %}
|
|
99
|
+
</div>
|
|
100
|
+
{% elif installer == 'off' %}
|
|
101
|
+
<p class="mb-6 max-w-prose text-sm">
|
|
102
|
+
Adding, updating and removing plugins here is turned off on this site
|
|
103
|
+
(<code>GEEKITY_PLUGIN_INSTALL=off</code>). Use <code>geekity plugin</code> on the command line.
|
|
104
|
+
</p>
|
|
105
|
+
{% endif %}
|
|
106
|
+
|
|
53
107
|
{% if not plugins.length %}
|
|
54
108
|
<p class="max-w-prose">
|
|
55
109
|
No plugins are installed. A site with its own <code>server.ts</code> passes them in
|
|
@@ -67,7 +121,13 @@
|
|
|
67
121
|
{{ status(plugin.badge.status, plugin.badge.label) }}
|
|
68
122
|
</p>
|
|
69
123
|
<p>{{ plugin.description }}</p>
|
|
70
|
-
<p class="text-sm">From {{ plugin.source }}
|
|
124
|
+
<p class="text-sm">From {{ plugin.source }}.{% if plugin.inCode %} Managed in code: change it in the site's own code, not here.{% endif %}</p>
|
|
125
|
+
|
|
126
|
+
{% if plugin.update %}
|
|
127
|
+
<p class="text-sm">{{ plugin.update.to }} is available.</p>
|
|
128
|
+
{% elif plugin.checkNote %}
|
|
129
|
+
<p class="text-sm">{{ plugin.checkNote }}</p>
|
|
130
|
+
{% endif %}
|
|
71
131
|
|
|
72
132
|
{% if plugin.problem %}
|
|
73
133
|
<p class="text-sm text-error">{{ plugin.problem }}</p>
|
|
@@ -93,14 +153,16 @@
|
|
|
93
153
|
</div>
|
|
94
154
|
{% endif %}
|
|
95
155
|
|
|
96
|
-
{% if plugin.canEnable or plugin.canDisable %}
|
|
156
|
+
{% if plugin.canEnable or plugin.canDisable or plugin.update or plugin.removeUrl %}
|
|
97
157
|
<form method="post" action="{{ enableUrl if plugin.canEnable else disableUrl }}">
|
|
98
158
|
<input type="hidden" name="csrf_token" value="{{ csrfToken }}" />
|
|
99
159
|
<input type="hidden" name="{{ field }}" value="{{ plugin.name }}" />
|
|
100
160
|
{% call cardActions() %}
|
|
161
|
+
{% if plugin.update %}{{ buttonLink('Update to ' + plugin.update.to, plugin.update.url, color='primary', style='soft') }}{% endif %}
|
|
162
|
+
{% if plugin.removeUrl %}{{ buttonLink('Remove', plugin.removeUrl, color='error', style='ghost') }}{% endif %}
|
|
101
163
|
{% if plugin.canEnable %}
|
|
102
164
|
{{ button('Enable', type='submit', color='primary') }}
|
|
103
|
-
{%
|
|
165
|
+
{% elif plugin.canDisable %}
|
|
104
166
|
{{ button('Disable', type='submit') }}
|
|
105
167
|
{% endif %}
|
|
106
168
|
{% endcall %}
|
|
@@ -110,4 +172,24 @@
|
|
|
110
172
|
</li>
|
|
111
173
|
{% endfor %}
|
|
112
174
|
</ul>
|
|
175
|
+
|
|
176
|
+
{% if changeLog.length %}
|
|
177
|
+
<h2 class="mb-4 text-xl font-bold">Recent changes</h2>
|
|
178
|
+
{% call table('Plugins added, updated and removed here, newest first') %}
|
|
179
|
+
<thead>
|
|
180
|
+
<tr><th scope="col">When</th><th scope="col">Who</th><th scope="col">What</th><th scope="col">Plugin</th><th scope="col">Version</th></tr>
|
|
181
|
+
</thead>
|
|
182
|
+
<tbody>
|
|
183
|
+
{% for change in changeLog %}
|
|
184
|
+
<tr>
|
|
185
|
+
<td class="whitespace-nowrap">{{ change.when }}</td>
|
|
186
|
+
<td>{{ change.user }}</td>
|
|
187
|
+
<td>{{ change.action }}</td>
|
|
188
|
+
<td><code class="break-all">{{ change.name }}</code></td>
|
|
189
|
+
<td>{{ change.versions }}</td>
|
|
190
|
+
</tr>
|
|
191
|
+
{% endfor %}
|
|
192
|
+
</tbody>
|
|
193
|
+
{% endcall %}
|
|
194
|
+
{% endif %}
|
|
113
195
|
{% endblock %}
|
package/admin/static/admin.css
CHANGED
|
@@ -51,6 +51,8 @@
|
|
|
51
51
|
--text-sm--line-height: calc(1.25 / .875);
|
|
52
52
|
--text-lg: 1.125rem;
|
|
53
53
|
--text-lg--line-height: calc(1.75 / 1.125);
|
|
54
|
+
--text-xl: 1.25rem;
|
|
55
|
+
--text-xl--line-height: calc(1.75 / 1.25);
|
|
54
56
|
--text-2xl: 1.5rem;
|
|
55
57
|
--text-2xl--line-height: calc(2 / 1.5);
|
|
56
58
|
--font-weight-normal: 400;
|
|
@@ -6936,6 +6938,10 @@
|
|
|
6936
6938
|
padding-top: var(--geekity-admin-bar-height);
|
|
6937
6939
|
}
|
|
6938
6940
|
|
|
6941
|
+
.pt-1 {
|
|
6942
|
+
padding-top: var(--spacing);
|
|
6943
|
+
}
|
|
6944
|
+
|
|
6939
6945
|
.pt-4 {
|
|
6940
6946
|
padding-top: calc(var(--spacing) * 4);
|
|
6941
6947
|
}
|
|
@@ -6963,6 +6969,11 @@
|
|
|
6963
6969
|
line-height: var(--tw-leading, var(--text-sm--line-height));
|
|
6964
6970
|
}
|
|
6965
6971
|
|
|
6972
|
+
.text-xl {
|
|
6973
|
+
font-size: var(--text-xl);
|
|
6974
|
+
line-height: var(--tw-leading, var(--text-xl--line-height));
|
|
6975
|
+
}
|
|
6976
|
+
|
|
6966
6977
|
.text-xs {
|
|
6967
6978
|
font-size: var(--text-xs);
|
|
6968
6979
|
line-height: var(--tw-leading, var(--text-xs--line-height));
|
|
@@ -7104,6 +7115,10 @@
|
|
|
7104
7115
|
outline-color: var(--color-base-content);
|
|
7105
7116
|
}
|
|
7106
7117
|
|
|
7118
|
+
.first\:pt-0:first-child {
|
|
7119
|
+
padding-top: 0;
|
|
7120
|
+
}
|
|
7121
|
+
|
|
7107
7122
|
.read-only\:border-dashed:read-only {
|
|
7108
7123
|
--tw-border-style: dashed;
|
|
7109
7124
|
border-style: dashed;
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
endpoint, which answers { ok, value }, { ok, choices } or { ok: false,
|
|
4
4
|
message }, and shows the suggestion with Accept and Dismiss. Choices come
|
|
5
5
|
only beside the tags field, each drawn from the page's template row with a
|
|
6
|
-
box to tick,
|
|
7
|
-
|
|
6
|
+
box to tick, under a heading row wherever its group changes, and Accept
|
|
7
|
+
adds the ticked ones. Accept fills the field and saves nothing; a save is
|
|
8
|
+
still only the form's own buttons.
|
|
8
9
|
|
|
9
10
|
A file rather than an inline script, loaded from the admin's own origin
|
|
10
11
|
like slug.js, so the admin's policy stays `script-src 'self'` and
|
|
@@ -55,7 +56,8 @@
|
|
|
55
56
|
var text = suggestion && suggestion.querySelector('p');
|
|
56
57
|
var list = suggestion && suggestion.querySelector('[data-editor-choices]');
|
|
57
58
|
var row = block.querySelector('template[data-editor-choice]');
|
|
58
|
-
|
|
59
|
+
var heading = block.querySelector('template[data-editor-choice-group]');
|
|
60
|
+
if (!url || !press || !status || !text || !list || !row || !heading) return;
|
|
59
61
|
var buttons = suggestion.querySelectorAll('button');
|
|
60
62
|
var accept = buttons[0];
|
|
61
63
|
var dismiss = buttons[1];
|
|
@@ -74,7 +76,15 @@
|
|
|
74
76
|
}
|
|
75
77
|
|
|
76
78
|
function drawChoices(choices) {
|
|
79
|
+
var group = '';
|
|
77
80
|
choices.forEach(function (choice) {
|
|
81
|
+
var named = choice.group ? String(choice.group) : '';
|
|
82
|
+
if (named !== group && named !== '') {
|
|
83
|
+
var title = heading.content.firstElementChild.cloneNode(true);
|
|
84
|
+
title.textContent = named;
|
|
85
|
+
list.appendChild(title);
|
|
86
|
+
}
|
|
87
|
+
group = named;
|
|
78
88
|
var item = row.content.firstElementChild.cloneNode(true);
|
|
79
89
|
var badge = item.querySelector('.badge');
|
|
80
90
|
item.querySelector('input').value = String(choice.value);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Context, Hono } from 'hono';
|
|
2
2
|
import type { Document, DocumentType } from '../content/document.ts';
|
|
3
3
|
import type { HandleLearner } from '../federation/handles.ts';
|
|
4
|
+
import type { Respelling } from '../content/tags.ts';
|
|
4
5
|
import type { Enclosure } from '../content/enclosure.ts';
|
|
5
6
|
import type { Photo } from '../content/photo.ts';
|
|
6
7
|
import type { PostLocation } from '../content/location.ts';
|
|
@@ -161,6 +162,8 @@ export type WriteOutcome = {
|
|
|
161
162
|
readonly saved: Document;
|
|
162
163
|
/** Images published without alt text, which the editor warns about. */
|
|
163
164
|
readonly undescribed: readonly UndescribedImage[];
|
|
165
|
+
/** Tags written in the site's spelling rather than as typed, which the editor says. */
|
|
166
|
+
readonly respelled: readonly Respelling[];
|
|
164
167
|
} | ({
|
|
165
168
|
readonly outcome: 'refused';
|
|
166
169
|
} & Refusal) | {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documents.d.ts","sourceRoot":"","sources":["../../src/admin/documents.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAY1C,OAAO,KAAK,EAAE,QAAQ,EAAmB,YAAY,EAAE,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AI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,+EAA+E;IAC/E,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,+EAA+E;IAC/E,SAAS,EAAE,OAAO,CAAC;IACnB,wFAAwF;IACxF,MAAM,EAAE,OAAO,CAAC;IAChB,qCAAqC;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,8EAA8E;IAC9E,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B;;;OAGG;IACH,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1B;AAED;;;;GAIG;AACH,eAAO,MAAM,gBAAgB;aAAK,QAAQ,EAAE,YAAY;aAAE,SAAS,EAAE,YAAY;CAAW,CAAC;AAsD7F,2EAA2E;AAC3E,wBAAgB,UAAU,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,IAAI,SAAI,GAAG,MAAM,CAMvF"}
|
package/dist/admin/documents.js
CHANGED
|
@@ -7,6 +7,7 @@ import { parseDocument } from '../content/parser.js';
|
|
|
7
7
|
import { PINNED_FRONT_MATTER_KEY, PINNED_POST_LIMIT, pinnedAt } from '../content/pinned.js';
|
|
8
8
|
import { discoverPostType, postLabel, replyTarget } from '../content/post-type.js';
|
|
9
9
|
import { isReadStatus, READ_OF_FRONT_MATTER_KEY, READ_STATUS_FRONT_MATTER_KEY, READ_STATUS_LABELS, READ_STATUSES, readWork, readWorkFrontMatter, } from '../content/read.js';
|
|
10
|
+
import { respellTags } from '../content/tags.js';
|
|
10
11
|
import { RSVP_FRONT_MATTER_KEY, RSVP_LABELS, RSVP_VALUES, rsvpValue } from '../content/rsvp.js';
|
|
11
12
|
import { ENCLOSURE_FRONT_MATTER_KEY, enclosureOf, isWebUrl, TRANSCRIPT_TYPES, } from '../content/enclosure.js';
|
|
12
13
|
import { PHOTO_FRONT_MATTER_KEY, photoFrontMatter } from '../content/photo.js';
|
|
@@ -311,8 +312,10 @@ async function saveFromForm(c, options) {
|
|
|
311
312
|
conflict: written.conflict,
|
|
312
313
|
});
|
|
313
314
|
}
|
|
314
|
-
const { saved, undescribed } = written;
|
|
315
|
+
const { saved, undescribed, respelled } = written;
|
|
315
316
|
flash(c, 'notice', savedMessage(document, saved, store.now(), (url) => c.var.replyContexts.read(url)));
|
|
317
|
+
if (respelled.length > 0)
|
|
318
|
+
flash(c, 'notice', respelledMessage(respelled));
|
|
316
319
|
if (undescribed.length > 0)
|
|
317
320
|
flash(c, 'warning', missingAltText(undescribed));
|
|
318
321
|
return c.redirect(documentEditorPath(kind, saved), 303);
|
|
@@ -479,13 +482,14 @@ export async function writeDocument(site, write) {
|
|
|
479
482
|
if (target !== document?.path && store.getByPath(target) !== undefined) {
|
|
480
483
|
return refused(`Another ${kind.singular} already lives in ${target}.`, 'editor-slug');
|
|
481
484
|
}
|
|
485
|
+
const tags = respellTags(kind.tagged ? splitTags(form.tags) : [], (tag) => store.tagSpelling(tag, { excluding: document?.path }));
|
|
482
486
|
const content = {
|
|
483
487
|
title: form.title,
|
|
484
488
|
...(date === undefined ? {} : { date }),
|
|
485
489
|
updated: store.now().toISOString(),
|
|
486
490
|
permalink,
|
|
487
491
|
...optional('redirectFrom', formerPermalinks(document, promised, permalink)),
|
|
488
|
-
tags:
|
|
492
|
+
tags: tags.tags,
|
|
489
493
|
categories: kind.categorised ? splitTags(form.categories) : [],
|
|
490
494
|
draft,
|
|
491
495
|
...(form.description === '' ? {} : { description: form.description }),
|
|
@@ -541,7 +545,7 @@ export async function writeDocument(site, write) {
|
|
|
541
545
|
next: saved,
|
|
542
546
|
origin: 'admin',
|
|
543
547
|
});
|
|
544
|
-
return { outcome: 'saved', saved, undescribed };
|
|
548
|
+
return { outcome: 'saved', saved, undescribed, respelled: tags.respelled };
|
|
545
549
|
}
|
|
546
550
|
async function citesUndescribedImage(site, document, form) {
|
|
547
551
|
if (form.previewHidden || form.citedAlt !== '' || form.title !== '')
|
|
@@ -617,6 +621,11 @@ function decodedSegment(segment) {
|
|
|
617
621
|
return segment;
|
|
618
622
|
}
|
|
619
623
|
}
|
|
624
|
+
function respelledMessage(respelled) {
|
|
625
|
+
const pairs = respelled.map(({ given, site }) => `“${site}” for “${given}”`);
|
|
626
|
+
const noun = respelled.length === 1 ? 'a tag' : `${String(respelled.length)} tags`;
|
|
627
|
+
return `Used this site’s spelling of ${noun}: ${pairs.join(', ')}.`;
|
|
628
|
+
}
|
|
620
629
|
/** What the flash says after a save, which depends on what the save did. */
|
|
621
630
|
function savedMessage(previous, saved, now, cited) {
|
|
622
631
|
const label = postLabel(saved, cited);
|