app

Local-first trade for farms and co-ops
git clone https://radroots.dev/git/app.git
Log | Files | Refs | README | LICENSE

+page.svelte (8137B)


      1 <script lang="ts">
      2   import { getContext, onMount } from 'svelte';
      3   import Button from '../../lib/components/primitives/Button.svelte';
      4   import LocalDataReview from '../../lib/components/LocalDataReview.svelte';
      5   import SupportLink from '../../lib/components/SupportLink.svelte';
      6   import {
      7     IDENTITY_VIEW_CONTEXT,
      8     type IdentityViewContext
      9   } from '../../lib/runtime/view-context.ts';
     10   import {
     11     createLocalDataReview,
     12     closeLocalDataReview
     13   } from '../../lib/persistence/local-data-review.ts';
     14   const identity = getContext<IdentityViewContext>(IDENTITY_VIEW_CONTEXT);
     15   const dataReview = createLocalDataReview(identity);
     16   onMount(() => () => closeLocalDataReview(dataReview));
     17   import {
     18     LOCAL_PUBLIC_HIDES_CONTEXT,
     19     PUBLIC_HIDE_DISCLOSURE,
     20     localPublicHidesSnapshot,
     21     subscribeLocalPublicHides,
     22     undoLocalPublicPublisher,
     23     type LocalPublicHides
     24   } from '../../lib/persistence/local-public-hides.ts';
     25   const hides = getContext<LocalPublicHides | undefined>(
     26     LOCAL_PUBLIC_HIDES_CONTEXT
     27   );
     28   import {
     29     LOCAL_PRIVATE_BLOCKS_CONTEXT,
     30     PRIVATE_BLOCK_DISCLOSURE,
     31     localPrivateBlocksViewSnapshot,
     32     subscribeLocalPrivateBlocksView,
     33     undoLocalPrivateBlocksView,
     34     type LocalPrivateBlocksView
     35   } from '../../lib/persistence/local-private-blocks.ts';
     36   const blocks = getContext<LocalPrivateBlocksView | undefined>(
     37     LOCAL_PRIVATE_BLOCKS_CONTEXT
     38   );
     39   let privateSnapshot = $state.raw(
     40     blocks
     41       ? localPrivateBlocksViewSnapshot(blocks)
     42       : { state: 'guest' as const }
     43   );
     44   let privateNotice = $state<string | undefined>();
     45   let privateBusy = $state(false);
     46   onMount(() => {
     47     if (!blocks) return;
     48     privateSnapshot = localPrivateBlocksViewSnapshot(blocks);
     49     return subscribeLocalPrivateBlocksView(blocks, () => {
     50       privateSnapshot = localPrivateBlocksViewSnapshot(blocks);
     51       privateNotice = undefined;
     52     });
     53   });
     54   async function undoBlock(peer: string) {
     55     if (!blocks || privateBusy || privateSnapshot.state !== 'ready') return;
     56     const owner = privateSnapshot.owner;
     57     privateBusy = true;
     58     const result = await undoLocalPrivateBlocksView(
     59       blocks,
     60       peer,
     61       'reviewed_local_private_undo'
     62     );
     63     if (!alive) return;
     64     privateBusy = false;
     65     const current = localPrivateBlocksViewSnapshot(blocks);
     66     if (current.state !== 'ready' || current.owner !== owner) return;
     67     privateNotice =
     68       result.status === 'saved' || result.status === 'existing'
     69         ? 'Block undone. Eligible local views can be shown again. Another explicit bounded decryption action may be needed; Undo starts no message work.'
     70         : 'Undo was not confirmed. Existing local data has not been reset.';
     71   }
     72   let snapshot = $state.raw(
     73     hides ? localPublicHidesSnapshot(hides) : { state: 'guest' as const }
     74   );
     75   let notice = $state<string | undefined>(),
     76     busy = $state(false);
     77   let alive = false;
     78   onMount(() => {
     79     alive = true;
     80     const off = hides
     81       ? subscribeLocalPublicHides(hides, () => {
     82           snapshot = localPublicHidesSnapshot(hides);
     83           notice = undefined;
     84         })
     85       : () => {};
     86     if (hides) snapshot = localPublicHidesSnapshot(hides);
     87     return () => {
     88       alive = false;
     89       off();
     90     };
     91   });
     92   async function undo(publisher: string) {
     93     if (!hides || busy || snapshot.state !== 'ready') return;
     94     const owner = snapshot.owner;
     95     busy = true;
     96     const result = await undoLocalPublicPublisher(
     97       hides,
     98       publisher,
     99       'reviewed_local_public_undo'
    100     );
    101     if (!alive) return;
    102     busy = false;
    103     const current = localPublicHidesSnapshot(hides);
    104     if (current.state !== 'ready' || current.owner !== owner) return;
    105     notice =
    106       result.status === 'saved' || result.status === 'existing'
    107         ? 'Hide undone. Eligible public listings can be shown again; operator policy still applies.'
    108         : 'Undo was not confirmed. Existing local data has not been reset.';
    109   }
    110 </script>
    111 
    112 <svelte:head><title>Privacy — HarvestCircle</title></svelte:head>
    113 <div class="page page--reading stack">
    114   <h1>Privacy</h1>
    115   <h2>Public listings</h2>
    116   <p>
    117     Listing descriptions, public areas and contact details that you choose to
    118     add are public.
    119   </p>
    120   <h2>Private messages</h2>
    121   <p>
    122     Message contents are encrypted. Participants can retain or share what they
    123     receive. Relay operators can still see connection and routing information,
    124     including IP addresses and authentication identity when used.
    125   </p>
    126   <h2>In this browser</h2>
    127   <p>
    128     Listing drafts and publication records are stored locally. Saved messages
    129     are encrypted copies with limited metadata that may expose peers and times
    130     on this device. Unsent message text is not automatically saved. Browser data
    131     can be cleared or lost; it is not a backup.
    132   </p>
    133   <h2>Removing information</h2>
    134   <p>
    135     Clearing browser data does not remove other people's copies or guarantee
    136     removal from relays. Local deletion does not reverse an accepted publication
    137     or send. Actual relay retention varies; this prototype makes no universal
    138     retention guarantee.
    139   </p>
    140   <p>
    141     Listings are public. Relay queries can reveal your search or publisher
    142     interest; search URLs may remain in browser history and hosting logs. This
    143     prototype uses no tracking analytics.
    144   </p>
    145   <LocalDataReview review={dataReview} />
    146   <details class="disclosure">
    147     <summary>Encryption and device limitations</summary>
    148     <p>
    149       Encryption is not anonymity or protection from a compromised device,
    150       extension or key. Messages have no forward secrecy or post-compromise
    151       security. JavaScript cannot guarantee secure zeroization. Logout discards
    152       private session projections; copies already shared or copied outside this
    153       site can remain.
    154     </p>
    155   </details>
    156   <p>{PUBLIC_HIDE_DISCLOSURE}</p>
    157   <h2>Local publisher controls</h2>
    158   {#if snapshot.state === 'ready'}
    159     {#if snapshot.publishers.length}
    160       <ul class="stack">
    161         {#each snapshot.publishers as publisher (publisher)}
    162           <li class="stack">
    163             <p class="key">{publisher}</p>
    164             <Button
    165               label="Undo hide"
    166               onclick={() => undo(publisher)}
    167               disabled={busy}
    168             />
    169           </li>
    170         {/each}
    171       </ul>
    172     {:else}<p>No publishers hidden for this account in this browser.</p>{/if}
    173   {:else if snapshot.state === 'guest'}
    174     <p>
    175       Connect to review your account-local publisher preferences. Guest browsing
    176       does not expose an account inventory.
    177     </p>
    178   {:else if snapshot.state === 'loading'}
    179     <p>Checking local publisher preferences…</p>
    180   {:else}
    181     <p class="notice">
    182       Local preferences could not be checked. You can still browse public food.
    183       Existing local data has not been reset; previous hides are unconfirmed.
    184     </p>
    185   {/if}
    186   {#if notice}<p role="status">{notice}</p>{/if}
    187   <p>{PRIVATE_BLOCK_DISCLOSURE}</p>
    188   <h2>Local private blocks</h2>
    189   {#if privateSnapshot.state === 'ready'}
    190     {#if privateSnapshot.peers.length}
    191       <ul class="stack">
    192         {#each privateSnapshot.peers as peer (peer)}
    193           <li class="stack">
    194             <p class="key">{peer}</p>
    195             <Button
    196               label="Undo block"
    197               onclick={() => undoBlock(peer)}
    198               disabled={privateBusy}
    199             />
    200           </li>
    201         {/each}
    202       </ul>
    203     {:else}<p>No people blocked for this account in this browser.</p>{/if}
    204   {:else if privateSnapshot.state === 'guest'}
    205     <p>
    206       Connect to review account-local blocks. Guest browsing does not expose a
    207       private inventory.
    208     </p>
    209   {:else if privateSnapshot.state === 'loading'}
    210     <p>Checking local private block preferences…</p>
    211   {:else}
    212     <p class="notice">
    213       Local private preferences could not be checked. Previous blocks are
    214       unconfirmed; private rendering and decryption continuation are
    215       unavailable. Existing local data has not been reset.
    216     </p>
    217   {/if}
    218   {#if privateNotice}<p role="status">{privateNotice}</p>{/if}
    219   <p>Privacy questions?</p>
    220   <SupportLink />
    221 </div>