Skip to content

About

YABS usage statistics grabber and visual dashboard

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1,030 Commits

Folders and files

Repository files navigation

Static usage statistics for YABS, generated from Cloudflare Analytics and published with GitHub Pages.

Dashboard: https://stats.yabs.sh/

YABS is commonly run with:

curl -sL yabs.sh | bash

This repository tracks public aggregate usage for yabs.sh without running any application servers, databases, containers, schedulers, or API backends.

How It Works

The whole system is intentionally small:

GitHub Actions
  -> Cloudflare GraphQL API
  -> scripts/update_stats.py
  -> docs/data/stats.json
  -> Git commit
  -> GitHub Pages
  -> Browser

The browser only downloads docs/data/stats.json. There is no REST API and no server-side dashboard process.

Git history is the persistent store. Each update loads the existing JSON file, merges newly fetched Cloudflare data, writes the file only if it changed, and commits it back to the repository.

Repository Layout

.github/workflows/update.yml  Scheduled stats updater
docs/index.html               GitHub Pages entrypoint
docs/app.js                   Dashboard JavaScript
docs/style.css                Dashboard styles
docs/data/stats.json          Static JSON data consumed by the browser
scripts/cloudflare.py         Tiny Cloudflare GraphQL client
scripts/update_stats.py       Stats fetch, merge, and generation script
scripts/diagnose.py           Read-only per-day traffic source breakdown
requirements.txt              Python dependencies

Data

docs/data/stats.json contains:

  • summary: headline counters such as all-time, today, last 7 days, and last 30 days
  • history: daily request history, including daily unique IPs and country breakdowns
  • countries: recent country totals for compatibility and initial display
  • hourly: recent rolling hourly data
  • activity: recent Cloudflare request-source totals
  • excluded: per-day totals of filtered non-run traffic and flagged client IPs

What counts as a run

A run is a request that would receive the script. The yabs.sh edge redirect only serves the script to user agents containing curl or Wget and sends everything else to the GitHub repo page, so non-matching requests are measured via httpRequestsAdaptiveGroups and subtracted from the daily and hourly rollups. Two more rules catch abuse that fakes its user agent:

  • any client IP making more than FLOOD_REQS_PER_DAY requests in a day is excluded entirely for that day
  • IPs listed in BLOCKED_IPS in scripts/update_stats.py are excluded at any volume

Exclusions are recomputed from adaptive analytics on every run, so each day is corrected while it remains inside Cloudflare's ~1 week adaptive window. Run python scripts/diagnose.py to see the per-day breakdown that would be applied.

Cloudflare plan limits control how far back each API can read. Daily history has the longest retention; hourly and request-source data are short rolling windows. Once daily history is written to stats.json, future runs preserve it even after Cloudflare no longer exposes that day.

Local Updates

Create a local .env file:

CF_API_TOKEN=your_cloudflare_token
CF_ZONE_TAG=your_cloudflare_zone_id

The token needs Cloudflare Zone:Analytics:Read permission for the yabs.sh zone.

Then run:

pip install -r requirements.txt
python scripts/update_stats.py

If data changed, the script updates docs/data/stats.json.

GitHub Actions

The updater workflow runs on a schedule and can also be started manually from GitHub Actions. It expects these repository secrets:

  • CF_API_TOKEN
  • CF_ZONE_ID

GitHub Pages should be configured as:

Deploy from branch
main
/docs

There is intentionally no Pages deployment workflow.

License

WTFPL. See LICENSE.

About

YABS usage statistics grabber and visual dashboard

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages