About.svelte 1.92 KB
Newer Older
Aral Balkan's avatar
Aral Balkan committed
1
<script>
2
  import Section from './Section.svelte'
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
  import { signedIn, privateMessages } from '../state'

  const baseUrl = `https://${window.location.hostname}`

  const link = fragment => `${baseUrl}${fragment}`

  const fetchJson = async fragment => {
    const response = await fetch(link(fragment))
    const json = await response.json()
    return json
  }

  async function getKeys() {
    return await fetchJson('/keys')
  }

  async function getHostname() {
    return (await fetchJson('/hostname')).hostname
  }
Aral Balkan's avatar
Aral Balkan committed
22
23
</script>

24
25
26
27
28
29
30
<style>
  h3 {
    background-color: lightsteelblue;
    padding: 0.25em;
  }
</style>

31
<Section path='/about' title='About'>
32
33
34
35
36
37
38
39
40
41
42
43
44

  <p>This is a Small Web instance running the Henry reference client. It is currently meant for use by developers.</p>

  <h3>Instance details</h3>

  <ul>
    {#await getHostname()}
      <li><strong>Your hostname is:</strong> loading…</li>
    {:then hostname}
      <li><strong>Your hostname is:</strong> {hostname}</li>
    {/await}
  </ul>

45
46
  <p>Your hostname is available in JSON format from the <a href={link('/hostname')}>/hostname</a></p>

47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
  <h3>Your details</h3>

  <p>You are <strong>{$signedIn ? 'signed in' : 'not signed in'}.</strong></p>

  <h4>Your public keys</h4>

  {#await getKeys()}
  <p>Loading keys…</p>
  {:then keys}
    <ul>
      <li><strong>Signing:</strong> {keys.signing}</li>
      <li><strong>Encryption:</strong> {keys.encryption}</li>
    </ul>
  {/await}
  <p>These keys are available in JSON format from the <a href={link('/keys')}>/keys</a> route.</p>

  <h3>Source</h3>

  <ul>
    <li><a href='https://source.small-tech.org/small-web/henry'>Client (Henry) source</a></li>
    <li><a href='https://github.com/small-tech/place'>Server (Place) source</a></li>
  </ul>

  <h3>Logs</h3>

  <h4>Private messages:</h4>

  <ul>
    {#each $privateMessages as message}
      <li>{message.data}</li>
    {:else}
      <li>None yet.</li>
    {/each}
  </ul>


Aral Balkan's avatar
Aral Balkan committed
83
</Section>