Compare commits

..

19 Commits

Author SHA1 Message Date
Jon Staab bf1ab5f0ee Bump version 2025-01-17 05:30:08 -08:00
Jon Staab 59568f95f1 Update logo 2025-01-16 15:26:54 -08:00
Jon Staab 75d52e7e17 Outsource terms/privacy 2025-01-16 14:54:43 -08:00
Jon Staab bdb5d3dfaa Update changelog 2025-01-16 08:46:51 -08:00
Jon Staab c387b65460 Bump version to 0.2.3 2025-01-16 08:41:20 -08:00
Jon Staab 01c4219922 Add reviewkey auth bypass, remove note to self 2025-01-15 15:48:39 -08:00
Jon Staab 9ca4440038 Add terms/privacy notice to landing 2025-01-15 14:05:23 -08:00
Jon Staab d6cc414f41 Add terms and privacy 2025-01-15 13:56:04 -08:00
Jon Staab 7ccb2949a9 Update gitignore 2025-01-15 13:41:15 -08:00
Jon Staab 8d4e657af5 Tweak avatar again 2025-01-15 11:42:54 -08:00
Jon Staab 4886650dfa Add mark all read 2025-01-15 11:07:21 -08:00
Jon Staab e36e6093e9 Add avatar fallback 2025-01-15 10:56:56 -08:00
Jon Staab edd6e5c8fc Add send button 2025-01-15 09:10:48 -08:00
Jon Staab be7a42d951 Add reports to channel messages 2025-01-15 07:40:28 -08:00
Jon Staab af91fe129b Accommodate onion urls 2025-01-14 15:58:38 -08:00
Jon Staab 6fcf0e7f12 Fix migration 2025-01-14 15:03:36 -08:00
Jon Staab b6defe59a8 Improve loading and notifications 2025-01-02 16:58:04 -08:00
Jon Staab f618e4e1f3 Fix tiptap styling 2025-01-02 16:12:46 -08:00
Jon Staab 5253980cdc Update changelog 2025-01-02 15:59:51 -08:00
39 changed files with 419 additions and 117 deletions
+2
View File
@@ -1,6 +1,8 @@
VITE_DEFAULT_PUBKEYS=fe7f6bc6f7338b76bbf80db402ade65953e20b2f23e66e898204b63cc42539a3,391819e2f2f13b90cac7209419eb574ef7c0d1f4e81867fc24c47a3ce5e8a248,84dee6e676e5bb67b4ad4e042cf70cbd8681155db535942fcc6a0533858a7240,dace63b00c42e6e017d00dd190a9328386002ff597b841eb5ef91de4f1ce8491,82341f882b6eabcd2ba7f1ef90aad961cf074af15b9ef44a09f9d2a8fbfbe6a2,58c741aa630c2da35a56a77c1d05381908bd10504fdd2d8b43f725efa6d23196,eeb11961b25442b16389fe6c7ebea9adf0ac36dd596816ea7119e521b8821b9e,b676ded7c768d66a757aa3967b1243d90bf57afb09d1044d3219d8d424e4aea0,61066504617ee79387021e18c89fb79d1ddbc3e7bff19cf2298f40466f8715e9,3f770d65d3a764a9c5cb503ae123e62ec7598ad035d836e2a810f3877a745b24,6389be6491e7b693e9f368ece88fcd145f07c068d2c1bbae4247b9b5ef439d32,97c70a44366a6535c145b333f973ea86dfdc2d7a99da618c40c64705ad98e322
VITE_BURROW_URL=
VITE_PLATFORM_URL=https://flotilla.social
VITE_PLATFORM_TERMS=https://flotilla.social/terms
VITE_PLATFORM_PRIVACY=https://flotilla.social/privacy
VITE_PLATFORM_NAME=Flotilla
VITE_PLATFORM_LOGO=static/flotilla.png
VITE_PLATFORM_RELAY=
+3
View File
@@ -17,6 +17,9 @@ Thumbs.db
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
# Android
.idea
# Generated assets
static/favicon.ico
static/pwa-64x64.png
+14
View File
@@ -1,5 +1,19 @@
# Changelog
# 0.2.3
* Add NIP 56 reports for messages and threads
* Add ToS and privacy policy
* Add avatar fallback icons
* Add mark as read to chats
* Add send button to chat compose
* Accommodate onion URLs
* Improve loading and notifications
# 0.2.2
* Fix bug with sending messages
# 0.2.1
* Improve performance, as well as scrolling and loading
+2 -2
View File
@@ -7,8 +7,8 @@ android {
applicationId "social.flotilla"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "0.2.2"
versionCode 3
versionName "0.2.4"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions {
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
+1 -1
View File
@@ -7,7 +7,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.2.1'
classpath 'com.android.tools.build:gradle:8.8.0'
classpath 'com.google.gms:google-services:4.4.0'
// NOTE: Do not place your application dependencies here; they belong
+1 -1
View File
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
+15 -15
View File
@@ -1,12 +1,12 @@
{
"name": "flotilla",
"version": "0.2.2",
"version": "0.2.3",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "flotilla",
"version": "0.2.2",
"version": "0.2.3",
"dependencies": {
"@capacitor/android": "^6.1.2",
"@capacitor/cli": "^6.1.2",
@@ -30,16 +30,16 @@
"@types/qrcode": "^1.5.5",
"@vite-pwa/assets-generator": "^0.2.6",
"@vite-pwa/sveltekit": "^0.6.6",
"@welshman/app": "~0.0.36",
"@welshman/app": "~0.0.37",
"@welshman/content": "~0.0.15",
"@welshman/dvm": "~0.0.13",
"@welshman/editor": "~0.0.4",
"@welshman/editor": "~0.0.6",
"@welshman/feeds": "~0.0.30",
"@welshman/lib": "~0.0.37",
"@welshman/net": "~0.0.45",
"@welshman/signer": "~0.0.19",
"@welshman/store": "~0.0.15",
"@welshman/util": "~0.0.55",
"@welshman/util": "~0.0.57",
"daisyui": "^4.12.10",
"date-picker-svelte": "^2.13.0",
"dotenv": "^16.4.5",
@@ -4843,14 +4843,14 @@
}
},
"node_modules/@welshman/app": {
"version": "0.0.36",
"resolved": "https://registry.npmjs.org/@welshman/app/-/app-0.0.36.tgz",
"integrity": "sha512-ECUaBiDE896P6LXdE3yN49z0I2MCvjA0lO6FOd2BCRfmnmdbTnC+FLcoPGTS262/uDuJz+rr3utBjq8DylugaQ==",
"version": "0.0.37",
"resolved": "https://registry.npmjs.org/@welshman/app/-/app-0.0.37.tgz",
"integrity": "sha512-EhhLx10PE6r/soiuaR0GF+NSH9H3ilTaXwmfx2cHHR1PE2LXXvf1oWMJl0ZPFmYe0VWfNiu98SLbTLYwe1Y4dQ==",
"license": "MIT",
"dependencies": {
"@types/throttle-debounce": "^5.0.2",
"@welshman/dvm": "~0.0.13",
"@welshman/feeds": "~0.0.29",
"@welshman/feeds": "~0.0.30",
"@welshman/lib": "~0.0.37",
"@welshman/net": "~0.0.45",
"@welshman/signer": "~0.0.19",
@@ -4902,9 +4902,9 @@
}
},
"node_modules/@welshman/editor": {
"version": "0.0.4",
"resolved": "https://registry.npmjs.org/@welshman/editor/-/editor-0.0.4.tgz",
"integrity": "sha512-tcMwLuBaBtT2JgON5f+Fd4Cg9oM7QMnXW9voGP+RqH1gJt0W6rjjQCtpqEcgdVtHhmaSL1P+tM4ORmOinoCv+A==",
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/@welshman/editor/-/editor-0.0.6.tgz",
"integrity": "sha512-7ZnjrsBX/5Z2OiHStCSBqNlspX/weURcP8yrH9CTcOEqJZfPx5UWfeYmzsbXttvCPBph+Cv9jfHkeVreyLkeKQ==",
"peerDependencies": {
"@tiptap/core": "^2.9.1",
"@tiptap/extension-code": "^2.9.1",
@@ -5004,9 +5004,9 @@
}
},
"node_modules/@welshman/util": {
"version": "0.0.55",
"resolved": "https://registry.npmjs.org/@welshman/util/-/util-0.0.55.tgz",
"integrity": "sha512-eqb2522Y/9oPaf+qd+qnsqZh4tDT8TZj29G/XvXCsGuFxXBpOzJ2uOuEVclXD4AeFdy0CgMRKe7kZ7741ZRCgg==",
"version": "0.0.57",
"resolved": "https://registry.npmjs.org/@welshman/util/-/util-0.0.57.tgz",
"integrity": "sha512-YflD6sfqdhIfHioJVlLydvyKOgACFL0dAcWHymlDz/FszIAl2k0XQXKgAjf0lT2uoXfrCdPsfSZwMTW7qUAY6Q==",
"license": "MIT",
"dependencies": {
"@types/ws": "^8.5.13",
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "flotilla",
"version": "0.2.2",
"version": "0.2.4",
"private": true,
"scripts": {
"dev": "vite dev",
@@ -59,16 +59,16 @@
"@types/qrcode": "^1.5.5",
"@vite-pwa/assets-generator": "^0.2.6",
"@vite-pwa/sveltekit": "^0.6.6",
"@welshman/app": "~0.0.36",
"@welshman/app": "~0.0.37",
"@welshman/content": "~0.0.15",
"@welshman/dvm": "~0.0.13",
"@welshman/editor": "~0.0.4",
"@welshman/editor": "~0.0.6",
"@welshman/feeds": "~0.0.30",
"@welshman/lib": "~0.0.37",
"@welshman/net": "~0.0.45",
"@welshman/signer": "~0.0.19",
"@welshman/store": "~0.0.15",
"@welshman/util": "~0.0.55",
"@welshman/util": "~0.0.57",
"daisyui": "^4.12.10",
"date-picker-svelte": "^2.13.0",
"dotenv": "^16.4.5",
+28 -3
View File
@@ -40,15 +40,14 @@
:root {
font-family: Lato;
}
[data-theme] {
--base-100: oklch(var(--b1));
--base-200: oklch(var(--b2));
--base-300: oklch(var(--b3));
--base-content: oklch(var(--bc));
--primary: oklch(var(--p));
--primary-content: oklch(var(--pc));
--secondary: oklch(var(--s));
--secondary-content: oklch(var(--sc));
}
.bg-alt,
@@ -120,6 +119,16 @@
@apply overflow-hidden text-ellipsis;
}
[data-tip]::before {
@apply ellipsize;
}
@media (max-width: 639px) {
[data-tip]::before {
display: none;
}
}
.content-padding-x {
@apply px-4 sm:px-8 md:px-12;
}
@@ -239,3 +248,19 @@ emoji-picker {
--input-font-color: var(--base-content);
--outline-color: var(--base-100);
}
/* tiptap */
.tiptap {
--tiptap-object-bg: var(--base-100);
--tiptap-object-fg: var(--base-content);
--tiptap-active-bg: var(--primary);
--tiptap-active-fg: var(--primary-content);
}
.tiptap-suggestions {
--tiptap-object-bg: var(--base-100);
--tiptap-object-fg: var(--base-content);
--tiptap-active-bg: var(--base-300);
--tiptap-active-fg: var(--base-content);
}
+24 -1
View File
@@ -2,6 +2,7 @@ import {get} from "svelte/store"
import {ctx, sample, uniq, sleep, chunk, equals} from "@welshman/lib"
import {
DELETE,
REPORT,
PROFILE,
INBOX_RELAYS,
RELAYS,
@@ -376,7 +377,6 @@ export const checkRelayAuth = async (url: string, timeout = 3000) => {
export const attemptRelayAccess = async (url: string, claim = "") => {
const checks = [
() => checkRelayProfile(url),
() => checkRelayConnection(url),
() => checkRelayAccess(url, claim),
() => checkRelayAuth(url),
@@ -430,6 +430,29 @@ export const makeDelete = ({event}: {event: TrustedEvent}) => {
export const publishDelete = ({relays, event}: {relays: string[]; event: TrustedEvent}) =>
publishThunk({event: makeDelete({event}), relays})
export type ReportParams = {
event: TrustedEvent
content: string
reason: string
}
export const makeReport = ({event, reason, content}: ReportParams) => {
const tags = [
["p", event.pubkey],
["e", event.id, reason],
]
return createEvent(REPORT, {content, tags})
}
export const publishReport = ({
relays,
event,
reason,
content,
}: ReportParams & {relays: string[]}) =>
publishThunk({event: makeReport({event, reason, content}), relays})
export type ReactionParams = {
event: TrustedEvent
content: string
+14 -5
View File
@@ -19,16 +19,18 @@
const submit = () => {
if ($uploading) return
onSubmit({
content: $editor!.getText({blockSeparator: "\n"}).trim(),
tags: $editor!.storage.nostr.getEditorTags(),
})
const content = $editor!.getText({blockSeparator: "\n"}).trim()
const tags = $editor!.storage.nostr.getEditorTags()
if (!content) return
onSubmit({content, tags})
$editor!.chain().clearContent().run()
}
onMount(() => {
editor = getEditor({autofocus: !isMobile, aggressive: true, element, submit, uploading})
editor = getEditor({autofocus: !isMobile, element, submit, uploading})
$editor!.chain().setContent(content).run()
})
@@ -51,4 +53,11 @@
<div class="chat-editor flex-grow overflow-hidden">
<div bind:this={element} />
</div>
<Button
data-tip="{window.navigator.platform.includes('Mac') ? 'cmd' : 'ctrl'}+enter to send"
class="center tooltip tooltip-left absolute right-4 h-10 w-10 min-w-10 rounded-full"
disabled={$uploading}
on:click={submit}>
<Icon icon="plain" />
</Button>
</form>
+1 -1
View File
@@ -82,7 +82,7 @@
</div>
</div>
<div class="row-2 ml-10 mt-1">
<ReactionSummary relays={[url]} {event} {onReactionClick} reactionClass="tooltip-right" />
<ReactionSummary {url} {event} {onReactionClick} reactionClass="tooltip-right" />
</div>
<button
class="join absolute right-1 top-1 border border-solid border-neutral text-xs opacity-0 transition-all"
@@ -3,6 +3,7 @@
import Button from "@lib/components/Button.svelte"
import Icon from "@lib/components/Icon.svelte"
import EventInfo from "@app/components/EventInfo.svelte"
import EventReport from "@app/components/EventReport.svelte"
import ConfirmDelete from "@app/components/ConfirmDelete.svelte"
import {pushModal} from "@app/modal"
@@ -10,6 +11,11 @@
export let event
export let onClick
const report = () => {
onClick()
pushModal(EventReport, {url, event})
}
const showInfo = () => {
onClick()
pushModal(EventInfo, {event})
@@ -35,5 +41,12 @@
Delete Message
</Button>
</li>
{:else}
<li>
<Button class="text-error" on:click={report}>
<Icon size={4} icon="danger" />
Report Content
</Button>
</li>
{/if}
</ul>
+2 -2
View File
@@ -41,10 +41,10 @@
<form class="column gap-4" on:submit|preventDefault={submit}>
<ModalHeader>
<div slot="title">Enable Messages</div>
<div slot="info">Do you want to enable notes and direct messages?</div>
<div slot="info">Do you want to enable direct messages?</div>
</ModalHeader>
<p>
By default, notes and direct messages are disabled, since loading them requires
By default, direct messages are disabled, since loading them requires
{PLATFORM_NAME} to download and decrypt a lot of data.
</p>
<p>
+25
View File
@@ -0,0 +1,25 @@
<script lang="ts">
import Icon from "@lib/components/Icon.svelte"
import Button from "@lib/components/Button.svelte"
import ChatStart from "@app/components/ChatStart.svelte"
import {setChecked} from "@app/notifications"
import {pushModal} from "@app/modal"
const startChat = () => pushModal(ChatStart, {}, {replaceState: true})
const markAsRead = () => {
setChecked("/chat/*")
history.back()
}
</script>
<div class="col-2">
<Button class="btn btn-primary" on:click={startChat}>
<Icon size={4} icon="add-circle" />
Start chat
</Button>
<Button class="btn btn-neutral" on:click={markAsRead}>
<Icon size={4} icon="check-circle" />
Mark all read
</Button>
</div>
+1 -1
View File
@@ -22,7 +22,7 @@
const expand = () => pushModal(ContentLinkDetail, {url}, {fullscreen: true})
</script>
<Link external href={url} class="my-2 inline-block">
<Link external href={url} class="my-2 block">
<div class="overflow-hidden rounded-box leading-[0]">
{#if url.match(/\.(mov|webm|mp4)$/)}
<video controls src={url} class="max-h-96 object-contain object-center">
+73
View File
@@ -0,0 +1,73 @@
<script lang="ts">
import Spinner from "@lib/components/Spinner.svelte"
import Button from "@lib/components/Button.svelte"
import Field from "@lib/components/Field.svelte"
import Icon from "@lib/components/Icon.svelte"
import ModalHeader from "@lib/components/ModalHeader.svelte"
import ModalFooter from "@lib/components/ModalFooter.svelte"
import {pushToast} from "@app/toast"
import {publishReport} from "@app/commands"
export let url
export let event
const back = () => history.back()
const confirm = async () => {
if (!reason) {
return pushToast({
theme: "error",
message: "Please select a reason for your report.",
})
}
loading = true
await publishReport({event, reason: reason.toLowerCase(), content, relays: [url]})
loading = false
history.back()
return pushToast({message: "Your report has been sent!"})
}
let reason = ""
let content = ""
let loading = false
</script>
<form class="column gap-4" on:submit|preventDefault={confirm}>
<ModalHeader>
<div slot="title">Report Content</div>
<div slot="info">Flag inappropriate content.</div>
</ModalHeader>
<Field>
<p slot="label">Reason*</p>
<select slot="input" class="select select-bordered" bind:value={reason}>
<option disabled selected>Choose a reason</option>
<option>Nudity</option>
<option>Malware</option>
<option>Profanity</option>
<option>Illegal</option>
<option>Spam</option>
<option>Impersonation</option>
<option>Other</option>
</select>
<p slot="info">Please select a reason for your report.</p>
</Field>
<Field>
<p slot="label">Details</p>
<textarea slot="input" class="textarea textarea-bordered" bind:value={content} />
<p slot="info">Please provide any additional details relevant to your report.</p>
</Field>
<ModalFooter>
<Button class="btn btn-link" on:click={back}>
<Icon icon="alt-arrow-left" />
Go back
</Button>
<Button type="submit" class="btn btn-primary" disabled={loading}>
<Spinner {loading}>Send Report</Spinner>
<Icon icon="alt-arrow-right" />
</Button>
</ModalFooter>
</form>
@@ -0,0 +1,55 @@
<script lang="ts">
import {getTag, REPORT} from "@welshman/util"
import type {TrustedEvent} from "@welshman/util"
import {deriveEvents} from "@welshman/store"
import {pubkey, repository} from "@welshman/app"
import ModalHeader from "@lib/components/ModalHeader.svelte"
import Button from "@lib/components/Button.svelte"
import Profile from "@app/components/Profile.svelte"
import {publishDelete} from "@app/commands"
export let url
export let event
const reports = deriveEvents(repository, {
filters: [{kinds: [REPORT], "#e": [event.id]}],
})
const back = () => history.back()
const deleteReport = (report: TrustedEvent) => {
publishDelete({event: report, relays: [url]})
if ($reports.length === 0) {
history.back()
}
}
const getReason = (tags: string[][]) => getTag("e", tags)?.[2] || "other"
</script>
<div class="column gap-4">
<ModalHeader>
<div slot="title">Report Details</div>
<div slot="info">All reports for this event are shown below.</div>
</ModalHeader>
{#each $reports as report (report.id)}
{@const reason = getReason(report.tags)}
{@const remove = () => deleteReport(report)}
<div class="column gap-2">
<div class="flex justify-between">
<div>
<Profile pubkey={report.pubkey} />
<span>Reported this event as "{reason}"</span>
</div>
{#if report.pubkey === $pubkey}
<Button class="btn-default btn" on:click={remove}>Delete Report</Button>
{/if}
</div>
{#if report.content}
<p>"{report.content}"</p>
{/if}
</div>
{/each}
<Button class="btn btn-primary" on:click={back}>Got it</Button>
</div>
+7 -1
View File
@@ -1,11 +1,12 @@
<script lang="ts">
import Icon from "@lib/components/Icon.svelte"
import Button from "@lib/components/Button.svelte"
import Link from "@lib/components/Link.svelte"
import Dialog from "@lib/components/Dialog.svelte"
import CardButton from "@lib/components/CardButton.svelte"
import LogIn from "@app/components/LogIn.svelte"
import SignUp from "@app/components/SignUp.svelte"
import {PLATFORM_NAME} from "@app/state"
import {PLATFORM_TERMS, PLATFORM_PRIVACY, PLATFORM_NAME} from "@app/state"
import {pushModal} from "@app/modal"
const logIn = () => pushModal(LogIn)
@@ -33,5 +34,10 @@
<div slot="info">Just a few questions and you'll be on your way.</div>
</CardButton>
</Button>
<p class="text-center text-xs opacity-75">
By using {PLATFORM_NAME}, you consent to our
<Link external class="link" href={PLATFORM_TERMS}>Terms of Service</Link> and
<Link external class="link" href={PLATFORM_PRIVACY}>Privacy Policy</Link>.
</p>
</div>
</Dialog>
+10 -1
View File
@@ -1,6 +1,6 @@
<script lang="ts">
import {onMount, onDestroy} from "svelte"
import {Nip46Broker, makeSecret} from "@welshman/signer"
import {Nip46Broker, getPubkey, makeSecret} from "@welshman/signer"
import {addSession} from "@welshman/app"
import {slideAndFade} from "@lib/transition"
import Spinner from "@lib/components/Spinner.svelte"
@@ -63,6 +63,15 @@
let input = ""
let loading = false
$: {
// For testing and for play store reviewers
if (input === "reviewkey") {
const secret = makeSecret()
addSession({method: "nip01", secret, pubkey: getPubkey(secret)})
}
}
onMount(async () => {
url = await broker.makeNostrconnectUrl({
perms: NIP46_PERMS,
+1 -1
View File
@@ -71,7 +71,7 @@
<SecondaryNavSection class="max-h-screen">
<div>
<SecondaryNavItem class="w-full !justify-between" on:click={openMenu}>
<strong>{displayRelayUrl(url)}</strong>
<strong class="ellipsize">{displayRelayUrl(url)}</strong>
<Icon icon="alt-arrow-down" />
</SecondaryNavItem>
{#if showMenu}
+1 -1
View File
@@ -29,7 +29,7 @@
<NoteCard {event} class="card2 bg-alt">
<Content {event} expandMode="inline" />
<div class="flex w-full justify-between gap-2">
<ReactionSummary relays={[url]} {event} {onReactionClick} reactionClass="tooltip-right">
<ReactionSummary {url} {event} {onReactionClick} reactionClass="tooltip-right">
<EmojiButton {onEmoji} class="btn btn-neutral btn-xs h-[26px] rounded-box">
<Icon icon="smile-circle" size={4} />
</EmojiButton>
+3 -11
View File
@@ -21,8 +21,6 @@
const showSettingsMenu = () => pushModal(MenuSettings)
const openNotes = () => ($canDecrypt ? goto("/notes") : pushModal(ChatEnable, {next: "/notes"}))
const openChat = () => ($canDecrypt ? goto("/chat") : pushModal(ChatEnable, {next: "/chat"}))
$: spaceUrls = Array.from($userRoomsByUrl.keys())
@@ -58,9 +56,6 @@
class="tooltip-right">
<Avatar src={$userProfile?.picture} class="!h-10 !w-10" />
</PrimaryNavItem>
<PrimaryNavItem title="Notes" on:click={openNotes} class="tooltip-right">
<Avatar icon="notes-minimalistic" class="!h-10 !w-10" />
</PrimaryNavItem>
<PrimaryNavItem
title="Messages"
on:click={openChat}
@@ -81,11 +76,8 @@
class="border-top fixed bottom-0 left-0 right-0 z-nav h-14 border border-base-200 bg-base-100 md:hidden">
<div class="content-padding-x content-sizing flex justify-between px-2">
<div class="flex gap-2 sm:gap-8">
<PrimaryNavItem title="Search" href="/people">
<Avatar icon="magnifer" class="!h-10 !w-10" />
</PrimaryNavItem>
<PrimaryNavItem title="Notes" on:click={openNotes}>
<Avatar icon="notes-minimalistic" class="!h-10 !w-10" />
<PrimaryNavItem title="Home" href="/home">
<Avatar icon="home-smile" class="!h-10 !w-10" />
</PrimaryNavItem>
<PrimaryNavItem
title="Messages"
@@ -98,7 +90,7 @@
</PrimaryNavItem>
</div>
<PrimaryNavItem title="Settings" on:click={showSettingsMenu}>
<Avatar src={$userProfile?.picture} class="!h-10 !w-10" />
<Avatar icon="settings" src={$userProfile?.picture} class="!h-10 !w-10" />
</PrimaryNavItem>
</div>
</div>
+4 -1
View File
@@ -1,5 +1,6 @@
<script lang="ts">
import type {SvelteComponent} from "svelte"
import {derived} from "svelte/store"
import {type Instance} from "tippy.js"
import {append, remove, uniq} from "@welshman/lib"
import {profileSearch} from "@welshman/app"
@@ -20,6 +21,8 @@
let popover: Instance
let instance: SvelteComponent
const search = derived(profileSearch, $profileSearch => $profileSearch.searchValues)
const selectPubkey = (pubkey: string) => {
term = ""
popover.hide()
@@ -76,8 +79,8 @@
component={Suggestions}
props={{
term,
search,
select: selectPubkey,
search: profileSearch,
component: ProfileSuggestion,
class: "rounded-box",
style: `left: 4px; width: ${input?.clientWidth + 12}px`,
+29 -7
View File
@@ -1,24 +1,35 @@
<script lang="ts">
import {onMount} from "svelte"
import {groupBy, uniqBy, batch} from "@welshman/lib"
import {REACTION, DELETE} from "@welshman/util"
import {groupBy, uniq, uniqBy, batch} from "@welshman/lib"
import {REACTION, getTag, REPORT, DELETE} from "@welshman/util"
import type {TrustedEvent} from "@welshman/util"
import {deriveEvents} from "@welshman/store"
import {pubkey, repository, load, displayProfileByPubkey} from "@welshman/app"
import {displayList} from "@lib/util"
import {isMobile} from "@lib/html"
import Icon from "@lib/components/Icon.svelte"
import EventReportDetails from "@app/components/EventReportDetails.svelte"
import {displayReaction} from "@app/state"
import {pushModal} from "@app/modal"
export let event
export let onReactionClick
export let relays: string[] = []
export let url = ""
export let reactionClass = ""
export let noTooltip = false
const reports = deriveEvents(repository, {
filters: [{kinds: [REPORT], "#e": [event.id]}],
})
const reactions = deriveEvents(repository, {
filters: [{kinds: [REACTION], "#e": [event.id]}],
})
const onReportClick = () => pushModal(EventReportDetails, {url, event})
$: reportReasons = uniq($reports.map(e => getTag("e", e.tags)?.[2]))
$: groupedReactions = groupBy(
e => e.content,
uniqBy(e => e.pubkey + e.content, $reactions),
@@ -26,11 +37,11 @@
onMount(() => {
load({
relays,
filters: [{kinds: [REACTION, DELETE], "#e": [event.id]}],
relays: [url],
filters: [{kinds: [REACTION, REPORT, DELETE], "#e": [event.id]}],
onEvent: batch(300, (events: TrustedEvent[]) => {
load({
relays,
relays: [url],
filters: [{kinds: [DELETE], "#e": events.map(e => e.id)}],
})
}),
@@ -38,8 +49,19 @@
})
</script>
{#if $reactions.length > 0}
{#if $reactions.length > 0 || $reports.length > 0}
<div class="flex min-w-0 flex-wrap gap-2">
{#if url && $reports.length > 0}
<button
type="button"
data-tip="{`This content has been reported as "${displayList(reportReasons)}".`}}"
class="btn btn-error btn-xs tooltip-right flex items-center gap-1 rounded-full"
class:tooltip={!noTooltip && !isMobile}
on:click|preventDefault|stopPropagation={onReportClick}>
<Icon icon="danger" />
<span>{$reports.length}</span>
</button>
{/if}
{#each groupedReactions.entries() as [content, events]}
{@const pubkeys = events.map(e => e.pubkey)}
{@const isOwn = $pubkey && pubkeys.includes($pubkey)}
+1 -1
View File
@@ -56,7 +56,7 @@
<div class="flex flex-wrap items-center justify-between gap-2">
<div class="flex flex-grow flex-wrap justify-end gap-2">
<ReactionSummary relays={[url]} {event} {onReactionClick} reactionClass="tooltip-left" />
<ReactionSummary {url} {event} {onReactionClick} reactionClass="tooltip-left" />
{#if $deleted}
<div class="btn btn-error btn-xs rounded-full">Deleted</div>
{:else if thunk}
+13
View File
@@ -4,6 +4,7 @@
import Button from "@lib/components/Button.svelte"
import Icon from "@lib/components/Icon.svelte"
import EventInfo from "@app/components/EventInfo.svelte"
import EventReport from "@app/components/EventReport.svelte"
import ThreadShare from "@app/components/ThreadShare.svelte"
import ConfirmDelete from "@app/components/ConfirmDelete.svelte"
import {pushModal} from "@app/modal"
@@ -14,6 +15,11 @@
const isRoot = event.kind !== COMMENT
const report = () => {
onClick()
pushModal(EventReport, {url, event})
}
const showInfo = () => {
onClick()
pushModal(EventInfo, {event})
@@ -52,5 +58,12 @@
Delete Message
</Button>
</li>
{:else}
<li>
<Button class="text-error" on:click={report}>
<Icon size={4} icon="danger" />
Report Content
</Button>
</li>
{/if}
</ul>
+8 -6
View File
@@ -42,9 +42,9 @@
}
</script>
<div class="flex justify-end px-1 text-xs {$$props.class}">
{#if isFailure && failure}
{@const [url, {message, status}] = failure}
{#if isFailure && failure}
{@const [url, {message, status}] = failure}
<div class="flex justify-end px-1 text-xs {$$props.class}">
<Tippy
class="flex items-center {$$props.class}"
component={ThunkStatusDetail}
@@ -55,7 +55,9 @@
<span>Failed to send!</span>
</span>
</Tippy>
{:else if canCancel || isPending}
</div>
{:else if canCancel || isPending}
<div class="flex justify-end px-1 text-xs {$$props.class}">
<span class="flex items-center gap-1 {$$props.class}">
<span class="loading loading-spinner mx-1 h-3 w-3 translate-y-px" />
<span class="opacity-50">Sending...</span>
@@ -63,5 +65,5 @@
<Button class="link" on:click={abort}>Cancel</Button>
{/if}
</span>
{/if}
</div>
</div>
{/if}
-7
View File
@@ -26,7 +26,6 @@ export const signWithAssert = async (template: StampedEvent) => {
}
export const getEditor = ({
aggressive = false,
autofocus = false,
charCount,
content = "",
@@ -36,7 +35,6 @@ export const getEditor = ({
uploading,
wordCount,
}: {
aggressive?: boolean
autofocus?: boolean
charCount?: Writable<number>
content?: string
@@ -62,11 +60,6 @@ export const getEditor = ({
placeholder,
},
},
breakOrSubmit: {
config: {
aggressive,
},
},
fileUpload: {
config: {
onDrop() {
+21 -5
View File
@@ -1,9 +1,9 @@
import {derived} from "svelte/store"
import {synced, throttled} from "@welshman/store"
import {pubkey} from "@welshman/app"
import {prop, identity, now} from "@welshman/lib"
import {prop, spec, identity, now, groupBy} from "@welshman/lib"
import type {TrustedEvent} from "@welshman/util"
import {MESSAGE} from "@welshman/util"
import {MESSAGE, COMMENT, getTagValue} from "@welshman/util"
import {makeSpacePath, makeChatPath, makeThreadPath, makeRoomPath} from "@app/routes"
import {
THREAD_FILTER,
@@ -36,7 +36,10 @@ export const notifications = derived(
}
for (const [entryPath, ts] of Object.entries($checked)) {
const isMatch = entryPath === "*" || entryPath.startsWith(path)
const isMatch =
entryPath === "*" ||
entryPath.startsWith(path) ||
(entryPath === "/chat/*" && path.startsWith("/chat/"))
if (isMatch && ts > latestEvent.created_at) {
return false
@@ -63,13 +66,26 @@ export const notifications = derived(
for (const [url, rooms] of $userRoomsByUrl.entries()) {
const spacePath = makeSpacePath(url)
const threadPath = makeThreadPath(url)
const latestEvent = allThreadEvents.find(e => $getUrlsForEvent(e.id).includes(url))
const threadEvents = allThreadEvents.filter(e => $getUrlsForEvent(e.id).includes(url))
if (hasNotification(threadPath, latestEvent)) {
if (hasNotification(threadPath, threadEvents[0])) {
paths.add(spacePath)
paths.add(threadPath)
}
const commentsByThreadId = groupBy(
e => getTagValue("E", e.tags),
threadEvents.filter(spec({kind: COMMENT})),
)
for (const [threadId, [comment]] of commentsByThreadId.entries()) {
const threadItemPath = makeThreadPath(url, threadId)
if (hasNotification(threadItemPath, comment)) {
paths.add(threadItemPath)
}
}
for (const room of rooms) {
const roomPath = makeRoomPath(url, room)
const latestEvent = allMessageEvents.find(
+1 -1
View File
@@ -50,7 +50,7 @@ export const listenForNotifications = () => {
filters: [
{kinds: [THREAD], since: now()},
{kinds: [COMMENT], "#K": [String(THREAD)], since: now()},
{kinds: [MESSAGE], "#h": Array.from(rooms), since: now()},
...Array.from(rooms).map(room => ({kinds: [MESSAGE], "#h": [room], since: now()})),
],
}),
)
+4
View File
@@ -94,6 +94,10 @@ export const SIGNER_RELAYS = ["wss://relay.nsec.app/", "wss://bucket.coracle.soc
export const PLATFORM_URL = window.location.origin
export const PLATFORM_TERMS = import.meta.env.VITE_PLATFORM_TERMS
export const PLATFORM_PRIVACY = import.meta.env.VITE_PLATFORM_PRIVACY
export const PLATFORM_LOGO = PLATFORM_URL + "/pwa-192x192.png"
export const PLATFORM_NAME = import.meta.env.VITE_PLATFORM_NAME
+24 -12
View File
@@ -1,20 +1,32 @@
<script lang="ts">
import cx from "classnames"
import {onMount} from "svelte"
import Icon from "@lib/components/Icon.svelte"
export let src = ""
export let size = 7
export let icon = "user-rounded"
let element: HTMLElement
$: rem = size * 4
onMount(() => {
if (src) {
const image = new Image()
image.addEventListener("error", () => {
element.querySelector(".hidden")?.classList.remove("hidden")
})
image.src = src
}
})
</script>
{#if src}
<div
class={cx($$props.class, "shrink-0 overflow-hidden rounded-full bg-cover bg-center")}
style={`width: ${size * 4}px; height: ${size * 4}px; min-width: ${size * 4}px; background-image: url(${src}); ${$$props.style || ""}`} />
{:else}
<div
class={cx($$props.class, "center !flex rounded-full")}
style={`width: ${size * 4}px; height: ${size * 4}px; min-width: ${size * 4}px; ${$$props.style || ""}`}>
<Icon {icon} size={Math.round(size * 0.8)} />
</div>
{/if}
<div
bind:this={element}
class="{$$props.class} relative !flex shrink-0 items-center justify-center overflow-hidden rounded-full bg-cover bg-center"
style="width: {rem}px; height: {rem}px; min-width: {rem}px; background-image: url({src}); {$$props.style ||
''}">
<Icon {icon} class={src ? "hidden" : ""} size={Math.round(size * 0.8)} />
</div>
+2 -2
View File
@@ -85,7 +85,7 @@
setupTracking()
setupAnalytics()
ready = initStorage("flotilla", 4, {
ready = initStorage("flotilla", 5, {
relays: storageAdapters.fromCollectionStore("url", relays, {throttle: 3000}),
handles: storageAdapters.fromCollectionStore("nip05", handles, {throttle: 3000}),
freshness: storageAdapters.fromObjectStore(freshness, {
@@ -100,7 +100,7 @@
throttle: 3000,
migrate: (data: {key: string; value: number}[]) => data.slice(0, 10_000),
}),
events: storageAdapters.fromRepositoryAndTracker(repository, tracker, {
events2: storageAdapters.fromRepositoryAndTracker(repository, tracker, {
throttle: 3000,
migrate: (events: TrustedEvent[]) => {
if (events.length < 15_000) {
+5 -2
View File
@@ -6,6 +6,7 @@
import ContentSearch from "@lib/components/ContentSearch.svelte"
import ChatItem from "@app/components/ChatItem.svelte"
import ChatStart from "@app/components/ChatStart.svelte"
import ChatMenuMobile from "@app/components/ChatMenuMobile.svelte"
import {chatSearch} from "@app/state"
import {pushModal} from "@app/modal"
import {setChecked} from "@app/notifications"
@@ -14,6 +15,8 @@
const startChat = () => pushModal(ChatStart)
const openMenu = () => pushModal(ChatMenuMobile)
$: chats = $chatSearch.searchOptions(term).filter(c => c.pubkeys.length > 1)
onDestroy(() => {
@@ -41,8 +44,8 @@
<Icon icon="magnifer" />
<input bind:value={term} class="grow" type="text" placeholder="Search for conversations..." />
</label>
<Button class="btn btn-primary" on:click={startChat}>
<Icon icon="add-circle" />
<Button class="btn btn-primary" on:click={openMenu}>
<Icon icon="menu-dots" />
</Button>
</div>
<div slot="content" class="col-2">
-16
View File
@@ -1,16 +0,0 @@
<script lang="ts">
import {pubkey} from "@welshman/app"
import Page from "@lib/components/Page.svelte"
import Chat from "@app/components/Chat.svelte"
$: id = $pubkey!
</script>
<Page>
<Chat {id}>
<p slot="info" class="px-4">
This is a place for your notes. Everything you write here is encrypted and stored on the nostr
network.
</p>
</Chat>
</Page>
+2 -2
View File
@@ -64,8 +64,8 @@
// Load recent messages for user rooms to help with a quick page transition
pullConservatively({relays, filters: rooms.map(r => ({kinds: [MESSAGE], "#h": [r], since}))})
// Listen for deletes that would apply to messages we already have
const sub = subscribe({relays, filters: [{kinds: [DELETE], since}]})
// Listen for deletes that would apply to messages we already have, and new groups
const sub = subscribe({relays, filters: [{kinds: [DELETE, GROUPS], since}]})
return () => {
sub.close()
+5 -4
View File
@@ -1,6 +1,7 @@
<script lang="ts">
import {page} from "$app/stores"
import type {TrustedEvent} from "@welshman/util"
import {displayRelayUrl} from "@welshman/util"
import {deriveRelay} from "@welshman/app"
import {fade} from "@lib/transition"
import Icon from "@lib/components/Icon.svelte"
@@ -79,11 +80,11 @@
</div>
</div>
</div>
<div>
<div class="min-w-0">
<h2 class="ellipsize whitespace-nowrap text-xl">
<RelayName {url} />
</h2>
<p class="text-sm opacity-75">{url}</p>
<p class="ellipsize text-sm opacity-75">{displayRelayUrl(url)}</p>
</div>
</div>
<RelayDescription {url} />
@@ -157,9 +158,9 @@
</div>
</Link>
{/each}
<Button on:click={addRoom} class="btn btn-neutral">
<Button on:click={addRoom} class="btn btn-neutral whitespace-nowrap">
<Icon icon="add-circle" />
Create Room
Create
</Button>
</div>
{#if pubkey}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

After

Width:  |  Height:  |  Size: 22 KiB