get uncached profiles from process.env.HTTP_CACHE
This commit is contained in:
parent
234167b749
commit
58ba714d36
@ -4,5 +4,6 @@
|
||||
"appTitle": "Snort - Nostr",
|
||||
"nip05Domain": "snort.social",
|
||||
"favicon": "public/favicon.ico",
|
||||
"appleTouchIconUrl": "/nostrich_512.png"
|
||||
"appleTouchIconUrl": "/nostrich_512.png",
|
||||
"httpCache": ""
|
||||
}
|
||||
|
@ -4,5 +4,6 @@
|
||||
"appTitle": "iris",
|
||||
"nip05Domain": "iris.to",
|
||||
"favicon": "public/iris/favicon.ico",
|
||||
"appleTouchIconUrl": "/img/apple-touch-icon.png"
|
||||
"appleTouchIconUrl": "/img/apple-touch-icon.png",
|
||||
"httpCache": "https://api.iris.to"
|
||||
}
|
||||
|
@ -29,10 +29,13 @@ export default function Modal(props: ModalProps) {
|
||||
return (
|
||||
<div className={`modal${props.className ? ` ${props.className}` : ""}`} onClick={props.onClose}>
|
||||
<div className="modal-body" onClick={props.onClose}>
|
||||
<div onClick={e => {
|
||||
e.stopPropagation();
|
||||
props.onClick?.(e);
|
||||
}}>{props.children}</div>
|
||||
<div
|
||||
onClick={e => {
|
||||
e.stopPropagation();
|
||||
props.onClick?.(e);
|
||||
}}>
|
||||
{props.children}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
@ -90,6 +90,7 @@ const config = {
|
||||
"process.env.APP_NAME": JSON.stringify(appConfig.get("appName")),
|
||||
"process.env.APP_NAME_CAPITALIZED": JSON.stringify(appConfig.get("appNameCapitalized")),
|
||||
"process.env.NIP05_DOMAIN": JSON.stringify(appConfig.get("nip05Domain")),
|
||||
"process.env.HTTP_CACHE": JSON.stringify(appConfig.get("httpCache")),
|
||||
}),
|
||||
],
|
||||
module: {
|
||||
|
@ -11,6 +11,20 @@ export function useUserProfile(pubKey?: HexKey): MetadataCache | undefined {
|
||||
h => {
|
||||
if (pubKey) {
|
||||
system.ProfileLoader.TrackMetadata(pubKey);
|
||||
if (process.env.HTTP_CACHE && !system.ProfileLoader.Cache.getFromCache(pubKey)) {
|
||||
try {
|
||||
fetch(`${process.env.HTTP_CACHE}/profile/${pubKey}`).then(async r => {
|
||||
if (r.ok) {
|
||||
const data = await r.json();
|
||||
if (data) {
|
||||
system.ProfileLoader.onProfileEvent(data);
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
const release = system.ProfileLoader.Cache.hook(h, pubKey);
|
||||
return () => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user