Simple API gateway for webhooks

feat: include country flag emoji

finxol.io 876f8692 e3adea51

verified
+15
+15
src/sensors.ts
··· 178 178 return c.text("Invalid country data", 400) 179 179 } 180 180 181 + const letterA = "a".codePointAt(0) as number 182 + //biome-ignore format: breaks emoji 183 + const regionalIndicatorA = "🇦".codePointAt(0) as number 184 + 185 + const toRegionalIndicator = (char: string) => 186 + String.fromCodePoint( 187 + char.codePointAt(0) as number - letterA + regionalIndicatorA, 188 + ) 189 + 190 + const emoji = country.data.features[0].properties.country_code 191 + .split("") 192 + .map((char) => toRegionalIndicator(char)) 193 + .join("") 194 + 181 195 const ret = { 182 196 country: country.data.features[0].properties.country, 183 197 country_code: country.data.features[0].properties.country_code, 198 + country_flag: emoji, 184 199 } 185 200 186 201 // Cache country data to KV store (expiry set for 2 hours)