mirror of
https://github.com/imsyy/DailyHotApi.git
synced 2026-01-12 13:14:55 +08:00
Compare commits
4 Commits
v2.0.0-rc.
...
v2.0.0-rc.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
11addd20ca | ||
|
|
23375519ba | ||
|
|
2ba46c5e0e | ||
|
|
d4a52a6b24 |
14
.github/workflows/docker.yml
vendored
14
.github/workflows/docker.yml
vendored
@@ -3,9 +3,10 @@ name: Publish Docker image
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
push_to_registry:
|
||||
build-docker:
|
||||
name: Push Docker image to multiple registries
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
@@ -15,6 +16,12 @@ jobs:
|
||||
- name: Check out the repo
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
@@ -36,11 +43,14 @@ jobs:
|
||||
imsyy/dailyhot-api
|
||||
ghcr.io/${{ github.repository }}
|
||||
|
||||
- name: Build and push Docker image
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
platforms: |
|
||||
linux/amd64
|
||||
linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
|
||||
14
Dockerfile
14
Dockerfile
@@ -1,8 +1,14 @@
|
||||
FROM node:20-alpine AS base
|
||||
|
||||
# 安装 Puppeteer 所需的依赖库
|
||||
RUN apk add --no-cache chromium nss freetype harfbuzz ca-certificates libc6-compat
|
||||
|
||||
# 配置 Chromium
|
||||
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
|
||||
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
|
||||
|
||||
FROM base AS builder
|
||||
|
||||
RUN apk add --no-cache libc6-compat
|
||||
RUN npm install -g pnpm
|
||||
WORKDIR /app
|
||||
|
||||
@@ -10,9 +16,9 @@ COPY package*json tsconfig.json pnpm-lock.yaml .env ./
|
||||
COPY src ./src
|
||||
COPY public ./public
|
||||
|
||||
RUN pnpm install && \
|
||||
pnpm build && \
|
||||
pnpm prune --production
|
||||
RUN pnpm install
|
||||
RUN pnpm build
|
||||
RUN pnpm prune --production
|
||||
|
||||
FROM base AS runner
|
||||
WORKDIR /app
|
||||
|
||||
@@ -2,6 +2,12 @@
|
||||
<img alt="logo" height="120" src="./public/favicon.png" width="120"/>
|
||||
<h2>今日热榜</h2>
|
||||
<p>一个聚合热门数据的 API 接口</p>
|
||||
<br />
|
||||
<img src="https://img.shields.io/github/last-commit/imsyy/DailyHotApi" alt="last commit"/>
|
||||
<img src="https://img.shields.io/github/languages/code-size/imsyy/DailyHotApi" alt="code size"/>
|
||||
<img src="https://img.shields.io/docker/image-size/imsyy/dailyhot-api" alt="docker-image-size"/>
|
||||
<img src="https://github.com/imsyy/DailyHotApi/actions/workflows/docker.yml/badge.svg" alt="Publish Docker image"/>
|
||||
<img src="https://github.com/imsyy/DailyHotApi/actions/workflows/npm.yml/badge.svg" alt="Publish npm package"/>
|
||||
</div>
|
||||
|
||||
## 🚩 特性
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "dailyhot-api",
|
||||
"version": "2.0.0-rc.4",
|
||||
"version": "2.0.0-rc.5",
|
||||
"description": "An Api on Today's Hot list",
|
||||
"keywords": [
|
||||
"API",
|
||||
@@ -17,7 +17,7 @@
|
||||
"license": "MIT",
|
||||
"author": "imsyy",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/types.js",
|
||||
"types": "src/types.d.ts",
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"sourceMap": true,
|
||||
|
||||
@@ -10,8 +10,8 @@ const serveHotApi = (port: number = config.PORT) => {
|
||||
fetch: app.fetch,
|
||||
port,
|
||||
});
|
||||
logger.info(`🔥 DailyHot API 成功在端口 ${config.PORT} 上运行`);
|
||||
logger.info(`🔗 Local: 👉 http://localhost:${config.PORT}`);
|
||||
logger.info(`🔥 DailyHot API 成功在端口 ${port} 上运行`);
|
||||
logger.info(`🔗 Local: 👉 http://localhost:${port}`);
|
||||
return apiServer;
|
||||
} catch (error) {
|
||||
logger.error(error);
|
||||
|
||||
@@ -31,7 +31,7 @@ const getList = async (options: Options, noCache: boolean) => {
|
||||
const { type } = options;
|
||||
const url = `https://www.v2ex.com/api/topics/${type}.json`;
|
||||
const result = await get({ url, noCache });
|
||||
const list = result.data.data.list;
|
||||
const list = result.data;
|
||||
return {
|
||||
fromCache: result.fromCache,
|
||||
updateTime: result.updateTime,
|
||||
|
||||
@@ -30,8 +30,6 @@ const getList = async (options: Options, noCache: boolean) => {
|
||||
const url = `http://www.nmc.cn/rest/findAlarm?pageNo=1&pageSize=20&signaltype=&signallevel=&province=${encodeURIComponent(province)}`;
|
||||
const result = await get({ url, noCache });
|
||||
const list = result.data.data.page.list;
|
||||
console.log(list);
|
||||
|
||||
return {
|
||||
fromCache: result.fromCache,
|
||||
updateTime: result.updateTime,
|
||||
|
||||
Reference in New Issue
Block a user