this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Update redirect service (#10116)

authored by

Eric Bailey and committed by
GitHub
6a15ca88 5a694202

+27
+5
bskylink/src/metrics.ts
··· 11 11 whitelisted: 'unknown' | 'yes' 12 12 blocked: boolean 13 13 warned: boolean 14 + utm_source?: string 15 + utm_medium?: string 16 + utm_campaign?: string 17 + utm_content?: string 18 + utm_term?: string 14 19 } 15 20 invalid_redirect: { 16 21 link: string
+5
bskylink/src/routes/redirect.ts
··· 101 101 whitelisted, 102 102 blocked, 103 103 warned, 104 + utm_source: req.query.utm_source?.toString(), 105 + utm_medium: req.query.utm_medium?.toString(), 106 + utm_campaign: req.query.utm_campaign?.toString(), 107 + utm_content: req.query.utm_content?.toString(), 108 + utm_term: req.query.utm_term?.toString(), 104 109 }) 105 110 106 111 return res.end(html)
+17
bskylink/tests/index.ts
··· 360 360 // No blocked-site div, always safe 361 361 assert.doesNotMatch(html, /"blocked-site"/) 362 362 }) 363 + 364 + it('normal redirect with query params', async () => { 365 + const urlToRedirect = 'https://bsky.app/settings' 366 + const url = new URL(`${baseUrl}/redirect`) 367 + url.searchParams.set('u', urlToRedirect) 368 + url.searchParams.set('utm_source', 'test') 369 + const res = await fetch(url, {redirect: 'manual'}) 370 + assert.strictEqual(res.status, 200) 371 + const html = await res.text() 372 + assert.match(html, /meta http-equiv="refresh"/) 373 + assert.match( 374 + html, 375 + new RegExp(urlToRedirect.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')), 376 + ) 377 + // No blocked-site div, always safe 378 + assert.doesNotMatch(html, /"blocked-site"/) 379 + }) 363 380 })