From f6a51fd80b2dad812fe9678f26fa9a8f00171fc0 Mon Sep 17 00:00:00 2001 From: Kieran Date: Thu, 25 May 2023 20:20:45 +0100 Subject: [PATCH 01/15] feat: render image/video in link previews --- packages/app/src/Element/LinkPreview.tsx | 38 ++++++++++++++++++++---- packages/app/src/SnortApi.ts | 1 + 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/packages/app/src/Element/LinkPreview.tsx b/packages/app/src/Element/LinkPreview.tsx index 83512264..e6d5881f 100644 --- a/packages/app/src/Element/LinkPreview.tsx +++ b/packages/app/src/Element/LinkPreview.tsx @@ -4,6 +4,7 @@ import { CSSProperties, useEffect, useState } from "react"; import Spinner from "Icons/Spinner"; import SnortApi, { LinkPreviewData } from "SnortApi"; import useImgProxy from "Hooks/useImgProxy"; +import { MediaElement } from "Element/MediaElement"; async function fetchUrlPreviewInfo(url: string) { const api = new SnortApi(); @@ -21,8 +22,12 @@ const LinkPreview = ({ url }: { url: string }) => { useEffect(() => { (async () => { const data = await fetchUrlPreviewInfo(url); - if (data && data.image) { - setPreview(data); + if (data) { + const type = data.og_tags?.find(a => a[0].toLowerCase() === "og:type"); + const canPreviewType = type?.[1].startsWith("image") || type?.[1].startsWith("video") || false; + if (canPreviewType || data.image) { + setPreview(data); + } } else { setPreview(null); } @@ -36,14 +41,37 @@ const LinkPreview = ({ url }: { url: string }) => { ); - const backgroundImage = preview?.image ? `url(${proxy(preview?.image)})` : ""; - const style = { "--img-url": backgroundImage } as CSSProperties; + function previewElement() { + const type = preview?.og_tags?.find(a => a[0].toLowerCase() === "og:type")?.[1]; + if (type?.startsWith("video")) { + const urlTags = ["og:video:secure_url", "og:video:url", "og:video"]; + const link = preview?.og_tags?.find(a => urlTags.includes(a[0].toLowerCase()))?.[1]; + const videoType = preview?.og_tags?.find(a => a[0].toLowerCase() === "og:video:type")?.[1] ?? "video/mp4"; + if (link) { + return ; + } + } + if (type?.startsWith("image")) { + const urlTags = ["og:image:secure_url", "og:image:url", "og:image"]; + const link = preview?.og_tags?.find(a => urlTags.includes(a[0].toLowerCase()))?.[1]; + const videoType = preview?.og_tags?.find(a => a[0].toLowerCase() === "og:image:type")?.[1] ?? "image/png"; + if (link) { + return ; + } + } + if (preview?.image) { + const backgroundImage = preview?.image ? `url(${proxy(preview?.image)})` : ""; + const style = { "--img-url": backgroundImage } as CSSProperties; + return
; + } + return null; + } return (
{preview && ( e.stopPropagation()} target="_blank" rel="noreferrer" className="ext"> - {preview?.image &&
} + {previewElement()}

{preview?.title} {preview?.description && ( diff --git a/packages/app/src/SnortApi.ts b/packages/app/src/SnortApi.ts index 404e7d78..217bfcfc 100644 --- a/packages/app/src/SnortApi.ts +++ b/packages/app/src/SnortApi.ts @@ -45,6 +45,7 @@ export interface LinkPreviewData { title?: string; description?: string; image?: string; + og_tags?: Array<[name: string, value: string]>; } export default class SnortApi { From 7ddd6eca93e7c4f7bda62e403610c274b4def0dc Mon Sep 17 00:00:00 2001 From: Kieran Date: Thu, 25 May 2023 19:21:57 +0000 Subject: [PATCH 02/15] chore: Update translations --- packages/app/src/translations/hu_HU.json | 2 +- packages/app/src/translations/sv_SE.json | 2 +- packages/app/src/translations/zh_CN.json | 2 +- packages/app/src/translations/zh_TW.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/app/src/translations/hu_HU.json b/packages/app/src/translations/hu_HU.json index efa36330..6cb6bad5 100644 --- a/packages/app/src/translations/hu_HU.json +++ b/packages/app/src/translations/hu_HU.json @@ -104,7 +104,7 @@ "Dt/Zd5": "A bejegyzésekben található média bizonyos emberek számára automatikusan megjelenik, másoknak pedig egy link lesz helyette.", "DtYelJ": "Átvitel", "E8a4yq": "Kövess néhány népszerű felhasználót", - "ELbg9p": "Data Providers", + "ELbg9p": "Adatszolgáltatók", "EPYwm7": "A privát kulcsod a jelszavad. Ha elhagyod, elveszíted a hozzáférést a fiókodhoz! Mentsd le egy biztonságos helyre, mert nincs lehetőség a privát kulcsaid helyreállítására!", "EWyQH5": "Globális", "Ebl/B2": "Fordítás erre {lang}", diff --git a/packages/app/src/translations/sv_SE.json b/packages/app/src/translations/sv_SE.json index 334f3031..e8e9f8dc 100644 --- a/packages/app/src/translations/sv_SE.json +++ b/packages/app/src/translations/sv_SE.json @@ -104,7 +104,7 @@ "Dt/Zd5": "Media i inlägg visas automatiskt för valda personer, annars visas endast länken", "DtYelJ": "Överför", "E8a4yq": "Följ några populära konton", - "ELbg9p": "Data Providers", + "ELbg9p": "Dataleverantörer", "EPYwm7": "Din privata nyckel är ditt lösenord. Om du förlorar denna nyckel, kommer du att förlora tillgång till ditt konto! Kopiera den och hålla den på en säker plats. Det finns inget sätt att återställa din privata nyckel.", "EWyQH5": "Global", "Ebl/B2": "Översätt till {lang}", diff --git a/packages/app/src/translations/zh_CN.json b/packages/app/src/translations/zh_CN.json index bfdce542..5984d3b4 100644 --- a/packages/app/src/translations/zh_CN.json +++ b/packages/app/src/translations/zh_CN.json @@ -104,7 +104,7 @@ "Dt/Zd5": "帖子中的媒体将自动显示给选定的人,否则只会显示链接", "DtYelJ": "转移", "E8a4yq": "关注一些受欢迎的帐户", - "ELbg9p": "Data Providers", + "ELbg9p": "数据提供方", "EPYwm7": "你的私钥相当于你的密码。如果你丢失了此私钥,你将无法访问你的账户!复制它并将其保存到安全的地方。你的私钥是无法重置的。", "EWyQH5": "全球", "Ebl/B2": "翻译成 {lang}", diff --git a/packages/app/src/translations/zh_TW.json b/packages/app/src/translations/zh_TW.json index 21da5ae1..25e7b325 100644 --- a/packages/app/src/translations/zh_TW.json +++ b/packages/app/src/translations/zh_TW.json @@ -104,7 +104,7 @@ "Dt/Zd5": "帖子中的媒體將自動顯示給選定的人,否則只會顯示鏈接", "DtYelJ": "轉移", "E8a4yq": "關注一些受歡迎的帳戶", - "ELbg9p": "Data Providers", + "ELbg9p": "數據提供方", "EPYwm7": "你的私鑰相當於你的密碼。如果你丟失了此私鑰,你將無法訪問你的帳戶!複製它並將其保存到安全的地方。你的私鑰是無法重置的。", "EWyQH5": "全球", "Ebl/B2": "翻譯成 {lang}", From 5b0af9ecfc813cb63c1774cc8aa7561fac4dd34a Mon Sep 17 00:00:00 2001 From: Kieran Date: Thu, 25 May 2023 20:25:28 +0100 Subject: [PATCH 03/15] bug: link preview loads forever when empty --- packages/app/src/Element/LinkPreview.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/app/src/Element/LinkPreview.tsx b/packages/app/src/Element/LinkPreview.tsx index e6d5881f..2398fa81 100644 --- a/packages/app/src/Element/LinkPreview.tsx +++ b/packages/app/src/Element/LinkPreview.tsx @@ -27,10 +27,11 @@ const LinkPreview = ({ url }: { url: string }) => { const canPreviewType = type?.[1].startsWith("image") || type?.[1].startsWith("video") || false; if (canPreviewType || data.image) { setPreview(data); + return; } - } else { - setPreview(null); } + + setPreview(null); })(); }, [url]); From 86ed386bb66597bd128913a99afc3c95c3d2a861 Mon Sep 17 00:00:00 2001 From: Kieran Date: Thu, 25 May 2023 23:16:22 +0100 Subject: [PATCH 04/15] feat: zap all on pubkey list --- packages/app/src/Element/AsyncButton.tsx | 1 + packages/app/src/Element/FollowListBase.tsx | 14 +++- packages/app/src/Element/PubkeyList.tsx | 82 ++++++++++++++++++++- packages/app/src/lang.json | 9 +++ packages/app/src/translations/en.json | 5 +- 5 files changed, 105 insertions(+), 6 deletions(-) diff --git a/packages/app/src/Element/AsyncButton.tsx b/packages/app/src/Element/AsyncButton.tsx index 808b6557..c4118afa 100644 --- a/packages/app/src/Element/AsyncButton.tsx +++ b/packages/app/src/Element/AsyncButton.tsx @@ -12,6 +12,7 @@ export default function AsyncButton(props: AsyncButtonProps) { const [loading, setLoading] = useState(false); async function handle(e: React.MouseEvent) { + e.stopPropagation(); if (loading || props.disabled) return; setLoading(true); try { diff --git a/packages/app/src/Element/FollowListBase.tsx b/packages/app/src/Element/FollowListBase.tsx index 122f6c4d..63de99a7 100644 --- a/packages/app/src/Element/FollowListBase.tsx +++ b/packages/app/src/Element/FollowListBase.tsx @@ -10,12 +10,21 @@ import messages from "./messages"; export interface FollowListBaseProps { pubkeys: HexKey[]; - title?: ReactNode | string; + title?: ReactNode; showFollowAll?: boolean; showAbout?: boolean; className?: string; + actions?: ReactNode; } -export default function FollowListBase({ pubkeys, title, showFollowAll, showAbout, className }: FollowListBaseProps) { + +export default function FollowListBase({ + pubkeys, + title, + showFollowAll, + showAbout, + className, + actions, +}: FollowListBaseProps) { const publisher = useEventPublisher(); const { follows, relays } = useLogin(); @@ -31,6 +40,7 @@ export default function FollowListBase({ pubkeys, title, showFollowAll, showAbou {(showFollowAll ?? true) && (

{title}
+ {actions} diff --git a/packages/app/src/Element/PubkeyList.tsx b/packages/app/src/Element/PubkeyList.tsx index df415ab2..6c43fe0f 100644 --- a/packages/app/src/Element/PubkeyList.tsx +++ b/packages/app/src/Element/PubkeyList.tsx @@ -1,8 +1,84 @@ import { RawEvent } from "@snort/nostr"; -import { dedupe } from "Util"; -import FollowListBase from "./FollowListBase"; +import { FormattedMessage, FormattedNumber } from "react-intl"; + +import { dedupe, hexToBech32, unixNow } from "Util"; +import FollowListBase from "Element/FollowListBase"; +import AsyncButton from "Element/AsyncButton"; +import { useWallet } from "Wallet"; +import { Toastore } from "Toaster"; +import { getDisplayName } from "Element/ProfileImage"; +import { UserCache } from "Cache"; +import useLogin from "Hooks/useLogin"; +import { LNURL } from "LNURL"; +import useEventPublisher from "Feed/EventPublisher"; +import { WalletInvoiceState } from "Wallet"; export default function PubkeyList({ ev, className }: { ev: RawEvent; className?: string }) { + const wallet = useWallet(); + const login = useLogin(); + const publisher = useEventPublisher(); const ids = dedupe(ev.tags.filter(a => a[0] === "p").map(a => a[1])); - return ; + + async function zapAll() { + for (const pk of ids) { + try { + const profile = await UserCache.get(pk); + const amtSend = login.preferences.defaultZapAmount; + const lnurl = profile?.lud16 || profile?.lud06; + if (lnurl) { + const svc = new LNURL(lnurl); + await svc.load(); + + const zap = await publisher?.zap( + amtSend * 1000, + pk, + Object.keys(login.relays.item), + undefined, + `Zap from ${hexToBech32("note", ev.id)}` + ); + const invoice = await svc.getInvoice(amtSend, undefined, zap); + if (invoice.pr) { + const rsp = await wallet.wallet?.payInvoice(invoice.pr); + if (rsp?.state === WalletInvoiceState.Paid) { + Toastore.push({ + element: ( + + ), + icon: "zap", + }); + } + } + } + } catch (e) { + console.debug("Failed to zap", pk, e); + } + } + } + + return ( + a[0] === "d")?.[1]} + actions={ + <> + zapAll()}> + , + }} + /> + + + } + /> + ); } diff --git a/packages/app/src/lang.json b/packages/app/src/lang.json index 298c44a9..f5c25c03 100644 --- a/packages/app/src/lang.json +++ b/packages/app/src/lang.json @@ -225,6 +225,9 @@ "defaultMessage": "Parent", "description": "Link to parent note in thread" }, + "AGNz71": { + "defaultMessage": "Zap All {n} sats" + }, "ASRK0S": { "defaultMessage": "This author has been muted" }, @@ -428,6 +431,9 @@ "IUZC+0": { "defaultMessage": "This means that nobody can modify notes which you have created and everybody can easily verify that the notes they are reading are created by you." }, + "Ig9/a1": { + "defaultMessage": "Sent {n} sats to {name}" + }, "Iwm6o2": { "defaultMessage": "NIP-05 Shop" }, @@ -1232,6 +1238,9 @@ "defaultMessage": "Unlock", "description": "Unlock wallet" }, + "xaj9Ba": { + "defaultMessage": "Provider" + }, "xbVgIm": { "defaultMessage": "Automatically load media" }, diff --git a/packages/app/src/translations/en.json b/packages/app/src/translations/en.json index ad813929..c27813f9 100644 --- a/packages/app/src/translations/en.json +++ b/packages/app/src/translations/en.json @@ -73,6 +73,7 @@ "9pMqYs": "Nostr Address", "9wO4wJ": "Lightning Invoice", "ADmfQT": "Parent", + "AGNz71": "Zap All {n} sats", "ASRK0S": "This author has been muted", "Adk34V": "Setup your Profile", "Ai8VHU": "Unlimited note retention on Snort relay", @@ -140,6 +141,7 @@ "IEwZvs": "Are you sure you want to unpin this note?", "INSqIz": "Twitter username...", "IUZC+0": "This means that nobody can modify notes which you have created and everybody can easily verify that the notes they are reading are created by you.", + "Ig9/a1": "Sent {n} sats to {name}", "Iwm6o2": "NIP-05 Shop", "Ix8l+B": "Trending Notes", "J+dIsA": "Subscriptions", @@ -402,6 +404,7 @@ "xJ9n2N": "Your public key", "xKflGN": "{username}''s Follows on Nostr", "xQtL3v": "Unlock", + "xaj9Ba": "Provider", "xbVgIm": "Automatically load media", "xhQMeQ": "Expires", "xmcVZ0": "Search", @@ -415,4 +418,4 @@ "zjJZBd": "You're ready!", "zonsdq": "Failed to load LNURL service", "zvCDao": "Automatically show latest notes" -} +} \ No newline at end of file From c9133cb917916d30d30b6af40e9ae01caca59115 Mon Sep 17 00:00:00 2001 From: Kieran Date: Thu, 25 May 2023 22:18:13 +0000 Subject: [PATCH 05/15] chore: Update translations --- packages/app/src/translations/ar_SA.json | 3 +++ packages/app/src/translations/da_DK.json | 3 +++ packages/app/src/translations/de_DE.json | 3 +++ packages/app/src/translations/en.json | 2 +- packages/app/src/translations/es_ES.json | 3 +++ packages/app/src/translations/fa_IR.json | 3 +++ packages/app/src/translations/fr_FR.json | 3 +++ packages/app/src/translations/hr_HR.json | 3 +++ packages/app/src/translations/hu_HU.json | 3 +++ packages/app/src/translations/id_ID.json | 3 +++ packages/app/src/translations/it_IT.json | 3 +++ packages/app/src/translations/ja_JP.json | 3 +++ packages/app/src/translations/ko_KR.json | 3 +++ packages/app/src/translations/nl_NL.json | 3 +++ packages/app/src/translations/pa_IN.json | 3 +++ packages/app/src/translations/ru_RU.json | 3 +++ packages/app/src/translations/sv_SE.json | 3 +++ packages/app/src/translations/ta_IN.json | 3 +++ packages/app/src/translations/zh_CN.json | 3 +++ packages/app/src/translations/zh_TW.json | 3 +++ 20 files changed, 58 insertions(+), 1 deletion(-) diff --git a/packages/app/src/translations/ar_SA.json b/packages/app/src/translations/ar_SA.json index 79f1c7de..528f0d29 100644 --- a/packages/app/src/translations/ar_SA.json +++ b/packages/app/src/translations/ar_SA.json @@ -73,6 +73,7 @@ "9pMqYs": "عنوان نوستر", "9wO4wJ": "فاتورة البرق", "ADmfQT": "السياق", + "AGNz71": "Zap All {n} sats", "ASRK0S": "تم كتم هذا المستخدم", "Adk34V": "قم بإعداد ملف التعريف الخاص بك", "Ai8VHU": "ابقاء المنشورات لمدة غير محدودة في موصل سنورت", @@ -140,6 +141,7 @@ "IEwZvs": "هل أنت متأكد من ازالة تثبيت هذا المنشور؟", "INSqIz": "اسم مستخدم تويتر...", "IUZC+0": "هذا يعني أنه لا يمكن لأي شخص تعديل المنشورات التي قمت بإنشائها ويمكن للجميع بسهولة التحقق من أن المنشورات التي يقرؤونها تم انشاؤها من حسابك.", + "Ig9/a1": "Sent {n} sats to {name}", "Iwm6o2": "سوق NIP-05", "Ix8l+B": "Trending Notes", "J+dIsA": "الإشتراكات", @@ -402,6 +404,7 @@ "xJ9n2N": "مفتاحك العام", "xKflGN": "يتابع {username} على نوستر", "xQtL3v": "فتح القفل", + "xaj9Ba": "Provider", "xbVgIm": "تحميل الوسائط تلقائيًا", "xhQMeQ": "ينتهي", "xmcVZ0": "البحث", diff --git a/packages/app/src/translations/da_DK.json b/packages/app/src/translations/da_DK.json index ad813929..d2eacb43 100644 --- a/packages/app/src/translations/da_DK.json +++ b/packages/app/src/translations/da_DK.json @@ -73,6 +73,7 @@ "9pMqYs": "Nostr Address", "9wO4wJ": "Lightning Invoice", "ADmfQT": "Parent", + "AGNz71": "Zap All {n} sats", "ASRK0S": "This author has been muted", "Adk34V": "Setup your Profile", "Ai8VHU": "Unlimited note retention on Snort relay", @@ -140,6 +141,7 @@ "IEwZvs": "Are you sure you want to unpin this note?", "INSqIz": "Twitter username...", "IUZC+0": "This means that nobody can modify notes which you have created and everybody can easily verify that the notes they are reading are created by you.", + "Ig9/a1": "Sent {n} sats to {name}", "Iwm6o2": "NIP-05 Shop", "Ix8l+B": "Trending Notes", "J+dIsA": "Subscriptions", @@ -402,6 +404,7 @@ "xJ9n2N": "Your public key", "xKflGN": "{username}''s Follows on Nostr", "xQtL3v": "Unlock", + "xaj9Ba": "Provider", "xbVgIm": "Automatically load media", "xhQMeQ": "Expires", "xmcVZ0": "Search", diff --git a/packages/app/src/translations/de_DE.json b/packages/app/src/translations/de_DE.json index e87142c7..8a06759d 100644 --- a/packages/app/src/translations/de_DE.json +++ b/packages/app/src/translations/de_DE.json @@ -73,6 +73,7 @@ "9pMqYs": "Nostr Adresse", "9wO4wJ": "Lightning Zahlungsanforderung", "ADmfQT": "Vorherige", + "AGNz71": "Zap All {n} sats", "ASRK0S": "Dieser Autor wurde stummgeschalten", "Adk34V": "Profil erstellen", "Ai8VHU": "Unbegrenzte Note Speicherung auf Snort Relais", @@ -140,6 +141,7 @@ "IEwZvs": "Sind sie sicher, dass sie diese Notiz entpinnen möchten?", "INSqIz": "Twitter Benuzername...", "IUZC+0": "Das bedeutet, dass niemand Ihre Notizen ändern kann, und jeder kann leicht überprüfen ob die Notizen die er liest wirklich von Ihnen erstellt wurden", + "Ig9/a1": "Sent {n} sats to {name}", "Iwm6o2": "NIP-05 Shop", "Ix8l+B": "Trending Notes", "J+dIsA": "Abonnements", @@ -402,6 +404,7 @@ "xJ9n2N": "Dein öffentlicher Schlüssel", "xKflGN": "{username}''s folgt auf Nostr", "xQtL3v": "Entsperren", + "xaj9Ba": "Provider", "xbVgIm": "Medien automatisch laden", "xhQMeQ": "Ablaufdatum", "xmcVZ0": "Suche", diff --git a/packages/app/src/translations/en.json b/packages/app/src/translations/en.json index c27813f9..d2eacb43 100644 --- a/packages/app/src/translations/en.json +++ b/packages/app/src/translations/en.json @@ -418,4 +418,4 @@ "zjJZBd": "You're ready!", "zonsdq": "Failed to load LNURL service", "zvCDao": "Automatically show latest notes" -} \ No newline at end of file +} diff --git a/packages/app/src/translations/es_ES.json b/packages/app/src/translations/es_ES.json index 7caa4e15..86f68f75 100644 --- a/packages/app/src/translations/es_ES.json +++ b/packages/app/src/translations/es_ES.json @@ -73,6 +73,7 @@ "9pMqYs": "Dirección Nostr", "9wO4wJ": "Factura Lightning", "ADmfQT": "Pariente", + "AGNz71": "Zap All {n} sats", "ASRK0S": "Este autor ha sido silenciado", "Adk34V": "Configura tu Perfil", "Ai8VHU": "Retención de nota ilimitada en relé Snort", @@ -140,6 +141,7 @@ "IEwZvs": "¿Estás seguro de que quieres desmarcar esta nota?", "INSqIz": "Usuario en Twitter...", "IUZC+0": "Esto significa que nadie puede modificar notas que tú has creado y que todo el mundo puede verificar que las notas que leen han sido escritas por ti.", + "Ig9/a1": "Sent {n} sats to {name}", "Iwm6o2": "Tienda NIP-05", "Ix8l+B": "Trending Notes", "J+dIsA": "Suscripciones", @@ -402,6 +404,7 @@ "xJ9n2N": "Tu clave pública", "xKflGN": "Seguidos de {username} en Nostr", "xQtL3v": "Desbloquear", + "xaj9Ba": "Provider", "xbVgIm": "Cargar medios automáticamente", "xhQMeQ": "Expira", "xmcVZ0": "Búsqueda", diff --git a/packages/app/src/translations/fa_IR.json b/packages/app/src/translations/fa_IR.json index a7a875ab..0594d70b 100644 --- a/packages/app/src/translations/fa_IR.json +++ b/packages/app/src/translations/fa_IR.json @@ -73,6 +73,7 @@ "9pMqYs": "آدرس ناستر", "9wO4wJ": "صورتحساب لایتنینگ", "ADmfQT": "والد", + "AGNz71": "Zap All {n} sats", "ASRK0S": "این نویسنده بیصدا شده است", "Adk34V": "نمایه خود را راه اندازی کنید", "Ai8VHU": "نگهداری نامحدود یادداشت ها روی رله", @@ -140,6 +141,7 @@ "IEwZvs": "مطمئنید می خواهید سنجاق یادداشت را بردارید؟", "INSqIz": "نام کاربری توییتر...", "IUZC+0": "این بدان معنی است که هیچ کس نمی تواند یادداشتی که ایجاد کرده اید را تغییر دهد و همه می توانند به آسانی تایید کنند که یادداشت هایی که می خوانند توسط شما ایجاد شده اند.", + "Ig9/a1": "Sent {n} sats to {name}", "Iwm6o2": "فروشگاه NIP-05", "Ix8l+B": "داغ‌ترین‌ یادداشت ها", "J+dIsA": "اشتراک", @@ -402,6 +404,7 @@ "xJ9n2N": "کلید عمومی شما", "xKflGN": "دنبال شوندگان {username} در ناستر", "xQtL3v": "باز کردن", + "xaj9Ba": "Provider", "xbVgIm": "بارگیری خودکار رسانه", "xhQMeQ": "منقضی می شود", "xmcVZ0": "جستجو", diff --git a/packages/app/src/translations/fr_FR.json b/packages/app/src/translations/fr_FR.json index 8680fb22..fe3d244d 100644 --- a/packages/app/src/translations/fr_FR.json +++ b/packages/app/src/translations/fr_FR.json @@ -73,6 +73,7 @@ "9pMqYs": "Adresse Nostr", "9wO4wJ": "Facture Lightning", "ADmfQT": "Parent", + "AGNz71": "Zap All {n} sats", "ASRK0S": "Cet auteur a été mis en sourdine", "Adk34V": "Configurer votre profil", "Ai8VHU": "Unlimited note retention on Snort relay", @@ -140,6 +141,7 @@ "IEwZvs": "Êtes-vous sûr de vouloir désépingler cette note?", "INSqIz": "Nom d'utilisateur Twitter...", "IUZC+0": "Cela signifie que personne ne peut modifier les notes que vous avez créées et que tout le monde peut facilement vérifier que les notes qu'ils lisent sont créées par vous.", + "Ig9/a1": "Sent {n} sats to {name}", "Iwm6o2": "NIP-05 Shop", "Ix8l+B": "Trending Notes", "J+dIsA": "Subscriptions", @@ -402,6 +404,7 @@ "xJ9n2N": "Votre clé publique", "xKflGN": "{username}'' suit sur Nostr", "xQtL3v": "Déverrouiller", + "xaj9Ba": "Provider", "xbVgIm": "Charger automatiquement le média", "xhQMeQ": "Expires", "xmcVZ0": "Chercher", diff --git a/packages/app/src/translations/hr_HR.json b/packages/app/src/translations/hr_HR.json index ad9ee7c9..7c4a06ea 100644 --- a/packages/app/src/translations/hr_HR.json +++ b/packages/app/src/translations/hr_HR.json @@ -73,6 +73,7 @@ "9pMqYs": "Nostr Adresa", "9wO4wJ": "Lightning račun", "ADmfQT": "Matični", + "AGNz71": "Zap All {n} sats", "ASRK0S": "Ovaj je autor utišan", "Adk34V": "Postavi svoj Profil", "Ai8VHU": "Neograničeno zadržavanje bilješki na releju Snort", @@ -140,6 +141,7 @@ "IEwZvs": "Jeste sigurni da želite otkačiti bilješku?", "INSqIz": "Twitter korisničko ime...", "IUZC+0": "Ovo znači da nitko ne može promijeniti bilješke koje ste kreirali te svatko jednostavno može verificirati da ste bilješke koje čitaju Vi kreirali.", + "Ig9/a1": "Sent {n} sats to {name}", "Iwm6o2": "NIP-05 Trgovina", "Ix8l+B": "Trending Notes", "J+dIsA": "Pretplate", @@ -402,6 +404,7 @@ "xJ9n2N": "Vaš javni ključ", "xKflGN": "{username}'ova praćenja na Nostr-u", "xQtL3v": "Otključaj", + "xaj9Ba": "Provider", "xbVgIm": "Automatski učitaj medije", "xhQMeQ": "Isteče", "xmcVZ0": "Pretraži", diff --git a/packages/app/src/translations/hu_HU.json b/packages/app/src/translations/hu_HU.json index 6cb6bad5..22b1aea1 100644 --- a/packages/app/src/translations/hu_HU.json +++ b/packages/app/src/translations/hu_HU.json @@ -73,6 +73,7 @@ "9pMqYs": "Nostr Cím", "9wO4wJ": "Lightning Számla", "ADmfQT": "Szülő", + "AGNz71": "Zap All {n} sats", "ASRK0S": "Ez a felhasználó némítva", "Adk34V": "Profilod kitöltése", "Ai8VHU": "A Snort csomóponton korlátlan bejegyzés megőrzés", @@ -140,6 +141,7 @@ "IEwZvs": "Biztos hogy a bejegyzés kiemelését visszavonod?", "INSqIz": "Twitter felhasználónév...", "IUZC+0": "Ez azt jelenti, hogy a te általad létrehozott bejegyzéseket senki sem tudja módosítani és bárki ellenőrizheti hogy tényleg te írtad.", + "Ig9/a1": "Sent {n} sats to {name}", "Iwm6o2": "NIP-05 Bolt", "Ix8l+B": "Felkapott Bejegyzések", "J+dIsA": "Előfizetések", @@ -402,6 +404,7 @@ "xJ9n2N": "A te publikus kulcsod", "xKflGN": "{username} a Nostr-án követ", "xQtL3v": "Feloldás", + "xaj9Ba": "Provider", "xbVgIm": "Média automatikus betöltése", "xhQMeQ": "Lejár", "xmcVZ0": "Keresés", diff --git a/packages/app/src/translations/id_ID.json b/packages/app/src/translations/id_ID.json index 6439b050..bc83940b 100644 --- a/packages/app/src/translations/id_ID.json +++ b/packages/app/src/translations/id_ID.json @@ -73,6 +73,7 @@ "9pMqYs": "Nostr Address", "9wO4wJ": "Faktur Lightning", "ADmfQT": "Orang Tua", + "AGNz71": "Zap All {n} sats", "ASRK0S": "Penulis ini telah dibisukan", "Adk34V": "Siapkan Profil Anda", "Ai8VHU": "Unlimited note retention on Snort relay", @@ -140,6 +141,7 @@ "IEwZvs": "Apakah Anda yakin Anda ingin menghilangkan sematan catatan ini?", "INSqIz": "Nama pengguna Twitter...", "IUZC+0": "Ini berarti bahwa tidak seorang pun dapat mengubah catatan yang telah Anda buat dan semua orang dapat dengan mudah memverifikasi bahwa catatan yang mereka baca dibuat oleh Anda.", + "Ig9/a1": "Sent {n} sats to {name}", "Iwm6o2": "NIP-05 Shop", "Ix8l+B": "Trending Notes", "J+dIsA": "Subscriptions", @@ -402,6 +404,7 @@ "xJ9n2N": "kunci publik Anda", "xKflGN": "Yang diikuti {username} di Nostr", "xQtL3v": "Unlock", + "xaj9Ba": "Provider", "xbVgIm": "Memuat media secara otomatis", "xhQMeQ": "Expires", "xmcVZ0": "Cari", diff --git a/packages/app/src/translations/it_IT.json b/packages/app/src/translations/it_IT.json index b941c0f1..14aeafc5 100644 --- a/packages/app/src/translations/it_IT.json +++ b/packages/app/src/translations/it_IT.json @@ -73,6 +73,7 @@ "9pMqYs": "Indirizzo Nostr", "9wO4wJ": "Fattura Lightning", "ADmfQT": "Parente", + "AGNz71": "Zap All {n} sats", "ASRK0S": "Questo autore è stato silenziato", "Adk34V": "Configura il tuo profilo", "Ai8VHU": "Ritenzione illimitata della nota sul relè Snort", @@ -140,6 +141,7 @@ "IEwZvs": "Sei sicuro di voler staccare questa nota?", "INSqIz": "Nome utente Twitter...", "IUZC+0": "Questo significa che nessuno può modificare le note che hai creato e tutti possono facilmente verificare che le note che stanno leggendo sono create da te.", + "Ig9/a1": "Sent {n} sats to {name}", "Iwm6o2": "NIP-05 Shop", "Ix8l+B": "Trending Notes", "J+dIsA": "Abbonamenti", @@ -402,6 +404,7 @@ "xJ9n2N": "La tua chiave pubblica", "xKflGN": "Seguito da {username} su Nostr", "xQtL3v": "Sblocca", + "xaj9Ba": "Provider", "xbVgIm": "Carica automaticamente i media", "xhQMeQ": "Scadenza", "xmcVZ0": "Cerca", diff --git a/packages/app/src/translations/ja_JP.json b/packages/app/src/translations/ja_JP.json index 3e2c3a9f..c195e5ef 100644 --- a/packages/app/src/translations/ja_JP.json +++ b/packages/app/src/translations/ja_JP.json @@ -73,6 +73,7 @@ "9pMqYs": "Nostrアドレス", "9wO4wJ": "ライトニング インボイス", "ADmfQT": "返信元", + "AGNz71": "Zap All {n} sats", "ASRK0S": "投稿者はミュートされています", "Adk34V": "プロフィールを設定", "Ai8VHU": "Snortリレーにおける無期限のノート保持", @@ -140,6 +141,7 @@ "IEwZvs": "本当にこの投稿のピン留めを解除しますか?", "INSqIz": "Twitterユーザー名を入力", "IUZC+0": "このため、あなたが作成した投稿を誰も変更できず、誰でも簡単にあなたが作成した投稿であることを確認できます。", + "Ig9/a1": "Sent {n} sats to {name}", "Iwm6o2": "NIP-05ショップ", "Ix8l+B": "Trending Notes", "J+dIsA": "サブスクリプション", @@ -402,6 +404,7 @@ "xJ9n2N": "公開鍵", "xKflGN": "{username}のNostrでのフォロー", "xQtL3v": "アンロック", + "xaj9Ba": "Provider", "xbVgIm": "メディアを自動で読み込む", "xhQMeQ": "有効期限", "xmcVZ0": "検索", diff --git a/packages/app/src/translations/ko_KR.json b/packages/app/src/translations/ko_KR.json index ad813929..d2eacb43 100644 --- a/packages/app/src/translations/ko_KR.json +++ b/packages/app/src/translations/ko_KR.json @@ -73,6 +73,7 @@ "9pMqYs": "Nostr Address", "9wO4wJ": "Lightning Invoice", "ADmfQT": "Parent", + "AGNz71": "Zap All {n} sats", "ASRK0S": "This author has been muted", "Adk34V": "Setup your Profile", "Ai8VHU": "Unlimited note retention on Snort relay", @@ -140,6 +141,7 @@ "IEwZvs": "Are you sure you want to unpin this note?", "INSqIz": "Twitter username...", "IUZC+0": "This means that nobody can modify notes which you have created and everybody can easily verify that the notes they are reading are created by you.", + "Ig9/a1": "Sent {n} sats to {name}", "Iwm6o2": "NIP-05 Shop", "Ix8l+B": "Trending Notes", "J+dIsA": "Subscriptions", @@ -402,6 +404,7 @@ "xJ9n2N": "Your public key", "xKflGN": "{username}''s Follows on Nostr", "xQtL3v": "Unlock", + "xaj9Ba": "Provider", "xbVgIm": "Automatically load media", "xhQMeQ": "Expires", "xmcVZ0": "Search", diff --git a/packages/app/src/translations/nl_NL.json b/packages/app/src/translations/nl_NL.json index ad813929..d2eacb43 100644 --- a/packages/app/src/translations/nl_NL.json +++ b/packages/app/src/translations/nl_NL.json @@ -73,6 +73,7 @@ "9pMqYs": "Nostr Address", "9wO4wJ": "Lightning Invoice", "ADmfQT": "Parent", + "AGNz71": "Zap All {n} sats", "ASRK0S": "This author has been muted", "Adk34V": "Setup your Profile", "Ai8VHU": "Unlimited note retention on Snort relay", @@ -140,6 +141,7 @@ "IEwZvs": "Are you sure you want to unpin this note?", "INSqIz": "Twitter username...", "IUZC+0": "This means that nobody can modify notes which you have created and everybody can easily verify that the notes they are reading are created by you.", + "Ig9/a1": "Sent {n} sats to {name}", "Iwm6o2": "NIP-05 Shop", "Ix8l+B": "Trending Notes", "J+dIsA": "Subscriptions", @@ -402,6 +404,7 @@ "xJ9n2N": "Your public key", "xKflGN": "{username}''s Follows on Nostr", "xQtL3v": "Unlock", + "xaj9Ba": "Provider", "xbVgIm": "Automatically load media", "xhQMeQ": "Expires", "xmcVZ0": "Search", diff --git a/packages/app/src/translations/pa_IN.json b/packages/app/src/translations/pa_IN.json index ad813929..d2eacb43 100644 --- a/packages/app/src/translations/pa_IN.json +++ b/packages/app/src/translations/pa_IN.json @@ -73,6 +73,7 @@ "9pMqYs": "Nostr Address", "9wO4wJ": "Lightning Invoice", "ADmfQT": "Parent", + "AGNz71": "Zap All {n} sats", "ASRK0S": "This author has been muted", "Adk34V": "Setup your Profile", "Ai8VHU": "Unlimited note retention on Snort relay", @@ -140,6 +141,7 @@ "IEwZvs": "Are you sure you want to unpin this note?", "INSqIz": "Twitter username...", "IUZC+0": "This means that nobody can modify notes which you have created and everybody can easily verify that the notes they are reading are created by you.", + "Ig9/a1": "Sent {n} sats to {name}", "Iwm6o2": "NIP-05 Shop", "Ix8l+B": "Trending Notes", "J+dIsA": "Subscriptions", @@ -402,6 +404,7 @@ "xJ9n2N": "Your public key", "xKflGN": "{username}''s Follows on Nostr", "xQtL3v": "Unlock", + "xaj9Ba": "Provider", "xbVgIm": "Automatically load media", "xhQMeQ": "Expires", "xmcVZ0": "Search", diff --git a/packages/app/src/translations/ru_RU.json b/packages/app/src/translations/ru_RU.json index e253a21a..6c5ec8f6 100644 --- a/packages/app/src/translations/ru_RU.json +++ b/packages/app/src/translations/ru_RU.json @@ -73,6 +73,7 @@ "9pMqYs": "Nostr адрес", "9wO4wJ": "Лайтнинг-инвойс", "ADmfQT": "Ветка", + "AGNz71": "Zap All {n} sats", "ASRK0S": "Этот автор был заглушен", "Adk34V": "Настройте свой профиль", "Ai8VHU": "Снятие ограничения срока хранения ваших заметок на релее Snort", @@ -140,6 +141,7 @@ "IEwZvs": "Вы уверены, что хотите открепить эту заметку?", "INSqIz": "Имя пользователя в Twitter...", "IUZC+0": "Это означает, что никто не может изменить созданные Вами заметки, и каждый может легко убедиться, что увиденные ими заметки созданы Вами.", + "Ig9/a1": "Sent {n} sats to {name}", "Iwm6o2": "Магазин NIP-05", "Ix8l+B": "Популярные заметки", "J+dIsA": "Подписки", @@ -402,6 +404,7 @@ "xJ9n2N": "Ваш публичный ключ", "xKflGN": "Подписки {username} на Nostr", "xQtL3v": "Разблокировать", + "xaj9Ba": "Provider", "xbVgIm": "Автоматически загружать изображения", "xhQMeQ": "Истекает", "xmcVZ0": "Поиск", diff --git a/packages/app/src/translations/sv_SE.json b/packages/app/src/translations/sv_SE.json index e8e9f8dc..948df53a 100644 --- a/packages/app/src/translations/sv_SE.json +++ b/packages/app/src/translations/sv_SE.json @@ -73,6 +73,7 @@ "9pMqYs": "Nostr Adress", "9wO4wJ": "Lightning-faktura", "ADmfQT": "Förälder", + "AGNz71": "Zap All {n} sats", "ASRK0S": "Denna författare har tystats", "Adk34V": "Ställ in din profil", "Ai8VHU": "Obegränsat antal anteckningar på Snort-relä", @@ -140,6 +141,7 @@ "IEwZvs": "Är du säker på att du vill ta bort denna anteckningen?", "INSqIz": "Twitter-användarnamn...", "IUZC+0": "Detta innebär att ingen kan ändra anteckningar som du har skapat och alla kan enkelt kontrollera att de anteckningar de läser har skapats av dig.", + "Ig9/a1": "Sent {n} sats to {name}", "Iwm6o2": "NIP-05 Shop", "Ix8l+B": "Trendande anteckningar", "J+dIsA": "Prenumerationer", @@ -402,6 +404,7 @@ "xJ9n2N": "Din publika nyckel", "xKflGN": "{username}'s Följer på Nostr", "xQtL3v": "Lås upp", + "xaj9Ba": "Provider", "xbVgIm": "Ladda media automatiskt", "xhQMeQ": "Löper ut", "xmcVZ0": "Sök", diff --git a/packages/app/src/translations/ta_IN.json b/packages/app/src/translations/ta_IN.json index 69ee089f..ddee8c5a 100644 --- a/packages/app/src/translations/ta_IN.json +++ b/packages/app/src/translations/ta_IN.json @@ -73,6 +73,7 @@ "9pMqYs": "நாஸ்டர் முகவரி", "9wO4wJ": "லைட்னிங் விலைப்பட்டியல்", "ADmfQT": "பெற்றோர்", + "AGNz71": "Zap All {n} sats", "ASRK0S": "இந்தப் பதிவாளர் முடக்கப் பட்டுள்ளார்", "Adk34V": "உங்கள் சுய விவரத்தை அமைக்கவும்", "Ai8VHU": "ஸ்நார்ட் ரிலேயில் வரம்பற்ற குறிப்புகளை வைத்திரு", @@ -140,6 +141,7 @@ "IEwZvs": "இந்தக் குறிப்பின் நிலையான பொறுத்தத்தை நிச்சயமாக நீக்க விரும்புகிறீர்களா?", "INSqIz": "டுவிட்டர் பயனர்பெயர்...", "IUZC+0": "இதன் பொருள் என்னவென்றால் நீங்கள் உருவாக்கிய குறிப்புகளை யாராலும் மாற்ற முடியாது, மேலும் தாங்கள் படிக்கும் குறிப்புகள் உங்களால் உருவாக்கப்பட்டதா என்பதை அனைவரும் எளிதாகச் சரிபார்க்க முடியும்.", + "Ig9/a1": "Sent {n} sats to {name}", "Iwm6o2": "NIP-05 அங்காடி", "Ix8l+B": "Trending Notes", "J+dIsA": "சந்தாக்கள்", @@ -402,6 +404,7 @@ "xJ9n2N": "உங்கள் பொது சாவி", "xKflGN": "நாஸ்டர் இல் {username} ஐப் பின்தொடர்வோர்", "xQtL3v": "பூட்டுநீக்கு", + "xaj9Ba": "Provider", "xbVgIm": "மீடியாவை தானாகக் காட்டவும்", "xhQMeQ": "காலாவதியாகிறது", "xmcVZ0": "தேடு", diff --git a/packages/app/src/translations/zh_CN.json b/packages/app/src/translations/zh_CN.json index 5984d3b4..4928e592 100644 --- a/packages/app/src/translations/zh_CN.json +++ b/packages/app/src/translations/zh_CN.json @@ -73,6 +73,7 @@ "9pMqYs": "Nostr 地址", "9wO4wJ": "闪电发票", "ADmfQT": "上一层", + "AGNz71": "Zap All {n} sats", "ASRK0S": "该作者已被静音", "Adk34V": "设置你的个人档案", "Ai8VHU": "Snort 中继器上无限制笔记保留", @@ -140,6 +141,7 @@ "IEwZvs": "是否确定要取消置顶此条笔记?", "INSqIz": "推特用户名...", "IUZC+0": "这意味着没有人能够篡改你创建的笔记,并且任何人都可以轻松验证他们正在阅读的笔记是否是由你创建的。", + "Ig9/a1": "Sent {n} sats to {name}", "Iwm6o2": "NIP-05 商店", "Ix8l+B": "热门笔记", "J+dIsA": "订阅", @@ -402,6 +404,7 @@ "xJ9n2N": "你的公钥", "xKflGN": "{username} 在 Nostr 上的关注", "xQtL3v": "解锁", + "xaj9Ba": "Provider", "xbVgIm": "自动加载媒体", "xhQMeQ": "有效期", "xmcVZ0": "搜索", diff --git a/packages/app/src/translations/zh_TW.json b/packages/app/src/translations/zh_TW.json index 25e7b325..15a1e754 100644 --- a/packages/app/src/translations/zh_TW.json +++ b/packages/app/src/translations/zh_TW.json @@ -73,6 +73,7 @@ "9pMqYs": "Nostr 地址", "9wO4wJ": "閃電發票", "ADmfQT": "上一層", + "AGNz71": "Zap All {n} sats", "ASRK0S": "该作者已被静音", "Adk34V": "設置你的個人檔案", "Ai8VHU": "Snort 中繼器上無限制筆記保留", @@ -140,6 +141,7 @@ "IEwZvs": "是否確定要取消置頂此條筆記?", "INSqIz": "推特用戶名", "IUZC+0": "這意味著沒有人能夠篡改你創建的筆記,並且任何人都可以輕鬆驗證他們正在閱讀的筆記是否是由你創建的。", + "Ig9/a1": "Sent {n} sats to {name}", "Iwm6o2": "NIP-05 商店", "Ix8l+B": "熱門筆記", "J+dIsA": "訂閱", @@ -402,6 +404,7 @@ "xJ9n2N": "你的公鑰", "xKflGN": "{username} 在 nostr 的關注", "xQtL3v": "解鎖", + "xaj9Ba": "Provider", "xbVgIm": "自動加載媒體", "xhQMeQ": "有效期", "xmcVZ0": "搜索", From d5032d64392234d8906a2d73857c5f9a9bd2bb79 Mon Sep 17 00:00:00 2001 From: Kieran Date: Tue, 30 May 2023 11:17:13 +0100 Subject: [PATCH 06/15] feat: L402 for image/video --- packages/app/src/Cache/PaymentsCache.ts | 18 +++ packages/app/src/Db/index.ts | 11 +- packages/app/src/Element/MediaElement.tsx | 133 +++++++++++++++++++++- packages/app/src/Element/ProxyImg.tsx | 29 ++--- packages/app/src/Hooks/useImgProxy.ts | 1 + packages/app/src/Util.ts | 14 +++ 6 files changed, 188 insertions(+), 18 deletions(-) create mode 100644 packages/app/src/Cache/PaymentsCache.ts diff --git a/packages/app/src/Cache/PaymentsCache.ts b/packages/app/src/Cache/PaymentsCache.ts new file mode 100644 index 00000000..a52543b0 --- /dev/null +++ b/packages/app/src/Cache/PaymentsCache.ts @@ -0,0 +1,18 @@ +import { Payment, db } from "Db"; +import FeedCache from "./FeedCache"; + +class Payments extends FeedCache { + constructor() { + super("PaymentsCache", db.payments); + } + + key(of: Payment): string { + return of.url; + } + + takeSnapshot(): Array { + return [...this.cache.values()]; + } +} + +export const PaymentsCache = new Payments(); diff --git a/packages/app/src/Db/index.ts b/packages/app/src/Db/index.ts index 4ed7ddaf..30be5c7c 100644 --- a/packages/app/src/Db/index.ts +++ b/packages/app/src/Db/index.ts @@ -3,7 +3,7 @@ import { FullRelaySettings, HexKey, RawEvent, u256 } from "@snort/nostr"; import { MetadataCache } from "Cache"; export const NAME = "snortDB"; -export const VERSION = 8; +export const VERSION = 9; export interface SubCache { id: string; @@ -33,6 +33,13 @@ export interface EventInteraction { reposted: boolean; } +export interface Payment { + url: string; + pr: string; + preimage: string; + macaroon: string; +} + const STORES = { users: "++pubkey, name, display_name, picture, nip05, npub", relays: "++addr", @@ -40,6 +47,7 @@ const STORES = { events: "++id, pubkey, created_at", dms: "++id, pubkey", eventInteraction: "++id", + payments: "++url", }; export class SnortDB extends Dexie { @@ -50,6 +58,7 @@ export class SnortDB extends Dexie { events!: Table; dms!: Table; eventInteraction!: Table; + payments!: Table; constructor() { super(NAME); diff --git a/packages/app/src/Element/MediaElement.tsx b/packages/app/src/Element/MediaElement.tsx index 15110254..aa59eb1c 100644 --- a/packages/app/src/Element/MediaElement.tsx +++ b/packages/app/src/Element/MediaElement.tsx @@ -1,9 +1,16 @@ import { ProxyImg } from "Element/ProxyImg"; -import React, { MouseEvent, useState } from "react"; +import React, { MouseEvent, useEffect, useState } from "react"; +import { FormattedMessage, FormattedNumber } from "react-intl"; import "./MediaElement.css"; import Modal from "Element/Modal"; import Icon from "Icons/Icon"; +import { decodeInvoice, InvoiceDetails, kvToObject } from "Util"; +import AsyncButton from "Element/AsyncButton"; +import { useWallet } from "Wallet"; +import { PaymentsCache } from "Cache/PaymentsCache"; +import { Payment } from "Db"; +import PageSpinner from "Element/PageSpinner"; /* [ @@ -21,19 +28,137 @@ interface MediaElementProps { blurHash?: string; } +interface L402Object { + macaroon: string; + invoice: string; +} + export function MediaElement(props: MediaElementProps) { + const [invoice, setInvoice] = useState(); + const [l402, setL402] = useState(); + const [auth, setAuth] = useState(); + const [error, setError] = useState(""); + const [url, setUrl] = useState(props.url); + const [loading, setLoading] = useState(false); + const wallet = useWallet(); + + async function probeFor402() { + const cached = await PaymentsCache.get(props.url); + if (cached) { + setAuth(cached); + return; + } + + const req = new Request(props.url, { + method: "OPTIONS", + headers: { + accept: "L402", + }, + }); + const rsp = await fetch(req); + if (rsp.status === 402) { + const auth = rsp.headers.get("www-authenticate"); + if (auth?.startsWith("L402")) { + const vals = kvToObject(auth.substring(5)); + console.debug(vals); + setL402(vals); + + if (vals.invoice) { + const decoded = decodeInvoice(vals.invoice); + setInvoice(decoded); + } + } + } + } + + async function payInvoice() { + if (wallet.wallet && l402) { + try { + const res = await wallet.wallet.payInvoice(l402.invoice); + console.debug(res); + if (res.preimage) { + const pmt = { + pr: l402.invoice, + url: props.url, + macaroon: l402.macaroon, + preimage: res.preimage, + }; + await PaymentsCache.set(pmt); + setAuth(pmt); + } + } catch (e) { + if (e instanceof Error) { + setError(e.message); + } + } + } + } + + async function loadMedia() { + if (!auth) return; + setLoading(true); + + const mediaReq = new Request(props.url, { + headers: { + Authorization: `L402 ${auth.macaroon}:${auth.preimage}`, + }, + }); + const rsp = await fetch(mediaReq); + if (rsp.ok) { + const buf = await rsp.blob(); + setUrl(URL.createObjectURL(buf)); + } + setLoading(false); + } + + useEffect(() => { + if (auth) { + loadMedia().catch(console.error); + } + }, [auth]); + + if (auth && loading) { + return ; + } + + if (invoice) { + return ( +
+

+ +

+
+
+ , + }} + /> +
+
+ payInvoice()}> + + +
+
+ {error && {error}} +
+ ); + } + if (props.mime.startsWith("image/")) { return ( - + probeFor402()} /> ); } else if (props.mime.startsWith("audio/")) { - return
- payInvoice()}> - - + {wallet.wallet && ( + payInvoice()}> + + + )}
+ {!wallet.wallet && ( + + e.stopPropagation()}> + + + ), + }} + /> + + )} {error && {error}}
); diff --git a/packages/app/src/lang.json b/packages/app/src/lang.json index f5c25c03..3d6e2228 100644 --- a/packages/app/src/lang.json +++ b/packages/app/src/lang.json @@ -45,6 +45,9 @@ "0BUTMv": { "defaultMessage": "Search..." }, + "0ehN4t": { + "defaultMessage": "Please connect a wallet {here} to be able to pay this invoice" + }, "0jOEtS": { "defaultMessage": "Invalid LNURL" }, @@ -96,6 +99,10 @@ "2ukA4d": { "defaultMessage": "{n} hours" }, + "380eol": { + "defaultMessage": "here", + "description": "Inline link text pointing to another page" + }, "3Rx6Qo": { "defaultMessage": "Advanced" }, @@ -218,6 +225,9 @@ "9pMqYs": { "defaultMessage": "Nostr Address" }, + "9qtLJC": { + "defaultMessage": "Payment Required" + }, "9wO4wJ": { "defaultMessage": "Lightning Invoice" }, @@ -313,6 +323,9 @@ "Dh3hbq": { "defaultMessage": "Auto Zap" }, + "DqLx9k": { + "defaultMessage": "You must pay {n} sats to access this file." + }, "Dt/Zd5": { "defaultMessage": "Media in posts will automatically be shown for selected people, otherwise only the link will show" }, diff --git a/packages/app/src/translations/en.json b/packages/app/src/translations/en.json index d2eacb43..6e53d0c4 100644 --- a/packages/app/src/translations/en.json +++ b/packages/app/src/translations/en.json @@ -14,6 +14,7 @@ "08zn6O": "Export Keys", "0Azlrb": "Manage", "0BUTMv": "Search...", + "0ehN4t": "Please connect a wallet {here} to be able to pay this invoice", "0jOEtS": "Invalid LNURL", "0mch2Y": "name has disallowed characters", "0yO7wF": "{n} secs", @@ -31,6 +32,7 @@ "2a2YiP": "{n} Bookmarks", "2k0Cv+": "Dislikes ({n})", "2ukA4d": "{n} hours", + "380eol": "here", "3Rx6Qo": "Advanced", "3cc4Ct": "Light", "3gOsZq": "Translators", @@ -71,6 +73,7 @@ "9WRlF4": "Send", "9gqH2W": "Login", "9pMqYs": "Nostr Address", + "9qtLJC": "Payment Required", "9wO4wJ": "Lightning Invoice", "ADmfQT": "Parent", "AGNz71": "Zap All {n} sats", @@ -102,6 +105,7 @@ "DZzCem": "Show latest {n} notes", "DcL8P+": "Supporter", "Dh3hbq": "Auto Zap", + "DqLx9k": "You must pay {n} sats to access this file.", "Dt/Zd5": "Media in posts will automatically be shown for selected people, otherwise only the link will show", "DtYelJ": "Transfer", "E8a4yq": "Follow some popular accounts", @@ -418,4 +422,4 @@ "zjJZBd": "You're ready!", "zonsdq": "Failed to load LNURL service", "zvCDao": "Automatically show latest notes" -} +} \ No newline at end of file From 8a0cc0bcf6a096e486e0d5d88a9e8472b1c808d4 Mon Sep 17 00:00:00 2001 From: Kieran Date: Tue, 30 May 2023 10:50:46 +0000 Subject: [PATCH 09/15] chore: Update translations --- packages/app/src/translations/ar_SA.json | 4 ++++ packages/app/src/translations/da_DK.json | 4 ++++ packages/app/src/translations/de_DE.json | 4 ++++ packages/app/src/translations/en.json | 2 +- packages/app/src/translations/es_ES.json | 4 ++++ packages/app/src/translations/fa_IR.json | 4 ++++ packages/app/src/translations/fr_FR.json | 4 ++++ packages/app/src/translations/hr_HR.json | 4 ++++ packages/app/src/translations/hu_HU.json | 4 ++++ packages/app/src/translations/id_ID.json | 4 ++++ packages/app/src/translations/it_IT.json | 4 ++++ packages/app/src/translations/ja_JP.json | 4 ++++ packages/app/src/translations/ko_KR.json | 4 ++++ packages/app/src/translations/nl_NL.json | 4 ++++ packages/app/src/translations/pa_IN.json | 4 ++++ packages/app/src/translations/ru_RU.json | 4 ++++ packages/app/src/translations/sv_SE.json | 4 ++++ packages/app/src/translations/ta_IN.json | 4 ++++ packages/app/src/translations/zh_CN.json | 4 ++++ packages/app/src/translations/zh_TW.json | 4 ++++ 20 files changed, 77 insertions(+), 1 deletion(-) diff --git a/packages/app/src/translations/ar_SA.json b/packages/app/src/translations/ar_SA.json index 528f0d29..cfe93422 100644 --- a/packages/app/src/translations/ar_SA.json +++ b/packages/app/src/translations/ar_SA.json @@ -14,6 +14,7 @@ "08zn6O": "Export Keys", "0Azlrb": "إدارة", "0BUTMv": "بحث...", + "0ehN4t": "Please connect a wallet {here} to be able to pay this invoice", "0jOEtS": "عنوان LNURL غير صالح", "0mch2Y": "الاسم يحتوي على أحرف غير مسموح بها", "0yO7wF": "{n} ثانية", @@ -31,6 +32,7 @@ "2a2YiP": "المنشورات المرجعية {n}", "2k0Cv+": "الاستهجان ({n})", "2ukA4d": "{n} ساعات", + "380eol": "here", "3Rx6Qo": "خيارات متقدمة", "3cc4Ct": "فاتح", "3gOsZq": "المترجمون", @@ -71,6 +73,7 @@ "9WRlF4": "ارسال", "9gqH2W": "تسجيل الدخول", "9pMqYs": "عنوان نوستر", + "9qtLJC": "Payment Required", "9wO4wJ": "فاتورة البرق", "ADmfQT": "السياق", "AGNz71": "Zap All {n} sats", @@ -102,6 +105,7 @@ "DZzCem": "عرض أحدث منشورات {n}", "DcL8P+": "داعم", "Dh3hbq": "الومض التلقائي", + "DqLx9k": "You must pay {n} sats to access this file.", "Dt/Zd5": "سيتم عرض الوسائط في المنشورات تلقائيًا للأشخاص المحددين ، وإلا سيتم عرض الرابط فقط", "DtYelJ": "تحويل", "E8a4yq": "تابع بعض الحسابات المشهورة", diff --git a/packages/app/src/translations/da_DK.json b/packages/app/src/translations/da_DK.json index d2eacb43..5852f598 100644 --- a/packages/app/src/translations/da_DK.json +++ b/packages/app/src/translations/da_DK.json @@ -14,6 +14,7 @@ "08zn6O": "Export Keys", "0Azlrb": "Manage", "0BUTMv": "Search...", + "0ehN4t": "Please connect a wallet {here} to be able to pay this invoice", "0jOEtS": "Invalid LNURL", "0mch2Y": "name has disallowed characters", "0yO7wF": "{n} secs", @@ -31,6 +32,7 @@ "2a2YiP": "{n} Bookmarks", "2k0Cv+": "Dislikes ({n})", "2ukA4d": "{n} hours", + "380eol": "here", "3Rx6Qo": "Advanced", "3cc4Ct": "Light", "3gOsZq": "Translators", @@ -71,6 +73,7 @@ "9WRlF4": "Send", "9gqH2W": "Login", "9pMqYs": "Nostr Address", + "9qtLJC": "Payment Required", "9wO4wJ": "Lightning Invoice", "ADmfQT": "Parent", "AGNz71": "Zap All {n} sats", @@ -102,6 +105,7 @@ "DZzCem": "Show latest {n} notes", "DcL8P+": "Supporter", "Dh3hbq": "Auto Zap", + "DqLx9k": "You must pay {n} sats to access this file.", "Dt/Zd5": "Media in posts will automatically be shown for selected people, otherwise only the link will show", "DtYelJ": "Transfer", "E8a4yq": "Follow some popular accounts", diff --git a/packages/app/src/translations/de_DE.json b/packages/app/src/translations/de_DE.json index 8a06759d..c706f6db 100644 --- a/packages/app/src/translations/de_DE.json +++ b/packages/app/src/translations/de_DE.json @@ -14,6 +14,7 @@ "08zn6O": "Schlüssel exportieren", "0Azlrb": "Verwalten", "0BUTMv": "Suche...", + "0ehN4t": "Please connect a wallet {here} to be able to pay this invoice", "0jOEtS": "Ungültige LNURL", "0mch2Y": "Der Name enthält unerlaubte Zeichen", "0yO7wF": "{n} Sek.", @@ -31,6 +32,7 @@ "2a2YiP": "{n} Lesezeichen", "2k0Cv+": "Gefällt nicht ({n})", "2ukA4d": "{n} Stunden", + "380eol": "here", "3Rx6Qo": "Erweitert", "3cc4Ct": "Hell", "3gOsZq": "Übersetzer", @@ -71,6 +73,7 @@ "9WRlF4": "Senden", "9gqH2W": "Anmelden", "9pMqYs": "Nostr Adresse", + "9qtLJC": "Payment Required", "9wO4wJ": "Lightning Zahlungsanforderung", "ADmfQT": "Vorherige", "AGNz71": "Zap All {n} sats", @@ -102,6 +105,7 @@ "DZzCem": "Letzte {n} Notizen anzeigen", "DcL8P+": "Unterstützer", "Dh3hbq": "Auto Zap", + "DqLx9k": "You must pay {n} sats to access this file.", "Dt/Zd5": "Medien in Posts werden für ausgewählte Personen automatisch angezeigt, ansonsten wird nur der Link angezeigt", "DtYelJ": "Transferieren", "E8a4yq": "Folgen Sie einigen beliebten Konten", diff --git a/packages/app/src/translations/en.json b/packages/app/src/translations/en.json index 6e53d0c4..5852f598 100644 --- a/packages/app/src/translations/en.json +++ b/packages/app/src/translations/en.json @@ -422,4 +422,4 @@ "zjJZBd": "You're ready!", "zonsdq": "Failed to load LNURL service", "zvCDao": "Automatically show latest notes" -} \ No newline at end of file +} diff --git a/packages/app/src/translations/es_ES.json b/packages/app/src/translations/es_ES.json index 86f68f75..4cda663e 100644 --- a/packages/app/src/translations/es_ES.json +++ b/packages/app/src/translations/es_ES.json @@ -14,6 +14,7 @@ "08zn6O": "Exportar claves", "0Azlrb": "Gestionar", "0BUTMv": "Buscar...", + "0ehN4t": "Please connect a wallet {here} to be able to pay this invoice", "0jOEtS": "LNURL inválida", "0mch2Y": "el nombre tiene caracteres inválidos", "0yO7wF": "{n} seg", @@ -31,6 +32,7 @@ "2a2YiP": "{n} Marcadores", "2k0Cv+": "No me gusta ({n})", "2ukA4d": "{n} horas", + "380eol": "here", "3Rx6Qo": "Avanzado", "3cc4Ct": "Claro", "3gOsZq": "traductores", @@ -71,6 +73,7 @@ "9WRlF4": "Enviar", "9gqH2W": "Acceso", "9pMqYs": "Dirección Nostr", + "9qtLJC": "Payment Required", "9wO4wJ": "Factura Lightning", "ADmfQT": "Pariente", "AGNz71": "Zap All {n} sats", @@ -102,6 +105,7 @@ "DZzCem": "Mostrar últimas {n} notas", "DcL8P+": "Seguidor", "Dh3hbq": "Auto Zap", + "DqLx9k": "You must pay {n} sats to access this file.", "Dt/Zd5": "Se cargarán las imágenes y vídeos automáticamente", "DtYelJ": "Transferir", "E8a4yq": "Sigue a cuentas populares", diff --git a/packages/app/src/translations/fa_IR.json b/packages/app/src/translations/fa_IR.json index 14c1a31b..2adbfd7c 100644 --- a/packages/app/src/translations/fa_IR.json +++ b/packages/app/src/translations/fa_IR.json @@ -14,6 +14,7 @@ "08zn6O": "استخراج کلید", "0Azlrb": "مدیریت", "0BUTMv": "جستجو...", + "0ehN4t": "Please connect a wallet {here} to be able to pay this invoice", "0jOEtS": "LNURL نامعتبر", "0mch2Y": "نام دارای کاراکتر غیرمجاز است", "0yO7wF": "{n} ثانیه", @@ -31,6 +32,7 @@ "2a2YiP": "{n} نشانک", "2k0Cv+": "({n}) ناپسند", "2ukA4d": "{n} ساعت", + "380eol": "here", "3Rx6Qo": "پیشرفته", "3cc4Ct": "روشن", "3gOsZq": "مترجمان", @@ -71,6 +73,7 @@ "9WRlF4": "ارسال", "9gqH2W": "ورود", "9pMqYs": "آدرس ناستر", + "9qtLJC": "Payment Required", "9wO4wJ": "صورتحساب لایتنینگ", "ADmfQT": "والد", "AGNz71": "همه را {n} ساتوشی زپ کن", @@ -102,6 +105,7 @@ "DZzCem": "{n} یادداشت اخیر را نشان بده", "DcL8P+": "پشتیبان", "Dh3hbq": "زپ خودکار", + "DqLx9k": "You must pay {n} sats to access this file.", "Dt/Zd5": "رسانه درون یادداشت ها به طور برای افراد انتخاب شده نشان داده می شود، وگرنه تنها لینک آن نشان داده می شود", "DtYelJ": "انتقال", "E8a4yq": "حساب های کاربری مشهور را دنبال کنید", diff --git a/packages/app/src/translations/fr_FR.json b/packages/app/src/translations/fr_FR.json index fe3d244d..245a8b27 100644 --- a/packages/app/src/translations/fr_FR.json +++ b/packages/app/src/translations/fr_FR.json @@ -14,6 +14,7 @@ "08zn6O": "Export Keys", "0Azlrb": "Manage", "0BUTMv": "Chercher...", + "0ehN4t": "Please connect a wallet {here} to be able to pay this invoice", "0jOEtS": "LNURL invalide", "0mch2Y": "le nom contient des caractères non autorisés", "0yO7wF": "{n} secondes", @@ -31,6 +32,7 @@ "2a2YiP": "{n} Favoris", "2k0Cv+": "N'aime pas ({n})", "2ukA4d": "{n} hours", + "380eol": "here", "3Rx6Qo": "Avancé", "3cc4Ct": "Clair", "3gOsZq": "Traducteurs", @@ -71,6 +73,7 @@ "9WRlF4": "Envoyer", "9gqH2W": "Se Connecter", "9pMqYs": "Adresse Nostr", + "9qtLJC": "Payment Required", "9wO4wJ": "Facture Lightning", "ADmfQT": "Parent", "AGNz71": "Zap All {n} sats", @@ -102,6 +105,7 @@ "DZzCem": "Afficher les {n} dernières notes", "DcL8P+": "Supporter", "Dh3hbq": "Zap automatique", + "DqLx9k": "You must pay {n} sats to access this file.", "Dt/Zd5": "Les médias dans les messages seront automatiquement affichés pour les personnes sélectionnées, sinon seul le lien s'affichera", "DtYelJ": "Transférer", "E8a4yq": "Suivez quelques comptes populaires", diff --git a/packages/app/src/translations/hr_HR.json b/packages/app/src/translations/hr_HR.json index 7c4a06ea..126022b7 100644 --- a/packages/app/src/translations/hr_HR.json +++ b/packages/app/src/translations/hr_HR.json @@ -14,6 +14,7 @@ "08zn6O": "Izvezi Ključeve", "0Azlrb": "Upravljaj", "0BUTMv": "Pretraga...", + "0ehN4t": "Please connect a wallet {here} to be able to pay this invoice", "0jOEtS": "Nevažeći LNURL", "0mch2Y": "ime sadrži nepodržane znakove", "0yO7wF": "{n} sekundi", @@ -31,6 +32,7 @@ "2a2YiP": "{n} Oznake", "2k0Cv+": "Ne sviđa se ({n})", "2ukA4d": "{n} sati", + "380eol": "here", "3Rx6Qo": "Napredno", "3cc4Ct": "Svijetlo", "3gOsZq": "Prevoditelji", @@ -71,6 +73,7 @@ "9WRlF4": "Pošalji", "9gqH2W": "Prijavi se", "9pMqYs": "Nostr Adresa", + "9qtLJC": "Payment Required", "9wO4wJ": "Lightning račun", "ADmfQT": "Matični", "AGNz71": "Zap All {n} sats", @@ -102,6 +105,7 @@ "DZzCem": "Prikaži posljednje {n} bilješke", "DcL8P+": "Podrška", "Dh3hbq": "Automatski Zap", + "DqLx9k": "You must pay {n} sats to access this file.", "Dt/Zd5": "Mediji u objavama automatski će se prikazati za odabrane osobe, inače će se prikazati samo poveznica", "DtYelJ": "Prijenos", "E8a4yq": "Pratite neke popularne račune", diff --git a/packages/app/src/translations/hu_HU.json b/packages/app/src/translations/hu_HU.json index fe95faea..21e60760 100644 --- a/packages/app/src/translations/hu_HU.json +++ b/packages/app/src/translations/hu_HU.json @@ -14,6 +14,7 @@ "08zn6O": "Kulcsok exportálása", "0Azlrb": "Menedzselés", "0BUTMv": "Keresés...", + "0ehN4t": "Please connect a wallet {here} to be able to pay this invoice", "0jOEtS": "Érvénytelen LNURL", "0mch2Y": "név nem engedélyezett karaktereket tartalmaz", "0yO7wF": "{n} másodperc", @@ -31,6 +32,7 @@ "2a2YiP": "{n} könyvjelző", "2k0Cv+": "Nemtetszések ({n})", "2ukA4d": "{n} órák", + "380eol": "here", "3Rx6Qo": "Speciális", "3cc4Ct": "Világos", "3gOsZq": "Fordítók", @@ -71,6 +73,7 @@ "9WRlF4": "Küldés", "9gqH2W": "Bejelentkezés", "9pMqYs": "Nostr Cím", + "9qtLJC": "Payment Required", "9wO4wJ": "Lightning Számla", "ADmfQT": "Szülő", "AGNz71": "Zap-elni Mind a {n} sats-ot", @@ -102,6 +105,7 @@ "DZzCem": "A legutóbbi {n} bejegyzés mutatása", "DcL8P+": "Támogató", "Dh3hbq": "Auto Zap", + "DqLx9k": "You must pay {n} sats to access this file.", "Dt/Zd5": "A bejegyzésekben található média bizonyos emberek számára automatikusan megjelenik, másoknak pedig egy link lesz helyette.", "DtYelJ": "Átvitel", "E8a4yq": "Kövess néhány népszerű felhasználót", diff --git a/packages/app/src/translations/id_ID.json b/packages/app/src/translations/id_ID.json index bc83940b..99c698bf 100644 --- a/packages/app/src/translations/id_ID.json +++ b/packages/app/src/translations/id_ID.json @@ -14,6 +14,7 @@ "08zn6O": "Export Keys", "0Azlrb": "Manage", "0BUTMv": "Cari...", + "0ehN4t": "Please connect a wallet {here} to be able to pay this invoice", "0jOEtS": "LNURL Tidak valid", "0mch2Y": "nama memiliki karakter yang tidak diizinkan", "0yO7wF": "{n} detik", @@ -31,6 +32,7 @@ "2a2YiP": "{n} Penanda Buku", "2k0Cv+": "Tidak disukai ({n})", "2ukA4d": "{n} hours", + "380eol": "here", "3Rx6Qo": "Advanced", "3cc4Ct": "Cahaya", "3gOsZq": "Penerjemah", @@ -71,6 +73,7 @@ "9WRlF4": "Mengirim", "9gqH2W": "Masuk", "9pMqYs": "Nostr Address", + "9qtLJC": "Payment Required", "9wO4wJ": "Faktur Lightning", "ADmfQT": "Orang Tua", "AGNz71": "Zap All {n} sats", @@ -102,6 +105,7 @@ "DZzCem": "Tampilkan catatan {n} terbaru", "DcL8P+": "Supporter", "Dh3hbq": "Auto Zap", + "DqLx9k": "You must pay {n} sats to access this file.", "Dt/Zd5": "Media dalam postingan akan secara otomatis ditampilkan untuk orang yang dipilih, jika tidak, hanya tautan yang akan ditampilkan", "DtYelJ": "Transfer", "E8a4yq": "Ikuti beberapa akun populer", diff --git a/packages/app/src/translations/it_IT.json b/packages/app/src/translations/it_IT.json index 14aeafc5..e4859933 100644 --- a/packages/app/src/translations/it_IT.json +++ b/packages/app/src/translations/it_IT.json @@ -14,6 +14,7 @@ "08zn6O": "Esporta Chiavi", "0Azlrb": "Gestisci", "0BUTMv": "Cerca...", + "0ehN4t": "Please connect a wallet {here} to be able to pay this invoice", "0jOEtS": "LNURL non valido", "0mch2Y": "il nome ha caratteri non ammessi", "0yO7wF": "{n} sec", @@ -31,6 +32,7 @@ "2a2YiP": "{n} preferiti", "2k0Cv+": "Non mi piace ({n})", "2ukA4d": "{n} ore", + "380eol": "here", "3Rx6Qo": "Avanzato", "3cc4Ct": "Chiaro", "3gOsZq": "Traduttori", @@ -71,6 +73,7 @@ "9WRlF4": "Invia", "9gqH2W": "Accedi", "9pMqYs": "Indirizzo Nostr", + "9qtLJC": "Payment Required", "9wO4wJ": "Fattura Lightning", "ADmfQT": "Parente", "AGNz71": "Zap All {n} sats", @@ -102,6 +105,7 @@ "DZzCem": "Visualizza le ultime {n} note", "DcL8P+": "Sostenitore", "Dh3hbq": "Zap automatico", + "DqLx9k": "You must pay {n} sats to access this file.", "Dt/Zd5": "I media nei post verranno mostrati automaticamente per le persone selezionate, altrimenti verrà mostrato solo il link.", "DtYelJ": "Trasferisci", "E8a4yq": "Segui alcuni account popolari", diff --git a/packages/app/src/translations/ja_JP.json b/packages/app/src/translations/ja_JP.json index 3e26ed5e..25215bd9 100644 --- a/packages/app/src/translations/ja_JP.json +++ b/packages/app/src/translations/ja_JP.json @@ -14,6 +14,7 @@ "08zn6O": "鍵をエクスポート", "0Azlrb": "管理", "0BUTMv": "検索する", + "0ehN4t": "Please connect a wallet {here} to be able to pay this invoice", "0jOEtS": "無効なLNURL", "0mch2Y": "名前に使用できない文字が含まれています", "0yO7wF": "{n}秒", @@ -31,6 +32,7 @@ "2a2YiP": "{n} ブックマーク", "2k0Cv+": "イヤ ({n})", "2ukA4d": "{n}時間", + "380eol": "here", "3Rx6Qo": "詳細オプション", "3cc4Ct": "ライト", "3gOsZq": "翻訳者", @@ -71,6 +73,7 @@ "9WRlF4": "送信", "9gqH2W": "ログイン", "9pMqYs": "Nostrアドレス", + "9qtLJC": "Payment Required", "9wO4wJ": "ライトニング インボイス", "ADmfQT": "返信元", "AGNz71": "{n} satsを全てザップ", @@ -102,6 +105,7 @@ "DZzCem": "最新の投稿{n}件を表示", "DcL8P+": "サポーター", "Dh3hbq": "自動ザップ", + "DqLx9k": "You must pay {n} sats to access this file.", "Dt/Zd5": "選択したユーザーの投稿ではメディアが自動的に表示され、それ以外はリンクのみが表示されます", "DtYelJ": "転送", "E8a4yq": "人気のアカウントをフォロー", diff --git a/packages/app/src/translations/ko_KR.json b/packages/app/src/translations/ko_KR.json index d2eacb43..5852f598 100644 --- a/packages/app/src/translations/ko_KR.json +++ b/packages/app/src/translations/ko_KR.json @@ -14,6 +14,7 @@ "08zn6O": "Export Keys", "0Azlrb": "Manage", "0BUTMv": "Search...", + "0ehN4t": "Please connect a wallet {here} to be able to pay this invoice", "0jOEtS": "Invalid LNURL", "0mch2Y": "name has disallowed characters", "0yO7wF": "{n} secs", @@ -31,6 +32,7 @@ "2a2YiP": "{n} Bookmarks", "2k0Cv+": "Dislikes ({n})", "2ukA4d": "{n} hours", + "380eol": "here", "3Rx6Qo": "Advanced", "3cc4Ct": "Light", "3gOsZq": "Translators", @@ -71,6 +73,7 @@ "9WRlF4": "Send", "9gqH2W": "Login", "9pMqYs": "Nostr Address", + "9qtLJC": "Payment Required", "9wO4wJ": "Lightning Invoice", "ADmfQT": "Parent", "AGNz71": "Zap All {n} sats", @@ -102,6 +105,7 @@ "DZzCem": "Show latest {n} notes", "DcL8P+": "Supporter", "Dh3hbq": "Auto Zap", + "DqLx9k": "You must pay {n} sats to access this file.", "Dt/Zd5": "Media in posts will automatically be shown for selected people, otherwise only the link will show", "DtYelJ": "Transfer", "E8a4yq": "Follow some popular accounts", diff --git a/packages/app/src/translations/nl_NL.json b/packages/app/src/translations/nl_NL.json index d2eacb43..5852f598 100644 --- a/packages/app/src/translations/nl_NL.json +++ b/packages/app/src/translations/nl_NL.json @@ -14,6 +14,7 @@ "08zn6O": "Export Keys", "0Azlrb": "Manage", "0BUTMv": "Search...", + "0ehN4t": "Please connect a wallet {here} to be able to pay this invoice", "0jOEtS": "Invalid LNURL", "0mch2Y": "name has disallowed characters", "0yO7wF": "{n} secs", @@ -31,6 +32,7 @@ "2a2YiP": "{n} Bookmarks", "2k0Cv+": "Dislikes ({n})", "2ukA4d": "{n} hours", + "380eol": "here", "3Rx6Qo": "Advanced", "3cc4Ct": "Light", "3gOsZq": "Translators", @@ -71,6 +73,7 @@ "9WRlF4": "Send", "9gqH2W": "Login", "9pMqYs": "Nostr Address", + "9qtLJC": "Payment Required", "9wO4wJ": "Lightning Invoice", "ADmfQT": "Parent", "AGNz71": "Zap All {n} sats", @@ -102,6 +105,7 @@ "DZzCem": "Show latest {n} notes", "DcL8P+": "Supporter", "Dh3hbq": "Auto Zap", + "DqLx9k": "You must pay {n} sats to access this file.", "Dt/Zd5": "Media in posts will automatically be shown for selected people, otherwise only the link will show", "DtYelJ": "Transfer", "E8a4yq": "Follow some popular accounts", diff --git a/packages/app/src/translations/pa_IN.json b/packages/app/src/translations/pa_IN.json index d2eacb43..5852f598 100644 --- a/packages/app/src/translations/pa_IN.json +++ b/packages/app/src/translations/pa_IN.json @@ -14,6 +14,7 @@ "08zn6O": "Export Keys", "0Azlrb": "Manage", "0BUTMv": "Search...", + "0ehN4t": "Please connect a wallet {here} to be able to pay this invoice", "0jOEtS": "Invalid LNURL", "0mch2Y": "name has disallowed characters", "0yO7wF": "{n} secs", @@ -31,6 +32,7 @@ "2a2YiP": "{n} Bookmarks", "2k0Cv+": "Dislikes ({n})", "2ukA4d": "{n} hours", + "380eol": "here", "3Rx6Qo": "Advanced", "3cc4Ct": "Light", "3gOsZq": "Translators", @@ -71,6 +73,7 @@ "9WRlF4": "Send", "9gqH2W": "Login", "9pMqYs": "Nostr Address", + "9qtLJC": "Payment Required", "9wO4wJ": "Lightning Invoice", "ADmfQT": "Parent", "AGNz71": "Zap All {n} sats", @@ -102,6 +105,7 @@ "DZzCem": "Show latest {n} notes", "DcL8P+": "Supporter", "Dh3hbq": "Auto Zap", + "DqLx9k": "You must pay {n} sats to access this file.", "Dt/Zd5": "Media in posts will automatically be shown for selected people, otherwise only the link will show", "DtYelJ": "Transfer", "E8a4yq": "Follow some popular accounts", diff --git a/packages/app/src/translations/ru_RU.json b/packages/app/src/translations/ru_RU.json index 6c5ec8f6..433a91a0 100644 --- a/packages/app/src/translations/ru_RU.json +++ b/packages/app/src/translations/ru_RU.json @@ -14,6 +14,7 @@ "08zn6O": "Экспортировать ключи", "0Azlrb": "Управление", "0BUTMv": "Поиск...", + "0ehN4t": "Please connect a wallet {here} to be able to pay this invoice", "0jOEtS": "Неверный LNURL", "0mch2Y": "имя содержит запрещенные символы", "0yO7wF": "{n} секунд", @@ -31,6 +32,7 @@ "2a2YiP": "{n} Закладок", "2k0Cv+": "Дизлайки ({n})", "2ukA4d": "{n} часов", + "380eol": "here", "3Rx6Qo": "Продвинутые", "3cc4Ct": "Светлый", "3gOsZq": "Переводчики", @@ -71,6 +73,7 @@ "9WRlF4": "Отправить", "9gqH2W": "Авторизуйтесь", "9pMqYs": "Nostr адрес", + "9qtLJC": "Payment Required", "9wO4wJ": "Лайтнинг-инвойс", "ADmfQT": "Ветка", "AGNz71": "Zap All {n} sats", @@ -102,6 +105,7 @@ "DZzCem": "Показать последние {n} заметки", "DcL8P+": "Саппортер", "Dh3hbq": "Авто Зап", + "DqLx9k": "You must pay {n} sats to access this file.", "Dt/Zd5": "Медиа в публикациях выбранных пользователей будут автоматически отображаться в вашей ленте, в противном случае будет показана только ссылка", "DtYelJ": "Перевод", "E8a4yq": "Подпишитесь на популярные аккаунты", diff --git a/packages/app/src/translations/sv_SE.json b/packages/app/src/translations/sv_SE.json index ecb1b9b1..0ed4cdfd 100644 --- a/packages/app/src/translations/sv_SE.json +++ b/packages/app/src/translations/sv_SE.json @@ -14,6 +14,7 @@ "08zn6O": "Exportera nycklar", "0Azlrb": "Hantera", "0BUTMv": "Sök...", + "0ehN4t": "Please connect a wallet {here} to be able to pay this invoice", "0jOEtS": "Ogiltig LNURL", "0mch2Y": "namnet har otillåtna tecken", "0yO7wF": "{n} secs", @@ -31,6 +32,7 @@ "2a2YiP": "{n} Bokmärken", "2k0Cv+": "Gillar inte ({n})", "2ukA4d": "{n} timmar", + "380eol": "here", "3Rx6Qo": "Avancerad", "3cc4Ct": "Ljust", "3gOsZq": "Översättare", @@ -71,6 +73,7 @@ "9WRlF4": "Skicka", "9gqH2W": "Logga in", "9pMqYs": "Nostr Adress", + "9qtLJC": "Payment Required", "9wO4wJ": "Lightning-faktura", "ADmfQT": "Förälder", "AGNz71": "Zappa Alla {n} sats", @@ -102,6 +105,7 @@ "DZzCem": "Visa senaste {n} anteckningar", "DcL8P+": "Supporter", "Dh3hbq": "Auto Zap", + "DqLx9k": "You must pay {n} sats to access this file.", "Dt/Zd5": "Media i inlägg visas automatiskt för valda personer, annars visas endast länken", "DtYelJ": "Överför", "E8a4yq": "Följ några populära konton", diff --git a/packages/app/src/translations/ta_IN.json b/packages/app/src/translations/ta_IN.json index ddee8c5a..cecdf371 100644 --- a/packages/app/src/translations/ta_IN.json +++ b/packages/app/src/translations/ta_IN.json @@ -14,6 +14,7 @@ "08zn6O": "சாவிகளை ஏற்றுமதி செய்யவும்", "0Azlrb": "நிர்வகி", "0BUTMv": "தேடு...", + "0ehN4t": "Please connect a wallet {here} to be able to pay this invoice", "0jOEtS": "செல்லாத LNURL", "0mch2Y": "பெயர் அங்கீகரிக்கப்படாத எழுத்துக்களைக் கொண்டுள்ளது", "0yO7wF": "{n} வினாடிகள்", @@ -31,6 +32,7 @@ "2a2YiP": "{n} புக்மார்க்குகள்", "2k0Cv+": "விருப்பமின்மைகள் ({n})", "2ukA4d": "{n} மணி", + "380eol": "here", "3Rx6Qo": "மேம்படுத்தப்பட்ட", "3cc4Ct": "ஒளி", "3gOsZq": "மொழிபெயர்ப்பாளர்கள்", @@ -71,6 +73,7 @@ "9WRlF4": "அனுப்பு", "9gqH2W": "உள்நுழை", "9pMqYs": "நாஸ்டர் முகவரி", + "9qtLJC": "Payment Required", "9wO4wJ": "லைட்னிங் விலைப்பட்டியல்", "ADmfQT": "பெற்றோர்", "AGNz71": "Zap All {n} sats", @@ -102,6 +105,7 @@ "DZzCem": "சமீபத்திய {n} குறிப்புகளைக் காட்டு", "DcL8P+": "ஆதரவாளர்", "Dh3hbq": "தானாக ஜாப்", + "DqLx9k": "You must pay {n} sats to access this file.", "Dt/Zd5": "தேர்ந்தெடுக்கப்பட்ட நபர்களுக்குக் குறிப்புகளில் உள்ள மீடியா தானாகவே காண்பிக்கப்படும், இல்லையெனில் இணைப்பு மட்டுமே காண்பிக்கப்படும்", "DtYelJ": "பரிமாற்றம்", "E8a4yq": "சில பிரபலமான கணக்குகளைப் பின்தொடரவும்", diff --git a/packages/app/src/translations/zh_CN.json b/packages/app/src/translations/zh_CN.json index 6a88886a..2ceb7c3e 100644 --- a/packages/app/src/translations/zh_CN.json +++ b/packages/app/src/translations/zh_CN.json @@ -14,6 +14,7 @@ "08zn6O": "导出密钥", "0Azlrb": "管理", "0BUTMv": "搜索...", + "0ehN4t": "Please connect a wallet {here} to be able to pay this invoice", "0jOEtS": "LNURL无效", "0mch2Y": "名称中有禁用字符", "0yO7wF": "{n} 秒", @@ -31,6 +32,7 @@ "2a2YiP": "{n} 个收藏", "2k0Cv+": "踩 ({n})", "2ukA4d": "{n} 小时", + "380eol": "here", "3Rx6Qo": "高级", "3cc4Ct": "浅色", "3gOsZq": "翻译人员", @@ -71,6 +73,7 @@ "9WRlF4": "发送", "9gqH2W": "登录", "9pMqYs": "Nostr 地址", + "9qtLJC": "Payment Required", "9wO4wJ": "闪电发票", "ADmfQT": "上一层", "AGNz71": "打闪所有 {n} 聪", @@ -102,6 +105,7 @@ "DZzCem": "显示最新的 {n} 条笔记", "DcL8P+": "支持者", "Dh3hbq": "自动打闪", + "DqLx9k": "You must pay {n} sats to access this file.", "Dt/Zd5": "帖子中的媒体将自动显示给选定的人,否则只会显示链接", "DtYelJ": "转移", "E8a4yq": "关注一些受欢迎的帐户", diff --git a/packages/app/src/translations/zh_TW.json b/packages/app/src/translations/zh_TW.json index 3af7c30b..453f84eb 100644 --- a/packages/app/src/translations/zh_TW.json +++ b/packages/app/src/translations/zh_TW.json @@ -14,6 +14,7 @@ "08zn6O": "導出密鑰", "0Azlrb": "管理", "0BUTMv": "搜索...", + "0ehN4t": "Please connect a wallet {here} to be able to pay this invoice", "0jOEtS": "LNURL 無效", "0mch2Y": "名稱中有禁用字符", "0yO7wF": "{n} 秒", @@ -31,6 +32,7 @@ "2a2YiP": "{n} 個收藏", "2k0Cv+": "踩 ({n})", "2ukA4d": "{n}小時", + "380eol": "here", "3Rx6Qo": "高級", "3cc4Ct": "淺色", "3gOsZq": "翻譯人員", @@ -71,6 +73,7 @@ "9WRlF4": "發送", "9gqH2W": "登錄", "9pMqYs": "Nostr 地址", + "9qtLJC": "Payment Required", "9wO4wJ": "閃電發票", "ADmfQT": "上一層", "AGNz71": "打閃所有 {n} 聰", @@ -102,6 +105,7 @@ "DZzCem": "顯示最新的 {n} 條筆記", "DcL8P+": "支持者", "Dh3hbq": "自動打閃", + "DqLx9k": "You must pay {n} sats to access this file.", "Dt/Zd5": "帖子中的媒體將自動顯示給選定的人,否則只會顯示鏈接", "DtYelJ": "轉移", "E8a4yq": "關注一些受歡迎的帳戶", From 73a669069f003fdf0dffaeacd169c0eb540647ec Mon Sep 17 00:00:00 2001 From: Kieran Date: Tue, 30 May 2023 11:53:34 +0100 Subject: [PATCH 10/15] bug: update img-src header --- packages/app/_headers | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/app/_headers b/packages/app/_headers index aa6bc2c8..bb210fcf 100644 --- a/packages/app/_headers +++ b/packages/app/_headers @@ -1,2 +1,2 @@ /* - Content-Security-Policy: default-src 'self'; manifest-src *; child-src 'none'; worker-src 'self'; frame-src youtube.com www.youtube.com https://platform.twitter.com https://embed.tidal.com https://w.soundcloud.com https://www.mixcloud.com https://open.spotify.com https://player.twitch.tv https://embed.music.apple.com https://nostrnests.com https://embed.wavlake.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; connect-src *; img-src * data:; font-src https://fonts.gstatic.com; media-src *; script-src 'self' 'wasm-unsafe-eval' https://static.cloudflareinsights.com https://platform.twitter.com https://embed.tidal.com; \ No newline at end of file + Content-Security-Policy: default-src 'self'; manifest-src *; child-src 'none'; worker-src 'self'; frame-src youtube.com www.youtube.com https://platform.twitter.com https://embed.tidal.com https://w.soundcloud.com https://www.mixcloud.com https://open.spotify.com https://player.twitch.tv https://embed.music.apple.com https://nostrnests.com https://embed.wavlake.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; connect-src *; img-src * data: blob:; font-src https://fonts.gstatic.com; media-src *; script-src 'self' 'wasm-unsafe-eval' https://static.cloudflareinsights.com https://platform.twitter.com https://embed.tidal.com; \ No newline at end of file From f09c4648c11edec11b07f890c70c4af2313d7531 Mon Sep 17 00:00:00 2001 From: Kieran Date: Tue, 30 May 2023 12:34:52 +0100 Subject: [PATCH 11/15] bug: service worker pre-cache --- packages/app/src/service-worker.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/app/src/service-worker.ts b/packages/app/src/service-worker.ts index 1e03c491..26cf6bf3 100644 --- a/packages/app/src/service-worker.ts +++ b/packages/app/src/service-worker.ts @@ -4,12 +4,10 @@ declare var self: ServiceWorkerGlobalScope; import { clientsClaim } from "workbox-core"; import { ExpirationPlugin } from "workbox-expiration"; -import { precacheAndRoute } from "workbox-precaching"; import { registerRoute } from "workbox-routing"; import { StaleWhileRevalidate, CacheFirst } from "workbox-strategies"; clientsClaim(); -precacheAndRoute(self.__WB_MANIFEST); const staticTypes = ["image", "video", "audio"]; registerRoute( From 5e027e5195f6993454e949a5b028a45e466faad5 Mon Sep 17 00:00:00 2001 From: Giszmo Date: Wed, 31 May 2023 12:52:56 +0000 Subject: [PATCH 12/15] Update '.github/ISSUE_TEMPLATE/bug_report.md' --- .github/ISSUE_TEMPLATE/bug_report.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 9b77ea71..6771ee2d 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -7,9 +7,11 @@ assignees: "" --- **Describe the bug** + A clear and concise description of what the bug is. **To Reproduce** + Steps to reproduce the behavior: 1. Go to '...' @@ -18,23 +20,25 @@ Steps to reproduce the behavior: 4. See error **Expected behavior** + A clear and concise description of what you expected to happen. **Screenshots** + If applicable, add screenshots to help explain your problem. **Desktop (please complete the following information):** - OS: [e.g. iOS] -- Browser [e.g. chrome, safari] -- Version [e.g. 22] +- Browser: [e.g. chrome, safari] +- Version: [e.g. 22] **Smartphone (please complete the following information):** - Device: [e.g. iPhone6] - OS: [e.g. iOS8.1] -- Browser [e.g. stock browser, safari] -- Version [e.g. 22] +- Browser: [e.g. stock browser, safari] +- Version: [e.g. 22] **Additional context** Add any other context about the problem here. From 203f5f28410606f19ed8913ff8ed4b88ee53f43c Mon Sep 17 00:00:00 2001 From: Kieran Date: Thu, 1 Jun 2023 08:54:26 +0000 Subject: [PATCH 13/15] chore: Update translations --- packages/app/src/translations/hu_HU.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/app/src/translations/hu_HU.json b/packages/app/src/translations/hu_HU.json index 21e60760..1cafaaaf 100644 --- a/packages/app/src/translations/hu_HU.json +++ b/packages/app/src/translations/hu_HU.json @@ -14,7 +14,7 @@ "08zn6O": "Kulcsok exportálása", "0Azlrb": "Menedzselés", "0BUTMv": "Keresés...", - "0ehN4t": "Please connect a wallet {here} to be able to pay this invoice", + "0ehN4t": "Kérlek csatlakoztass egy pénztárcát {here} hogy ezt a számlát ki tud fizetni", "0jOEtS": "Érvénytelen LNURL", "0mch2Y": "név nem engedélyezett karaktereket tartalmaz", "0yO7wF": "{n} másodperc", @@ -32,7 +32,7 @@ "2a2YiP": "{n} könyvjelző", "2k0Cv+": "Nemtetszések ({n})", "2ukA4d": "{n} órák", - "380eol": "here", + "380eol": "itt", "3Rx6Qo": "Speciális", "3cc4Ct": "Világos", "3gOsZq": "Fordítók", @@ -73,7 +73,7 @@ "9WRlF4": "Küldés", "9gqH2W": "Bejelentkezés", "9pMqYs": "Nostr Cím", - "9qtLJC": "Payment Required", + "9qtLJC": "Fizetés szükséges", "9wO4wJ": "Lightning Számla", "ADmfQT": "Szülő", "AGNz71": "Zap-elni Mind a {n} sats-ot", @@ -105,7 +105,7 @@ "DZzCem": "A legutóbbi {n} bejegyzés mutatása", "DcL8P+": "Támogató", "Dh3hbq": "Auto Zap", - "DqLx9k": "You must pay {n} sats to access this file.", + "DqLx9k": "Neked {n} sats kell fizetned, hogy ehhez a fájlhoz hozzáférjél.", "Dt/Zd5": "A bejegyzésekben található média bizonyos emberek számára automatikusan megjelenik, másoknak pedig egy link lesz helyette.", "DtYelJ": "Átvitel", "E8a4yq": "Kövess néhány népszerű felhasználót", From d50787e3f27678882c67efcb7829f8469037ebc4 Mon Sep 17 00:00:00 2001 From: Kieran Date: Sun, 11 Jun 2023 11:21:19 +0200 Subject: [PATCH 14/15] feat: use notes instead of posts --- packages/app/src/Login/MultiAccountStore.ts | 9 +++++++++ packages/app/src/Login/Preferences.ts | 4 ++-- packages/app/src/Pages/Root.tsx | 20 +++++++++---------- packages/app/src/Pages/messages.ts | 1 - .../app/src/Pages/settings/Preferences.tsx | 4 ++-- packages/app/src/Pages/settings/messages.ts | 5 ++--- packages/app/src/lang.json | 15 ++++++-------- packages/app/src/translations/en.json | 7 +++---- 8 files changed, 34 insertions(+), 31 deletions(-) diff --git a/packages/app/src/Login/MultiAccountStore.ts b/packages/app/src/Login/MultiAccountStore.ts index 916833a4..0900aecf 100644 --- a/packages/app/src/Login/MultiAccountStore.ts +++ b/packages/app/src/Login/MultiAccountStore.ts @@ -195,6 +195,15 @@ export class MultiAccountStore extends ExternalStore { window.localStorage.removeItem(LegacyKeys.RelayListKey); window.localStorage.removeItem(LegacyKeys.FollowList); window.localStorage.removeItem(LegacyKeys.NotificationsReadItem); + + // replace default tab with notes + for (const [, v] of this.#accounts) { + if ((v.preferences.defaultRootTab as string) === "posts") { + v.preferences.defaultRootTab = "notes"; + didMigrate = true; + } + } + if (didMigrate) { console.debug("Finished migration to MultiAccountStore"); this.#save(); diff --git a/packages/app/src/Login/Preferences.ts b/packages/app/src/Login/Preferences.ts index 647dc90b..0c9e39c2 100644 --- a/packages/app/src/Login/Preferences.ts +++ b/packages/app/src/Login/Preferences.ts @@ -55,7 +55,7 @@ export interface UserPreferences { /** * Default page to select on load */ - defaultRootTab: "posts" | "conversations" | "global"; + defaultRootTab: "notes" | "conversations" | "global"; /** * Default zap amount @@ -79,7 +79,7 @@ export const DefaultPreferences = { autoShowLatest: false, fileUploader: "void.cat", imgProxyConfig: DefaultImgProxy, - defaultRootTab: "posts", + defaultRootTab: "notes", defaultZapAmount: 50, autoZap: false, } as UserPreferences; diff --git a/packages/app/src/Pages/Root.tsx b/packages/app/src/Pages/Root.tsx index 0ac7cc2e..8d738c51 100644 --- a/packages/app/src/Pages/Root.tsx +++ b/packages/app/src/Pages/Root.tsx @@ -25,12 +25,12 @@ export default function RootPage() { const { publicKey: pubKey, tags, preferences } = useLogin(); const RootTab: Record = { - Posts: { - text: formatMessage(messages.Posts), + Notes: { + text: formatMessage(messages.Notes), value: 0, - data: "/posts", + data: "/notes", }, - PostsAndReplies: { + Conversations: { text: formatMessage(messages.Conversations), value: 1, data: "/conversations", @@ -50,7 +50,7 @@ export default function RootPage() { const tagTabs = tags.item.map((t, idx) => { return { text: `#${t}`, value: idx + 3, data: `/tag/${t}` }; }); - const tabs = [RootTab.Posts, RootTab.PostsAndReplies, RootTab.Global, RootTab.Discover, ...tagTabs]; + const tabs = [RootTab.Notes, RootTab.Conversations, RootTab.Global, RootTab.Discover, ...tagTabs]; const tab = useMemo(() => { const pTab = location.pathname.split("/").slice(-1)[0]; @@ -64,7 +64,7 @@ export default function RootPage() { switch (pTab) { case "conversations": { - return RootTab.PostsAndReplies; + return RootTab.NotesAndReplies; } case "global": { return RootTab.Global; @@ -73,7 +73,7 @@ export default function RootPage() { return RootTab.Discover; } default: { - return RootTab.Posts; + return RootTab.Notes; } } }, [location]); @@ -195,7 +195,7 @@ const GlobalTab = () => { ); }; -const PostsTab = () => { +const NotesTab = () => { const { follows, publicKey } = useLogin(); const subject: TimelineSubject = { type: "pubkey", @@ -239,8 +239,8 @@ export const RootRoutes = [ element: , }, { - path: "posts", - element: , + path: "notes", + element: , }, { path: "conversations", diff --git a/packages/app/src/Pages/messages.ts b/packages/app/src/Pages/messages.ts index 6cd7ae4b..d5c872d5 100644 --- a/packages/app/src/Pages/messages.ts +++ b/packages/app/src/Pages/messages.ts @@ -2,7 +2,6 @@ import { defineMessages } from "react-intl"; export default defineMessages({ Login: { defaultMessage: "Login" }, - Posts: { defaultMessage: "Posts" }, Conversations: { defaultMessage: "Conversations" }, Global: { defaultMessage: "Global" }, NewUsers: { defaultMessage: "New users page" }, diff --git a/packages/app/src/Pages/settings/Preferences.tsx b/packages/app/src/Pages/settings/Preferences.tsx index 51be7be8..f75351b7 100644 --- a/packages/app/src/Pages/settings/Preferences.tsx +++ b/packages/app/src/Pages/settings/Preferences.tsx @@ -115,8 +115,8 @@ const PreferencesPage = () => { defaultRootTab: e.target.value, } as UserPreferences) }> -