The GitHub Container Auto Switcher is a Firefox add-on designed to ease the use of Firefox Containers with GitHub for privacy-conscious users. It is intended for those GitHub users who prefer to browse public repositories while being logged out to prevent GitHub from tracking their visits.
When accessing a private repository while logged out, GitHub returns a 404 Not Found error. The above said users then have to switch the current tab to a designated GitHub container manually or using an add-on such as Switch Container. This add-on automates this switching if it detects that the private repository is accessible to the logged-in user in the designated GitHub container.
Step 1: Enable Firefox Containers and create a designated container for GitHub at Firefox Settings -> General
Step 2: Logout of GitHub
Step 3: Create a new tab in the designated container and login to GitHub in this container tab
Step 4: Find the add-on in the add-ons list and click on it. Select your designated Firefox container for GitHub.
Step 5: Create a GitHub Personal Access Token with "repo" scope. Ref: GitHub's official documentation.
Step 6: Paste the obtained token (the one that is prefixed with ghp_
) in the addon and click "SAVE".
Step 7: Test the add-on by attempting to browse to a private repository in a non-containerized tab. The add-on should detect the repository being private and should switch the current tab to the designated GitHub container.
-
Automatic Container Switching: This add-on activates exclusively on GitHub pages (
github.com/*
). If you encounter a 404 error on a GitHub page, it parses the repository by extracting the owner/repo name from the URL, even if you're on a subpage like issues or pull requests. -
Private Repository Detection: Using GitHub API, the add-on fetches the repository's metadata and checks if the repository is private. If so, it automatically switches your tab to the designated GitHub container.
-
Privacy Preserving: Apart from the request to the GitHub API, no data leaves your device. The designated GitHub container ID and Personal Access Token are stored locally in the addon's local storage.
- Version 0.0.1 -- Added private repository detection and automatic switching to designated GitHub container
This add-on was built based on the following sources:
-
Forked off the Switch Container Add-on
-
Contextual identities handling:
https://github.com/mdn/webextensions-examples/blob/master/contextual-identities/context.js
-
Pop-up html/css:
https://github.com/mdn/webextensions-examples/blob/master/contextual-identities/context.html
(html)https://github.com/mdn/webextensions-examples/blob/master/contextual-identities/context.css
(css) -
Icon:
omni.ja\chrome\browser\content\browser\
Disclaimer: This add-on is open source and is not endorsed by Mozilla, MDN, or GitHub, and has no commercial objectives.
This project is licensed under the terms of the Mozilla Public License Version 2.0.