diff --git a/packages/app/config/default.json b/packages/app/config/default.json index 659ea8e6..9f3f34e5 100644 --- a/packages/app/config/default.json +++ b/packages/app/config/default.json @@ -17,7 +17,9 @@ "deck": true, "zapPool": true, "notificationGraph": true, - "communityLeaders": true + "communityLeaders": true, + "nostrAddress": true, + "pushNotifications": true }, "signUp": { "moderation": true, @@ -47,5 +49,9 @@ "alby": { "clientId": "pohiJjPhQR", "clientSecret": "GAl1YKLA3FveK1gLBYok" - } + }, + "chatChannels": [ + { "type": "telegram", "value": "https://t.me/irismessenger" }, + { "type": "nip28", "value": "23286a4602ada10cc10200553bff62a110e8dc0eacddf73277395a89ddf26a09" } + ] } diff --git a/packages/app/config/iris.json b/packages/app/config/iris.json index 84a70a99..491ce1d5 100644 --- a/packages/app/config/iris.json +++ b/packages/app/config/iris.json @@ -45,5 +45,6 @@ "wss://eden.nostr.land/": { "read": true, "write": false }, "wss://relay.nostr.band/": { "read": true, "write": true }, "wss://relay.damus.io/": { "read": true, "write": true } - } + }, + "chatChannels": [{ "type": "telegram", "value": "https://t.me/irismessenger" }] } diff --git a/packages/app/config/nostr.json b/packages/app/config/nostr.json index 33caafaf..b0eb9fe2 100644 --- a/packages/app/config/nostr.json +++ b/packages/app/config/nostr.json @@ -16,7 +16,9 @@ "deck": false, "zapPool": false, "notificationGraph": true, - "communityLeaders": false + "communityLeaders": false, + "nostrAddress": false, + "pushNotifications": false }, "signUp": { "moderation": true, diff --git a/packages/app/custom.d.ts b/packages/app/custom.d.ts index 342ac905..b4408585 100644 --- a/packages/app/custom.d.ts +++ b/packages/app/custom.d.ts @@ -1,4 +1,5 @@ /// +/// declare module "*.jpg" { const value: unknown; @@ -59,6 +60,8 @@ declare const CONFIG: { zapPool: boolean; notificationGraph: boolean; communityLeaders: boolean; + nostrAddress: boolean; + pushNotifications: boolean; }; defaultPreferences: { hideMutedNotes: boolean; @@ -96,6 +99,12 @@ declare const CONFIG: { clientId: string; clientSecret: string; }; + + // public chat channels for site + chatChannels?: Array<{ + type: "nip28" | "telegram"; + value: string; + }>; }; /** diff --git a/packages/app/src/Pages/DonatePage.tsx b/packages/app/src/Pages/DonatePage.tsx index c3067bc3..50de2342 100644 --- a/packages/app/src/Pages/DonatePage.tsx +++ b/packages/app/src/Pages/DonatePage.tsx @@ -1,8 +1,10 @@ import { HexKey } from "@snort/system"; import { useEffect, useState, useSyncExternalStore } from "react"; import { FormattedMessage } from "react-intl"; -import { Link } from "react-router-dom"; +import { Link, useNavigate } from "react-router-dom"; +import Telegram from "@/assets/img/telegram.svg"; +import { Nip28ChatSystem } from "@/chat/nip28"; import AsyncButton from "@/Components/Button/AsyncButton"; import Copy from "@/Components/Copy/Copy"; import ZapButton from "@/Components/Event/ZapButton"; @@ -64,6 +66,7 @@ const DonatePage = () => { const [today, setSumToday] = useState(); const [onChain, setOnChain] = useState(""); const api = new SnortApi(ApiHost); + const navigate = useNavigate(); async function getOnChainAddress() { const { address } = await api.onChainDonation(); @@ -91,28 +94,24 @@ const DonatePage = () => { return (
-

- -

- https://git.v0l.io/Kieran/snort + + here ), }} @@ -124,18 +123,51 @@ const DonatePage = () => { id="VfhYxG" values={{ here: ( - + ), }} />

-

- - Telegram - -

+ {CONFIG.chatChannels && ( + <> +

+ +

+
+ {CONFIG.chatChannels.map(a => { + switch (a.type) { + case "telegram": { + return ( + { + window.open(a.value, "_blank", "noreferrer"); + }}> + + + + ); + } + case "nip28": { + return ( + { + navigate(`/messages/${Nip28ChatSystem.chatId(a.value)}`); + }}> + + + + ); + } + } + })} +
+ + )} +

