mirror of
https://github.com/svemagie/blog-eleventy-indiekit.git
synced 2026-05-16 07:28:51 +02:00
fix: use webmentions proxy in client-side fetcher
Prevents direct calls to webmention.io API which may fail without token Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
+3
-2
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Client-side webmention fetcher
|
* Client-side webmention fetcher
|
||||||
* Supplements build-time cached webmentions with real-time data from webmention.io
|
* Supplements build-time cached webmentions with real-time data from proxy API
|
||||||
*/
|
*/
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
@@ -18,7 +18,8 @@
|
|||||||
if (sessionStorage.getItem(cacheKey)) return;
|
if (sessionStorage.getItem(cacheKey)) return;
|
||||||
sessionStorage.setItem(cacheKey, '1');
|
sessionStorage.setItem(cacheKey, '1');
|
||||||
|
|
||||||
const apiUrl = `https://webmention.io/api/mentions.jf2?target=${encodeURIComponent(target)}&per-page=100`;
|
// Use server-side proxy to keep webmention.io token secure
|
||||||
|
const apiUrl = `/webmentions-api/api/mentions?target=${encodeURIComponent(target)}&per-page=100`;
|
||||||
|
|
||||||
fetch(apiUrl)
|
fetch(apiUrl)
|
||||||
.then((res) => res.json())
|
.then((res) => res.json())
|
||||||
|
|||||||
Reference in New Issue
Block a user