mirror of
https://github.com/hzrd149/nostrudel.git
synced 2025-03-17 13:21:44 +01:00
prompt user to enable nip-89 client tags
This commit is contained in:
parent
c648923508
commit
2435cd6ad8
@ -13,7 +13,6 @@ COPY . .
|
||||
|
||||
ENV VITE_COMMIT_HASH=""
|
||||
ENV VITE_APP_VERSION="custom"
|
||||
ENV ENABLE_CLIENT_TAG="false"
|
||||
RUN yarn build
|
||||
|
||||
FROM nginx:stable-alpine-slim AS main
|
||||
|
@ -23,6 +23,10 @@ import {
|
||||
SliderFilledTrack,
|
||||
SliderThumb,
|
||||
ModalCloseButton,
|
||||
Alert,
|
||||
AlertIcon,
|
||||
ButtonGroup,
|
||||
Text,
|
||||
} from "@chakra-ui/react";
|
||||
import dayjs from "dayjs";
|
||||
import { useForm } from "react-hook-form";
|
||||
@ -55,6 +59,9 @@ import useAppSettings from "../../hooks/use-app-settings";
|
||||
import { ErrorBoundary } from "../error-boundary";
|
||||
import { usePublishEvent } from "../../providers/global/publish-provider";
|
||||
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 = {
|
||||
subject: string;
|
||||
@ -84,6 +91,8 @@ export default function PostModal({
|
||||
const publish = usePublishEvent();
|
||||
const account = useCurrentAccount()!;
|
||||
const { noteDifficulty } = useAppSettings();
|
||||
const addClientTag = useSubject(localSettings.addClientTag);
|
||||
const promptAddClientTag = useLocalStorageDisclosure("prompt-add-client-tag", true);
|
||||
const [miningTarget, setMiningTarget] = useState(0);
|
||||
const [publishAction, setPublishAction] = useState<PublishAction>();
|
||||
const emojis = useContextEmojis();
|
||||
@ -303,6 +312,25 @@ export default function PostModal({
|
||||
<ModalBody display="flex" flexDirection="column" padding={["2", "2", "4"]} gap="2">
|
||||
{renderContent()}
|
||||
</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>
|
||||
</Modal>
|
||||
);
|
||||
|
@ -48,7 +48,6 @@ export const NOSTR_CONNECT_PERMISSIONS = [
|
||||
];
|
||||
|
||||
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 = [
|
||||
"client",
|
||||
"noStrudel",
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { generateSecretKey } from "nostr-tools";
|
||||
import { bytesToHex, hexToBytes } from "@noble/hashes/utils";
|
||||
|
||||
import { ENABLE_CLIENT_TAG, DEFAULT_SIGNAL_RELAYS } from "../const";
|
||||
import { DEFAULT_SIGNAL_RELAYS } from "../const";
|
||||
import {
|
||||
BooleanLocalStorageEntry,
|
||||
NullableNumberLocalStorageEntry,
|
||||
@ -45,7 +45,7 @@ const webRtcRecentConnections = new LocalStorageEntry(
|
||||
);
|
||||
|
||||
// posting
|
||||
const addClientTag = new BooleanLocalStorageEntry("add-client-tag", ENABLE_CLIENT_TAG);
|
||||
const addClientTag = new BooleanLocalStorageEntry("add-client-tag", false);
|
||||
|
||||
// performance
|
||||
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">
|
||||
NIP-89
|
||||
</Link>{" "}
|
||||
client tag to events
|
||||
client tags on events
|
||||
</FormHelperText>
|
||||
</FormControl>
|
||||
<Button
|
||||
|
Loading…
x
Reference in New Issue
Block a user