Skip to content

Commit

Permalink
Merge branch 'main' into 1704839541-car-from-backup-table
Browse files Browse the repository at this point in the history
  • Loading branch information
gobengo authored Jan 23, 2024
2 parents fb948f8 + 8f82eb1 commit 462d908
Show file tree
Hide file tree
Showing 15 changed files with 116 additions and 42 deletions.
65 changes: 38 additions & 27 deletions .github/workflows/website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
id: cloudflare
Expand All @@ -237,17 +237,28 @@ jobs:
uses: marocchino/[email protected]
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
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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).
<h1 align="center"><a href="https://web3.storage"><img width="25%" src="https://user-images.githubusercontent.com/11778450/227262707-1a9674a7-9286-43e3-87b4-98b388677720.png" alt="web3.storage logo" /></a>
</h1>
<p align="center">The simple file storage service for IPFS &amp; Filecoin.</p>

> ⚠️ 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!
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
]
},
"engines": {
"node": "16.x",
"node": "18.x",
"npm": ">=7.x"
}
}
14 changes: 14 additions & 0 deletions packages/api/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)


Expand Down
2 changes: 1 addition & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
@@ -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)",
Expand Down
18 changes: 18 additions & 0 deletions packages/api/src/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/magic.link.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
12 changes: 8 additions & 4 deletions packages/api/src/maintenance.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { HTTPError, MaintenanceError } from './errors.js'
import { FeatureHasBeenSunsetError, HTTPError, MaintenanceError } from './errors.js'
import { getTokenFromRequest } from './auth.js'

/**
Expand Down Expand Up @@ -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
Expand All @@ -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()
}
}
Expand Down
6 changes: 6 additions & 0 deletions packages/api/test/maintenance.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down
21 changes: 21 additions & 0 deletions packages/website/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)


Expand Down
2 changes: 1 addition & 1 deletion packages/website/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Website

Frontend build for the web3.storage website.
Frontend build of the web3.storage website.

## Getting Started

Expand Down
2 changes: 1 addition & 1 deletion packages/website/components/messagebanner/messagebanner.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions packages/website/components/w3up-launch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
<br />
<a href={createNewAccountHref}>Click here to create a new account</a> and&nbsp;
<a href={learnWhatsNewHref}>here to read about what’s awesome</a> about the new web3.storage experience.
Expand Down
2 changes: 1 addition & 1 deletion packages/website/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@web3-storage/website",
"version": "2.38.2",
"version": "2.39.2",
"description": "web3.storage website",
"private": true,
"scripts": {
Expand Down

0 comments on commit 462d908

Please sign in to comment.