pass dpr for imgproxy

This commit is contained in:
Kieran 2023-02-14 16:10:03 +00:00
parent d3f72794ee
commit abfb6d8c38
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941
4 changed files with 4 additions and 4 deletions

View File

@ -2,7 +2,7 @@ import "./Avatar.css";
import Nostrich from "nostrich.webp";
import { CSSProperties, useEffect, useState } from "react";
import type { UserMetadata } from "@snort/nostr";
import useImgProxy from "Feed/ImgProxy";
import useImgProxy from "Hooks/useImgProxy";
const Avatar = ({ user, ...rest }: { user?: UserMetadata; onClick?: () => void }) => {
const [url, setUrl] = useState<string>(Nostrich);

View File

@ -1,4 +1,4 @@
import useImgProxy from "Feed/ImgProxy";
import useImgProxy from "Hooks/useImgProxy";
import { useEffect, useState } from "react";
interface ProxyImgProps extends React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement> {

View File

@ -30,7 +30,7 @@ export default function useImgProxy() {
return {
proxy: async (url: string, resize?: number) => {
if (!settings) return url;
const opt = resize ? `rs:fit:${resize}:${resize}` : "";
const opt = resize ? `rs:fit:${resize}:${resize}/dpr:${window.devicePixelRatio}` : "";
const urlBytes = te.encode(url);
const urlEncoded = urlSafe(base64.encode(urlBytes, 0, urlBytes.byteLength));
const path = `/${opt}/${urlEncoded}`;

View File

@ -4,7 +4,7 @@ import { DefaultRelays } from "Const";
import { HexKey, TaggedRawEvent } from "@snort/nostr";
import { RelaySettings } from "@snort/nostr";
import type { AppDispatch, RootState } from "State/Store";
import { ImgProxySettings } from "Feed/ImgProxy";
import { ImgProxySettings } from "Hooks/useImgProxy";
const PrivateKeyItem = "secret";
const PublicKeyItem = "pubkey";