+ +

diff --git a/packages/app/src/Pages/settings/Menu.tsx b/packages/app/src/Pages/settings/Menu.tsx index 39d51c71..9729650d 100644 --- a/packages/app/src/Pages/settings/Menu.tsx +++ b/packages/app/src/Pages/settings/Menu.tsx @@ -45,12 +45,16 @@ const SettingsIndex = () => { message: , path: "keys", }, - { - icon: "badge", - iconBg: "bg-pink-500", - message: , - path: "handle", - }, + ...(CONFIG.features.nostrAddress + ? [ + { + icon: "badge", + iconBg: "bg-pink-500", + message: , + path: "handle", + }, + ] + : []), { icon: "gear", iconBg: "bg-slate-500", @@ -96,18 +100,26 @@ const SettingsIndex = () => { message: , path: "moderation", }, - { - icon: "bell-outline", - iconBg: "bg-red-500", - message: , - path: "notifications", - }, - { - icon: "link", - iconBg: "bg-blue-500", - message: , - path: "invite", - }, + ...(CONFIG.features.pushNotifications + ? [ + { + icon: "bell-outline", + iconBg: "bg-red-500", + message: , + path: "notifications", + }, + ] + : []), + ...(CONFIG.features.communityLeaders + ? [ + { + icon: "link", + iconBg: "bg-blue-500", + message: , + path: "invite", + }, + ] + : []), { icon: "hard-drive", iconBg: "bg-cyan-500", diff --git a/packages/app/src/Utils/Notifications.ts b/packages/app/src/Utils/Notifications.ts index cca512b7..8d5fd055 100644 --- a/packages/app/src/Utils/Notifications.ts +++ b/packages/app/src/Utils/Notifications.ts @@ -74,6 +74,9 @@ export async function sendNotification(state: LoginSession, req: NotificationReq } export async function subscribeToNotifications(publisher: EventPublisher) { + if (!CONFIG.features.pushNotifications) { + return; + } // request permissions to send notifications if ("Notification" in window) { try { diff --git a/packages/app/src/assets/img/telegram.svg b/packages/app/src/assets/img/telegram.svg new file mode 100644 index 00000000..c67526fd --- /dev/null +++ b/packages/app/src/assets/img/telegram.svg @@ -0,0 +1,16 @@ + + + + Artboard + Created with Sketch. + + + + + + + + + + + \ No newline at end of file diff --git a/packages/app/src/lang.json b/packages/app/src/lang.json index ad1ea851..73829652 100644 --- a/packages/app/src/lang.json +++ b/packages/app/src/lang.json @@ -691,6 +691,9 @@ "LF5kYT": { "defaultMessage": "Other Connections" }, + "LKw/ue": { + "defaultMessage": "Check out the code {link}" + }, "LR1XjT": { "defaultMessage": "Pin too short" }, @@ -902,6 +905,9 @@ "TDR5ge": { "defaultMessage": "Media in notes will automatically be shown for selected people, otherwise only the link will show" }, + "TH1fFo": { + "defaultMessage": "Telegram" + }, "TJo5E6": { "defaultMessage": "Preview" }, @@ -1023,9 +1029,6 @@ "XgWvGA": { "defaultMessage": "Reactions" }, - "XhpBfA": { - "defaultMessage": "{site} is an open source project built by passionate people in their free time, your donations are greatly appreciated" - }, "Xnimz0": { "defaultMessage": "Sending from {wallet}" }, @@ -1226,6 +1229,9 @@ "fBlba3": { "defaultMessage": "Thanks for using {site}, please consider donating if you can." }, + "fLIvbC": { + "defaultMessage": "Snort is an open source project built by passionate people in their free time, your donations are greatly appreciated" + }, "fOksnD": { "defaultMessage": "Can't vote because LNURL service does not support zaps" }, @@ -1579,6 +1585,9 @@ "rmdsT4": { "defaultMessage": "{n} days" }, + "rn52n9": { + "defaultMessage": "Public Chat Channels" + }, "rx1i0i": { "defaultMessage": "Short link" }, @@ -1615,9 +1624,6 @@ "u/vOPu": { "defaultMessage": "Paid" }, - "u4bHcR": { - "defaultMessage": "Check out the code here: {link}" - }, "u9NoC1": { "defaultMessage": "Name must be less than {limit} characters" }, @@ -1679,6 +1685,9 @@ "defaultMessage": "Anon", "description": "Anonymous Zap" }, + "whSrs+": { + "defaultMessage": "Nostr Public Chat" + }, "wih7iJ": { "defaultMessage": "name is blocked" }, @@ -1737,9 +1746,6 @@ "yCLnBC": { "defaultMessage": "LNURL or Lightning Address" }, - "yNBPJp": { - "defaultMessage": "Help fund the development of {site}" - }, "zCb8fX": { "defaultMessage": "Weight" }, diff --git a/packages/app/src/translations/en.json b/packages/app/src/translations/en.json index dad8f98c..e5cf15b7 100644 --- a/packages/app/src/translations/en.json +++ b/packages/app/src/translations/en.json @@ -228,6 +228,7 @@ "KtsyO0": "Enter Pin", "LBAnc7": "View as user?", "LF5kYT": "Other Connections", + "LKw/ue": "Check out the code {link}", "LR1XjT": "Pin too short", "LXxsbk": "Anonymous", "LgbKvU": "Comment", @@ -297,6 +298,7 @@ "Ss0sWu": "Pay Now", "StKzTE": "The author has marked this note as a sensitive topic", "TDR5ge": "Media in notes will automatically be shown for selected people, otherwise only the link will show", + "TH1fFo": "Telegram", "TJo5E6": "Preview", "TP/cMX": "Ended", "TaeBqw": "Sign in with Nostr Extension", @@ -337,7 +339,6 @@ "XQiFEl": "Follows Relay Health", "XXm7jJ": "Trending Hashtags", "XgWvGA": "Reactions", - "XhpBfA": "{site} is an open source project built by passionate people in their free time, your donations are greatly appreciated", "Xnimz0": "Sending from {wallet}", "Xopqkl": "Your default zap amount is {number} sats, example values are calculated from this.", "XrSk2j": "Redeem", @@ -404,6 +405,7 @@ "f2CAxA": "Dump", "fBI91o": "Zap", "fBlba3": "Thanks for using {site}, please consider donating if you can.", + "fLIvbC": "Snort is an open source project built by passionate people in their free time, your donations are greatly appreciated", "fOksnD": "Can't vote because LNURL service does not support zaps", "fQN+tq": "Show posts that have a content warning tag", "fWZYP5": "Pinned", @@ -521,6 +523,7 @@ "rT14Ow": "Add Relays", "rfuMjE": "(Default)", "rmdsT4": "{n} days", + "rn52n9": "Public Chat Channels", "rx1i0i": "Short link", "sKDn4e": "Show Badges", "sUNhQE": "user", @@ -533,7 +536,6 @@ "tjpYlr": "Relay Metrics", "ttxS0b": "Supporter Badge", "u/vOPu": "Paid", - "u4bHcR": "Check out the code here: {link}", "u9NoC1": "Name must be less than {limit} characters", "uCk8r+": "Already have an account?", "uSV4Ti": "Reposts need to be manually confirmed", @@ -554,6 +556,7 @@ "wEQDC6": "Edit", "wSZR47": "Submit", "wWLwvh": "Anon", + "whSrs+": "Nostr Public Chat", "wih7iJ": "name is blocked", "wofVHy": "Moderation", "wqyN/i": "Find out more info about {service} at {link}", @@ -573,7 +576,6 @@ "y/bmsG": "Allow", "y1Z3or": "Language", "yCLnBC": "LNURL or Lightning Address", - "yNBPJp": "Help fund the development of {site}", "zCb8fX": "Weight", "zFegDD": "Contact", "zINlao": "Owner",