Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add p2p retrieval option #391

Merged
merged 43 commits into from
Oct 24, 2024
Merged
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
f2dd77d
feat: add config toggle for p2p retrieval
2color Oct 18, 2024
fd3c586
deps: add helia and bump verified fetch
2color Oct 18, 2024
c15199c
feat: load p2p helia
2color Oct 18, 2024
7a103d9
chore: remove console.log
2color Oct 18, 2024
eba97a4
feat: try to make recursive gateways optional
2color Oct 18, 2024
8eb8227
fixup! feat: add config toggle for p2p retrieval
2color Oct 21, 2024
804d098
chore: aegir lint --fix
SgtPooki Oct 21, 2024
a1043b8
chore: install missing deps
SgtPooki Oct 21, 2024
9a5981a
feat: use esbuild for building
SgtPooki Oct 21, 2024
1dec8ec
feat: remove webpack
SgtPooki Oct 21, 2024
ec62f19
test: fix e2e tests
SgtPooki Oct 21, 2024
04ebe4b
chore: remove timeout only required on my network
SgtPooki Oct 21, 2024
e27f549
chore: remove copyfiles
SgtPooki Oct 21, 2024
dcbddbf
chore: suggestions from self code review
SgtPooki Oct 21, 2024
a0df1fd
fix: gateways null when loading sw
SgtPooki Oct 21, 2024
6a47ff4
fix: use code-splitting
SgtPooki Oct 21, 2024
da60eb8
fix: firefox doesn't like ESM service workers
SgtPooki Oct 21, 2024
4225e61
fix: remove type in sw registration
2color Oct 22, 2024
2710f1e
feat: add git version into index.html
2color Oct 22, 2024
af67055
Merge branch 'feat/use-esbuild' into add-p2p
2color Oct 22, 2024
fd05172
Revert "feat: try to make recursive gateways optional"
2color Oct 22, 2024
900e081
fix: bug returning an array with 1 el
2color Oct 22, 2024
fe4f0f1
ui: improve contrast for disabled toggle
2color Oct 22, 2024
11b2aef
feat: add granular config options
2color Oct 22, 2024
6ea4336
test: fix config layout test
2color Oct 22, 2024
93108c1
deps: add missing deps
2color Oct 22, 2024
92eb26d
fix: unused deps
2color Oct 22, 2024
abe705b
Merge remote-tracking branch 'origin/main' into add-p2p
2color Oct 22, 2024
58a5e20
Merge branch 'main' into add-p2p
SgtPooki Oct 22, 2024
89c79a3
fix: make toggles smaller
2color Oct 23, 2024
cf4192c
fix: avoid setting defaults in inputs
2color Oct 23, 2024
2a57da9
feat: allow a single router for now
2color Oct 23, 2024
546b69c
chore: rename to get verified fetch
2color Oct 23, 2024
436e0db
feat: reorder config
2color Oct 23, 2024
c65e971
feat: add additional title
2color Oct 23, 2024
7e7ef6f
fix: break config UI into sections
SgtPooki Oct 23, 2024
a6cd325
chore: output localhost as listening host
SgtPooki Oct 23, 2024
975a51d
Merge remote-tracking branch 'origin/main' into add-p2p
2color Oct 24, 2024
17b5f53
fix: allow multiple routers
2color Oct 24, 2024
d2deff8
fix: run validation onblur to allow editing
2color Oct 24, 2024
565152c
fix: log config as string
2color Oct 24, 2024
6d9b7c6
feat: add ipip-484 filtering to delegated router
2color Oct 24, 2024
e618627
chore: more left padding on input section
SgtPooki Oct 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: reorder config
  • Loading branch information
2color committed Oct 23, 2024
commit 436e0db1b20fd94171873cb2693b176caf708f04
9 changes: 9 additions & 0 deletions src/components/input-description.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react'

export const InputDescription: React.FC<{ description?: string }> = ({ description }) => {
if (description == null || description.length === 0) {
return null
}

return (<span className="charcoal f6 fw1 db pt1 lh-copy mb2">{description}</span>)
}
5 changes: 5 additions & 0 deletions src/components/input-label.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import React from 'react'

export const InputLabel: React.FC<{ label: string }> = ({ label }) => {
return (<span className='f5 ma0 pt3 teal fw4 db'>{label}</span>)
}
6 changes: 4 additions & 2 deletions src/components/local-storage-input.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import React, { useCallback, useEffect, useState } from 'react'
import { InputDescription } from './input-description'
import { InputLabel } from './input-label'

