File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44 * @see https://webmention.io/
55 * @see https://github.com/aaronpk/webmention.io
66 */
7+ import { WEBMENTION_IO_TOKEN } from 'astro:env/client'
78
89export interface WebmentionAuthor {
910 url ?: string
@@ -85,23 +86,12 @@ const cleanWebmention = (entry: Webmention): Webmention => {
8586 * @param token - Optional webmention.io API token (from env var)
8687 * @returns Array of processed webmentions
8788 */
88- export const fetchWebmentions = async (
89- url : string ,
90- token ?: string
91- ) : Promise < Webmention [ ] > => {
92- // Get token from environment if not provided
93- const apiToken = token || import . meta. env [ 'WEBMENTION_IO_TOKEN' ]
94-
95- if ( ! apiToken ) {
96- console . warn ( '⚠️ WEBMENTION_IO_TOKEN not found. Webmentions will not be fetched.' )
97- return [ ]
98- }
99-
89+ export const fetchWebmentions = async ( url : string ) : Promise < Webmention [ ] > => {
10090 try {
10191 // Fetch from webmention.io API
10292 const apiUrl = new URL ( 'https://webmention.io/api/mentions.jf2' )
10393 apiUrl . searchParams . set ( 'target' , url )
104- apiUrl . searchParams . set ( 'token' , apiToken )
94+ apiUrl . searchParams . set ( 'token' , WEBMENTION_IO_TOKEN )
10595 apiUrl . searchParams . set ( 'per-page' , '1000' )
10696
10797 const response = await fetch ( apiUrl . toString ( ) , {
Original file line number Diff line number Diff line change @@ -143,8 +143,8 @@ export const environmentalVariablesConfig: AstroUserConfig['env'] = {
143143 * Site uses ConvertKit for managing newsletter subscriptions
144144 */
145145 WEBMENTION_IO_TOKEN : envField . string ( {
146- access : 'secret ' ,
147- context : 'server ' ,
146+ access : 'public ' ,
147+ context : 'client ' ,
148148 optional : false ,
149149 } ) ,
150150 } ,
You can’t perform that action at this time.
0 commit comments