this repo has no description
0
fork

Configure Feed

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

Convert all the punycodes

Surprising that this is still not built into browsers

+36 -21
+4 -5
package-lock.json
··· 30 30 "p-retry": "~6.2.0", 31 31 "p-throttle": "~6.1.0", 32 32 "preact": "~10.20.1", 33 + "punycode": "~2.3.1", 33 34 "react-hotkeys-hook": "~4.5.0", 34 35 "react-intersection-observer": "~9.8.1", 35 36 "react-quick-pinch-zoom": "~5.1.0", ··· 7154 7155 "integrity": "sha512-8xuCeM3l8yqdmbPoYeLbrAXCBWu19XEYc5/F28f5qOaoAIMyfmBUkl5axiK+x9olUvRlcekvnm98AP9RDngOIw==" 7155 7156 }, 7156 7157 "node_modules/punycode": { 7157 - "version": "2.3.0", 7158 - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", 7159 - "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", 7160 - "dev": true, 7161 - "license": "MIT", 7158 + "version": "2.3.1", 7159 + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", 7160 + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", 7162 7161 "engines": { 7163 7162 "node": ">=6" 7164 7163 }
+1
package.json
··· 32 32 "p-retry": "~6.2.0", 33 33 "p-throttle": "~6.1.0", 34 34 "preact": "~10.20.1", 35 + "punycode": "~2.3.1", 35 36 "react-hotkeys-hook": "~4.5.0", 36 37 "react-intersection-observer": "~9.8.1", 37 38 "react-quick-pinch-zoom": "~5.1.0",
+3 -2
src/components/account-info.jsx
··· 9 9 useRef, 10 10 useState, 11 11 } from 'preact/hooks'; 12 + import punycode from 'punycode'; 12 13 13 14 import { api } from '../utils/api'; 14 15 import enhanceContent from '../utils/enhance-content'; ··· 228 229 229 230 const accountInstance = useMemo(() => { 230 231 if (!url) return null; 231 - const domain = new URL(url).hostname; 232 + const domain = punycode.toUnicode(new URL(url).hostname); 232 233 return domain; 233 234 }, [url]); 234 235 ··· 1598 1599 const path = pathname.replace(/\/$/, '').replace(/^\//, ''); 1599 1600 return ( 1600 1601 <> 1601 - <span class="more-insignificant">{host}/</span> 1602 + <span class="more-insignificant">{punycode.toUnicode(host)}/</span> 1602 1603 <wbr /> 1603 1604 <span>{path}</span> 1604 1605 </>
+8 -5
src/components/status.jsx
··· 20 20 useRef, 21 21 useState, 22 22 } from 'preact/hooks'; 23 + import punycode from 'punycode'; 23 24 import { useHotkeys } from 'react-hotkeys-hook'; 24 25 import { useLongPress } from 'use-long-press'; 25 26 import { useSnapshot } from 'valtio'; ··· 2231 2232 ); 2232 2233 2233 2234 if (hasText && (image || (type === 'photo' && blurhash))) { 2234 - const domain = new URL(url).hostname 2235 - .replace(/^www\./, '') 2236 - .replace(/\/$/, ''); 2235 + const domain = punycode.toUnicode( 2236 + new URL(url).hostname.replace(/^www\./, '').replace(/\/$/, ''), 2237 + ); 2237 2238 let blurhashImage; 2238 2239 const rgbAverageColor = 2239 2240 image && blurhash ? getBlurHashAverageColor(blurhash) : null; ··· 2349 2350 // ); 2350 2351 } 2351 2352 if (hasText && !image) { 2352 - const domain = new URL(url).hostname.replace(/^www\./, ''); 2353 + const domain = punycode.toUnicode( 2354 + new URL(url).hostname.replace(/^www\./, ''), 2355 + ); 2353 2356 return ( 2354 2357 <a 2355 2358 href={cardStatusURL || url} ··· 2881 2884 const [_, username, restPath] = path.match(/\/(@[^\/]+)\/(.*)/) || []; 2882 2885 return ( 2883 2886 <> 2884 - {host} 2887 + {punycode.toUnicode(host)} 2885 2888 {username ? ( 2886 2889 <> 2887 2890 /{username}
+8 -1
src/pages/account-statuses.jsx
··· 6 6 useRef, 7 7 useState, 8 8 } from 'preact/hooks'; 9 + import punycode from 'punycode'; 9 10 import { useParams, useSearchParams } from 'react-router-dom'; 10 11 import { useSnapshot } from 'valtio'; 11 12 ··· 516 517 > 517 518 <Icon icon="transfer" />{' '} 518 519 <small class="menu-double-lines"> 519 - Switch to account's instance (<b>{accountInstance}</b>) 520 + Switch to account's instance{' '} 521 + {accountInstance ? ( 522 + <> 523 + {' '} 524 + (<b>{punycode.toUnicode(accountInstance)}</b>) 525 + </> 526 + ) : null} 520 527 </small> 521 528 </MenuItem> 522 529 {!sameCurrentInstance && (
+6 -3
src/pages/catchup.jsx
··· 13 13 useRef, 14 14 useState, 15 15 } from 'preact/hooks'; 16 + import punycode from 'punycode'; 16 17 import { useHotkeys } from 'react-hotkeys-hook'; 17 18 import { useSearchParams } from 'react-router-dom'; 18 19 import { uid } from 'uid/single'; ··· 1099 1100 height, 1100 1101 publishedAt, 1101 1102 } = card; 1102 - const domain = new URL(url).hostname 1103 - .replace(/^www\./, '') 1104 - .replace(/\/$/, ''); 1103 + const domain = punycode.toUnicode( 1104 + new URL(url).hostname 1105 + .replace(/^www\./, '') 1106 + .replace(/\/$/, ''), 1107 + ); 1105 1108 let accentColor; 1106 1109 if (blurhash) { 1107 1110 const averageColor = getBlurHashAverageColor(blurhash);
+2 -2
src/pages/status.jsx
··· 12 12 useRef, 13 13 useState, 14 14 } from 'preact/hooks'; 15 + import punycode from 'punycode'; 15 16 import { useHotkeys } from 'react-hotkeys-hook'; 16 17 import { InView } from 'react-intersection-observer'; 17 18 import { matchPath, useSearchParams } from 'react-router-dom'; 18 - import { useDebouncedCallback } from 'use-debounce'; 19 19 import { useSnapshot } from 'valtio'; 20 20 21 21 import Avatar from '../components/avatar'; ··· 1208 1208 {postInstance ? ( 1209 1209 <> 1210 1210 {' '} 1211 - (<b>{postInstance}</b>) 1211 + (<b>{punycode.toUnicode(postInstance)}</b>) 1212 1212 </> 1213 1213 ) : ( 1214 1214 ''
+4 -3
src/pages/trending.jsx
··· 3 3 import { MenuItem } from '@szhsin/react-menu'; 4 4 import { getBlurHashAverageColor } from 'fast-blurhash'; 5 5 import { useMemo, useRef, useState } from 'preact/hooks'; 6 + import punycode from 'punycode'; 6 7 import { useNavigate, useParams } from 'react-router-dom'; 7 8 import { useSnapshot } from 'valtio'; 8 9 ··· 161 162 url, 162 163 width, 163 164 } = link; 164 - const domain = new URL(url).hostname 165 - .replace(/^www\./, '') 166 - .replace(/\/$/, ''); 165 + const domain = punycode.toUnicode( 166 + new URL(url).hostname.replace(/^www\./, '').replace(/\/$/, ''), 167 + ); 167 168 let accentColor; 168 169 if (blurhash) { 169 170 const averageColor = getBlurHashAverageColor(blurhash);