Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a0d9596b2e | ||
|
|
45749e5d34 | ||
|
|
703d2a3e04 | ||
|
|
c575bebfdb | ||
|
|
a98ff3a1ff | ||
|
|
bfd3c4eb93 | ||
|
|
a8516a8ce8 | ||
|
|
f72d953483 | ||
|
|
1fe10b8c0a | ||
|
|
aede5d794c | ||
|
|
15437461da | ||
|
|
4bb900745f | ||
|
|
697f4eeed8 | ||
|
|
a1a3fd065d | ||
|
|
b5bd6e88a6 | ||
|
|
be79e862d6 | ||
|
|
f62dfa6a19 |
@@ -1,3 +0,0 @@
|
|||||||
|
|
||||||
# Don't index SpecStory auto-save files, but allow explicit context inclusion via @ references
|
|
||||||
.specstory/**
|
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
name: Auto Refresh
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '*/20 0-17,22,23 * * *'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: lts/*
|
||||||
|
|
||||||
|
- name: Refresh
|
||||||
|
env:
|
||||||
|
JWT_TOKEN: ${{ secrets.JWT_TOKEN }}
|
||||||
|
run: npx tsx ./scripts/refresh.ts
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
name: Publish Docker image to Gitea
|
name: Publish Docker image
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -8,12 +8,11 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-docker:
|
build-docker:
|
||||||
name: Build and push to Gitea Registry (Internal)
|
name: Push Docker image to multiple registries
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
packages: write # 必须:允许写入软件包
|
packages: write
|
||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check out the repo
|
- name: Check out the repo
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -23,29 +22,19 @@ jobs:
|
|||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
with:
|
|
||||||
# 👇 告诉 Buildx 这个地址允许 HTTP (insecure)
|
|
||||||
driver-opts: network=1panel-network
|
|
||||||
config-inline: |
|
|
||||||
[registry."172.18.0.21:3000"]
|
|
||||||
http = true
|
|
||||||
insecure = true
|
|
||||||
|
|
||||||
- name: Log in to Gitea Registry (Internal)
|
- name: Log in to the Container registry
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
# ✅ 修改点1: 使用内网地址,避开 Cloudflare 和 WAF
|
registry: ghcr.io
|
||||||
registry: 172.18.0.21:3000
|
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ secrets.GGITEA_PAT }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Extract metadata (tags, labels) for Docker
|
- name: Extract metadata (tags, labels) for Docker
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
with:
|
with:
|
||||||
# ✅ 修改点2: 镜像名必须以 gitea:3000 开头,才能推送到内网注册中心
|
images: ghcr.io/${{ github.repository }}
|
||||||
# Gitea 会自动处理映射,你在外网依然可以用 git.chgr.cc 拉取
|
|
||||||
images: 172.18.0.21:3000/${{ github.repository }}
|
|
||||||
|
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
@@ -57,4 +46,4 @@ jobs:
|
|||||||
linux/arm64
|
linux/arm64
|
||||||
push: true
|
push: true
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
name: Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branch: main
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: lts/*
|
||||||
|
|
||||||
|
- run: npx changelogithub
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
||||||
+1
-2
@@ -12,5 +12,4 @@ dev-dist
|
|||||||
*.tsbuildinfo
|
*.tsbuildinfo
|
||||||
wrangler.toml
|
wrangler.toml
|
||||||
imports.app.d.ts
|
imports.app.d.ts
|
||||||
package-lock.json
|
package-lock.json
|
||||||
.specstory/
|
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
FROM node:20.12.2-alpine AS builder
|
FROM node:20.12.2-alpine as builder
|
||||||
WORKDIR /usr/src
|
WORKDIR /usr/src
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN corepack enable
|
RUN corepack enable
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
# NewsNow
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
[English](./README.md) | [简体中文](README.zh-CN.md) | 日本語
|
[English](./README.md) | [简体中文](README.zh-CN.md) | 日本語
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
# NewsNow
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
English | [简体中文](README.zh-CN.md) | [日本語](README.ja-JP.md)
|
English | [简体中文](README.zh-CN.md) | [日本語](README.ja-JP.md)
|
||||||
|
|||||||
+4
-2
@@ -1,3 +1,7 @@
|
|||||||
|
# NewsNow
|
||||||
|
|
||||||
|
<a href="https://hellogithub.com/repository/c2978695e74a423189e9ca2543ab3b36" target="_blank"><img src="https://api.hellogithub.com/v1/widgets/recommend.svg?rid=c2978695e74a423189e9ca2543ab3b36&claim_uid=SMJiFwlsKCkWf89&theme=small" alt="Featured|HelloGitHub" /></a>
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
[English](./README.md) | 简体中文 | [日本語](README.ja-JP.md)
|
[English](./README.md) | 简体中文 | [日本語](README.ja-JP.md)
|
||||||
@@ -110,5 +114,3 @@ pnpm dev
|
|||||||
如果本项目对你有所帮助,可以给小猫买点零食。如果需要定制或者其他帮助,请通过下列方式联系备注。
|
如果本项目对你有所帮助,可以给小猫买点零食。如果需要定制或者其他帮助,请通过下列方式联系备注。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
<a href="https://hellogithub.com/repository/c2978695e74a423189e9ca2543ab3b36" target="_blank"><img src="https://api.hellogithub.com/v1/widgets/recommend.svg?rid=c2978695e74a423189e9ca2543ab3b36&claim_uid=SMJiFwlsKCkWf89&theme=small" alt="Featured|HelloGitHub" /></a>
|
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
services:
|
|
||||||
newsnow:
|
|
||||||
build: .
|
|
||||||
ports:
|
|
||||||
- '4444:4444'
|
|
||||||
volumes:
|
|
||||||
- newsnow_data:/usr/app/.data
|
|
||||||
environment:
|
|
||||||
- G_CLIENT_ID=
|
|
||||||
- G_CLIENT_SECRET=
|
|
||||||
- JWT_SECRET=
|
|
||||||
- INIT_TABLE=true
|
|
||||||
- ENABLE_CACHE=true
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
newsnow_data:
|
|
||||||
name: newsnow_data
|
|
||||||
+3
-10
@@ -1,22 +1,15 @@
|
|||||||
|
version: '3'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
newsnow:
|
newsnow:
|
||||||
image: ghcr.io/ourongxing/newsnow:latest
|
image: ghcr.io/ourongxing/newsnow:latest
|
||||||
container_name: newsnow
|
container_name: newsnow
|
||||||
|
restart: always
|
||||||
ports:
|
ports:
|
||||||
- '4444:4444'
|
- '4444:4444'
|
||||||
volumes:
|
|
||||||
- newsnow_data:/usr/app/.data
|
|
||||||
environment:
|
environment:
|
||||||
- HOST=0.0.0.0
|
|
||||||
- PORT=4444
|
|
||||||
- NODE_ENV=production
|
|
||||||
- G_CLIENT_ID=
|
- G_CLIENT_ID=
|
||||||
- G_CLIENT_SECRET=
|
- G_CLIENT_SECRET=
|
||||||
- JWT_SECRET=
|
- JWT_SECRET=
|
||||||
- INIT_TABLE=true
|
- INIT_TABLE=true
|
||||||
- ENABLE_CACHE=true
|
- ENABLE_CACHE=true
|
||||||
- PRODUCTHUNT_API_TOKEN=
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
newsnow_data:
|
|
||||||
name: newsnow_data
|
|
||||||
|
|||||||
+1
-2
@@ -2,5 +2,4 @@ G_CLIENT_ID=
|
|||||||
G_CLIENT_SECRET=
|
G_CLIENT_SECRET=
|
||||||
JWT_SECRET=
|
JWT_SECRET=
|
||||||
INIT_TABLE=true
|
INIT_TABLE=true
|
||||||
ENABLE_CACHE=true
|
ENABLE_CACHE=true
|
||||||
PRODUCTHUNT_API_TOKEN=
|
|
||||||
+19
-6
@@ -1,5 +1,5 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="zh-CN" class="dark">
|
<html lang="zh-CN">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
@@ -15,14 +15,14 @@
|
|||||||
<meta property="og:title" content="NewsNow - 优雅的新闻聚合阅读器" />
|
<meta property="og:title" content="NewsNow - 优雅的新闻聚合阅读器" />
|
||||||
<meta property="og:description" content="实时新闻聚合阅读器,汇集全球热点新闻,提供优雅的阅读体验" />
|
<meta property="og:description" content="实时新闻聚合阅读器,汇集全球热点新闻,提供优雅的阅读体验" />
|
||||||
<meta property="og:type" content="website" />
|
<meta property="og:type" content="website" />
|
||||||
<meta property="og:url" content="https://hot.chgr.cc" />
|
<meta property="og:url" content="https://newsnow.busiyi.world" />
|
||||||
<meta property="og:image" content="https://hot.chgr.cc/og-image.png" />
|
<meta property="og:image" content="https://newsnow.busiyi.world/og-image.png" />
|
||||||
|
|
||||||
<!-- Twitter Card Meta Tags -->
|
<!-- Twitter Card Meta Tags -->
|
||||||
<meta name="twitter:card" content="summary_large_image" />
|
<meta name="twitter:card" content="summary_large_image" />
|
||||||
<meta name="twitter:title" content="NewsNow - 优雅的新闻聚合阅读器" />
|
<meta name="twitter:title" content="NewsNow - 优雅的新闻聚合阅读器" />
|
||||||
<meta name="twitter:description" content="实时新闻聚合阅读器,汇集全球热点新闻,提供优雅的阅读体验" />
|
<meta name="twitter:description" content="实时新闻聚合阅读器,汇集全球热点新闻,提供优雅的阅读体验" />
|
||||||
<meta name="twitter:image" content="https://hot.chgr.cc/og-image.svg" />
|
<meta name="twitter:image" content="https://newsnow.busiyi.world/og-image.svg" />
|
||||||
|
|
||||||
<meta name="theme-color" content="#F14D42" />
|
<meta name="theme-color" content="#F14D42" />
|
||||||
<link rel="preload" href="/Baloo2-Bold.subset.ttf" as="font" type="font/ttf" crossorigin>
|
<link rel="preload" href="/Baloo2-Bold.subset.ttf" as="font" type="font/ttf" crossorigin>
|
||||||
@@ -34,8 +34,8 @@
|
|||||||
"@context": "https://schema.org",
|
"@context": "https://schema.org",
|
||||||
"@type": "WebSite",
|
"@type": "WebSite",
|
||||||
"name": "NewsNow",
|
"name": "NewsNow",
|
||||||
"url": "https://hot.chgr.cc",
|
"url": "https://newsnow.busiyi.world",
|
||||||
"description": "实时新闻聚合阅读器,汇集全球热点新闻,提供优雅的阅读体验"
|
"description": "实时新闻聚合阅读器,汇集全球热点新闻,提供优雅的阅读体验",
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -49,6 +49,19 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
function safeParseString(str) {
|
||||||
|
try {
|
||||||
|
return JSON.parse(str)
|
||||||
|
} catch {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const theme = safeParseString(localStorage.getItem("color-scheme")) || "dark"
|
||||||
|
const isDark = window.matchMedia("(prefers-color-scheme: dark)").matches
|
||||||
|
if (theme !== "light") {
|
||||||
|
document.documentElement.classList.add("dark")
|
||||||
|
}
|
||||||
|
|
||||||
const query = new URLSearchParams(window.location.search)
|
const query = new URLSearchParams(window.location.search)
|
||||||
if (query.has("login") && query.has("user") && query.has("jwt")) {
|
if (query.has("login") && query.has("user") && query.has("jwt")) {
|
||||||
localStorage.setItem("user", query.get("user"))
|
localStorage.setItem("user", query.get("user"))
|
||||||
|
|||||||
+1
-11
@@ -17,11 +17,6 @@ const nitroOption: Parameters<typeof viteNitro>[0] = {
|
|||||||
connector: "better-sqlite3",
|
connector: "better-sqlite3",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
devDatabase: {
|
|
||||||
default: {
|
|
||||||
connector: "better-sqlite3",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
imports: {
|
imports: {
|
||||||
dirs: ["server/utils", "shared"],
|
dirs: ["server/utils", "shared"],
|
||||||
},
|
},
|
||||||
@@ -43,11 +38,6 @@ if (process.env.VERCEL) {
|
|||||||
// }
|
// }
|
||||||
} else if (process.env.CF_PAGES) {
|
} else if (process.env.CF_PAGES) {
|
||||||
nitroOption.preset = "cloudflare-pages"
|
nitroOption.preset = "cloudflare-pages"
|
||||||
nitroOption.unenv = {
|
|
||||||
alias: {
|
|
||||||
"safer-buffer": "node:buffer",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
nitroOption.database = {
|
nitroOption.database = {
|
||||||
default: {
|
default: {
|
||||||
connector: "cloudflare-d1",
|
connector: "cloudflare-d1",
|
||||||
@@ -67,4 +57,4 @@ if (process.env.VERCEL) {
|
|||||||
|
|
||||||
export default function () {
|
export default function () {
|
||||||
return viteNitro(nitroOption)
|
return viteNitro(nitroOption)
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-9
@@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"name": "newsnow",
|
"name": "newsnow",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "0.0.37",
|
"version": "0.0.28",
|
||||||
"private": true,
|
"private": true,
|
||||||
"packageManager": "pnpm@10.14.0+sha512.ad27a79641b49c3e481a16a805baa71817a04bbe06a38d17e60e2eaee83f6a146c6a688125f5792e48dd5ba30e7da52a5cda4c3992b9ccf333f9ce223af84748",
|
"packageManager": "pnpm@10.5.2",
|
||||||
"author": {
|
"author": {
|
||||||
"url": "https://github.com/ourongxing/",
|
"url": "https://github.com/ourongxing/",
|
||||||
"email": "[email protected]",
|
"email": "[email protected]",
|
||||||
@@ -30,12 +30,11 @@
|
|||||||
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.3",
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.3",
|
||||||
"@formkit/auto-animate": "^0.8.2",
|
"@formkit/auto-animate": "^0.8.2",
|
||||||
"@iconify-json/si": "^1.2.3",
|
"@iconify-json/si": "^1.2.3",
|
||||||
"@modelcontextprotocol/sdk": "^1.11.0",
|
|
||||||
"@tanstack/react-query-devtools": "^5.66.11",
|
"@tanstack/react-query-devtools": "^5.66.11",
|
||||||
"@tanstack/react-router": "^1.112.0",
|
"@tanstack/react-router": "^1.112.0",
|
||||||
"@unocss/reset": "^66.0.0",
|
"@unocss/reset": "^66.0.0",
|
||||||
"ahooks": "^3.8.4",
|
"ahooks": "^3.8.4",
|
||||||
"better-sqlite3": "^11.10.0",
|
"better-sqlite3": "^11.8.1",
|
||||||
"cheerio": "^1.0.0",
|
"cheerio": "^1.0.0",
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
"cmdk": "^1.0.4",
|
"cmdk": "^1.0.4",
|
||||||
@@ -55,7 +54,6 @@
|
|||||||
"overlayscrollbars": "^2.11.1",
|
"overlayscrollbars": "^2.11.1",
|
||||||
"pnpm": "^10.5.2",
|
"pnpm": "^10.5.2",
|
||||||
"react": "^19.0.0",
|
"react": "^19.0.0",
|
||||||
"react-device-detect": "^2.2.3",
|
|
||||||
"react-dom": "^19.0.0",
|
"react-dom": "^19.0.0",
|
||||||
"react-use": "^17.6.0",
|
"react-use": "^17.6.0",
|
||||||
"uncrypto": "^0.1.3",
|
"uncrypto": "^0.1.3",
|
||||||
@@ -101,7 +99,7 @@
|
|||||||
"vitest": "^3.0.7",
|
"vitest": "^3.0.7",
|
||||||
"workbox-build": "^7.3.0",
|
"workbox-build": "^7.3.0",
|
||||||
"workbox-window": "^7.3.0",
|
"workbox-window": "^7.3.0",
|
||||||
"wrangler": "4.14.1"
|
"wrangler": "^3.111.0"
|
||||||
},
|
},
|
||||||
"pnpm": {
|
"pnpm": {
|
||||||
"patchedDependencies": {
|
"patchedDependencies": {
|
||||||
@@ -111,18 +109,16 @@
|
|||||||
"@napi-rs/pinyin",
|
"@napi-rs/pinyin",
|
||||||
"@parcel/watcher",
|
"@parcel/watcher",
|
||||||
"@swc/core",
|
"@swc/core",
|
||||||
"esbuild",
|
|
||||||
"better-sqlite3",
|
"better-sqlite3",
|
||||||
|
"esbuild",
|
||||||
"sharp",
|
"sharp",
|
||||||
"simple-git-hooks",
|
"simple-git-hooks",
|
||||||
"unrs-resolver",
|
|
||||||
"workerd"
|
"workerd"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
"cross-spawn": ">=7.0.6",
|
"cross-spawn": ">=7.0.6",
|
||||||
"dayjs": "1.11.13",
|
"dayjs": "1.11.13",
|
||||||
"nitropack": "npm:[email protected]",
|
|
||||||
"picomatch": "^4.0.2",
|
"picomatch": "^4.0.2",
|
||||||
"react": "^19",
|
"react": "^19",
|
||||||
"db0": "^0.3.1",
|
"db0": "^0.3.1",
|
||||||
|
|||||||
Generated
+3038
-4831
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
Before Width: | Height: | Size: 5.6 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 15 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 38 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 3.4 KiB |
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||||
<url>
|
<url>
|
||||||
<loc>https://hot.chgr.cc/</loc>
|
<loc>https://newsnow.busiyi.world/</loc>
|
||||||
<lastmod>2025-01-18</lastmod>
|
<lastmod>2025-01-18</lastmod>
|
||||||
<changefreq>always</changefreq>
|
<changefreq>always</changefreq>
|
||||||
<priority>1.0</priority>
|
<priority>1.0</priority>
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
import sources from "../shared/sources.json"
|
||||||
|
|
||||||
|
Promise.all(Object.keys(sources).map(id =>
|
||||||
|
fetch(`https://newsnow.busiyi.world/api/s?id=${id}`),
|
||||||
|
)).catch(console.error)
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js"
|
|
||||||
import { getServer } from "#/mcp/server"
|
|
||||||
|
|
||||||
export default defineEventHandler(async (event) => {
|
|
||||||
const req = event.node.req
|
|
||||||
const res = event.node.res
|
|
||||||
const server = getServer()
|
|
||||||
try {
|
|
||||||
const transport: StreamableHTTPServerTransport = new StreamableHTTPServerTransport({ sessionIdGenerator: undefined })
|
|
||||||
transport.onerror = console.error.bind(console)
|
|
||||||
await server.connect(transport)
|
|
||||||
await transport.handleRequest(req, res, await readBody(event))
|
|
||||||
res.on("close", () => {
|
|
||||||
// console.log("Request closed")
|
|
||||||
transport.close()
|
|
||||||
server.close()
|
|
||||||
})
|
|
||||||
return res
|
|
||||||
} catch (e) {
|
|
||||||
console.error(e)
|
|
||||||
return {
|
|
||||||
jsonrpc: "2.0",
|
|
||||||
error: {
|
|
||||||
code: -32603,
|
|
||||||
message: "Internal server error",
|
|
||||||
},
|
|
||||||
id: null,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
@@ -82,4 +82,4 @@ export async function getCacheTable() {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.error("failed to init database ", e)
|
logger.error("failed to init database ", e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,4 +66,4 @@ export class UserTable {
|
|||||||
if (!state.success) throw new Error(`delete user ${key} failed`)
|
if (!state.success) throw new Error(`delete user ${key} failed`)
|
||||||
logger.success(`delete user ${key}`)
|
logger.success(`delete user ${key}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
-5
@@ -8,7 +8,6 @@ declare module 'glob:./sources/{*.ts,**/index.ts}' {
|
|||||||
export const chongbuluo: typeof import('./sources/chongbuluo')
|
export const chongbuluo: typeof import('./sources/chongbuluo')
|
||||||
export const cls: typeof import('./sources/cls/index')
|
export const cls: typeof import('./sources/cls/index')
|
||||||
export const coolapk: typeof import('./sources/coolapk/index')
|
export const coolapk: typeof import('./sources/coolapk/index')
|
||||||
export const douban: typeof import('./sources/douban')
|
|
||||||
export const douyin: typeof import('./sources/douyin')
|
export const douyin: typeof import('./sources/douyin')
|
||||||
export const fastbull: typeof import('./sources/fastbull')
|
export const fastbull: typeof import('./sources/fastbull')
|
||||||
export const gelonghui: typeof import('./sources/gelonghui')
|
export const gelonghui: typeof import('./sources/gelonghui')
|
||||||
@@ -23,8 +22,6 @@ declare module 'glob:./sources/{*.ts,**/index.ts}' {
|
|||||||
export const kaopu: typeof import('./sources/kaopu')
|
export const kaopu: typeof import('./sources/kaopu')
|
||||||
export const kuaishou: typeof import('./sources/kuaishou')
|
export const kuaishou: typeof import('./sources/kuaishou')
|
||||||
export const linuxdo: typeof import('./sources/linuxdo')
|
export const linuxdo: typeof import('./sources/linuxdo')
|
||||||
export const idcflare: typeof import('./sources/idcflare')
|
|
||||||
export const mktnews: typeof import('./sources/mktnews')
|
|
||||||
export const nowcoder: typeof import('./sources/nowcoder')
|
export const nowcoder: typeof import('./sources/nowcoder')
|
||||||
export const pcbeta: typeof import('./sources/pcbeta')
|
export const pcbeta: typeof import('./sources/pcbeta')
|
||||||
export const producthunt: typeof import('./sources/producthunt')
|
export const producthunt: typeof import('./sources/producthunt')
|
||||||
@@ -32,8 +29,6 @@ declare module 'glob:./sources/{*.ts,**/index.ts}' {
|
|||||||
export const solidot: typeof import('./sources/solidot')
|
export const solidot: typeof import('./sources/solidot')
|
||||||
export const sputniknewscn: typeof import('./sources/sputniknewscn')
|
export const sputniknewscn: typeof import('./sources/sputniknewscn')
|
||||||
export const sspai: typeof import('./sources/sspai')
|
export const sspai: typeof import('./sources/sspai')
|
||||||
export const steam: typeof import('./sources/steam')
|
|
||||||
export const tencent: typeof import('./sources/tencent')
|
|
||||||
export const thepaper: typeof import('./sources/thepaper')
|
export const thepaper: typeof import('./sources/thepaper')
|
||||||
export const tieba: typeof import('./sources/tieba')
|
export const tieba: typeof import('./sources/tieba')
|
||||||
export const toutiao: typeof import('./sources/toutiao')
|
export const toutiao: typeof import('./sources/toutiao')
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
import sources from "../../shared/sources.json"
|
|
||||||
|
|
||||||
export const description = Object.entries(sources).filter(([_, source]) => {
|
|
||||||
if (source.redirect) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}).map(([id, source]) => {
|
|
||||||
return source.title ? `${source.name}-${source.title} id is ${id}` : `${source.name} id is ${id}`
|
|
||||||
}).join(";")
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
import { z } from "zod"
|
|
||||||
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"
|
|
||||||
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js"
|
|
||||||
import packageJSON from "../../package.json"
|
|
||||||
import { description } from "./desc.js"
|
|
||||||
|
|
||||||
export function getServer() {
|
|
||||||
const server = new McpServer(
|
|
||||||
{
|
|
||||||
name: "NewsNow",
|
|
||||||
version: packageJSON.version,
|
|
||||||
},
|
|
||||||
{ capabilities: { logging: {} } },
|
|
||||||
)
|
|
||||||
|
|
||||||
server.tool(
|
|
||||||
"get_hotest_latest_news",
|
|
||||||
`get hotest or latest news from source by {id}, return {count: 10} news.`,
|
|
||||||
{
|
|
||||||
id: z.string().describe(`source id. e.g. ${description}`),
|
|
||||||
count: z.any().default(10).describe("count of news to return."),
|
|
||||||
},
|
|
||||||
async ({ id, count }): Promise<CallToolResult> => {
|
|
||||||
let n = Number(count)
|
|
||||||
if (Number.isNaN(n) || n < 1) {
|
|
||||||
n = 10
|
|
||||||
}
|
|
||||||
|
|
||||||
const res: SourceResponse = await $fetch(`/api/s?id=${id}`)
|
|
||||||
return {
|
|
||||||
content: res.items.slice(0, count).map((item) => {
|
|
||||||
return {
|
|
||||||
text: `[${item.title}](${item.url})`,
|
|
||||||
type: "text",
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
}
|
|
||||||
},
|
|
||||||
)
|
|
||||||
|
|
||||||
server.server.onerror = console.error.bind(console)
|
|
||||||
|
|
||||||
return server
|
|
||||||
}
|
|
||||||
@@ -6,7 +6,7 @@ export default defineEventHandler(async (event) => {
|
|||||||
if (!url.pathname.startsWith("/api")) return
|
if (!url.pathname.startsWith("/api")) return
|
||||||
if (["JWT_SECRET", "G_CLIENT_ID", "G_CLIENT_SECRET"].find(k => !process.env[k])) {
|
if (["JWT_SECRET", "G_CLIENT_ID", "G_CLIENT_SECRET"].find(k => !process.env[k])) {
|
||||||
event.context.disabledLogin = true
|
event.context.disabledLogin = true
|
||||||
if (["/api/s", "/api/proxy", "/api/latest", "/api/mcp"].every(p => !url.pathname.startsWith(p)))
|
if (["/api/s", "/api/proxy", "/api/latest"].every(p => !url.pathname.startsWith(p)))
|
||||||
throw createError({ statusCode: 506, message: "Server not configured, disable login" })
|
throw createError({ statusCode: 506, message: "Server not configured, disable login" })
|
||||||
} else {
|
} else {
|
||||||
if (["/api/s", "/api/me"].find(p => url.pathname.startsWith(p))) {
|
if (["/api/s", "/api/me"].find(p => url.pathname.startsWith(p))) {
|
||||||
|
|||||||
@@ -1,3 +1,29 @@
|
|||||||
|
interface NewApiVideoItem {
|
||||||
|
id: string;
|
||||||
|
title: string;
|
||||||
|
desc: string;
|
||||||
|
cover: string;
|
||||||
|
author: string;
|
||||||
|
timestamp: number; // 注意这是毫秒时间戳
|
||||||
|
hot: number;
|
||||||
|
url: string;
|
||||||
|
mobileUrl: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface NewApiResponse {
|
||||||
|
code: number;
|
||||||
|
name: string;
|
||||||
|
title: string;
|
||||||
|
type: string;
|
||||||
|
description: string;
|
||||||
|
parameData: any; // 可以根据需要细化
|
||||||
|
link: string;
|
||||||
|
total: number;
|
||||||
|
updateTime: string;
|
||||||
|
fromCache: boolean;
|
||||||
|
data: NewApiVideoItem[]; // 核心数据在这里
|
||||||
|
}
|
||||||
|
|
||||||
interface WapRes {
|
interface WapRes {
|
||||||
code: number
|
code: number
|
||||||
exp_str: string
|
exp_str: string
|
||||||
@@ -120,18 +146,56 @@ const hotVideo = defineSource(async () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const ranking = defineSource(async () => {
|
const ranking = defineSource(async () => {
|
||||||
const url = "https://api.bilibili.com/x/web-interface/ranking/v2"
|
// 1. 使用新接口的 URL
|
||||||
const res: HotVideoRes = await myFetch(url)
|
const newUrl = "https://api-hot.chgr.cc/bilibili?limit=20"; // <--- 替换成新接口的实际地址
|
||||||
|
// 假设 myFetch 可以正确获取并解析新接口的 JSON
|
||||||
|
const newRes: NewApiResponse = await myFetch(newUrl);
|
||||||
|
|
||||||
return res.data.list.map(video => ({
|
// 2. 数据转换适配层:将 NewApiResponse 转换为符合 HotVideoRes['data']['list'] 结构的数组
|
||||||
|
// 注意:我们只需要构建 map 函数需要的部分即可,不需要严格创建完整的 HotVideoRes
|
||||||
|
const adaptedList = newRes.data.map(newItem => {
|
||||||
|
// 创建一个符合 map 函数内部访问 video 对象结构的临时对象
|
||||||
|
return {
|
||||||
|
bvid: newItem.id,
|
||||||
|
title: newItem.title,
|
||||||
|
pubdate: Math.floor(newItem.timestamp / 1000), // 将毫秒转为秒 (整数)
|
||||||
|
owner: {
|
||||||
|
name: newItem.author,
|
||||||
|
// 如果 map 中需要其他 owner 字段,需提供默认值
|
||||||
|
mid: 0,
|
||||||
|
face: '',
|
||||||
|
},
|
||||||
|
stat: {
|
||||||
|
view: newItem.hot, // 使用 hot 作为观看数 (近似值)
|
||||||
|
like: 0, // <--- 新接口没有点赞数,这里设置为 0
|
||||||
|
// 如果 map 中需要其他 stat 字段,需提供默认值
|
||||||
|
danmaku: 0, reply: 0, favorite: 0, coin: 0, share: 0, now_rank: 0, his_rank: 0, dislike: 0,
|
||||||
|
},
|
||||||
|
desc: newItem.desc,
|
||||||
|
pic: newItem.cover,
|
||||||
|
// --- 以下字段如果 map 中没有用到,可以不映射 ---
|
||||||
|
aid: 0, videos: 1, tid: 0, tname: 'N/A', copyright: 1, ctime: Math.floor(newItem.timestamp / 1000),
|
||||||
|
state: 0, duration: 0, dynamic: '', cid: 0, dimension: { width: 0, height: 0, rotate: 0 },
|
||||||
|
short_link: newItem.url, short_link_v2: newItem.url, rcmd_reason: { content: '', corner_mark: 0 },
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
// 3. 使用转换后的 adaptedList 进行 map 操作,这部分代码保持不变
|
||||||
|
// map 函数现在操作的是我们手动适配过的对象数组
|
||||||
|
return adaptedList.map(video => ({
|
||||||
id: video.bvid,
|
id: video.bvid,
|
||||||
title: video.title,
|
title: video.title,
|
||||||
url: `https://www.bilibili.com/video/${video.bvid}`,
|
url: `https://www.bilibili.com/video/${video.bvid}`, // 保持原来的 URL 拼接方式
|
||||||
pubDate: video.pubdate * 1000,
|
// 或者,如果你想用新接口提供的 URL:
|
||||||
|
// url: video.short_link, // short_link 在适配层映射自 newItem.url
|
||||||
|
pubDate: video.pubdate * 1000, // 将秒转换回毫秒
|
||||||
extra: {
|
extra: {
|
||||||
|
// 注意:因为 like 设置为 0,这里的点赞数会显示为 0
|
||||||
info: `${video.owner.name} · ${formatNumber(video.stat.view)}观看 · ${formatNumber(video.stat.like)}点赞`,
|
info: `${video.owner.name} · ${formatNumber(video.stat.view)}观看 · ${formatNumber(video.stat.like)}点赞`,
|
||||||
|
// 如果不想显示点赞数,可以修改 info 的格式:
|
||||||
|
// info: `${video.owner.name} · ${formatNumber(video.stat.view)}观看`,
|
||||||
hover: video.desc,
|
hover: video.desc,
|
||||||
icon: proxyPicture(video.pic),
|
icon: proxyPicture(video.pic), // pic 来源于 newItem.cover
|
||||||
},
|
},
|
||||||
}))
|
}))
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,47 +0,0 @@
|
|||||||
interface HotMoviesRes {
|
|
||||||
category: string
|
|
||||||
tags: []
|
|
||||||
items: MovieItem[]
|
|
||||||
recommend_tags: []
|
|
||||||
total: number
|
|
||||||
type: string
|
|
||||||
}
|
|
||||||
|
|
||||||
interface MovieItem {
|
|
||||||
rating: {
|
|
||||||
count: number
|
|
||||||
max: number
|
|
||||||
star_count: number
|
|
||||||
value: number
|
|
||||||
}
|
|
||||||
title: string
|
|
||||||
pic: {
|
|
||||||
large: string
|
|
||||||
normal: string
|
|
||||||
}
|
|
||||||
is_new: boolean
|
|
||||||
uri: string
|
|
||||||
episodes_info: string
|
|
||||||
card_subtitle: string
|
|
||||||
type: string
|
|
||||||
id: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export default defineSource(async () => {
|
|
||||||
const baseURL = "https://m.douban.com/rexxar/api/v2/subject/recent_hot/movie"
|
|
||||||
const res: HotMoviesRes = await myFetch(baseURL, {
|
|
||||||
headers: {
|
|
||||||
Referer: "https://movie.douban.com/",
|
|
||||||
Accept: "application/json, text/plain, */*",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
return res.items.map(movie => ({
|
|
||||||
id: movie.id,
|
|
||||||
title: movie.title,
|
|
||||||
url: `https://movie.douban.com/subject/${movie.id}`,
|
|
||||||
extra: {
|
|
||||||
info: movie.card_subtitle.split(" / ").slice(0, 3).join(" / "),
|
|
||||||
hover: movie.card_subtitle,
|
|
||||||
},
|
|
||||||
}))
|
|
||||||
})
|
|
||||||
+16
-33
@@ -1,37 +1,20 @@
|
|||||||
interface HotItem {
|
interface Res {
|
||||||
id: string
|
data: {
|
||||||
title: string
|
title: string
|
||||||
url: string
|
hot: string
|
||||||
mobileUrl: string
|
url: string
|
||||||
|
mobil_url: string
|
||||||
|
}[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export default defineSource(async () => {
|
export default defineSource(async () => {
|
||||||
// 获取虎扑新热榜页面的HTML内容
|
const r: Res = await myFetch(`https://api.vvhan.com/api/hotlist/huPu`)
|
||||||
const html = await myFetch(`https://bbs.hupu.com/topic-daily-hot`)
|
return r.data.map((k) => {
|
||||||
|
return {
|
||||||
// 正则表达式匹配新的热榜项结构
|
id: k.url,
|
||||||
const regex = /<li class="bbs-sl-web-post-body">[\s\S]*?<a href="(\/[^"]+?\.html)"[^>]*?class="p-title"[^>]*>([^<]+)<\/a>/g
|
title: k.title,
|
||||||
|
url: k.url,
|
||||||
const result: HotItem[] = []
|
mobileUrl: k.mobil_url,
|
||||||
let match
|
}
|
||||||
|
})
|
||||||
// 将赋值操作移到循环内部,修复no-cond-assign警告
|
|
||||||
while (true) {
|
|
||||||
match = regex.exec(html)
|
|
||||||
if (!match) break
|
|
||||||
|
|
||||||
const [, path, title] = match
|
|
||||||
|
|
||||||
// 构建完整URL
|
|
||||||
const url = `https://bbs.hupu.com${path}`
|
|
||||||
|
|
||||||
result.push({
|
|
||||||
id: path,
|
|
||||||
title: title.trim(),
|
|
||||||
url,
|
|
||||||
mobileUrl: url,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
return result
|
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,61 +0,0 @@
|
|||||||
interface Res {
|
|
||||||
topic_list: {
|
|
||||||
can_create_topic: boolean
|
|
||||||
more_topics_url: string
|
|
||||||
per_page: number
|
|
||||||
top_tags: string[]
|
|
||||||
topics: {
|
|
||||||
id: number
|
|
||||||
title: string
|
|
||||||
fancy_title: string
|
|
||||||
posts_count: number
|
|
||||||
reply_count: number
|
|
||||||
highest_post_number: number
|
|
||||||
image_url: null | string
|
|
||||||
created_at: Date
|
|
||||||
last_posted_at: Date
|
|
||||||
bumped: boolean
|
|
||||||
bumped_at: Date
|
|
||||||
unseen: boolean
|
|
||||||
pinned: boolean
|
|
||||||
excerpt?: string
|
|
||||||
visible: boolean
|
|
||||||
closed: boolean
|
|
||||||
archived: boolean
|
|
||||||
like_count: number
|
|
||||||
has_summary: boolean
|
|
||||||
last_poster_username: string
|
|
||||||
category_id: number
|
|
||||||
pinned_globally: boolean
|
|
||||||
}[]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const hot = defineSource(async () => {
|
|
||||||
const res = await myFetch<Res>("https://n8n.chgr.cc/webhook/api?name=idcflare")
|
|
||||||
return res.topic_list.topics
|
|
||||||
.filter(k => k.visible && !k.archived && !k.pinned)
|
|
||||||
.map(k => ({
|
|
||||||
id: k.id,
|
|
||||||
title: k.title,
|
|
||||||
url: `https://idcflare.com/t/topic/${k.id}`,
|
|
||||||
}))
|
|
||||||
})
|
|
||||||
|
|
||||||
const latest = defineSource(async () => {
|
|
||||||
const res = await myFetch<Res>("https://idcflare.com/latest.json?order=created")
|
|
||||||
return res.topic_list.topics
|
|
||||||
.filter(k => k.visible && !k.archived && !k.pinned)
|
|
||||||
.map(k => ({
|
|
||||||
id: k.id,
|
|
||||||
title: k.title,
|
|
||||||
pubDate: new Date(k.created_at).valueOf(),
|
|
||||||
url: `https://idcflare.com/t/topic/${k.id}`,
|
|
||||||
}))
|
|
||||||
})
|
|
||||||
|
|
||||||
export default defineSource({
|
|
||||||
"idcflare": latest,
|
|
||||||
"idcflare-latest": latest,
|
|
||||||
"idcflare-hot": hot,
|
|
||||||
})
|
|
||||||
@@ -2,17 +2,17 @@ type Res = {
|
|||||||
description: string
|
description: string
|
||||||
link: string
|
link: string
|
||||||
// Date
|
// Date
|
||||||
pub_date: string
|
pubDate: string
|
||||||
publisher: string
|
publisher: string
|
||||||
title: string
|
title: string
|
||||||
}[]
|
}[]
|
||||||
export default defineSource(async () => {
|
export default defineSource(async () => {
|
||||||
const res: Res = await $fetch("https://kaopustorage.blob.core.windows.net/news-prod/news_list_hans_0.json")
|
const res = await Promise.all(["https://kaopucdn.azureedge.net/jsondata/news_list_beta_hans_0.json", "https://kaopucdn.azureedge.net/jsondata/news_list_beta_hans_1.json"].map(url => myFetch(url) as Promise<Res>))
|
||||||
return res.filter(k => ["财新", "公视"].every(h => k.publisher !== h)).map((k) => {
|
return res.flat().filter(k => ["财新", "公视"].every(h => k.publisher !== h)).map((k) => {
|
||||||
return {
|
return {
|
||||||
id: k.link,
|
id: k.link,
|
||||||
title: k.title,
|
title: k.title,
|
||||||
pubDate: k.pub_date,
|
pubDate: k.pubDate,
|
||||||
extra: {
|
extra: {
|
||||||
hover: k.description,
|
hover: k.description,
|
||||||
info: k.publisher,
|
info: k.publisher,
|
||||||
|
|||||||
@@ -1,66 +0,0 @@
|
|||||||
interface Report {
|
|
||||||
id: string
|
|
||||||
type: number
|
|
||||||
time: string
|
|
||||||
important: number
|
|
||||||
data: {
|
|
||||||
content: string
|
|
||||||
pic: string
|
|
||||||
title: string
|
|
||||||
}
|
|
||||||
remark: string[]
|
|
||||||
hot: boolean
|
|
||||||
hot_start: string
|
|
||||||
hot_end: string
|
|
||||||
classify: {
|
|
||||||
id: number
|
|
||||||
pid: number
|
|
||||||
name: string
|
|
||||||
parent: string
|
|
||||||
}[]
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Res {
|
|
||||||
data: {
|
|
||||||
id: number
|
|
||||||
name: string
|
|
||||||
pid: number
|
|
||||||
child: {
|
|
||||||
id: number
|
|
||||||
name: string
|
|
||||||
pid: number
|
|
||||||
flash_list: Report[]
|
|
||||||
}[]
|
|
||||||
}[]
|
|
||||||
}
|
|
||||||
|
|
||||||
const flash = defineSource(async () => {
|
|
||||||
const res: Res = await myFetch("https://api.mktnews.net/api/flash/host")
|
|
||||||
|
|
||||||
const categories = ["policy", "AI", "financial"] as const
|
|
||||||
const typeMap = { policy: "Policy", AI: "AI", financial: "Financial" } as const
|
|
||||||
|
|
||||||
const allReports = categories.flatMap((category) => {
|
|
||||||
const categoryData = res.data.find(item => item.name === category)
|
|
||||||
if (!categoryData?.child) return []
|
|
||||||
|
|
||||||
return categoryData.child.flatMap(subCategory =>
|
|
||||||
(subCategory.flash_list || []).map(item => ({ ...item, type: typeMap[category] })),
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
return allReports
|
|
||||||
.sort((a, b) => b.time.localeCompare(a.time))
|
|
||||||
.map(item => ({
|
|
||||||
id: item.id,
|
|
||||||
title: item.data.title || item.data.content.match(/^【([^】]*)】(.*)$/)?.[1] || item.data.content,
|
|
||||||
pubDate: item.time,
|
|
||||||
extra: { info: item.type, hover: item.data.content },
|
|
||||||
url: `https://mktnews.net/flashDetail.html?id=${item.id}`,
|
|
||||||
}))
|
|
||||||
})
|
|
||||||
|
|
||||||
export default defineSource({
|
|
||||||
"mktnews": flash,
|
|
||||||
"mktnews-flash": flash,
|
|
||||||
})
|
|
||||||
@@ -1,56 +1,28 @@
|
|||||||
import process from "node:process"
|
import * as cheerio from "cheerio"
|
||||||
import type { NewsItem } from "@shared/types"
|
import type { NewsItem } from "@shared/types"
|
||||||
|
|
||||||
export default defineSource(async () => {
|
export default defineSource(async () => {
|
||||||
const apiToken = process.env.PRODUCTHUNT_API_TOKEN
|
const baseURL = "https://www.producthunt.com"
|
||||||
const token = `Bearer ${apiToken}`
|
const html: any = await myFetch(baseURL)
|
||||||
if (!apiToken) {
|
const $ = cheerio.load(html)
|
||||||
throw new Error("PRODUCTHUNT_API_TOKEN is not set")
|
const $main = $("[data-test=homepage-section-0] [data-test^=post-item]")
|
||||||
}
|
|
||||||
const query = `
|
|
||||||
query {
|
|
||||||
posts(first: 30, order: VOTES) {
|
|
||||||
edges {
|
|
||||||
node {
|
|
||||||
id
|
|
||||||
name
|
|
||||||
tagline
|
|
||||||
votesCount
|
|
||||||
url
|
|
||||||
slug
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
|
|
||||||
const response: any = await myFetch("https://api.producthunt.com/v2/api/graphql", {
|
|
||||||
method: "POST",
|
|
||||||
headers: {
|
|
||||||
"Authorization": token,
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
"Accept": "application/json",
|
|
||||||
},
|
|
||||||
body: JSON.stringify({ query }),
|
|
||||||
})
|
|
||||||
|
|
||||||
const news: NewsItem[] = []
|
const news: NewsItem[] = []
|
||||||
const posts = response?.data?.posts?.edges || []
|
$main.each((_, el) => {
|
||||||
|
const a = $(el).find("a").first()
|
||||||
for (const edge of posts) {
|
const url = a.attr("href")
|
||||||
const post = edge.node
|
const title = $(el).find("a[data-test^=post-name]").text().replace(/^\d+\.\s*/, "")
|
||||||
if (post.id && post.name) {
|
const id = $(el).attr("data-test")?.replace("post-item-", "")
|
||||||
|
const vote = $(el).find("[data-test=vote-button]").text()
|
||||||
|
if (url && id && title) {
|
||||||
news.push({
|
news.push({
|
||||||
id: post.id,
|
url: `${baseURL}${url}`,
|
||||||
title: post.name,
|
title,
|
||||||
url: post.url || `https://www.producthunt.com/posts/${post.slug}`,
|
id,
|
||||||
extra: {
|
extra: {
|
||||||
info: ` △︎ ${post.votesCount || 0}`,
|
info: `△︎ ${vote}`,
|
||||||
hover: post.tagline,
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
|
|
||||||
return news
|
return news
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,32 +0,0 @@
|
|||||||
import * as cheerio from "cheerio"
|
|
||||||
import type { NewsItem } from "@shared/types"
|
|
||||||
|
|
||||||
export default defineSource(async () => {
|
|
||||||
const response: any = await myFetch("https://store.steampowered.com/stats/stats/")
|
|
||||||
const $ = cheerio.load(response)
|
|
||||||
const $rows = $("#detailStats tr.player_count_row")
|
|
||||||
const news: NewsItem[] = []
|
|
||||||
|
|
||||||
$rows.each((_, el) => {
|
|
||||||
const $el = $(el)
|
|
||||||
const $a = $el.find("a.gameLink")
|
|
||||||
const url = $a.attr("href")
|
|
||||||
const gameName = $a.text().trim()
|
|
||||||
const currentPlayers = $el.find("td:first-child .currentServers").text().trim()
|
|
||||||
|
|
||||||
if (url && gameName && currentPlayers) {
|
|
||||||
const title = gameName
|
|
||||||
news.push({
|
|
||||||
url,
|
|
||||||
title,
|
|
||||||
id: url,
|
|
||||||
pubDate: Date.now(),
|
|
||||||
extra: {
|
|
||||||
info: currentPlayers,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
return news
|
|
||||||
})
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
import { myFetch } from "#/utils/fetch"
|
|
||||||
import { defineSource } from "#/utils/source"
|
|
||||||
|
|
||||||
interface WapRes {
|
|
||||||
ret: number
|
|
||||||
msg: string
|
|
||||||
data: {
|
|
||||||
id: number
|
|
||||||
name: string
|
|
||||||
lead: string
|
|
||||||
cover?: string
|
|
||||||
shareTitle: string
|
|
||||||
shareAbstract: string
|
|
||||||
sharePic: string
|
|
||||||
is724: boolean
|
|
||||||
is724Paper: boolean
|
|
||||||
head_cmsid: string
|
|
||||||
feed_style: number
|
|
||||||
head_article: {
|
|
||||||
live_info: string
|
|
||||||
title: string
|
|
||||||
img: string
|
|
||||||
pub_time: string
|
|
||||||
media_name: string
|
|
||||||
}
|
|
||||||
paperInfo: any
|
|
||||||
tabs: {
|
|
||||||
id: string
|
|
||||||
channel_id: string
|
|
||||||
name: string
|
|
||||||
source: string
|
|
||||||
type: string
|
|
||||||
articleList: any[]
|
|
||||||
article_count: number
|
|
||||||
sub_tab: string
|
|
||||||
}[]
|
|
||||||
banner: string
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 综合早报
|
|
||||||
*/
|
|
||||||
const comprehensiveNews = defineSource(async () => {
|
|
||||||
const url = "https://i.news.qq.com/web_backend/v2/getTagInfo?tagId=aEWqxLtdgmQ%3D"
|
|
||||||
const res = await myFetch<WapRes>(url, {
|
|
||||||
headers: {
|
|
||||||
Referer: "https://news.qq.com/",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
return res.data.tabs[0].articleList.map(news => ({
|
|
||||||
id: news.id,
|
|
||||||
title: news.title,
|
|
||||||
url: news.link_info.url,
|
|
||||||
extra: {
|
|
||||||
hover: news.desc,
|
|
||||||
},
|
|
||||||
}))
|
|
||||||
})
|
|
||||||
|
|
||||||
export default defineSource({
|
|
||||||
"tencent-hot": comprehensiveNews,
|
|
||||||
})
|
|
||||||
@@ -52,7 +52,7 @@ const news = defineSource(async () => {
|
|||||||
|
|
||||||
const res: NewsRes = await myFetch(apiUrl)
|
const res: NewsRes = await myFetch(apiUrl)
|
||||||
return res.data.items
|
return res.data.items
|
||||||
.filter(k => k.resource_type !== "theme" && k.resource_type !== "ad" && k.resource.type !== "live" && k.resource.uri)
|
.filter(k => k.resource_type !== "ad" && k.resource.type !== "live" && k.resource.uri)
|
||||||
.map(({ resource: h }) => {
|
.map(({ resource: h }) => {
|
||||||
return {
|
return {
|
||||||
id: h.id,
|
id: h.id,
|
||||||
|
|||||||
+43
-47
@@ -1,52 +1,48 @@
|
|||||||
import * as cheerio from "cheerio"
|
interface Res {
|
||||||
|
ok: number // 1 is ok
|
||||||
|
data: {
|
||||||
|
realtime:
|
||||||
|
{
|
||||||
|
num: number // 看上去是个 id
|
||||||
|
emoticon: string
|
||||||
|
icon?: string // 热,新 icon url
|
||||||
|
icon_width: number
|
||||||
|
icon_height: number
|
||||||
|
is_ad?: number // 1
|
||||||
|
note: string
|
||||||
|
small_icon_desc: string
|
||||||
|
icon_desc?: string // 如果是 荐 ,就是广告
|
||||||
|
topic_flag: number
|
||||||
|
icon_desc_color: string
|
||||||
|
flag: number
|
||||||
|
word_scheme: string
|
||||||
|
small_icon_desc_color: string
|
||||||
|
realpos: number
|
||||||
|
label_name: string
|
||||||
|
word: string // 热搜词
|
||||||
|
rank: number
|
||||||
|
}[]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export default defineSource(async () => {
|
export default defineSource(async () => {
|
||||||
const baseurl = "https://s.weibo.com"
|
const url = "https://weibo.com/ajax/side/hotSearch"
|
||||||
const url = `${baseurl}/top/summary?cate=realtimehot`
|
const res: Res = await myFetch(url)
|
||||||
|
return res.data.realtime
|
||||||
const html = await myFetch(url, {
|
.filter(k => !k.is_ad)
|
||||||
headers: {
|
.map((k) => {
|
||||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36",
|
const keyword = k.word_scheme ? k.word_scheme : `#${k.word}#`
|
||||||
// https://github.com/v5tech/weibo-trending-hot-search
|
return {
|
||||||
"Cookie": "SUB=_2AkMWIuNSf8NxqwJRmP8dy2rhaoV2ygrEieKgfhKJJRMxHRl-yT9jqk86tRB6PaLNvQZR6zYUcYVT1zSjoSreQHidcUq7",
|
id: k.word,
|
||||||
"referer": url,
|
title: k.word,
|
||||||
},
|
extra: {
|
||||||
})
|
icon: k.icon && {
|
||||||
|
url: proxyPicture(k.icon),
|
||||||
const $ = cheerio.load(html)
|
scale: 1.5,
|
||||||
|
|
||||||
const rows = $("#pl_top_realtimehot table tbody tr").slice(1)
|
|
||||||
|
|
||||||
const hotNews: NewsItem[] = []
|
|
||||||
|
|
||||||
rows.each((_, row) => {
|
|
||||||
const $row = $(row)
|
|
||||||
const $link = $row.find("td.td-02 a").filter((_, el) => {
|
|
||||||
const href = $(el).attr("href")
|
|
||||||
return !!(href && !href.includes("javascript:void(0);"))
|
|
||||||
}).first()
|
|
||||||
|
|
||||||
if ($link.length) {
|
|
||||||
const title = $link.text().trim()
|
|
||||||
const href = $link.attr("href")
|
|
||||||
|
|
||||||
if (title && href) {
|
|
||||||
const $flag = $row.find("td.td-03").text().trim()
|
|
||||||
const flagUrl = {
|
|
||||||
新: "https://simg.s.weibo.com/moter/flags/1_0.png",
|
|
||||||
热: "https://simg.s.weibo.com/moter/flags/2_0.png",
|
|
||||||
}[$flag]
|
|
||||||
hotNews.push({
|
|
||||||
id: title,
|
|
||||||
title,
|
|
||||||
url: `${baseurl}${href}`,
|
|
||||||
mobileUrl: `${baseurl}${href}`,
|
|
||||||
extra: {
|
|
||||||
icon: flagUrl ? { url: proxyPicture(flagUrl), scale: 1.5 } : undefined,
|
|
||||||
},
|
},
|
||||||
})
|
},
|
||||||
|
url: `https://s.weibo.com/weibo?q=${encodeURIComponent(keyword)}`,
|
||||||
|
mobileUrl: `https://m.weibo.cn/search?containerid=231522type%3D1%26q%3D${encodeURIComponent(keyword)}&_T_WM=16922097837&v_p=42`,
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
})
|
|
||||||
return hotNews
|
|
||||||
})
|
})
|
||||||
|
|||||||
+19
-34
@@ -1,53 +1,38 @@
|
|||||||
interface Res {
|
interface Res {
|
||||||
data: {
|
data: {
|
||||||
type: "hot_list_feed"
|
card_label?: {
|
||||||
style_type: "1"
|
icon: string
|
||||||
feed_specific: {
|
night_icon: string
|
||||||
answer_count: 411
|
|
||||||
}
|
}
|
||||||
target: {
|
target: {
|
||||||
title_area: {
|
id: number
|
||||||
text: string
|
title: string
|
||||||
}
|
url: string
|
||||||
excerpt_area: {
|
created: number
|
||||||
text: string
|
answer_count: number
|
||||||
}
|
follower_count: number
|
||||||
image_area: {
|
bound_topic_ids: number[]
|
||||||
url: string
|
comment_count: number
|
||||||
}
|
is_following: boolean
|
||||||
metrics_area: {
|
excerpt: string
|
||||||
text: string
|
|
||||||
font_color: string
|
|
||||||
background: string
|
|
||||||
weight: string
|
|
||||||
}
|
|
||||||
label_area: {
|
|
||||||
type: "trend"
|
|
||||||
trend: number
|
|
||||||
night_color: string
|
|
||||||
normal_color: string
|
|
||||||
}
|
|
||||||
link: {
|
|
||||||
url: string
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}[]
|
}[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export default defineSource({
|
export default defineSource({
|
||||||
zhihu: async () => {
|
zhihu: async () => {
|
||||||
const url = "https://www.zhihu.com/api/v3/feed/topstory/hot-list-web?limit=20&desktop=true"
|
const url = "https://www.zhihu.com/api/v3/feed/topstory/hot-lists/total?limit=20&desktop=true"
|
||||||
const res: Res = await myFetch(url)
|
const res: Res = await myFetch(url)
|
||||||
return res.data
|
return res.data
|
||||||
.map((k) => {
|
.map((k) => {
|
||||||
|
const urlId = k.target.url?.match(/(\d+)$/)?.[1]
|
||||||
return {
|
return {
|
||||||
id: k.target.link.url.match(/(\d+)$/)?.[1] ?? k.target.link.url,
|
id: k.target.id,
|
||||||
title: k.target.title_area.text,
|
title: k.target.title,
|
||||||
extra: {
|
extra: {
|
||||||
info: k.target.metrics_area.text,
|
icon: k.card_label?.night_icon && proxyPicture(k.card_label.night_icon),
|
||||||
hover: k.target.excerpt_area.text,
|
|
||||||
},
|
},
|
||||||
url: k.target.link.url,
|
url: `https://www.zhihu.com/question/${urlId || k.target.id}`,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
+10
-14
@@ -4,10 +4,9 @@
|
|||||||
"weibo": "weibo-shishiresou",
|
"weibo": "weibo-shishiresou",
|
||||||
"zaobao": "lianhezaobao",
|
"zaobao": "lianhezaobao",
|
||||||
"coolapk": "kuan-jinrizuire",
|
"coolapk": "kuan-jinrizuire",
|
||||||
"mktnews-flash": "MKTNews-kuaixun",
|
"wallstreetcn-quick": "huaerjiejianwen-shishikuaixun",
|
||||||
"wallstreetcn-quick": "huaerjiejianwen-kuaixun",
|
"wallstreetcn-news": "huaerjiejianwen-zuixinzixun",
|
||||||
"wallstreetcn-news": "huaerjiejianwen-zuixin",
|
"wallstreetcn-hot": "huaerjiejianwen-zuirewenzhang",
|
||||||
"wallstreetcn-hot": "huaerjiejianwen-zuire",
|
|
||||||
"36kr-quick": "36ke-kuaixun",
|
"36kr-quick": "36ke-kuaixun",
|
||||||
"douyin": "douyin",
|
"douyin": "douyin",
|
||||||
"hupu": "hupu-zhugandaoretie",
|
"hupu": "hupu-zhugandaoretie",
|
||||||
@@ -17,7 +16,8 @@
|
|||||||
"thepaper": "pengpaixinwen-rebang",
|
"thepaper": "pengpaixinwen-rebang",
|
||||||
"sputniknewscn": "weixingtongxunshe",
|
"sputniknewscn": "weixingtongxunshe",
|
||||||
"cankaoxiaoxi": "cankaoxiaoxi",
|
"cankaoxiaoxi": "cankaoxiaoxi",
|
||||||
"pcbeta-windows11": "yuanjingluntan-Win11",
|
"pcbeta-windows11": "yuanjingluntan-Windows 11",
|
||||||
|
"pcbeta-windows": "yuanjingluntan-Windows ziyuan",
|
||||||
"cls-telegraph": "cailianshe-dianbao",
|
"cls-telegraph": "cailianshe-dianbao",
|
||||||
"cls-depth": "cailianshe-shendu",
|
"cls-depth": "cailianshe-shendu",
|
||||||
"cls-hot": "cailianshe-remen",
|
"cls-hot": "cailianshe-remen",
|
||||||
@@ -36,18 +36,14 @@
|
|||||||
"kaopu": "kaopuxinwen",
|
"kaopu": "kaopuxinwen",
|
||||||
"jin10": "jinshishuju",
|
"jin10": "jinshishuju",
|
||||||
"baidu": "baiduresou",
|
"baidu": "baiduresou",
|
||||||
"linuxdo-latest": "LINUX DO-zuixin",
|
"linuxdo-latest": "LINUX DO-zuixin",
|
||||||
"linuxdo-hot": "LINUX DO-jinrizuire",
|
"linuxdo-hot": "LINUX DO-jinrizuire",
|
||||||
"idcflare-latest": "IDC Flare-zuixin",
|
"ghxi": "guoheboke",
|
||||||
"idcflare-hot": "IDC Flare-jinrizuire",
|
"smzdm": "shenmezhidemai",
|
||||||
"nowcoder": "niuke",
|
"nowcoder": "niuke",
|
||||||
"sspai": "shaoshupai",
|
"sspai": "shaoshupai",
|
||||||
"juejin": "xitujuejin",
|
"juejin": "xitujuejin",
|
||||||
"ifeng": "fenghuangwang-redianzixun",
|
"ifeng": "fenghuangwang-redianzixun",
|
||||||
"chongbuluo-latest": "chongbuluo-zuixin",
|
"chongbuluo-latest": "chongbuluo-zuixin",
|
||||||
"chongbuluo-hot": "chongbuluo-zuire",
|
"chongbuluo-hot": "chongbuluo-zuire"
|
||||||
"douban": "douban-remendianying",
|
}
|
||||||
"steam": "Steam-zaixianrenshu",
|
|
||||||
"tencent-hot": "tengxunxinwen-zonghezaobao"
|
|
||||||
}
|
|
||||||
|
|
||||||
+116
-200
@@ -13,6 +13,81 @@ const Time = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const originSources = {
|
export const originSources = {
|
||||||
|
"bilibili": {
|
||||||
|
name: "哔哩哔哩",
|
||||||
|
color: "blue",
|
||||||
|
home: "https://www.bilibili.com",
|
||||||
|
sub: {
|
||||||
|
"hot-search": {
|
||||||
|
title: "热搜",
|
||||||
|
column: "china",
|
||||||
|
type: "hottest",
|
||||||
|
},
|
||||||
|
"ranking": {
|
||||||
|
title: "排行榜",
|
||||||
|
column: "china",
|
||||||
|
disable: "cf",
|
||||||
|
type: "hottest",
|
||||||
|
interval: Time.Common,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"linuxdo": {
|
||||||
|
name: "LINUX DO",
|
||||||
|
column: "tech",
|
||||||
|
color: "slate",
|
||||||
|
home: "https://linux.do/",
|
||||||
|
disable: "cf",
|
||||||
|
sub: {
|
||||||
|
latest: {
|
||||||
|
title: "最新",
|
||||||
|
home: "https://linux.do/latest",
|
||||||
|
},
|
||||||
|
hot: {
|
||||||
|
title: "今日最热",
|
||||||
|
type: "hottest",
|
||||||
|
interval: Time.Common,
|
||||||
|
home: "https://linux.do/hot",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"github": {
|
||||||
|
name: "Github",
|
||||||
|
color: "gray",
|
||||||
|
home: "https://github.com/",
|
||||||
|
column: "tech",
|
||||||
|
sub: {
|
||||||
|
"trending-today": {
|
||||||
|
title: "Today",
|
||||||
|
type: "hottest",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"douyin": {
|
||||||
|
name: "抖音",
|
||||||
|
type: "hottest",
|
||||||
|
column: "china",
|
||||||
|
color: "gray",
|
||||||
|
home: "https://www.douyin.com",
|
||||||
|
},
|
||||||
|
"kuaishou": {
|
||||||
|
name: "快手",
|
||||||
|
type: "hottest",
|
||||||
|
column: "china",
|
||||||
|
color: "orange",
|
||||||
|
// cloudflare pages cannot access
|
||||||
|
disable: "cf",
|
||||||
|
home: "https://www.kuaishou.com",
|
||||||
|
},
|
||||||
|
"weibo": {
|
||||||
|
name: "微博",
|
||||||
|
title: "实时热搜",
|
||||||
|
type: "hottest",
|
||||||
|
column: "china",
|
||||||
|
color: "red",
|
||||||
|
interval: Time.Realtime,
|
||||||
|
home: "https://weibo.com",
|
||||||
|
},
|
||||||
"v2ex": {
|
"v2ex": {
|
||||||
name: "V2EX",
|
name: "V2EX",
|
||||||
color: "slate",
|
color: "slate",
|
||||||
@@ -31,14 +106,27 @@ export const originSources = {
|
|||||||
color: "blue",
|
color: "blue",
|
||||||
home: "https://www.zhihu.com",
|
home: "https://www.zhihu.com",
|
||||||
},
|
},
|
||||||
"weibo": {
|
"juejin": {
|
||||||
name: "微博",
|
name: "稀土掘金",
|
||||||
title: "实时热搜",
|
column: "tech",
|
||||||
|
color: "blue",
|
||||||
type: "hottest",
|
type: "hottest",
|
||||||
|
home: "https://juejin.cn",
|
||||||
|
},
|
||||||
|
"baidu": {
|
||||||
|
name: "百度热搜",
|
||||||
column: "china",
|
column: "china",
|
||||||
|
color: "blue",
|
||||||
|
type: "hottest",
|
||||||
|
home: "https://www.baidu.com",
|
||||||
|
},
|
||||||
|
"hupu": {
|
||||||
|
name: "虎扑",
|
||||||
|
home: "https://hupu.com",
|
||||||
|
column: "china",
|
||||||
|
title: "主干道热帖",
|
||||||
|
type: "hottest",
|
||||||
color: "red",
|
color: "red",
|
||||||
interval: Time.Realtime,
|
|
||||||
home: "https://weibo.com",
|
|
||||||
},
|
},
|
||||||
"zaobao": {
|
"zaobao": {
|
||||||
name: "联合早报",
|
name: "联合早报",
|
||||||
@@ -57,18 +145,6 @@ export const originSources = {
|
|||||||
title: "今日最热",
|
title: "今日最热",
|
||||||
home: "https://coolapk.com",
|
home: "https://coolapk.com",
|
||||||
},
|
},
|
||||||
"mktnews": {
|
|
||||||
name: "MKTNews",
|
|
||||||
column: "finance",
|
|
||||||
home: "https://mktnews.net",
|
|
||||||
color: "indigo",
|
|
||||||
interval: Time.Realtime,
|
|
||||||
sub: {
|
|
||||||
flash: {
|
|
||||||
title: "快讯",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"wallstreetcn": {
|
"wallstreetcn": {
|
||||||
name: "华尔街见闻",
|
name: "华尔街见闻",
|
||||||
color: "blue",
|
color: "blue",
|
||||||
@@ -78,14 +154,14 @@ export const originSources = {
|
|||||||
quick: {
|
quick: {
|
||||||
type: "realtime",
|
type: "realtime",
|
||||||
interval: Time.Fast,
|
interval: Time.Fast,
|
||||||
title: "快讯",
|
title: "实时快讯",
|
||||||
},
|
},
|
||||||
news: {
|
news: {
|
||||||
title: "最新",
|
title: "最新资讯",
|
||||||
interval: Time.Common,
|
interval: Time.Common,
|
||||||
},
|
},
|
||||||
hot: {
|
hot: {
|
||||||
title: "最热",
|
title: "最热文章",
|
||||||
type: "hottest",
|
type: "hottest",
|
||||||
interval: Time.Common,
|
interval: Time.Common,
|
||||||
},
|
},
|
||||||
@@ -105,21 +181,6 @@ export const originSources = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"douyin": {
|
|
||||||
name: "抖音",
|
|
||||||
type: "hottest",
|
|
||||||
column: "china",
|
|
||||||
color: "gray",
|
|
||||||
home: "https://www.douyin.com",
|
|
||||||
},
|
|
||||||
"hupu": {
|
|
||||||
name: "虎扑",
|
|
||||||
home: "https://hupu.com",
|
|
||||||
column: "china",
|
|
||||||
title: "主干道热帖",
|
|
||||||
type: "hottest",
|
|
||||||
color: "red",
|
|
||||||
},
|
|
||||||
"tieba": {
|
"tieba": {
|
||||||
name: "百度贴吧",
|
name: "百度贴吧",
|
||||||
title: "热议",
|
title: "热议",
|
||||||
@@ -171,7 +232,7 @@ export const originSources = {
|
|||||||
home: "https://bbs.pcbeta.com",
|
home: "https://bbs.pcbeta.com",
|
||||||
sub: {
|
sub: {
|
||||||
windows11: {
|
windows11: {
|
||||||
title: "Win11",
|
title: "Windows 11",
|
||||||
type: "realtime",
|
type: "realtime",
|
||||||
interval: Time.Fast,
|
interval: Time.Fast,
|
||||||
},
|
},
|
||||||
@@ -179,7 +240,6 @@ export const originSources = {
|
|||||||
title: "Windows 资源",
|
title: "Windows 资源",
|
||||||
type: "realtime",
|
type: "realtime",
|
||||||
interval: Time.Fast,
|
interval: Time.Fast,
|
||||||
disable: true,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -263,52 +323,6 @@ export const originSources = {
|
|||||||
type: "hottest",
|
type: "hottest",
|
||||||
home: "https://www.producthunt.com/",
|
home: "https://www.producthunt.com/",
|
||||||
},
|
},
|
||||||
"github": {
|
|
||||||
name: "Github",
|
|
||||||
color: "gray",
|
|
||||||
home: "https://github.com/",
|
|
||||||
column: "tech",
|
|
||||||
sub: {
|
|
||||||
"trending-today": {
|
|
||||||
title: "Today",
|
|
||||||
type: "hottest",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"bilibili": {
|
|
||||||
name: "哔哩哔哩",
|
|
||||||
color: "blue",
|
|
||||||
home: "https://www.bilibili.com",
|
|
||||||
sub: {
|
|
||||||
"hot-search": {
|
|
||||||
title: "热搜",
|
|
||||||
column: "china",
|
|
||||||
type: "hottest",
|
|
||||||
},
|
|
||||||
"hot-video": {
|
|
||||||
title: "热门视频",
|
|
||||||
disable: "cf",
|
|
||||||
column: "china",
|
|
||||||
type: "hottest",
|
|
||||||
},
|
|
||||||
"ranking": {
|
|
||||||
title: "排行榜",
|
|
||||||
column: "china",
|
|
||||||
disable: "cf",
|
|
||||||
type: "hottest",
|
|
||||||
interval: Time.Common,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"kuaishou": {
|
|
||||||
name: "快手",
|
|
||||||
type: "hottest",
|
|
||||||
column: "china",
|
|
||||||
color: "orange",
|
|
||||||
// cloudflare pages cannot access
|
|
||||||
disable: "cf",
|
|
||||||
home: "https://www.kuaishou.com",
|
|
||||||
},
|
|
||||||
"kaopu": {
|
"kaopu": {
|
||||||
name: "靠谱新闻",
|
name: "靠谱新闻",
|
||||||
column: "world",
|
column: "world",
|
||||||
@@ -324,63 +338,11 @@ export const originSources = {
|
|||||||
type: "realtime",
|
type: "realtime",
|
||||||
home: "https://www.jin10.com",
|
home: "https://www.jin10.com",
|
||||||
},
|
},
|
||||||
"baidu": {
|
|
||||||
name: "百度热搜",
|
|
||||||
column: "china",
|
|
||||||
color: "blue",
|
|
||||||
type: "hottest",
|
|
||||||
home: "https://www.baidu.com",
|
|
||||||
},
|
|
||||||
"linuxdo": {
|
|
||||||
name: "LINUX DO",
|
|
||||||
column: "tech",
|
|
||||||
color: "slate",
|
|
||||||
home: "https://linux.do/",
|
|
||||||
sub: {
|
|
||||||
latest: {
|
|
||||||
title: "最新",
|
|
||||||
home: "https://linux.do/latest",
|
|
||||||
},
|
|
||||||
hot: {
|
|
||||||
title: "今日最热",
|
|
||||||
type: "hottest",
|
|
||||||
interval: Time.Common,
|
|
||||||
home: "https://linux.do/hot",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"idcflare": {
|
|
||||||
name: "IDC Flare",
|
|
||||||
column: "tech",
|
|
||||||
color: "slate",
|
|
||||||
home: "https://idcflare.com/",
|
|
||||||
sub: {
|
|
||||||
latest: {
|
|
||||||
title: "最新",
|
|
||||||
home: "https://idcflare.com/latest",
|
|
||||||
},
|
|
||||||
hot: {
|
|
||||||
title: "今日最热",
|
|
||||||
type: "hottest",
|
|
||||||
interval: Time.Common,
|
|
||||||
home: "https://idcflare.com/hot",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"ghxi": {
|
"ghxi": {
|
||||||
name: "果核剥壳",
|
name: "果核剥壳",
|
||||||
column: "china",
|
column: "china",
|
||||||
color: "yellow",
|
color: "yellow",
|
||||||
home: "https://www.ghxi.com/",
|
home: "https://www.ghxi.com/",
|
||||||
disable: true,
|
|
||||||
},
|
|
||||||
"smzdm": {
|
|
||||||
name: "什么值得买",
|
|
||||||
column: "china",
|
|
||||||
color: "red",
|
|
||||||
type: "hottest",
|
|
||||||
home: "https://www.smzdm.com",
|
|
||||||
disable: true,
|
|
||||||
},
|
},
|
||||||
"nowcoder": {
|
"nowcoder": {
|
||||||
name: "牛客",
|
name: "牛客",
|
||||||
@@ -396,13 +358,6 @@ export const originSources = {
|
|||||||
type: "hottest",
|
type: "hottest",
|
||||||
home: "https://sspai.com",
|
home: "https://sspai.com",
|
||||||
},
|
},
|
||||||
"juejin": {
|
|
||||||
name: "稀土掘金",
|
|
||||||
column: "tech",
|
|
||||||
color: "blue",
|
|
||||||
type: "hottest",
|
|
||||||
home: "https://juejin.cn",
|
|
||||||
},
|
|
||||||
"ifeng": {
|
"ifeng": {
|
||||||
name: "凤凰网",
|
name: "凤凰网",
|
||||||
column: "china",
|
column: "china",
|
||||||
@@ -430,36 +385,6 @@ export const originSources = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"douban": {
|
|
||||||
name: "豆瓣",
|
|
||||||
column: "china",
|
|
||||||
title: "热门电影",
|
|
||||||
color: "green",
|
|
||||||
type: "hottest",
|
|
||||||
home: "https://www.douban.com",
|
|
||||||
},
|
|
||||||
"steam": {
|
|
||||||
name: "Steam",
|
|
||||||
column: "world",
|
|
||||||
title: "在线人数",
|
|
||||||
color: "blue",
|
|
||||||
type: "hottest",
|
|
||||||
home: "https://store.steampowered.com",
|
|
||||||
},
|
|
||||||
"tencent": {
|
|
||||||
name: "腾讯新闻",
|
|
||||||
column: "china",
|
|
||||||
color: "blue",
|
|
||||||
home: "https://news.qq.com",
|
|
||||||
sub: {
|
|
||||||
hot: {
|
|
||||||
title: "综合早报",
|
|
||||||
type: "hottest",
|
|
||||||
interval: Time.Common,
|
|
||||||
home: "https://news.qq.com/tag/aEWqxLtdgmQ=",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
} as const satisfies Record<string, OriginSource>
|
} as const satisfies Record<string, OriginSource>
|
||||||
|
|
||||||
export function genSources() {
|
export function genSources() {
|
||||||
@@ -479,38 +404,29 @@ export function genSources() {
|
|||||||
if (source.sub && Object.keys(source.sub).length) {
|
if (source.sub && Object.keys(source.sub).length) {
|
||||||
Object.entries(source.sub).forEach(([subId, subSource], i) => {
|
Object.entries(source.sub).forEach(([subId, subSource], i) => {
|
||||||
if (i === 0) {
|
if (i === 0) {
|
||||||
_.push([
|
_.push([id, {
|
||||||
id,
|
redirect: `${id}-${subId}`,
|
||||||
{
|
...parent,
|
||||||
redirect: `${id}-${subId}`,
|
...subSource,
|
||||||
...parent,
|
}] as [any, Source])
|
||||||
...subSource,
|
|
||||||
},
|
|
||||||
] as [any, Source])
|
|
||||||
}
|
}
|
||||||
_.push([`${id}-${subId}`, { ...parent, ...subSource }] as [
|
_.push([`${id}-${subId}`, { ...parent, ...subSource }] as [any, Source])
|
||||||
any,
|
|
||||||
Source,
|
|
||||||
])
|
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
_.push([
|
_.push([id, {
|
||||||
id,
|
title: source.title,
|
||||||
{
|
...parent,
|
||||||
title: source.title,
|
}])
|
||||||
...parent,
|
|
||||||
},
|
|
||||||
])
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return typeSafeObjectFromEntries(
|
return typeSafeObjectFromEntries(_.filter(([_, v]) => {
|
||||||
_.filter(([_, v]) => {
|
if (v.disable === "cf" && process.env.CF_PAGES) {
|
||||||
if (v.disable === "cf" && process.env.CF_PAGES) {
|
return false
|
||||||
return false
|
} else if (v.disable === true) {
|
||||||
} else {
|
return false
|
||||||
return v.disable !== true
|
} else {
|
||||||
}
|
return true
|
||||||
}),
|
}
|
||||||
)
|
}))
|
||||||
}
|
}
|
||||||
|
|||||||
+44
-81
@@ -51,23 +51,6 @@
|
|||||||
"color": "green",
|
"color": "green",
|
||||||
"interval": 600000
|
"interval": 600000
|
||||||
},
|
},
|
||||||
"mktnews": {
|
|
||||||
"redirect": "mktnews-flash",
|
|
||||||
"name": "MKTNews",
|
|
||||||
"column": "finance",
|
|
||||||
"home": "https://mktnews.net",
|
|
||||||
"color": "indigo",
|
|
||||||
"interval": 120000,
|
|
||||||
"title": "快讯"
|
|
||||||
},
|
|
||||||
"mktnews-flash": {
|
|
||||||
"name": "MKTNews",
|
|
||||||
"column": "finance",
|
|
||||||
"home": "https://mktnews.net",
|
|
||||||
"color": "indigo",
|
|
||||||
"interval": 120000,
|
|
||||||
"title": "快讯"
|
|
||||||
},
|
|
||||||
"wallstreetcn": {
|
"wallstreetcn": {
|
||||||
"redirect": "wallstreetcn-quick",
|
"redirect": "wallstreetcn-quick",
|
||||||
"name": "华尔街见闻",
|
"name": "华尔街见闻",
|
||||||
@@ -76,7 +59,7 @@
|
|||||||
"home": "https://wallstreetcn.com/",
|
"home": "https://wallstreetcn.com/",
|
||||||
"color": "blue",
|
"color": "blue",
|
||||||
"interval": 300000,
|
"interval": 300000,
|
||||||
"title": "快讯"
|
"title": "实时快讯"
|
||||||
},
|
},
|
||||||
"wallstreetcn-quick": {
|
"wallstreetcn-quick": {
|
||||||
"name": "华尔街见闻",
|
"name": "华尔街见闻",
|
||||||
@@ -85,7 +68,7 @@
|
|||||||
"home": "https://wallstreetcn.com/",
|
"home": "https://wallstreetcn.com/",
|
||||||
"color": "blue",
|
"color": "blue",
|
||||||
"interval": 300000,
|
"interval": 300000,
|
||||||
"title": "快讯"
|
"title": "实时快讯"
|
||||||
},
|
},
|
||||||
"wallstreetcn-news": {
|
"wallstreetcn-news": {
|
||||||
"name": "华尔街见闻",
|
"name": "华尔街见闻",
|
||||||
@@ -93,7 +76,7 @@
|
|||||||
"home": "https://wallstreetcn.com/",
|
"home": "https://wallstreetcn.com/",
|
||||||
"color": "blue",
|
"color": "blue",
|
||||||
"interval": 1800000,
|
"interval": 1800000,
|
||||||
"title": "最新"
|
"title": "最新资讯"
|
||||||
},
|
},
|
||||||
"wallstreetcn-hot": {
|
"wallstreetcn-hot": {
|
||||||
"name": "华尔街见闻",
|
"name": "华尔街见闻",
|
||||||
@@ -102,7 +85,7 @@
|
|||||||
"home": "https://wallstreetcn.com/",
|
"home": "https://wallstreetcn.com/",
|
||||||
"color": "blue",
|
"color": "blue",
|
||||||
"interval": 1800000,
|
"interval": 1800000,
|
||||||
"title": "最热"
|
"title": "最热文章"
|
||||||
},
|
},
|
||||||
"36kr": {
|
"36kr": {
|
||||||
"redirect": "36kr-quick",
|
"redirect": "36kr-quick",
|
||||||
@@ -198,7 +181,7 @@
|
|||||||
"home": "https://bbs.pcbeta.com",
|
"home": "https://bbs.pcbeta.com",
|
||||||
"color": "blue",
|
"color": "blue",
|
||||||
"interval": 300000,
|
"interval": 300000,
|
||||||
"title": "Win11"
|
"title": "Windows 11"
|
||||||
},
|
},
|
||||||
"pcbeta-windows11": {
|
"pcbeta-windows11": {
|
||||||
"name": "远景论坛",
|
"name": "远景论坛",
|
||||||
@@ -207,7 +190,16 @@
|
|||||||
"home": "https://bbs.pcbeta.com",
|
"home": "https://bbs.pcbeta.com",
|
||||||
"color": "blue",
|
"color": "blue",
|
||||||
"interval": 300000,
|
"interval": 300000,
|
||||||
"title": "Win11"
|
"title": "Windows 11"
|
||||||
|
},
|
||||||
|
"pcbeta-windows": {
|
||||||
|
"name": "远景论坛",
|
||||||
|
"type": "realtime",
|
||||||
|
"column": "tech",
|
||||||
|
"home": "https://bbs.pcbeta.com",
|
||||||
|
"color": "blue",
|
||||||
|
"interval": 300000,
|
||||||
|
"title": "Windows 资源"
|
||||||
},
|
},
|
||||||
"cls": {
|
"cls": {
|
||||||
"redirect": "cls-telegraph",
|
"redirect": "cls-telegraph",
|
||||||
@@ -361,16 +353,6 @@
|
|||||||
"interval": 600000,
|
"interval": 600000,
|
||||||
"title": "热搜"
|
"title": "热搜"
|
||||||
},
|
},
|
||||||
"bilibili-hot-video": {
|
|
||||||
"name": "哔哩哔哩",
|
|
||||||
"type": "hottest",
|
|
||||||
"disable": "cf",
|
|
||||||
"column": "china",
|
|
||||||
"home": "https://www.bilibili.com",
|
|
||||||
"color": "blue",
|
|
||||||
"interval": 600000,
|
|
||||||
"title": "热门视频"
|
|
||||||
},
|
|
||||||
"bilibili-ranking": {
|
"bilibili-ranking": {
|
||||||
"name": "哔哩哔哩",
|
"name": "哔哩哔哩",
|
||||||
"type": "hottest",
|
"type": "hottest",
|
||||||
@@ -414,23 +396,41 @@
|
|||||||
"color": "blue",
|
"color": "blue",
|
||||||
"interval": 600000
|
"interval": 600000
|
||||||
},
|
},
|
||||||
|
"linuxdo": {
|
||||||
|
"redirect": "linuxdo-latest",
|
||||||
|
"name": "LINUX DO",
|
||||||
|
"disable": "cf",
|
||||||
|
"column": "tech",
|
||||||
|
"home": "https://linux.do/latest",
|
||||||
|
"color": "slate",
|
||||||
|
"interval": 600000,
|
||||||
|
"title": "最新"
|
||||||
|
},
|
||||||
|
"linuxdo-latest": {
|
||||||
|
"name": "LINUX DO",
|
||||||
|
"disable": "cf",
|
||||||
|
"column": "tech",
|
||||||
|
"home": "https://linux.do/latest",
|
||||||
|
"color": "slate",
|
||||||
|
"interval": 600000,
|
||||||
|
"title": "最新"
|
||||||
|
},
|
||||||
"linuxdo-hot": {
|
"linuxdo-hot": {
|
||||||
"name": "LINUX DO",
|
"name": "LINUX DO",
|
||||||
"type": "hottest",
|
"type": "hottest",
|
||||||
|
"disable": "cf",
|
||||||
"column": "tech",
|
"column": "tech",
|
||||||
"home": "https://linux.do",
|
"home": "https://linux.do/hot",
|
||||||
"color": "gray",
|
"color": "slate",
|
||||||
"interval": 600000,
|
"interval": 1800000,
|
||||||
"title": "今日最热"
|
"title": "今日最热"
|
||||||
},
|
},
|
||||||
"idcflare-hot": {
|
"ghxi": {
|
||||||
"name": "IDC Flare",
|
"name": "果核剥壳",
|
||||||
"type": "hottest",
|
"column": "china",
|
||||||
"column": "tech",
|
"home": "https://www.ghxi.com/",
|
||||||
"home": "https://idcflare.com",
|
"color": "yellow",
|
||||||
"color": "gray",
|
"interval": 600000
|
||||||
"interval": 600000,
|
|
||||||
"title": "今日最热"
|
|
||||||
},
|
},
|
||||||
"nowcoder": {
|
"nowcoder": {
|
||||||
"name": "牛客",
|
"name": "牛客",
|
||||||
@@ -490,42 +490,5 @@
|
|||||||
"color": "green",
|
"color": "green",
|
||||||
"interval": 1800000,
|
"interval": 1800000,
|
||||||
"title": "最热"
|
"title": "最热"
|
||||||
},
|
|
||||||
"douban": {
|
|
||||||
"title": "热门电影",
|
|
||||||
"name": "豆瓣",
|
|
||||||
"type": "hottest",
|
|
||||||
"column": "china",
|
|
||||||
"home": "https://www.douban.com",
|
|
||||||
"color": "green",
|
|
||||||
"interval": 600000
|
|
||||||
},
|
|
||||||
"steam": {
|
|
||||||
"title": "在线人数",
|
|
||||||
"name": "Steam",
|
|
||||||
"type": "hottest",
|
|
||||||
"column": "world",
|
|
||||||
"home": "https://store.steampowered.com",
|
|
||||||
"color": "blue",
|
|
||||||
"interval": 600000
|
|
||||||
},
|
|
||||||
"tencent": {
|
|
||||||
"redirect": "tencent-hot",
|
|
||||||
"name": "腾讯新闻",
|
|
||||||
"type": "hottest",
|
|
||||||
"column": "china",
|
|
||||||
"home": "https://news.qq.com/tag/aEWqxLtdgmQ=",
|
|
||||||
"color": "blue",
|
|
||||||
"interval": 1800000,
|
|
||||||
"title": "综合早报"
|
|
||||||
},
|
|
||||||
"tencent-hot": {
|
|
||||||
"name": "腾讯新闻",
|
|
||||||
"type": "hottest",
|
|
||||||
"column": "china",
|
|
||||||
"home": "https://news.qq.com/tag/aEWqxLtdgmQ=",
|
|
||||||
"color": "blue",
|
|
||||||
"interval": 1800000,
|
|
||||||
"title": "综合早报"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,10 +8,8 @@ import { useThrottleFn } from "ahooks"
|
|||||||
import { useAutoAnimate } from "@formkit/auto-animate/react"
|
import { useAutoAnimate } from "@formkit/auto-animate/react"
|
||||||
import { motion } from "framer-motion"
|
import { motion } from "framer-motion"
|
||||||
import { useWindowSize } from "react-use"
|
import { useWindowSize } from "react-use"
|
||||||
import { isMobile } from "react-device-detect"
|
|
||||||
import { DndContext } from "../common/dnd"
|
import { DndContext } from "../common/dnd"
|
||||||
import { useSortable } from "../common/dnd/useSortable"
|
import { useSortable } from "../common/dnd/useSortable"
|
||||||
import { OverlayScrollbar } from "../common/overlay-scrollbar"
|
|
||||||
import type { ItemsProps } from "./card"
|
import type { ItemsProps } from "./card"
|
||||||
import { CardWrapper } from "./card"
|
import { CardWrapper } from "./card"
|
||||||
import { currentSourcesAtom } from "~/atoms"
|
import { currentSourcesAtom } from "~/atoms"
|
||||||
@@ -28,76 +26,58 @@ export function Dnd() {
|
|||||||
return Math.min(width - 32, WIDTH)
|
return Math.min(width - 32, WIDTH)
|
||||||
}, [width])
|
}, [width])
|
||||||
|
|
||||||
if (!items.length) return null
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DndWrapper items={items} setItems={setItems} isSingleColumn={isMobile}>
|
<DndWrapper items={items} setItems={setItems}>
|
||||||
<OverlayScrollbar defer className="overflow-x-auto">
|
<motion.ol
|
||||||
<motion.ol
|
className="grid w-full gap-6"
|
||||||
className={isMobile
|
ref={parent}
|
||||||
? "flex px-2 gap-6 pb-4 scroll-smooth"
|
style={{
|
||||||
: "grid w-full gap-6"}
|
gridTemplateColumns: `repeat(auto-fill, minmax(${minWidth}px, 1fr))`,
|
||||||
ref={parent}
|
}}
|
||||||
style={isMobile
|
initial="hidden"
|
||||||
? {
|
animate="visible"
|
||||||
// 横向滚动布局
|
variants={{
|
||||||
}
|
hidden: {
|
||||||
: {
|
opacity: 0,
|
||||||
gridTemplateColumns: `repeat(auto-fill, minmax(${minWidth}px, 1fr))`,
|
},
|
||||||
}}
|
visible: {
|
||||||
initial="hidden"
|
opacity: 1,
|
||||||
animate="visible"
|
transition: {
|
||||||
variants={{
|
delayChildren: 0.1,
|
||||||
hidden: {
|
staggerChildren: 0.1,
|
||||||
opacity: 0,
|
|
||||||
},
|
},
|
||||||
visible: {
|
},
|
||||||
opacity: 1,
|
}}
|
||||||
transition: {
|
>
|
||||||
delayChildren: 0.1,
|
{items.map(id => (
|
||||||
staggerChildren: 0.1,
|
<motion.li
|
||||||
|
key={id}
|
||||||
|
transition={{
|
||||||
|
type: "tween",
|
||||||
|
duration: AnimationDuration / 1000,
|
||||||
|
}}
|
||||||
|
variants={{
|
||||||
|
hidden: {
|
||||||
|
y: 20,
|
||||||
|
opacity: 0,
|
||||||
},
|
},
|
||||||
},
|
visible: {
|
||||||
}}
|
y: 0,
|
||||||
>
|
opacity: 1,
|
||||||
{items.map((id, index) => (
|
},
|
||||||
<motion.li
|
}}
|
||||||
key={id}
|
>
|
||||||
className={$(isMobile && "flex-shrink-0", isMobile && index === items.length - 1 && "mr-2")}
|
<SortableCardWrapper id={id} />
|
||||||
style={isMobile ? { width: `${width - 16 > WIDTH ? WIDTH : width - 16}px` } : undefined}
|
</motion.li>
|
||||||
transition={{
|
))}
|
||||||
type: "tween",
|
</motion.ol>
|
||||||
duration: AnimationDuration / 1000,
|
|
||||||
}}
|
|
||||||
variants={{
|
|
||||||
hidden: {
|
|
||||||
y: 20,
|
|
||||||
opacity: 0,
|
|
||||||
},
|
|
||||||
visible: {
|
|
||||||
y: 0,
|
|
||||||
opacity: 1,
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<SortableCardWrapper id={id} />
|
|
||||||
</motion.li>
|
|
||||||
))}
|
|
||||||
</motion.ol>
|
|
||||||
</OverlayScrollbar>
|
|
||||||
{isMobile && (
|
|
||||||
<div className="flex justify-center">
|
|
||||||
<span className="text-sm text-gray-500 text-center">左右滑动查看更多</span>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</DndWrapper>
|
</DndWrapper>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function DndWrapper({ items, setItems, isSingleColumn, children }: PropsWithChildren<{
|
function DndWrapper({ items, setItems, children }: PropsWithChildren<{
|
||||||
items: SourceID[]
|
items: SourceID[]
|
||||||
setItems: (items: SourceID[]) => void
|
setItems: (items: SourceID[]) => void
|
||||||
isSingleColumn: boolean
|
|
||||||
}>) {
|
}>) {
|
||||||
const onDropTargetChange = useCallback(({ location, source }: BaseEventPayload<ElementDragType>) => {
|
const onDropTargetChange = useCallback(({ location, source }: BaseEventPayload<ElementDragType>) => {
|
||||||
const traget = location.current.dropTargets[0]
|
const traget = location.current.dropTargets[0]
|
||||||
@@ -111,10 +91,10 @@ function DndWrapper({ items, setItems, isSingleColumn, children }: PropsWithChil
|
|||||||
startIndex: fromIndex,
|
startIndex: fromIndex,
|
||||||
indexOfTarget: toIndex,
|
indexOfTarget: toIndex,
|
||||||
closestEdgeOfTarget,
|
closestEdgeOfTarget,
|
||||||
axis: isSingleColumn ? "horizontal" : "vertical",
|
axis: "vertical",
|
||||||
})
|
})
|
||||||
setItems(update)
|
setItems(update)
|
||||||
}, [items, setItems, isSingleColumn])
|
}, [items, setItems])
|
||||||
// 避免动画干扰
|
// 避免动画干扰
|
||||||
const { run } = useThrottleFn(onDropTargetChange, {
|
const { run } = useThrottleFn(onDropTargetChange, {
|
||||||
leading: true,
|
leading: true,
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
[cmdk-list] {
|
[cmdk-list] {
|
||||||
--at-apply: px-3 flex flex-col gap-2 items-stretch max-h-[400px] h-[calc(100vh-100px)];
|
--at-apply: px-3 flex flex-col gap-2 items-stretch h-400px;
|
||||||
}
|
}
|
||||||
|
|
||||||
[cmdk-group-heading] {
|
[cmdk-group-heading] {
|
||||||
|
|||||||
@@ -17,12 +17,6 @@ function GoTop() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
function Github() {
|
|
||||||
return (
|
|
||||||
<button type="button" title="Github" className="i-ph:github-logo-duotone btn" onClick={() => window.open(Homepage)} />
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
function Refresh() {
|
function Refresh() {
|
||||||
const currentSources = useAtomValue(currentSourcesAtom)
|
const currentSources = useAtomValue(currentSourcesAtom)
|
||||||
const { refresh } = useRefetch()
|
const { refresh } = useRefetch()
|
||||||
@@ -71,7 +65,6 @@ export function Header() {
|
|||||||
<span className="justify-self-end flex gap-2 items-center text-xl text-primary-600 dark:text-primary">
|
<span className="justify-self-end flex gap-2 items-center text-xl text-primary-600 dark:text-primary">
|
||||||
<GoTop />
|
<GoTop />
|
||||||
<Refresh />
|
<Refresh />
|
||||||
<Github />
|
|
||||||
<Menu />
|
<Menu />
|
||||||
</span>
|
</span>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
import { motion } from "framer-motion"
|
import { motion } from "framer-motion"
|
||||||
|
|
||||||
// function ThemeToggle() {
|
function ThemeToggle() {
|
||||||
// const { isDark, toggleDark } = useDark()
|
const { isDark, toggleDark } = useDark()
|
||||||
// return (
|
return (
|
||||||
// <li onClick={toggleDark} className="cursor-pointer [&_*]:cursor-pointer transition-all">
|
<li onClick={toggleDark} className="cursor-pointer [&_*]:cursor-pointer transition-all">
|
||||||
// <span className={$("inline-block", isDark ? "i-ph-moon-stars-duotone" : "i-ph-sun-dim-duotone")} />
|
<span className={$("inline-block", isDark ? "i-ph-moon-stars-duotone" : "i-ph-sun-dim-duotone")} />
|
||||||
// <span>
|
<span>
|
||||||
// {isDark ? "浅色模式" : "深色模式"}
|
{isDark ? "浅色模式" : "深色模式"}
|
||||||
// </span>
|
</span>
|
||||||
// </li>
|
</li>
|
||||||
// )
|
)
|
||||||
// }
|
}
|
||||||
|
|
||||||
export function Menu() {
|
export function Menu() {
|
||||||
const { loggedIn, login, logout, userInfo, enableLogin } = useLogin()
|
const { loggedIn, login, logout, userInfo, enableLogin } = useLogin()
|
||||||
@@ -64,7 +64,7 @@ export function Menu() {
|
|||||||
<span>Github 账号登录</span>
|
<span>Github 账号登录</span>
|
||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
{/* <ThemeToggle /> */}
|
<ThemeToggle />
|
||||||
<li onClick={() => window.open(Homepage)} className="cursor-pointer [&_*]:cursor-pointer transition-all">
|
<li onClick={() => window.open(Homepage)} className="cursor-pointer [&_*]:cursor-pointer transition-all">
|
||||||
<span className="i-ph:github-logo-duotone inline-block" />
|
<span className="i-ph:github-logo-duotone inline-block" />
|
||||||
<span>Star on Github </span>
|
<span>Star on Github </span>
|
||||||
@@ -75,7 +75,7 @@ export function Menu() {
|
|||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
alt="GitHub stars badge"
|
alt="GitHub stars badge"
|
||||||
src="https://img.shields.io/github/stars/ourongxing/newsnow?logo=github&style=flat&labelColor=%235e3c40&color=%23614447"
|
src="https://img.shields.io/github/stars/ourongxing/newsnow?logo=github"
|
||||||
/>
|
/>
|
||||||
</a>
|
</a>
|
||||||
<a
|
<a
|
||||||
@@ -83,7 +83,7 @@ export function Menu() {
|
|||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
alt="GitHub forks badge"
|
alt="GitHub forks badge"
|
||||||
src="https://img.shields.io/github/forks/ourongxing/newsnow?logo=github&style=flat&labelColor=%235e3c40&color=%23614447"
|
src="https://img.shields.io/github/forks/ourongxing/newsnow?logo=github"
|
||||||
/>
|
/>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import { Outlet, createRootRouteWithContext } from "@tanstack/react-router"
|
|||||||
import { TanStackRouterDevtools } from "@tanstack/router-devtools"
|
import { TanStackRouterDevtools } from "@tanstack/router-devtools"
|
||||||
import { ReactQueryDevtools } from "@tanstack/react-query-devtools"
|
import { ReactQueryDevtools } from "@tanstack/react-query-devtools"
|
||||||
import type { QueryClient } from "@tanstack/react-query"
|
import type { QueryClient } from "@tanstack/react-query"
|
||||||
import { isMobile } from "react-device-detect"
|
|
||||||
import { Header } from "~/components/header"
|
import { Header } from "~/components/header"
|
||||||
import { GlobalOverlayScrollbar } from "~/components/common/overlay-scrollbar"
|
import { GlobalOverlayScrollbar } from "~/components/common/overlay-scrollbar"
|
||||||
import { Footer } from "~/components/footer"
|
import { Footer } from "~/components/footer"
|
||||||
@@ -31,13 +30,11 @@ function RootComponent() {
|
|||||||
usePWA()
|
usePWA()
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<GlobalOverlayScrollbar
|
<GlobalOverlayScrollbar className={$([
|
||||||
className={$([
|
"h-full overflow-x-auto px-4",
|
||||||
!isMobile && "px-4",
|
"md:(px-10)",
|
||||||
"h-full overflow-x-auto",
|
"lg:(px-24)",
|
||||||
"md:(px-10)",
|
])}
|
||||||
"lg:(px-24)",
|
|
||||||
])}
|
|
||||||
>
|
>
|
||||||
<header
|
<header
|
||||||
className={$([
|
className={$([
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
"moduleResolution": "bundler",
|
"moduleResolution": "bundler",
|
||||||
"allowImportingTsExtensions": true,
|
"allowImportingTsExtensions": true,
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"allowJs": true,
|
|
||||||
"noFallthroughCasesInSwitch": true,
|
"noFallthroughCasesInSwitch": true,
|
||||||
"noUnusedLocals": true,
|
"noUnusedLocals": true,
|
||||||
"noUnusedParameters": true,
|
"noUnusedParameters": true,
|
||||||
|
|||||||
Reference in New Issue
Block a user