mirror of
https://github.com/hzrd149/nostrudel.git
synced 2025-09-20 04:20:39 +02:00
prompt user to enable nip-89 client tags
This commit is contained in:
@@ -13,7 +13,6 @@ COPY . .
|
|||||||
|
|
||||||
ENV VITE_COMMIT_HASH=""
|
ENV VITE_COMMIT_HASH=""
|
||||||
ENV VITE_APP_VERSION="custom"
|
ENV VITE_APP_VERSION="custom"
|
||||||
ENV ENABLE_CLIENT_TAG="false"
|
|
||||||
RUN yarn build
|
RUN yarn build
|
||||||
|
|
||||||
FROM nginx:stable-alpine-slim AS main
|
FROM nginx:stable-alpine-slim AS main
|
||||||
|
@@ -23,6 +23,10 @@ import {
|
|||||||
SliderFilledTrack,
|
SliderFilledTrack,
|
||||||
SliderThumb,
|
SliderThumb,
|
||||||
ModalCloseButton,
|
ModalCloseButton,
|
||||||
|
Alert,
|
||||||
|
AlertIcon,
|
||||||
|
ButtonGroup,
|
||||||
|
Text,
|
||||||
} from "@chakra-ui/react";
|
} from "@chakra-ui/react";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import { useForm } from "react-hook-form";
|
import { useForm } from "react-hook-form";
|
||||||
@@ -55,6 +59,9 @@ import useAppSettings from "../../hooks/use-app-settings";
|
|||||||
import { ErrorBoundary } from "../error-boundary";
|
import { ErrorBoundary } from "../error-boundary";
|
||||||
import { usePublishEvent } from "../../providers/global/publish-provider";
|
import { usePublishEvent } from "../../providers/global/publish-provider";
|
||||||
import { TextNoteContents } from "../note/timeline-note/text-note-contents";
|
import { TextNoteContents } from "../note/timeline-note/text-note-contents";
|
||||||
|
import useSubject from "../../hooks/use-subject";
|
||||||
|
import localSettings from "../../services/local-settings";
|
||||||
|
import useLocalStorageDisclosure from "../../hooks/use-localstorage-disclosure";
|
||||||
|
|
||||||
type FormValues = {
|
type FormValues = {
|
||||||
subject: string;
|
subject: string;
|
||||||
@@ -84,6 +91,8 @@ export default function PostModal({
|
|||||||
const publish = usePublishEvent();
|
const publish = usePublishEvent();
|
||||||
const account = useCurrentAccount()!;
|
const account = useCurrentAccount()!;
|
||||||
const { noteDifficulty } = useAppSettings();
|
const { noteDifficulty } = useAppSettings();
|
||||||
|
const addClientTag = useSubject(localSettings.addClientTag);
|
||||||
|
const promptAddClientTag = useLocalStorageDisclosure("prompt-add-client-tag", true);
|
||||||
const [miningTarget, setMiningTarget] = useState(0);
|
const [miningTarget, setMiningTarget] = useState(0);
|
||||||
const [publishAction, setPublishAction] = useState<PublishAction>();
|
const [publishAction, setPublishAction] = useState<PublishAction>();
|
||||||
const emojis = useContextEmojis();
|
const emojis = useContextEmojis();
|
||||||
@@ -303,6 +312,25 @@ export default function PostModal({
|
|||||||
<ModalBody display="flex" flexDirection="column" padding={["2", "2", "4"]} gap="2">
|
<ModalBody display="flex" flexDirection="column" padding={["2", "2", "4"]} gap="2">
|
||||||
{renderContent()}
|
{renderContent()}
|
||||||
</ModalBody>
|
</ModalBody>
|
||||||
|
|
||||||
|
{!addClientTag && promptAddClientTag.isOpen && (
|
||||||
|
<Alert status="info" whiteSpace="pre-wrap" flexDirection={{ base: "column", lg: "row" }}>
|
||||||
|
<AlertIcon hideBelow="lg" />
|
||||||
|
<Text>
|
||||||
|
Enable{" "}
|
||||||
|
<Link isExternal href="https://github.com/nostr-protocol/nips/blob/master/89.md#client-tag">
|
||||||
|
NIP-89
|
||||||
|
</Link>{" "}
|
||||||
|
client tags and let other users know what app your using to write notes
|
||||||
|
</Text>
|
||||||
|
<ButtonGroup ml="auto" size="sm" variant="ghost">
|
||||||
|
<Button onClick={promptAddClientTag.onClose}>Close</Button>
|
||||||
|
<Button colorScheme="primary" onClick={() => localSettings.addClientTag.next(true)}>
|
||||||
|
Enable
|
||||||
|
</Button>
|
||||||
|
</ButtonGroup>
|
||||||
|
</Alert>
|
||||||
|
)}
|
||||||
</ModalContent>
|
</ModalContent>
|
||||||
</Modal>
|
</Modal>
|
||||||
);
|
);
|
||||||
|
@@ -48,7 +48,6 @@ export const NOSTR_CONNECT_PERMISSIONS = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
export const NEVER_ATTACH_CLIENT_TAG = [kinds.EncryptedDirectMessage];
|
export const NEVER_ATTACH_CLIENT_TAG = [kinds.EncryptedDirectMessage];
|
||||||
export const ENABLE_CLIENT_TAG = import.meta.env.VITE_ENABLE_CLIENT_TAG !== "false";
|
|
||||||
export const NIP_89_CLIENT_TAG = [
|
export const NIP_89_CLIENT_TAG = [
|
||||||
"client",
|
"client",
|
||||||
"noStrudel",
|
"noStrudel",
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import { generateSecretKey } from "nostr-tools";
|
import { generateSecretKey } from "nostr-tools";
|
||||||
import { bytesToHex, hexToBytes } from "@noble/hashes/utils";
|
import { bytesToHex, hexToBytes } from "@noble/hashes/utils";
|
||||||
|
|
||||||
import { ENABLE_CLIENT_TAG, DEFAULT_SIGNAL_RELAYS } from "../const";
|
import { DEFAULT_SIGNAL_RELAYS } from "../const";
|
||||||
import {
|
import {
|
||||||
BooleanLocalStorageEntry,
|
BooleanLocalStorageEntry,
|
||||||
NullableNumberLocalStorageEntry,
|
NullableNumberLocalStorageEntry,
|
||||||
@@ -45,7 +45,7 @@ const webRtcRecentConnections = new LocalStorageEntry(
|
|||||||
);
|
);
|
||||||
|
|
||||||
// posting
|
// posting
|
||||||
const addClientTag = new BooleanLocalStorageEntry("add-client-tag", ENABLE_CLIENT_TAG);
|
const addClientTag = new BooleanLocalStorageEntry("add-client-tag", false);
|
||||||
|
|
||||||
// performance
|
// performance
|
||||||
const verifyEventMethod = new LocalStorageEntry("verify-event-method", "wasm"); // wasm, internal, none
|
const verifyEventMethod = new LocalStorageEntry("verify-event-method", "wasm"); // wasm, internal, none
|
||||||
|
@@ -180,7 +180,7 @@ export default function PostSettings() {
|
|||||||
<Link isExternal href="https://github.com/nostr-protocol/nips/blob/master/89.md#client-tag">
|
<Link isExternal href="https://github.com/nostr-protocol/nips/blob/master/89.md#client-tag">
|
||||||
NIP-89
|
NIP-89
|
||||||
</Link>{" "}
|
</Link>{" "}
|
||||||
client tag to events
|
client tags on events
|
||||||
</FormHelperText>
|
</FormHelperText>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<Button
|
<Button
|
||||||
|
Reference in New Issue
Block a user