export interface LocalStorageInputProps extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> {
localStorageKey: string
@@ -67,8 +69,8 @@ export default ({ resetKey, localStorageKey, label, placeholder, validationFn, d

return (
<div {...props}>
<label htmlFor={localStorageKey} className='f5 ma0 pt3 teal fw4 db'>{label}</label>
<span className="charcoal-muted f6 fw1 db pt1 lh-copy">{description}</span>
<InputLabel label={label} />
<InputDescription description={description} />
<textarea
className='input-reset ba br2 b--light-silver code lh-copy black-80 bg-white pa2 w-100 mt2'
id={localStorageKey}
6 changes: 4 additions & 2 deletions src/components/local-storage-toggle.tsx
Original file line number Diff line number Diff line change
@@ -3,6 +3,8 @@
*/
import React, { useEffect, useState } from 'react'
import './local-storage-toggle.css'
import { InputDescription } from './input-description'
import { InputLabel } from './input-label'

interface LocalStorageToggleProps {
label: string
@@ -38,8 +40,8 @@ export const LocalStorageToggle: React.FC<LocalStorageToggleProps> = ({

return (
<div {...props} className={`${props.className}`}>
<span className='f5 ma0 pt3 teal fw4 db'>{label}</span>
{(description.length > 0) ? <span className="charcoal-muted f6 fw1 db pt1 lh-copy mb2">{description}</span> : null}
<InputLabel label={label} />
<InputDescription description={description} />

<input
type="checkbox"
40 changes: 20 additions & 20 deletions src/pages/config.tsx
Original file line number Diff line number Diff line change
@@ -172,25 +172,7 @@ function ConfigPage (): React.JSX.Element | null {
{!isLoadedInIframe && <Header /> }
<main className='e2e-config-page pa4-l bg-snow mw7 center pa4'>
<Collapsible collapsedLabel="View config" expandedLabel='Hide config' collapsed={isLoadedInIframe}>
<LocalStorageToggle
className="e2e-config-page-input"
label="Enable Recursive Gateways"
description="Use recursive gateways configured below for retrieval of content."
defaultValue={defaultEnableRecursiveGateways}
localStorageKey={LOCAL_STORAGE_KEYS.config.enableRecursiveGateways}
resetKey={resetKey}
/>
<LocalStorageInput
className="e2e-config-page-input e2e-config-page-input-gateways"
description="A newline delimited list of recursive trustless gateway URLs."
localStorageKey={LOCAL_STORAGE_KEYS.config.gateways}
label='Recursive Gateways'
validationFn={urlValidationFn}
defaultValue={convertUrlArrayToInput(defaultGateways)}
preSaveFormat={newlineToJsonArray}
postLoadFormat={jsonToNewlineString}
resetKey={resetKey}
/>
<span className='f3 ma0 pt3 teal fw4 db'>Direct Retrieval</span>
<LocalStorageToggle
className="e2e-config-page-input"
label="Enable Delegated HTTP Gateway Providers"
@@ -238,7 +220,25 @@ function ConfigPage (): React.JSX.Element | null {
postLoadFormat={(value) => convertDnsResolverObjectToInput(JSON.parse(value))}
resetKey={resetKey}
/>

<LocalStorageToggle
className="e2e-config-page-input"
label="Enable Recursive Gateways"
description="Use recursive gateways configured below for retrieval of content."
defaultValue={defaultEnableRecursiveGateways}
localStorageKey={LOCAL_STORAGE_KEYS.config.enableRecursiveGateways}
resetKey={resetKey}
/>
<LocalStorageInput
className="e2e-config-page-input e2e-config-page-input-gateways"
description="A newline delimited list of recursive trustless gateway URLs."
localStorageKey={LOCAL_STORAGE_KEYS.config.gateways}
label='Recursive Gateways'
validationFn={urlValidationFn}
defaultValue={convertUrlArrayToInput(defaultGateways)}
preSaveFormat={newlineToJsonArray}
postLoadFormat={jsonToNewlineString}
resetKey={resetKey}
/>
<LocalStorageInput
className="e2e-config-page-input"
description="A string that enables debug logging. Use '*,*:trace' to enable all debug logging."