diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml index e65d9a905e..830e23977b 100644 --- a/.github/workflows/website.yml +++ b/.github/workflows/website.yml @@ -204,19 +204,19 @@ jobs: NEXT_PUBLIC_W3UP_LAUNCH_LIMITED_AVAILABILITY_START: ${{ vars.NEXT_PUBLIC_W3UP_LAUNCH_LIMITED_AVAILABILITY_START }} DID_DOCUMENT_ID: ${{ secrets.STAGING_DID_DOCUMENT_ID }} DID_DOCUMENT_PRIMARY_DID_KEY: ${{ secrets.STAGING_DID_DOCUMENT_PRIMARY_DID_KEY }} - - name: Add to web3.storage - uses: web3-storage/add-to-web3@v2 - id: ipfs - with: - path_to_add: packages/website/out - web3_token: ${{ secrets.WEB3_TOKEN }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Update IPFS DNSLink https://staging.web3.storage - if: github.event_name == 'push' && github.ref == 'refs/heads/main' - run: npx dnslink-cloudflare --record staging --domain web3.storage --link /ipfs/${{ steps.ipfs.outputs.cid }} - env: - CF_API_TOKEN: ${{ secrets.CF_TOKEN }} + # - name: Add to web3.storage + # uses: web3-storage/add-to-web3@v2 + # id: ipfs + # with: + # path_to_add: packages/website/out + # web3_token: ${{ secrets.WEB3_TOKEN }} + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # - name: Update IPFS DNSLink https://staging.web3.storage + # if: github.event_name == 'push' && github.ref == 'refs/heads/main' + # run: npx dnslink-cloudflare --record staging --domain web3.storage --link /ipfs/${{ steps.ipfs.outputs.cid }} + # env: + # CF_API_TOKEN: ${{ secrets.CF_TOKEN }} - name: Deploy preview build to Cloudflare Pages uses: mathiasvr/command-output@v1.1.0 id: cloudflare @@ -237,17 +237,28 @@ jobs: uses: marocchino/sticky-pull-request-comment@v2.2.0 with: number: ${{ steps.finder.outputs.pr }} + # message: | + # ### Website preview πβ¨ + # - π https://w3s.link/ipfs/${{ steps.ipfs.outputs.cid }} + # - β οΈ ${{ steps.cloudflare_url.outputs.stdout }} + + # [build log](/${{ github.repository }}/actions/runs/${{ github.run_id }}) message: | ### Website preview πβ¨ - - π https://w3s.link/ipfs/${{ steps.ipfs.outputs.cid }} - β οΈ ${{ steps.cloudflare_url.outputs.stdout }} [build log](/${{ github.repository }}/actions/runs/${{ github.run_id }}) - name: Add Preview URLs as Job Summary + # run: | + # echo " + # ### Website preview πβ¨ + # - π https://w3s.link/ipfs/${{ steps.ipfs.outputs.cid }} + # - β οΈ ${{ steps.cloudflare_url.outputs.stdout }} + + # [build log](/${{ github.repository }}/actions/runs/${{ github.run_id }})" >> $GITHUB_STEP_SUMMARY run: | echo " ### Website preview πβ¨ - - π https://w3s.link/ipfs/${{ steps.ipfs.outputs.cid }} - β οΈ ${{ steps.cloudflare_url.outputs.stdout }} [build log](/${{ github.repository }}/actions/runs/${{ github.run_id }})" >> $GITHUB_STEP_SUMMARY @@ -302,18 +313,18 @@ jobs: NEXT_PUBLIC_W3UP_LAUNCH_LIMITED_AVAILABILITY_START: ${{ vars.NEXT_PUBLIC_W3UP_LAUNCH_LIMITED_AVAILABILITY_START }} DID_DOCUMENT_ID: ${{ secrets.PRODUCTION_DID_DOCUMENT_ID }} DID_DOCUMENT_PRIMARY_DID_KEY: ${{ secrets.PRODUCTION_DID_DOCUMENT_PRIMARY_DID_KEY }} - - name: Add to web3.storage - uses: web3-storage/add-to-web3@v2 - id: ipfs - with: - path_to_add: packages/website/out - web3_token: ${{ secrets.WEB3_TOKEN }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Update IPFS DNSLink https://web3.storage - run: npx dnslink-cloudflare --record _dnslink --domain web3.storage --link /ipfs/${{ steps.ipfs.outputs.cid }} - env: - CF_API_TOKEN: ${{ secrets.CF_TOKEN }} + # - name: Add to web3.storage + # uses: web3-storage/add-to-web3@v2 + # id: ipfs + # with: + # path_to_add: packages/website/out + # web3_token: ${{ secrets.WEB3_TOKEN }} + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # - name: Update IPFS DNSLink https://web3.storage + # run: npx dnslink-cloudflare --record _dnslink --domain web3.storage --link /ipfs/${{ steps.ipfs.outputs.cid }} + # env: + # CF_API_TOKEN: ${{ secrets.CF_TOKEN }} - name: Deploy https://web3.storage to Cloudflare Pages run: npx wrangler pages publish --project-name web3-storage --branch "main" --commit-hash "$GITHUB_SHA" ./packages/website/out env: diff --git a/README.md b/README.md index 220f6e67c5..0cc984671a 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ +> β οΈ **DEPRECATED** This repo will be archived on January 9, 2024 as this web3.storage API will no longer take new uploads. Please use the [new client and API](https://github.com/web3-storage/w3up/tree/main/packages/w3up-client) for future usage of web3.storage. Documentation for the new client can be found [here](https://web3.storage/docs). You can learn more about these changes [here](https://blog.web3.storage/posts/the-data-layer-is-here-with-the-new-web3-storage). +
The simple file storage service for IPFS & Filecoin.
-> β οΈ This repo will be archived on January 9, 2024 as this web3.storage API will no longer take new uploads. Please use the [new client and API](https://github.com/web3-storage/w3up/tree/main/packages/w3up-client) for future usage of web3.storage. Documentation for the new client can be found [here](https://web3.storage/docs). You can learn more about these changes [here](https://blog.web3.storage/posts/the-data-layer-is-here-with-the-new-web3-storage). - ## Usage Store your files with web3.storage and retrieve them via their unique Content ID. Our tools make it simple to hash your content locally, so you can verify the service only ever stores the exact bytes you asked us to. Pick the method of using with web3.storage that works for you! diff --git a/package-lock.json b/package-lock.json index 9a4c4d762a..7a1e4ed3dd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,7 +26,7 @@ "wrangler": "^2.0.23" }, "engines": { - "node": "16.x", + "node": "18.x", "npm": ">=7.x" } }, diff --git a/package.json b/package.json index ad2d478481..1724eeec65 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ ] }, "engines": { - "node": "16.x", + "node": "18.x", "npm": ">=7.x" } } diff --git a/packages/api/CHANGELOG.md b/packages/api/CHANGELOG.md index 7c39f5846b..d4ac0edaf3 100644 --- a/packages/api/CHANGELOG.md +++ b/packages/api/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## [7.24.0](https://github.com/web3-storage/web3.storage/compare/api-v7.23.0...api-v7.24.0) (2024-01-22) + + +### Features + +* listUploads includes parts property with list of links to CARs that contain it ([#2347](https://github.com/web3-storage/web3.storage/issues/2347)) ([b870346](https://github.com/web3-storage/web3.storage/commit/b87034604882252f314f9abfb96d347c30f17d25)) + +## [7.23.0](https://github.com/web3-storage/web3.storage/compare/api-v7.22.0...api-v7.23.0) (2024-01-09) + + +### Features + +* api maintenance message is a FeatureHasBeenSunsetError when env.MODE is READ_ONLY ([#2346](https://github.com/web3-storage/web3.storage/issues/2346)) ([8c29cec](https://github.com/web3-storage/web3.storage/commit/8c29cec0e7dda7ac06ffac0339a734f0b0151b91)) + ## [7.22.0](https://github.com/web3-storage/web3.storage/compare/api-v7.21.0...api-v7.22.0) (2024-01-05) diff --git a/packages/api/package.json b/packages/api/package.json index a64ed8186b..03dc6268ac 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -1,6 +1,6 @@ { "name": "@web3-storage/api", - "version": "7.22.0", + "version": "7.24.0", "private": true, "type": "module", "license": "(Apache-2.0 OR MIT)", diff --git a/packages/api/src/errors.js b/packages/api/src/errors.js index 234418d88a..c38c5cc7c3 100644 --- a/packages/api/src/errors.js +++ b/packages/api/src/errors.js @@ -193,6 +193,24 @@ export class MaintenanceError extends Error { } MaintenanceError.CODE = 'ERROR_MAINTENANCE' +export class FeatureHasBeenSunsetError extends Error { + /** + * @param {string} reason + */ + constructor (reason) { + super(reason) + this.name = 'FeatureHasBeenSunset' + /** + * The 410 (Gone) status code indicates that access to the target resource + * is no longer available at the origin server and that this condition is likely + * to be permanent. + */ + this.status = 410 // Gone + this.code = FeatureHasBeenSunsetError.CODE + } +} +FeatureHasBeenSunsetError.CODE = 'ERROR_FEATURE_HAS_BEEN_SUNSET' + export class PSAErrorInvalidData extends PinningServiceApiError { /** * @param {string} message diff --git a/packages/api/src/magic.link.js b/packages/api/src/magic.link.js index 8a357c2ba4..af39613404 100644 --- a/packages/api/src/magic.link.js +++ b/packages/api/src/magic.link.js @@ -61,7 +61,7 @@ function isMagicTestModeToken (token) { let parsed try { parsed = JSON.parse(globalThis.atob(token)) - } catch (error) { + } catch { return false } if (parsed.length !== 2) { diff --git a/packages/api/src/maintenance.js b/packages/api/src/maintenance.js index af60f47de1..e4425c73fd 100644 --- a/packages/api/src/maintenance.js +++ b/packages/api/src/maintenance.js @@ -1,4 +1,4 @@ -import { HTTPError, MaintenanceError } from './errors.js' +import { FeatureHasBeenSunsetError, HTTPError, MaintenanceError } from './errors.js' import { getTokenFromRequest } from './auth.js' /** @@ -50,10 +50,10 @@ export function withMode (mode) { * @returns {Response|undefined} */ return (request, env, ctx) => { - const enabled = () => { - const currentMode = env.MODE - const currentModeBits = modeBits(currentMode) + const currentMode = env.MODE + const currentModeBits = modeBits(currentMode) + const enabled = () => { return modeBits(mode).every((bit, i) => { if (bit === '-') { return true @@ -78,6 +78,10 @@ export function withMode (mode) { // Not enabled, use maintenance handler. if (!enabled() && !modeSkip()) { + const isAfterSunsetStart = env.NEXT_PUBLIC_W3UP_LAUNCH_SUNSET_START ? (env.NEXT_PUBLIC_W3UP_LAUNCH_SUNSET_START < new Date().toISOString()) : false + if (isAfterSunsetStart && (currentMode === READ_ONLY)) { + throw new FeatureHasBeenSunsetError('This API feature has been sunset, and is no longer available. To continue uploading, use the new web3.storage API: https://web3.storage/docs.') + } return maintenanceHandler() } } diff --git a/packages/api/test/maintenance.spec.js b/packages/api/test/maintenance.spec.js index 27e0131223..d849165f17 100644 --- a/packages/api/test/maintenance.spec.js +++ b/packages/api/test/maintenance.spec.js @@ -62,6 +62,12 @@ describe('maintenance middleware', () => { assert.throws(() => block(() => { }, { MODE: NO_READ_OR_WRITE }), /API undergoing maintenance/) + + // after product sunset, READ_ONLY means FeatureHasBeenSunset + assert.throws(() => block(() => { }, { + MODE: READ_ONLY, + NEXT_PUBLIC_W3UP_LAUNCH_SUNSET_START: (new Date(0)).toISOString() + }), /FeatureHasBeenSunset/) }) it('should bypass maintenance mode with a allowed token', async () => { diff --git a/packages/website/CHANGELOG.md b/packages/website/CHANGELOG.md index 935ffc899b..aecbd931ce 100644 --- a/packages/website/CHANGELOG.md +++ b/packages/website/CHANGELOG.md @@ -1,5 +1,26 @@ # Changelog +## [2.39.2](https://github.com/web3-storage/web3.storage/compare/website-v2.39.1...website-v2.39.2) (2024-01-09) + + +### Bug Fixes + +* force website release ([07881a3](https://github.com/web3-storage/web3.storage/commit/07881a341432e4261f0498467e9570873fc6964b)) + +## [2.39.1](https://github.com/web3-storage/web3.storage/compare/website-v2.39.0...website-v2.39.1) (2024-01-09) + + +### Bug Fixes + +* only display maintenance message for no read or write ([b85827a](https://github.com/web3-storage/web3.storage/commit/b85827ab175db91c29a64da45c2d9653635ff0d9)) + +## [2.39.0](https://github.com/web3-storage/web3.storage/compare/website-v2.38.2...website-v2.39.0) (2024-01-09) + + +### Features + +* api maintenance message is a FeatureHasBeenSunsetError when env.MODE is READ_ONLY ([#2346](https://github.com/web3-storage/web3.storage/issues/2346)) ([8c29cec](https://github.com/web3-storage/web3.storage/commit/8c29cec0e7dda7ac06ffac0339a734f0b0151b91)) + ## [2.38.2](https://github.com/web3-storage/web3.storage/compare/website-v2.38.1...website-v2.38.2) (2023-11-14) diff --git a/packages/website/README.md b/packages/website/README.md index 01c9a14278..f0e134cb47 100644 --- a/packages/website/README.md +++ b/packages/website/README.md @@ -1,6 +1,6 @@ # Website -Frontend build for the web3.storage website. +Frontend build of the web3.storage website. ## Getting Started diff --git a/packages/website/components/messagebanner/messagebanner.js b/packages/website/components/messagebanner/messagebanner.js index 3d74e5d46a..59fa91249d 100644 --- a/packages/website/components/messagebanner/messagebanner.js +++ b/packages/website/components/messagebanner/messagebanner.js @@ -47,7 +47,7 @@ export default function MessageBanner() { } if ( apiVersionData && - apiVersionData.mode !== 'rw' && + apiVersionData.mode === '--' && (bannerContent.html === '' || bannerContent.html === undefined) ) { if (bannerContent.html !== GeneralPageData.message_banner.maintenceAlert) { diff --git a/packages/website/components/w3up-launch.js b/packages/website/components/w3up-launch.js index 078b22ca36..7e5a304a9c 100644 --- a/packages/website/components/w3up-launch.js +++ b/packages/website/components/w3up-launch.js @@ -19,8 +19,8 @@ export const W3upMigrationRecommendationCopy = ({ sunsetStartDate }) => { const sunsetDateFormatter = new Intl.DateTimeFormat(undefined, { dateStyle: 'long' }); return ( <> - This web3.storage product will sunset on {sunsetDateFormatter.format(sunsetStartDate)}. We recommend migrating - your usage of web3.storage to the new web3.storage. + This web3.storage product sunset for new uploads on {sunsetDateFormatter.format(sunsetStartDate)}. To continue + uploading, migrate to the new web3.storage API.