Skip to content

Commit

Permalink
fix: doc and auth
Browse files Browse the repository at this point in the history
Documentation guidance update for command deployment, and bug fix for Showcase 401
  • Loading branch information
Ray-D-Song committed Nov 4, 2024
1 parent 4b20359 commit 17b6d91
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/preview-service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ on:
branches:
- main
- hotfix
- chunk
- search

jobs:
deploy:
Expand Down
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Copy the last line of the output, and replace the `database_id` value in the `wr

Then execute the initialization sql:
```bash
npx wrangler d1 execute web-archive --remote --file=./init.sql
npx wrangler d1 migrations apply web-archive --remote
```

Output:
Expand All @@ -123,10 +123,7 @@ Note: if the execution fails to complete, your DB will return to its original st
└────────────────────────┴───────────┴──────────────┴────────────────────┘
```
### 4. Update BEARER_TOKEN
BEARER_TOKEN is the credential for accessing the web-archive, equivalent to a password, modify the value of `BEARER_TOKEN` in the `wrangler.toml` file.
### 5. Deploy
### 4. Deploy
```bash
npx wrangler pages deploy
```
Expand Down
6 changes: 2 additions & 4 deletions docs/README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ database_id = "xxxx-xxxx-xxxx-xxxx-xxxx"

然后执行初始化 sql:
```bash
npx wrangler d1 execute web-archive --remote --file=./init.sql
npx wrangler d1 migrations apply web-archive --remote
```

成功输出:
Expand All @@ -116,10 +116,8 @@ Note: if the execution fails to complete, your DB will return to its original st
│ 9 │ 13 │ 13 │ 0.04 │
└────────────────────────┴───────────┴──────────────┴────────────────────┘
```
### 4. 修改 BEARER_TOKEN
BEARER_TOKEN 是访问 web-archive 的凭证,相当于密码,修改 `wrangler.toml` 文件中 `BEARER_TOKEN` 的值。
### 5. 部署服务
### 4. 部署服务
```bash
# 部署服务
npx wrangler pages deploy
Expand Down
4 changes: 4 additions & 0 deletions packages/server/src/middleware/token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ import type { Context, Next } from 'hono'
import { verifyAdminToken } from '~/model/store'

async function tokenMiddleware(c: Context, next: Next) {
if (c.req.path === '/api/pages/screenshot') {
return await next()
}

const authHeader = c.req.header('Authorization')

if (!authHeader || !authHeader.startsWith('Bearer ')) {
Expand Down

0 comments on commit 17b6d91

Please # to comment.