Skip to content

Commit 1d53a34

Browse files
dragon-fishclaude
andcommitted
feat: add Docker deployment support and update README
Add multi-stage Dockerfile, docker-compose.yml with env passthrough, and rewrite README with deployment instructions and updated docs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 6ccf1d0 commit 1d53a34

5 files changed

Lines changed: 107 additions & 39 deletions

File tree

.dockerignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.git
2+
.nuxt
3+
.output
4+
dist
5+
node_modules
6+
*.log
7+
.vscode
8+
.idea
9+
*.md
10+
!package.json
11+
DEV_NOTES
12+
docker-compose.yml

Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM node:24-alpine AS build
2+
3+
WORKDIR /app
4+
5+
COPY package.json pnpm-lock.yaml .npmrc ./
6+
RUN corepack enable pnpm \
7+
&& pnpm install --frozen-lockfile --prefer-offline
8+
9+
COPY . .
10+
RUN pnpm build
11+
12+
FROM node:24-alpine
13+
14+
WORKDIR /app
15+
ENV NODE_ENV=production
16+
17+
COPY --from=build /app/.output .output
18+
19+
EXPOSE 3000
20+
CMD ["node", ".output/server/index.mjs"]

README.md

Lines changed: 62 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,89 @@
11
<div align="center">
22

3-
![PixivNow Logo](src/assets/LogoH.png)
3+
![PixivNow Logo](app/assets/LogoH.png)
44

5-
Pixiv Service Proxy
5+
PixivNow - Now, everyone can enjoy Pixiv!
6+
7+
</div>
8+
9+
## Deploy / 部署
10+
11+
### Docker (推荐)
12+
13+
```bash
14+
git clone https://github.com/FreeNowOrg/PixivNow.git
15+
cd PixivNow
16+
docker compose up -d
17+
```
18+
19+
服务将在 `http://localhost:3000` 启动。
20+
21+
代码更新后重新构建:
22+
23+
```bash
24+
git pull && docker compose up -d --build
25+
```
26+
27+
### Vercel
628

729
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FFreeNowOrg%2FPixivNow&demo-title=PixivNow)
830

9-
免费部署一个一模一样的服务步骤很简单——点上面的按钮然后一直下一步即可。<br>
10-
各位爹不要再爬我的服务了好吗?100GB/h的额度都能被您爬完了,我自己还怎么看色图呢?<br>
11-
好自为之喵,不要怪我骂人喵。
31+
点击上方按钮一键部署,或 Fork 后在 Vercel 导入项目。
1232

13-
</div>
33+
如果打算公开你的部署,请小心你的账单。PixivNow 可能会被滥用来大量下载图片,导致流量激增和高额费用。
1434

15-
## API
35+
### 手动构建
1636

