Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ answers with a "check your inbox" page that links back to the site. `embed.js` w

**CSP:** pass the page's `nonce` so the script runs, and allow pit.world:
`connect-src 'self' https://pit.world; form-action 'self' https://pit.world`. If the request is
blocked anyway, the form says "Failed: could not reach pit.world" instead of doing nothing.
blocked anyway, the form says "Failed: could not reach the subscribe service" instead of doing nothing.
Turn it off with `subscribe: false` (`--no-subscribe`). Installs before 0.3.0 cannot render the
form; their footer shows a plain "Newsletter" link to the same page instead, from the @latest template.

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@profullstack/footer",
"version": "0.6.18",
"version": "0.6.19",
"type": "module",
"description": "Profullstack's distributed footer engine for remote, agent-friendly site branding and navigation.",
"keywords": ["footer", "webring", "openwebring", "copyright", "react", "nextjs", "hono", "ssr"],
Expand Down
4 changes: 2 additions & 2 deletions src/subscribe.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ export function wireSubscribe(form) {
say('Email confirmation sent to ' + email + '. Check your inbox.', 'ok');
form.reset();
} else {
say('Failed: ' + (body.error || reasons[body.status] || 'pit.world answered ' + res.status), 'error');
say('Failed: ' + (body.error || reasons[body.status] || 'the subscribe service answered ' + res.status), 'error');
}
});
})
.catch(function (err) {
say('Failed: could not reach pit.world (' + ((err && err.message) || err) + ')', 'error');
say('Failed: could not reach the subscribe service (' + ((err && err.message) || err) + ')', 'error');
})
.then(function () {
if (button) button.disabled = false;
Expand Down
4 changes: 2 additions & 2 deletions test/subscribe.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ test('a refusal says Failed with the reason', async () => {
assert.equal((await submitWith(reply(400, { ok: false, status: 'undeliverable' }))).msg.textContent, "Failed: that address's domain can't receive email");
assert.equal((await submitWith(reply(429, { error: 'Too many requests. Try again shortly.' }))).msg.textContent, 'Failed: Too many requests. Try again shortly.');
const r = await submitWith(reply(502, {}));
assert.equal(r.msg.textContent, 'Failed: pit.world answered 502');
assert.equal(r.msg.textContent, 'Failed: the subscribe service answered 502');
assert.equal(r.msg.attrs['data-state'], 'error');
});

test('a blocked or failed request says so instead of doing nothing', async () => {
const r = await submitWith(() => Promise.reject(new TypeError('Failed to fetch')));
assert.equal(r.msg.textContent, 'Failed: could not reach pit.world (Failed to fetch)');
assert.equal(r.msg.textContent, 'Failed: could not reach the subscribe service (Failed to fetch)');
assert.equal(r.button.disabled, false);
});

Expand Down
Loading