diff --git a/services/image/src/tests/type-endpoint.test.ts b/services/image/src/tests/type-endpoint.test.ts index 47f22f3..ec574c0 100644 --- a/services/image/src/tests/type-endpoint.test.ts +++ b/services/image/src/tests/type-endpoint.test.ts @@ -47,32 +47,17 @@ test('type-endpoint - 200 - json', async () => { `) }) -test('type-endpoint - 302 - image', async () => { +test('type-endpoint - 200 - image', async () => { const res = await fetch( 'https://image-beta.w.kodadot.xyz/type/endpoint/https://polkadot-data.s3.us-east-2.amazonaws.com/metadata/nfts-88/nfts-88_collection-img.png', { redirect: 'manual' } ) - expect(res.ok).toBe(false) - expect(res.status).toBe(302) + expect(res.ok).toBe(true) + expect(res.status).toBe(200) const redirectURL = res.headers.get('location') - expect(redirectURL).toBe( - 'https://imagedelivery.net/jk5b6spi_m_-9qC4VTnjpg/https---polkadot-data-s3-us-east-2-amazonaws-com-metadata-nfts-88-nfts-88-collection-img-png/public' - ) - - const res2 = await fetch(redirectURL) - expect(res2.ok).toBe(true) - expect(res2.headers.get('content-type')).toBe('image/png') - - const data = await res2.blob() - expect(data).toMatchInlineSnapshot(` - Blob { - Symbol(kHandle): Blob {}, - Symbol(kLength): 86717, - Symbol(kType): "image/png", - } - `) + expect(redirectURL).toBe(null) }) test('type-endpoint - 200 - image - original', async () => { diff --git a/services/ogi-route/README.md b/services/ogi-route/README.md index c7afc73..cd7e0e6 100644 --- a/services/ogi-route/README.md +++ b/services/ogi-route/README.md @@ -23,11 +23,60 @@ Better alternative implementation: ## Architecture diagram ```mermaid - graph LR; - user --> koda.art - koda.art -- assigned routes --> ogi-route{{ogi-route}} - koda.art -- routes doesn't match --> nft-gallery{{nft-gallery}} - ogi-route --> isbot - isbot -- true --> ogi{{ogi}} - isbot -- false --> nft-gallery -``` +graph LR + A[User] --> B[koda.art] + B --> C{ogi-route} + C -->|SEO sensitive paths| D[ogi] + C -->|All other routes| E[nft-gallery] + E -->|For generative art| F[dyndata] + E -->|For generative art| G[fxart] + E -->|NFT & contract info| M[oda] + + F -->|Generate| H[Dynamic ID for substrate] + F -->|Generate| I[Dynamic metadata] + F -->|/image| O{Cache exists?} + O -->|Yes| P[Return from R2 bucket] + O -->|No| Q[Capture service] + Q --> R[Store in R2 bucket] + R --> P + + G -->|Generate| J[Dynamic ID for substrate] + G -->|Generate| K[Dynamic metadata] + G -->|Schedule| L[Calendar endpoints] + + M -->|Unified endpoint| N[Substrate & EVM NFT<br/>and contract details] + + style C fill:#f9f,stroke:#333,stroke-width:2px + style D fill:#bbf,stroke:#333,stroke-width:2px + style E fill:#bfb,stroke:#333,stroke-width:2px + style F fill:#fbb,stroke:#333,stroke-width:2px + style G fill:#fbb,stroke:#333,stroke-width:2px + style M fill:#bff,stroke:#333,stroke-width:2px + style O fill:#fcf,stroke:#333,stroke-width:2px + style Q fill:#cff,stroke:#333,stroke-width:2px + + classDef note fill:#fff,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5; + classDef endpoint fill:#ffe,stroke:#333,stroke-width:1px; + classDef storage fill:#ffd,stroke:#333,stroke-width:2px; + + N1[SEO sensitive paths<br/>e.g., /gallery, /collection]:::note + N2[Main gallery for<br/>user interactions]:::note + N3[Generative art<br/>components]:::note + N4[Unified NFT &<br/>contract info service]:::note + + H:::endpoint + I:::endpoint + J:::endpoint + K:::endpoint + L:::endpoint + N:::endpoint + P:::storage + R:::storage + + N1 -.-> C + N2 -.-> E + N3 -.-> F + N3 -.-> G + N4 -.-> M + +``` \ No newline at end of file