17-
您可以使用以下方式传递用户 token 来鉴权:
37+
需要 [Node.js](https://nodejs.org/) LTS 和 [pnpm](https://pnpm.io/)
1838

19-
- Header 以`Authorization`传递
20-
- Cookie 以键名`PHPSESSID`传递
39+
```bash
40+
pnpm install
41+
pnpm build
42+
node .output/server/index.mjs
43+
```
2144

22-
请求路径 `/ajax/*` 的返回结果与 `https://pixiv.net/ajax/*` 的行为完全一致。
45+
## Environment Variables / 环境变量
2346

24-
以下列举部分 PixivNow 的独特接口:
47+
| 变量 | 说明 | 默认值 |
48+
| --------------------------------- | -------------------------- | ------ |
49+
| `NUXT_PUBLIC_PXIMG_BASEURL_I` | i.pximg.net 图片代理地址 | `/-/` |
50+
| `NUXT_PUBLIC_PXIMG_BASEURL_S` | s.pximg.net 图片代理地址 | `/~/` |
51+
| `NUXT_PUBLIC_GOOGLE_ANALYTICS_ID` | Google Analytics ID ||
52+
| `NUXT_UA_BLACKLIST` | 屏蔽的 UA 模式 (JSON 数组) ||
2553

26-
### `/api/illust/random`
54+
Docker 部署时可在 `docker-compose.yml` 中添加 `environment` 配置。
2755

28-
返回随机图片,其实是 `/ajax/illust/discovery` 的语法糖,也支持直接返回图片。
56+
## API
2957

30-
- `max` `{number}` 返回图片的个数
31-
- `mode` `{'all' | 'safe' | 'r18'}` 其中 `r18` 只有在登录状态且参数设置允许时才会返回
32-
- `format` `{'image' | 'json'}` 返回的格式,如果 `Accept` 包含 `image` 则预设为 `image`
58+
通过以下方式传递用户 token 鉴权(二选一):
3359

34-
### `/api/ranking`
60+
- Header `Authorization`
61+
- Cookie `PHPSESSID`
3562

36-
`/ranking.php` 的重定向
63+
请求路径 `/ajax/*` 的返回结果与 `https://pixiv.net/ajax/*` 行为一致
3764

38-
### `/user`
65+
### `/api/illust/random`
3966

40-
通过传入的 token,以 json 格式返回源站 `<meta name="global-data">` 中的用户信息
67+
返回随机图片(`/ajax/illust/discovery` 的语法糖)
4168

42-
## 图片代理
69+
| 参数 | 类型 | 说明 |
70+
| -------- | -------------------------- | ------------------------------------------------------------ |
71+
| `max` | `number` | 返回图片的个数 |
72+
| `mode` | `'all' \| 'safe' \| 'r18'` | `r18` 需登录且账号设置允许 |
73+
| `format` | `'image' \| 'json'` | `Accept` 包含 `image` 时默认为 `image`,image 模式返回重定向 |
4374

44-
本站的图片使用 CloudFlare Workers 进行代理,可以直接访问欣赏众多插画。
75+
### `/api/ranking`
76+
77+
`/ranking.php` 的重定向。
4578

46-
但是由于遭遇了大量不明流量,因此我们暂时开启了图片代理服务的防盗链。如果您有自行部署整站的需要,可以通过在Vercel环境变量`VITE_PXIMG_BASEURL_I`中传入反代url(首选),或修改 `vercel.json`中的对于图片的重定向配置,图片的请求路径与源站完全一致。
79+
### `/api/user`
80+
81+
辅助接口,通过传入的 token,返回当前登录用户信息 (globalData->userData)。
4782

4883
---
4984

5085
_For communication and learning only._
5186

52-
**All data & pictures from query:** &copy;Pixiv & Illusts' authors
53-
54-
> Copyright 2021 PixivNow
55-
>
56-
> Licensed under the Apache License, Version 2.0 (the "License");<br>
57-
> you may not use this file except in compliance with the License.<br>
58-
> You may obtain a copy of the License at
59-
>
60-
> http://www.apache.org/licenses/LICENSE-2.0
61-
>
62-
> Unless required by applicable law or agreed to in writing, software<br>
63-
> distributed under the License is distributed on an "AS IS" BASIS,<br>
64-
> WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<br>
65-
> See the License for the specific language governing permissions and<br>
66-
> limitations under the License.
87+
**All data & pictures from query:** &copy;Pixiv & original authors
88+
89+
> Licensed under the [Apache License 2.0](LICENSE)

docker-compose.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
services:
2+
pixivnow:
3+
build: .
4+
ports:
5+
- '${PIXIVNOW_PORT:-3000}:3000'
6+
environment:
7+
- NUXT_PUBLIC_PXIMG_BASEURL_I=${NUXT_PUBLIC_PXIMG_BASEURL_I:-/-/}
8+
- NUXT_PUBLIC_PXIMG_BASEURL_S=${NUXT_PUBLIC_PXIMG_BASEURL_S:-/~/}
9+
- NUXT_PUBLIC_GOOGLE_ANALYTICS_ID=${NUXT_PUBLIC_GOOGLE_ANALYTICS_ID:-}
10+
- NUXT_UA_BLACKLIST=${NUXT_UA_BLACKLIST:-}
11+
restart: unless-stopped

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
"build": "nuxt build",
1515
"generate": "nuxt generate",
1616
"preview": "nuxt preview",
17+
"prepare": "nuxt prepare",
1718
"postinstall": "nuxt prepare",
19+
"serve": "node .output/server/index.mjs",
1820
"changelog": "conventional-changelog -p jquery -i CHANGELOG.md -s -r 0"
1921
},
2022
"dependencies": {

0 commit comments

Comments
 (0)