GitHub Has Restricted Access to Star Data
https://www.star-history.com/blog/github-stargazer-api-restriction
众所周知,最近Github限制了仓库星星历史数据对公众开放的API
只能由其所有者或者贡献者获得这个数据,那么使用了star-history.com这个第三方的仓库历史🌟 趋势图的话,就会导致仓库Readme的图片加载不出来了,路人看的话是完全没有权限,只能所有者去获得这个数据,那么Meteor-History应运而生了!
Meteor-History,Meteor是流星的意思,希望各位热衷于开源社区的作者们自己的仓库像有流星雨一样的🌟 ^-^
Meteor-History is a self-hosted GitHub repository gallery and SVG card service. It synchronizes repository and profile data on a schedule, stores star history as persistent JSON, and provides copyable image URLs and Markdown for project README files.
先端上仓库地址:https://github.com/MengMengCode/Meteor-History
(如果你觉得这个项目对您有用,恳请大家麻烦点个小Star🌟 )
本项目的原理是:使用低权限的GITHUB_TOKEN: a fine-grained GitHub token with only Metadata → Read-only access.使用这个TOKEN,以仓库所有者的身份请求仓库Star数据,然后使用缓存文件记录拉取的数据,定时拉取更新数据,然后通过API,将这个数据对外公开(使用类似star-history的样式)
然后顺便将个人资料卡的也集成进去了,后期会加入更多好看的卡片
1.进入 https://github.com/settings/personal-access-tokens/new
2.随便起个TOKEN名字,我习惯将这种无所谓的Ready-Only的低权限TOKEN设置成长期:
3.然后选择部分仓库(这个可以后期修改)然后选择 Metadata → Read-only access
4.点击生成TOKEN,就会得到一个github_pat_开头的密钥
部署教程
curl -fsSL https://raw.githubusercontent.com/MengMengCode/Meteor-History/main/deploy.sh | sudo sh
根据交互提示进行操作即可
name: meteor-history # Compose project name
services:
meteor-history:
image: ghcr.io/mengmengcode/meteor-history:latest # Image tag; pin a release tag for reproducible deployments
container_name: meteor-history # Container name shown by Docker
restart: unless-stopped # Restart policy
ports:
- "8666:8666" # Host port:container port
volumes:
- meteor-history-cache:/app/.cache # Persistent repository and star-history JSON
environment:
GITHUB_TOKEN: "github_pat_xxx" # Required: fine-grained token with Metadata read access
EMBED_SIGNING_KEY: "replace-with-at-least-32-random-characters" # Required: signs image URLs
PUBLIC_BASE_URL: "" # Optional: public HTTPS origin; empty uses the request origin and disables hotlink protection
PORT: "8666" # Internal HTTP port
CACHE_TTL_MINUTES: "360" # Minutes before cached JSON is considered stale
REFRESH_INTERVAL_MINUTES: "360" # Minutes between scheduled GitHub synchronization runs
EMBED_RATE_LIMIT_PER_MINUTE: "120" # SVG requests allowed per client each minute
API_RATE_LIMIT_PER_MINUTE: "240" # JSON API requests allowed per client each minute
EMBED_HOTLINK_PROTECTION: "false" # Enable only when PUBLIC_BASE_URL is configured
EMBED_ALLOWED_HOSTS: "github.com,*.githubusercontent.com,*.github.io" # Allowed Referer hosts when protection is enabled
TRUST_PROXY: "false" # Set true only behind a trusted reverse proxy
INCLUDE_PRIVATE_REPOSITORIES: "false" # Keep false for public deployments
volumes:
meteor-history-cache: # Docker-managed persistent volume
Cloudflare 部署教程:
不建议使用Cloudflare部署,除非你有Worker请求数不会被刷爆的自信 ^-^
1.点击上方按钮,跳转CF授权绑定Github:
2.GITHUB_TOKEN填(a fine-grained GitHub token with only Metadata → Read-only access.这个权限的TOKEN,上方有教程说明),EMBED_SIGNING_KEY使用随机生成的32为字符作为防盗链签名使用的,PUBLIC_BASE_URL填你想要绑定的域名,如果没有的话可以先随便写一个,等分配了Worker域名之后再将这个修改成Worker域名(否则会出现卡片加载不了的问题),其他的默认,然后点击部署即可。