Fix router (#39)

* on click, do not add route if included in pathname

* corrected readme tools table links

* remove code blocks inside links

* corrected hypercore and hyperwarm links

---------

Co-authored-by: rafapaezbas <rafa@holepunch.com>
This commit is contained in:
rafapaezbas
2024-02-14 14:11:39 +01:00
committed by GitHub
parent 2095b95c23
commit 636b931276
4 changed files with 12 additions and 8 deletions

View File

@@ -1,6 +1,6 @@
# Sharing a Pear Application
Applications can be shared with peers by seeding them to the network from an efficient local data structure (a [hypercore](../bulding-blocks.md#hyeprcore])). We call the mirroring of a local file system into the Pear platform Application Storage "staging". Seeding is sharing an app from a machine over the Distributed Hash Table (DHT) (via [hyperswarm](../building-blocks.md#hyperswarm)) so that other peers can replicate, consume and reseed the application.
Applications can be shared with peers by seeding them to the network from an efficient local data structure (a [hypercore](../building-blocks/hypercore.md)). We call the mirroring of a local file system into the Pear platform Application Storage "staging". Seeding is sharing an app from a machine over the Distributed Hash Table (DHT) (via [hyperswarm](../building-blocks/hyperswarm.md)) so that other peers can replicate, consume and reseed the application.
> [Build with Pear - Episode 02: Sharing Pear Applications](https://www.youtube.com/watch?v=slYj9_ifpZQ)

View File

@@ -30,8 +30,12 @@ customElements.define('app-router', class AppRouter extends HTMLElement {
if (evt.target.origin !== location.origin) return window.open(evt.target.href)
const { tagName } = evt.target.getRootNode().host || {}
const route = tagName ? this.getAttribute(tagName) : ''
if (evt.target.pathname.startsWith(route)) {
this.load(evt.target.pathname).catch(console.error)
} else {
this.load(route + evt.target.pathname).catch(console.error)
}
}
connectedCallback () {
for (const { name, value } of Array.from(this.attributes)) {

View File

@@ -71,7 +71,7 @@ customElements.define('docs-viewer', class extends HTMLElement {
async load (page = '/') {
if (page === '/') page = this.entry
const html = await fetch(page)
const text = await marked.parse(await html.text())
const text = await marked.parse((await html.text()).replace(/\[`([^`]+)`\]/g, "[$1]")) // remove backticks inside link, example: [`hypercore`] -> [hypercore]
this.panel.querySelector('slot').innerHTML = text
this.panel.style.display = ''
}

View File

@@ -114,11 +114,11 @@ The following tools are used extensively employed in the day-to-day development
| Tools | Description |
| :----------------------------------------------------------: | :---------------------------------------------------------: |
| <mark>**[Hypershell](./tools/hypershell)**</mark> | A CLI to create and connect to P2P E2E encrypted shells.. |
| <mark>**[Hypertele](./tools/hypertele)**</mark> | A swiss-knife proxy powered by [HyperDHT](./building-blocks/hyperdht). |
| <mark>**[Hyperbeam](./tools/hyperbeam)**</mark> | A one-to-one and end-to-end encrypted internet pipe. |
| <mark>**[Hyperssh](./tools/hyperssh)**</mark> | A CLI to run SSH over the [HyperDHT](./building-blocks/hyperdht). |
| <mark>**[Drives](./tools/drives)**</mark> | CLI to download, seed, and mirror a [hyperdrive](./building-blocks/hyperdrive) or a [localdrive](./helpers/localdrive). |
| <mark>**[Hypershell](./tools/hypershell.md)**</mark> | A CLI to create and connect to P2P E2E encrypted shells.. |
| <mark>**[Hypertele](./tools/hypertele.md)**</mark> | A swiss-knife proxy powered by [HyperDHT](./building-blocks/hyperdht.md). |
| <mark>**[Hyperbeam](./tools/hyperbeam.md)**</mark> | A one-to-one and end-to-end encrypted internet pipe. |
| <mark>**[Hyperssh](./tools/hyperssh.md)**</mark> | A CLI to run SSH over the [HyperDHT](./building-blocks/hyperdht.md). |
| <mark>**[Drives](./tools/drives.md)**</mark> | CLI to download, seed, and mirror a [hyperdrive](./building-blocks/hyperdrive.md) or a [localdrive](./helpers/localdrive.md). |
## Stability indexing