Skip to content

melosso/forgejo-script-mirror-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mirror script for Forgejo

A lightweight companion script for Forgejo that restores its' engagement metrics to mirrored repositories by pulling live Star and Fork counts from the original source.

Screenshot

Designed to work seamlessly with our brand-inspired Melosso Forgejo Theme.

Why?

Forgejo mirrors only synchronize Git data, leaving social metrics like stars and forks at zero. This makes it difficult to see a project's popularity or "social proof" at a glance on your local instance.

This script fills those gaps by fetching live engagement data from the original source (GitHub, GitLab, etc.) and overlaying it onto your Forgejo UI. All fetched metrics are cached locally for 24 hours to ensure your instance stays fast and respects API rate limits.

The script has universal support for GitHub, GitLab, GitBucket, and Gitea-based instances. It automatically identifies mirrors through the Forgejo API and adds a small snippet to your custom header template.

Important Privacy Note: While Forgejo syncs the code server-side, this script creates a client-side leak by forcing the visitor's browser to announce itself to GitHub's API just to update the "Star" count. This means the visitor's IP address and the repository they are viewing are visible to the upstream provider (e.g., Codeberg, GitHub). Please make sure to indicate this in your privacy policy if you have one.

Installation

Add the contents of mirror-meta.js to your Forgejo custom header template.

  1. Use an editor to create or edit the custom/templates/custom/header.tmpl file

  2. Make sure to keep the code in the <script> tag

  3. Restart Forgejo:

    sudo systemctl restart forgejo

Configuration

Edit the top of the script to toggle features:

const enableStars = true;
const enableForks = true;

// If you don't like to use animations:
const useAnimation = true;

License

Published and licensed under the AGPL-3.0 license.

About

A simple Forgejo client-side script to update your stars/forks in Forgejo (for your mirrored repositories).

Topics

Resources

License

Stars

Watchers

Forks

Contributors