@@ -19,6 +19,7 @@ export const ipfsProviders: Record<string, string> = {
1919 pinata : 'https://gateway.pinata.cloud/' ,
2020 cloudflare : 'https://cloudflare-ipfs.com/' ,
2121 ipfs : DEFAULT_IPFS_PROVIDER ,
22+ dweb : 'https://dweb.link/' ,
2223 '' : 'https://cloudflare-ipfs.com/'
2324}
2425
@@ -193,7 +194,11 @@ export const resolveMedia = (mimeType: string): MediaType => {
193194 }
194195
195196 if ( / ^ a p p l i c a t i o n \/ j s o n / . test ( mimeType ) ) {
196- return MediaType . JSON ;
197+ return MediaType . MODEL ;
198+ }
199+
200+ if ( / ^ a p p l i c a t i o n \/ o c t e t - s t r e a m / . test ( mimeType ) ) {
201+ return MediaType . MODEL ;
197202 }
198203
199204 const match = mimeType . match ( / ^ [ a - z ] + / ) ;
@@ -221,3 +226,21 @@ export const sortByModification = (a: any, b: any) => b._mod - a._mod
221226export const nftSort = ( a : any , b : any ) => b . blockNumber - a . blockNumber
222227export const sortBy = ( arr : any [ ] , cb = nftSort ) => arr . slice ( ) . sort ( cb )
223228export const defaultSortBy = ( arr : any [ ] ) => sortBy ( arr )
229+
230+
231+ export const isJsonGltf = ( value : any ) : boolean => {
232+ try {
233+ if ( ! ( value [ 'asset' ] && / ^ 2 \. [ 0 - 9 ] $ / . test ( value [ 'asset' ] [ 'version' ] ) ) ) {
234+ return false
235+ }
236+
237+ if ( ! ( value [ 'buffers' ] && / ^ d a t a : a p p l i c a t i o n \/ o c t e t / . test ( value [ 'buffers' ] [ 0 ] [ 'uri' ] ) ) ) {
238+ return false
239+ }
240+
241+ return true
242+ } catch ( e ) {
243+ console . warn ( `Unable to decide on isJsonGltf ${ e } ` )
244+ return false
245+ }
246+ }
0 commit comments