Feat: Add Bili Page

哔哩小窗说明页面,状态和随机壁纸接口调整
This commit is contained in:
奇趣保罗 2022-04-18 11:04:46 +08:00
parent 8cdf2a6655
commit 3d38f2f8dd
7 changed files with 122 additions and 22 deletions

View File

@ -6,18 +6,18 @@ export const source: Record<string, IWallpaperSource> = {
name: "Gitee",
url: "https://dreamer-paul.gitee.io/anime-wallpaper/",
start: 1,
end: 104
end: 107
},
gh: {
name: "GitHub",
url: "https://dreamer-paul.github.io/Anime-Wallpaper/",
start: 1,
end: 104
end: 107
},
jsd: {
name: "JSDelivr",
url: "https://fastly.jsdelivr.net/gh/Dreamer-Paul/Anime-Wallpaper/",
start: 1,
end: 104
end: 107
}
}

View File

@ -1,5 +0,0 @@
import { Api, Get } from '@midwayjs/hooks';
export const getDate = Api(Get(), async () => {
return new Date().toString();
});

View File

@ -1,10 +0,0 @@
import { Api, Post } from '@midwayjs/hooks';
import fetch from 'isomorphic-unfetch';
export default Api(Post(), async (repo: string) => {
const response = await fetch(`https://api.github.com/repos/${repo}`);
const json = await response.json();
return {
stars: json.stargazers_count,
};
});

View File

@ -5,18 +5,19 @@ import { client } from "./utils/redis";
export default Api(
Get(),
async () => {
const wallpaperStat = await client.get("api-next:stat:wallpaper");
const neteaseStat = await client.get("api-next:stat:netease");
const wallpaperStat = await client.get("api-next:stat:wallpaper");
const biliStat = await client.get("api-next:stat:bili");
const bingStat = await client.get("api-next:stat:bing");
const acgmStat = await client.get("api-next:stat:acgm");
return {
code: 1,
data: {
wallpaper: Number(wallpaperStat),
netease: Number(neteaseStat),
wallpaper: Number(wallpaperStat),
acgm: Number(acgmStat),
bili: -1,
bili: Number(biliStat),
bing: Number(bingStat),
}
};

View File

@ -19,6 +19,7 @@ import Log from "./pages/log";
import Netease from "./pages/netease";
import Wallpaper from "./pages/wallpaper";
import ACGM from "./pages/acgm";
import Bili from "./pages/bili";
import Bing from "./pages/bing";
import NoMatch from "./pages/404";
@ -34,6 +35,7 @@ function App() {
<Route path="/netease" element={<Netease />} />
<Route path="/wallpaper" element={<Wallpaper />} />
<Route path="/acgm" element={<ACGM />} />
<Route path="/bili" element={<Bili />} />
<Route path="/bing" element={<Bing />} />
<Route path="*" element={<NoMatch />} />
</Routes>

112
src/pages/bili.tsx Normal file
View File

@ -0,0 +1,112 @@
// React
import React, { useEffect } from "react";
// UI
import { Link } from "react-router-dom";
import prism from "prismjs";
import ArticleHead from "@/components/Layout/ArticleHead";
// Components
function Bili() {
useEffect(() => {
prism.highlightAll();
}, []);
return (
<main>
<ArticleHead title="哔哩哔哩小窗" desc="更简洁的展示 B 站发布的视频内容" />
<article className="post">
<h3>使</h3>
<p> <code>iframe</code> API <code>https://api.paugram.com/bili/?av=视频 AV 号</code> 填写在 <code>src</code> 属性里即可食用。</p>
<p>使 API <Link to="/notice"></Link></p>
<h3></h3>
<div className="ks-table text-nowrap">
<table>
<thead>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
</thead>
<tbody>
<tr>
<td>av <em></em></td>
<td> AV </td>
<td> B 访</td>
</tr>
<tr>
<td>bv <em></em></td>
<td> BV </td>
<td> B 访</td>
</tr>
<tr>
<td>style</td>
<td><code>white</code> <code>gray</code> <code>black</code></td>
<td></td>
</tr>
</tbody>
</table>
</div>
<h3></h3>
<div className="ks-table text-nowrap">
<table>
<thead>
<tr>
<td></td>
<td></td>
</tr>
</thead>
<tbody>
<tr>
<td>[]</td>
<td></td>
</tr>
<tr>
<td>white</td>
<td></td>
</tr>
<tr>
<td>gray</td>
<td></td>
</tr>
<tr>
<td>black</td>
<td></td>
</tr>
</tbody>
</table>
</div>
<h3></h3>
<p> av39027441 </p>
<pre className="language-html"><code>&lt;iframe src="https://api.paugram.com/bili?av=39027441&style=gray" style="height: 10em; width: 100%"&gt;&lt;/iframe&gt;</code></pre>
<p></p>
<iframe src={`//${location.host}/api/bili?av=39027441&style=gray`} style={{ height: "10em", width: "100%"}}></iframe>
<p> av69269716 </p>
<pre className="language-html"><code>&lt;iframe src="https://api.paugram.com/bili?av=69269716&style=black" style="height: 10em; width: 100%"&gt;&lt;/iframe&gt;</code></pre>
<p></p>
<iframe src={`//${location.host}/api/bili?av=69269716&style=black`} style={{ height: "10em", width: "100%"}}></iframe>
<p> BV19f4y1k7eN </p>
<pre className="language-html"><code>&lt;iframe src="https://api.paugram.com/bili?bv=BV19f4y1k7eN&style=white" style="height: 10em; width: 100%"&gt;&lt;/iframe&gt;</code></pre>
<p></p>
<iframe src={`//${location.host}/api/bili?bv=BV19f4y1k7eN&style=white`} style={{ height: "10em", width: "100%"}}></iframe>
<h3></h3>
<p></p>
<p>使 <code>16px</code> <code>height: 10em</code> <code>height: 160px</code> </p>
<h3></h3>
<ul>
<li><a href="https://www.bilibili.com" rel="nofollow" target="_blank">BiliBili</a></li>
</ul>
</article>
</main>
)
}
export default Bili;

View File

@ -34,7 +34,7 @@ function Index() {
<h3></h3>
<p> 2018 7 API 使</p>
<div className="row text-center">
<div className="row text-center" style={{ marginTop: "2em" }}>
{
stat?.data && Object.keys(stat.data).map((item) => (
<div className="col-4" key={item}>