forked from Kieran/snort
commit
c82fcd63ae
@ -2,10 +2,15 @@ import "./Avatar.css";
|
|||||||
import Nostrich from "../nostrich.jpg";
|
import Nostrich from "../nostrich.jpg";
|
||||||
import { CSSProperties } from "react";
|
import { CSSProperties } from "react";
|
||||||
import type { UserMetadata } from "Nostr";
|
import type { UserMetadata } from "Nostr";
|
||||||
|
import { useSelector } from "react-redux";
|
||||||
|
import { RootState } from "State/Store";
|
||||||
|
import { ApiHost } from "Const";
|
||||||
|
|
||||||
const Avatar = ({ user, ...rest }: { user?: UserMetadata, onClick?: () => void }) => {
|
const Avatar = ({ user, ...rest }: { user?: UserMetadata, onClick?: () => void }) => {
|
||||||
const avatarUrl = (user?.picture?.length ?? 0) === 0 ? Nostrich : user?.picture
|
const useImageProxy = useSelector((s: RootState) => s.login.preferences.useImageProxy);
|
||||||
|
|
||||||
|
const avatarUrl = (user?.picture?.length ?? 0) === 0 ? Nostrich :
|
||||||
|
(useImageProxy ? `${ApiHost}/api/v1/imgproxy/${window.btoa(user!.picture!)}` : user?.picture)
|
||||||
const backgroundImage = `url(${avatarUrl})`
|
const backgroundImage = `url(${avatarUrl})`
|
||||||
const domain = user?.nip05 && user.nip05.split('@')[1]
|
const domain = user?.nip05 && user.nip05.split('@')[1]
|
||||||
const style = { '--img-url': backgroundImage } as CSSProperties
|
const style = { '--img-url': backgroundImage } as CSSProperties
|
||||||
|
@ -39,7 +39,7 @@ export default function NoteReaction(props: NoteReactionProps) {
|
|||||||
* Some clients embed the reposted note in the content
|
* Some clients embed the reposted note in the content
|
||||||
*/
|
*/
|
||||||
function extractRoot() {
|
function extractRoot() {
|
||||||
if (ev?.Kind === EventKind.Repost && ev.Content.length > 0) {
|
if (ev?.Kind === EventKind.Repost && ev.Content.length > 0 && ev.Content !== "#[0]") {
|
||||||
try {
|
try {
|
||||||
let r: RawEvent = JSON.parse(ev.Content);
|
let r: RawEvent = JSON.parse(ev.Content);
|
||||||
return r as TaggedRawEvent;
|
return r as TaggedRawEvent;
|
||||||
|
@ -71,6 +71,15 @@ const PreferencesPage = () => {
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="card flex">
|
||||||
|
<div className="flex f-col f-grow">
|
||||||
|
<div>Image proxy</div>
|
||||||
|
<small>Use the caching image proxy to load avatars</small>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<input type="checkbox" checked={perf.useImageProxy} onChange={e => dispatch(setPreferences({ ...perf, useImageProxy: e.target.checked }))} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div className="card flex">
|
<div className="card flex">
|
||||||
<div className="flex f-col f-grow">
|
<div className="flex f-col f-grow">
|
||||||
<div>Debug Menus</div>
|
<div>Debug Menus</div>
|
||||||
|
@ -53,7 +53,12 @@ export interface UserPreferences {
|
|||||||
/**
|
/**
|
||||||
* File uploading service to upload attachments to
|
* File uploading service to upload attachments to
|
||||||
*/
|
*/
|
||||||
fileUploader: "void.cat" | "nostr.build"
|
fileUploader: "void.cat" | "nostr.build",
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use image proxy service to compress avatars
|
||||||
|
*/
|
||||||
|
useImageProxy: boolean,
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface LoginStore {
|
export interface LoginStore {
|
||||||
@ -155,7 +160,8 @@ const InitState = {
|
|||||||
confirmReposts: false,
|
confirmReposts: false,
|
||||||
showDebugMenus: false,
|
showDebugMenus: false,
|
||||||
autoShowLatest: false,
|
autoShowLatest: false,
|
||||||
fileUploader: "void.cat"
|
fileUploader: "void.cat",
|
||||||
|
useImageProxy: true
|
||||||
}
|
}
|
||||||
} as LoginStore;
|
} as LoginStore;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user