|
1 | 1 | <div align="center"> |
2 | 2 |
|
3 | | - |
| 3 | + |
4 | 4 |
|
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 |
6 | 28 |
|
7 | 29 | [](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FFreeNowOrg%2FPixivNow&demo-title=PixivNow) |
8 | 30 |
|
9 | | -免费部署一个一模一样的服务步骤很简单——点上面的按钮然后一直下一步即可。<br> |
10 | | -各位爹不要再爬我的服务了好吗?100GB/h的额度都能被您爬完了,我自己还怎么看色图呢?<br> |
11 | | -好自为之喵,不要怪我骂人喵。 |
| 31 | +点击上方按钮一键部署,或 Fork 后在 Vercel 导入项目。 |
12 | 32 |
|
13 | | -</div> |
| 33 | +如果打算公开你的部署,请小心你的账单。PixivNow 可能会被滥用来大量下载图片,导致流量激增和高额费用。 |
14 | 34 |
|
15 | | -## API |
| 35 | +### 手动构建 |
16 | 36 |
|
17 | | -您可以使用以下方式传递用户 token 来鉴权: |
| 37 | +需要 [Node.js](https://nodejs.org/) LTS 和 [pnpm](https://pnpm.io/)。 |
18 | 38 |
|
19 | | -- Header 以`Authorization`传递 |
20 | | -- Cookie 以键名`PHPSESSID`传递 |
| 39 | +```bash |
| 40 | +pnpm install |
| 41 | +pnpm build |
| 42 | +node .output/server/index.mjs |
| 43 | +``` |
21 | 44 |
|
22 | | -请求路径 `/ajax/*` 的返回结果与 `https://pixiv.net/ajax/*` 的行为完全一致。 |
| 45 | +## Environment Variables / 环境变量 |
23 | 46 |
|
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 数组) | — | |
25 | 53 |
|
26 | | -### `/api/illust/random` |
| 54 | +Docker 部署时可在 `docker-compose.yml` 中添加 `environment` 配置。 |
27 | 55 |
|
28 | | -返回随机图片,其实是 `/ajax/illust/discovery` 的语法糖,也支持直接返回图片。 |
| 56 | +## API |
29 | 57 |
|
30 | | -- `max` `{number}` 返回图片的个数 |
31 | | -- `mode` `{'all' | 'safe' | 'r18'}` 其中 `r18` 只有在登录状态且参数设置允许时才会返回 |
32 | | -- `format` `{'image' | 'json'}` 返回的格式,如果 `Accept` 包含 `image` 则预设为 `image` |
| 58 | +通过以下方式传递用户 token 鉴权(二选一): |
33 | 59 |
|
34 | | -### `/api/ranking` |
| 60 | +- Header `Authorization` |
| 61 | +- Cookie `PHPSESSID` |
35 | 62 |
|
36 | | -是 `/ranking.php` 的重定向。 |
| 63 | +请求路径 `/ajax/*` 的返回结果与 `https://pixiv.net/ajax/*` 行为一致。 |
37 | 64 |
|
38 | | -### `/user` |
| 65 | +### `/api/illust/random` |
39 | 66 |
|
40 | | -通过传入的 token,以 json 格式返回源站 `<meta name="global-data">` 中的用户信息。 |
| 67 | +返回随机图片(`/ajax/illust/discovery` 的语法糖)。 |
41 | 68 |
|
42 | | -## 图片代理 |
| 69 | +| 参数 | 类型 | 说明 | |
| 70 | +| -------- | -------------------------- | ------------------------------------------------------------ | |
| 71 | +| `max` | `number` | 返回图片的个数 | |
| 72 | +| `mode` | `'all' \| 'safe' \| 'r18'` | `r18` 需登录且账号设置允许 | |
| 73 | +| `format` | `'image' \| 'json'` | `Accept` 包含 `image` 时默认为 `image`,image 模式返回重定向 | |
43 | 74 |
|
44 | | -本站的图片使用 CloudFlare Workers 进行代理,可以直接访问欣赏众多插画。 |
| 75 | +### `/api/ranking` |
| 76 | + |
| 77 | +`/ranking.php` 的重定向。 |
45 | 78 |
|
46 | | -但是由于遭遇了大量不明流量,因此我们暂时开启了图片代理服务的防盗链。如果您有自行部署整站的需要,可以通过在Vercel环境变量`VITE_PXIMG_BASEURL_I`中传入反代url(首选),或修改 `vercel.json`中的对于图片的重定向配置,图片的请求路径与源站完全一致。 |
| 79 | +### `/api/user` |
| 80 | + |
| 81 | +辅助接口,通过传入的 token,返回当前登录用户信息 (globalData->userData)。 |
47 | 82 |
|
48 | 83 | --- |
49 | 84 |
|
50 | 85 | _For communication and learning only._ |
51 | 86 |
|
52 | | -**All data & pictures from query:** ©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:** ©Pixiv & original authors |
| 88 | + |
| 89 | +> Licensed under the [Apache License 2.0](LICENSE) |
0 commit comments