Commit 0228b35 1 parent 5194dd2 commit 0228b35 Copy full SHA for 0228b35
File tree 9 files changed +20
-10
lines changed
app/space/[did]/root/[cid]
9 files changed +20
-10
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ NEXT_PUBLIC_W3UP_SERVICE_URL=https://staging.up.web3.storage
3
3
NEXT_PUBLIC_W3UP_RECEIPTS_URL=https://staging.up.web3.storage/receipt/
4
4
NEXT_PUBLIC_W3UP_SERVICE_DID=did:web:staging.web3.storage
5
5
NEXT_PUBLIC_W3UP_PROVIDER=did:web:staging.web3.storage
6
+ NEXT_PUBLIC_IPFS_GATEWAY_URL=https://%ROOT_CID%.ipfs-staging.w3s.link
6
7
7
8
# set these to your gateway service URL and DID
8
9
NEXT_PUBLIC_W3UP_GATEWAY_HOST=https://freeway-staging.dag.haus
Original file line number Diff line number Diff line change 42
42
echo "NEXT_PUBLIC_W3UP_PROVIDER=did:web:staging.web3.storage" >> .env
43
43
echo "NEXT_PUBLIC_W3UP_GATEWAY_HOST=https://freeway-staging.dag.haus" >> .env
44
44
echo "NEXT_PUBLIC_W3UP_GATEWAY_ID=did:web:staging.w3s.link" >> .env
45
+ echo "NEXT_PUBLIC_IPFS_GATEWAY_URL=https://%ROOT_CID%.ipfs-staging.w3s.link" >> .env
45
46
echo "NEXT_PUBLIC_STRIPE_PRICING_TABLE_ID=prctbl_1NzhdvF6A5ufQX5vKNZuRhie" >> .env
46
47
echo "NEXT_PUBLIC_STRIPE_TRIAL_PRICING_TABLE_ID=prctbl_1QIDHGF6A5ufQX5vOK9Xl8Up" >> .env
47
48
echo "NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_51LO87hF6A5ufQX5viNsPTbuErzfavdrEFoBuaJJPfoIhzQXdOUdefwL70YewaXA32ZrSRbK4U4fqebC7SVtyeNcz00qmgNgueC" >> .env
@@ -139,6 +140,7 @@ jobs:
139
140
echo "NEXT_PUBLIC_W3UP_PROVIDER=did:web:web3.storage" >> .env
140
141
echo "NEXT_PUBLIC_W3UP_GATEWAY_HOST=https://w3s.link" >> .env
141
142
echo "NEXT_PUBLIC_W3UP_GATEWAY_ID=did:web:w3s.link" >> .env
143
+ echo "NEXT_PUBLIC_IPFS_GATEWAY_URL=https://%ROOT_CID%.ipfs.w3s.link" >> .env
142
144
echo "NEXT_PUBLIC_STRIPE_PRICING_TABLE_ID=prctbl_1OCJ1qF6A5ufQX5vM5DWg4rA" >> .env
143
145
echo "NEXT_PUBLIC_STRIPE_TRIAL_PRICING_TABLE_ID=prctbl_1QPYsuF6A5ufQX5vdIGAe54g" >> .env
144
146
echo "NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_live_51LO87hF6A5ufQX5vQTO5BHyz8y9ybJp4kg1GsBjYuqwluuwtQTkbeZzkoQweFQDlv7JaGjuIdUWAyuwXp3tmCfsM005lJK9aS8" >> .env
Original file line number Diff line number Diff line change 42
42
echo "NEXT_PUBLIC_W3UP_PROVIDER=did:web:staging.web3.storage" >> .env
43
43
echo "NEXT_PUBLIC_W3UP_GATEWAY_HOST=https://freeway-staging.dag.haus" >> .env
44
44
echo "NEXT_PUBLIC_W3UP_GATEWAY_ID=did:web:staging.w3s.link" >> .env
45
+ echo "NEXT_PUBLIC_IPFS_GATEWAY_URL=https://%ROOT_CID%.ipfs-staging.w3s.link" >> .env
45
46
echo "NEXT_PUBLIC_STRIPE_PRICING_TABLE_ID=prctbl_1NzhdvF6A5ufQX5vKNZuRhie" >> .env
46
47
echo "NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_51LO87hF6A5ufQX5viNsPTbuErzfavdrEFoBuaJJPfoIhzQXdOUdefwL70YewaXA32ZrSRbK4U4fqebC7SVtyeNcz00qmgNgueC" >> .env
47
48
echo "NEXT_PUBLIC_STRIPE_CUSTOMER_PORTAL_LINK=https://billing.stripe.com/p/login/test_6oE29Gff99KO6mk8ww" >> .env
@@ -132,6 +133,7 @@ jobs:
132
133
echo "NEXT_PUBLIC_W3UP_PROVIDER=did:web:web3.storage" >> .env
133
134
echo "NEXT_PUBLIC_W3UP_GATEWAY_HOST=https://w3s.link" >> .env
134
135
echo "NEXT_PUBLIC_W3UP_GATEWAY_ID=did:web:w3s.link" >> .env
136
+ echo "NEXT_PUBLIC_IPFS_GATEWAY_URL=https://%ROOT_CID%.ipfs.w3s.link" >> .env
135
137
echo "NEXT_PUBLIC_STRIPE_PRICING_TABLE_ID=prctbl_1OCJ1qF6A5ufQX5vM5DWg4rA" >> .env
136
138
echo "NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_live_51LO87hF6A5ufQX5vQTO5BHyz8y9ybJp4kg1GsBjYuqwluuwtQTkbeZzkoQweFQDlv7JaGjuIdUWAyuwXp3tmCfsM005lJK9aS8" >> .env
137
139
echo "NEXT_PUBLIC_STRIPE_CUSTOMER_PORTAL_LINK=https://billing.stripe.com/p/login/cN22aA62U6bO1sA9AA" >> .env
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import CopyIcon from '@/components/CopyIcon'
13
13
import { Breadcrumbs } from '@/components/Breadcrumbs'
14
14
import { useRouter } from 'next/navigation'
15
15
import { createUploadsListKey } from '@/cache'
16
+ import { ipfsGatewayURL } from '@/components/services'
16
17
17
18
interface PageProps {
18
19
params : {
@@ -58,7 +59,7 @@ export default function ItemPage ({ params }: PageProps): JSX.Element {
58
59
router . replace ( `/space/${ spaceDID } ` )
59
60
}
60
61
61
- const url = `https:// ${ root } .ipfs.w3s.link`
62
+ const url = ipfsGatewayURL ( root )
62
63
return (
63
64
< div >
64
65
< Breadcrumbs space = { space . did ( ) } root = { root } />
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import { H3 } from './Text'
12
12
import * as UcantoClient from '@ucanto/client'
13
13
import { HTTP } from '@ucanto/transport'
14
14
import * as CAR from '@ucanto/transport/car'
15
+ import { gatewayHost } from './services'
15
16
16
17
export function SpaceCreatorCreating ( ) : JSX . Element {
17
18
return (
@@ -59,15 +60,14 @@ export function SpaceCreatorForm({
59
60
setSubmitted ( true )
60
61
try {
61
62
62
- const gatewayId = toWebDID ( process . env . NEXT_PUBLIC_W3UP_GATEWAY_ID ) || toWebDID ( 'did:web:w3s.link' )
63
- const gatewayUrl = process . env . NEXT_PUBLIC_W3UP_GATEWAY_HOST || 'https://w3s.link'
63
+ const gatewayId = toWebDID ( process . env . NEXT_PUBLIC_W3UP_GATEWAY_ID ) ?? toWebDID ( 'did:web:w3s.link' )
64
64
65
65
const storachaGateway = UcantoClient . connect ( {
66
66
id : {
67
67
did : ( ) => gatewayId
68
68
} ,
69
69
codec : CAR . outbound ,
70
- channel : HTTP . open < ContentServeService > ( { url : new URL ( gatewayUrl ) } ) ,
70
+ channel : HTTP . open < ContentServeService > ( { url : new URL ( gatewayHost ) } ) ,
71
71
} )
72
72
73
73
const space = await client . createSpace ( name , {
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ import {
12
12
WrapInDirectoryCheckbox ,
13
13
useUploader
14
14
} from '@w3ui/react'
15
- import { gatewayHost } from '../components/services'
15
+ import { ipfsGatewayURL } from '../components/services'
16
16
import { useEffect , useState } from 'react'
17
17
import { RadioGroup } from '@headlessui/react'
18
18
import { H2 } from './Text'
@@ -94,7 +94,7 @@ export const Done = ({ dataCID }: DoneProps): JSX.Element => {
94
94
< H2 > Uploaded</ H2 >
95
95
< a
96
96
className = 'font-mono text-xs max-w-full overflow-hidden no-wrap text-ellipsis'
97
- href = { `https:// ${ cid } .ipfs. ${ gatewayHost } /` }
97
+ href = { ipfsGatewayURL ( cid ) }
98
98
>
99
99
{ cid }
100
100
</ a >
Original file line number Diff line number Diff line change 1
- import type { Service } from '@w3ui/react'
1
+ import type { Service , UnknownLink } from '@w3ui/react'
2
2
import { connect } from '@ucanto/client'
3
3
import { CAR , HTTP } from '@ucanto/transport'
4
4
import * as DID from '@ipld/dag-ucan/did'
@@ -19,6 +19,11 @@ export const servicePrincipal = DID.parse(
19
19
process . env . NEXT_PUBLIC_W3UP_SERVICE_DID ?? 'did:web:web3.storage'
20
20
)
21
21
22
+ export const ipfsGatewayURL = ( rootCID : UnknownLink | string ) => new URL (
23
+ // 'https://%ROOT_CID%.ipfs.w3s.link' or 'https://%ROOT_CID%.ipfs-staging.w3s.link'
24
+ process . env . NEXT_PUBLIC_IPFS_GATEWAY_URL ?. replace ( '%ROOT_CID%' , rootCID . toString ( ) ) ?? `https://${ rootCID } .ipfs.w3s.link`
25
+ ) . toString ( )
26
+
22
27
export const serviceConnection = connect < Service > ( {
23
28
id : servicePrincipal ,
24
29
codec : CAR . outbound ,
@@ -28,4 +33,4 @@ export const serviceConnection = connect<Service>({
28
33
} ) ,
29
34
} )
30
35
31
- export const gatewayHost = process . env . NEXT_PUBLIC_W3UP_GATEWAY_HOST ?? 'w3s.link'
36
+ export const gatewayHost = process . env . NEXT_PUBLIC_W3UP_GATEWAY_HOST ?? 'https:// w3s.link'
Original file line number Diff line number Diff line change @@ -101,7 +101,7 @@ class Reader {
101
101
//
102
102
// If so we should be able to get a location claim, and key in the
103
103
// claim should be the CAR CID.
104
- const claims = await Claims . read ( root )
104
+ const claims = await Claims . read ( root . multihash )
105
105
const locationClaims = [ ]
106
106
for ( const c of claims ) {
107
107
if ( c . type === 'assert/location' ) {
Original file line number Diff line number Diff line change @@ -50,7 +50,6 @@ class Reader {
50
50
}
51
51
52
52
const root = Link . parse ( raw . cid )
53
- // @ts -expect-error not in client types
54
53
const parts : string [ ] = raw . parts
55
54
56
55
const shards : Shard [ ] = [ ]
You can’t perform that action at this time.
0 commit comments