Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ body:
id: version
attributes:
label: FocusTube version
placeholder: 2.3.1
placeholder: 2.3.2
validations:
required: true

Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ All notable project-facing changes are documented here.

No unreleased changes yet.

## [2.3.2] - 2026-09-01

- Disabled Firefox private-window access so FocusTube does not persist data from private browsing sessions.
- Tightened platform hostname checks to reject lookalike domains.

## [2.3.1] - 2026-09-01

- Hardened timer recovery across Chromium service-worker and Firefox background restarts. Future alarms are restored, stale alarms cannot affect replacement timers, failed writes roll back safely, and completion side effects are deduplicated.
Expand Down
77 changes: 77 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our community include:

- Demonstrating empathy and kindness toward other people.
- Being respectful of differing opinions, viewpoints, and experiences.
- Giving and gracefully accepting constructive feedback.
- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience.
- Focusing on what is best not just for us as individuals, but for the overall community.

Examples of unacceptable behavior include:

- The use of sexualized language or imagery, and sexual attention or advances of any kind.
- Trolling, insulting or derogatory comments, and personal or political attacks.
- Public or private harassment.
- Publishing others' private information, such as a physical or email address, without their explicit permission.
- Other conduct which could reasonably be considered inappropriate in a professional setting.

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.

Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned with this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official email address, posting via an official social media account, or acting as an appointed representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported privately through [GitHub private reporting](https://github.com/malekwael229/FocusTube/security/advisories/new). Begin the report title with `Code of Conduct` so it can be handled appropriately. All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact:** Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.

**Consequence:** A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact:** A violation through a single incident or series of actions.

**Consequence:** A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing this Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels such as social media. Violating these terms may lead to a temporary or permanent ban.

### 3. Temporary Ban

**Community Impact:** A serious violation of community standards, including sustained inappropriate behavior.

**Consequence:** A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing this Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact:** Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.

**Consequence:** A permanent ban from any sort of public interaction within the community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.1, available at [contributor-covenant.org/version/2/1/code_of_conduct.html](https://www.contributor-covenant.org/version/2/1/code_of_conduct.html).

Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).

For answers to common questions about this Code of Conduct, see the [Contributor Covenant FAQ](https://www.contributor-covenant.org/faq). Translations are available from the [Contributor Covenant translations page](https://www.contributor-covenant.org/translations).
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

Thanks for helping maintain FocusTube. This project is a live browser extension, so changes should be small, testable, and privacy-preserving.

By participating, you agree to follow the [Code of Conduct](CODE_OF_CONDUCT.md).

## Local Setup

1. Clone the repository:
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@

<p>
<a href="https://github.com/malekwael229/FocusTube/actions/workflows/ci.yml"><img alt="CI status" src="https://github.com/malekwael229/FocusTube/actions/workflows/ci.yml/badge.svg?branch=main" /></a>
<a href="https://www.bestpractices.dev/projects/14395"><img alt="OpenSSF Best Practices Baseline Level 1" src="https://www.bestpractices.dev/projects/14395/baseline" /></a>
<img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-blue.svg" />
<img alt="Version: 2.3.1" src="https://img.shields.io/badge/version-2.3.1-green.svg" />
<img alt="Version: 2.3.2" src="https://img.shields.io/badge/version-2.3.2-green.svg" />
<img alt="Firefox compatible" src="https://img.shields.io/badge/firefox-compatible-orange.svg" />
</p>
</div>
Expand Down Expand Up @@ -142,7 +143,7 @@ FocusTube is designed to run locally in the browser.

## Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md) for contribution guidance. [TESTING.md](TESTING.md) covers automated commands and the browser matrix; [ARCHITECTURE.md](ARCHITECTURE.md) describes the runtime boundaries.
See [CONTRIBUTING.md](CONTRIBUTING.md) for contribution guidance and [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) for community standards. [TESTING.md](TESTING.md) covers automated commands and the browser matrix; [ARCHITECTURE.md](ARCHITECTURE.md) describes the runtime boundaries.

## Security

Expand Down
2 changes: 1 addition & 1 deletion chrome-manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 3,
"name": "FocusTube: Distraction Blocker",
"version": "2.3.1",
"version": "2.3.2",
"description": "Reduce distractions from YouTube Shorts, Instagram Reels, TikTok, Facebook Reels, and LinkedIn.",
"content_security_policy": {
"extension_pages": "script-src 'self'; object-src 'self';"
Expand Down
12 changes: 7 additions & 5 deletions content-common.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
const Site = {
isYT: () => location.hostname.includes("youtube.com"),
isIG: () => location.hostname.includes("instagram.com"),
isTT: () => location.hostname.includes("tiktok.com"),
isFB: () => location.hostname.includes("facebook.com"),
isLI: () => location.hostname.includes("linkedin.com"),
matchesHostname: (hostname, domain) =>
hostname === domain || hostname.endsWith(`.${domain}`),
isYT: () => Site.matchesHostname(location.hostname, "youtube.com"),
isIG: () => Site.matchesHostname(location.hostname, "instagram.com"),
isTT: () => Site.matchesHostname(location.hostname, "tiktok.com"),
isFB: () => Site.matchesHostname(location.hostname, "facebook.com"),
isLI: () => Site.matchesHostname(location.hostname, "linkedin.com"),
};
const CONFIG = {
extensionEnabled: true,
Expand Down
3 changes: 2 additions & 1 deletion firefox-manifest.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"manifest_version": 2,
"name": "FocusTube: Distraction Blocker",
"version": "2.3.1",
"version": "2.3.2",
"description": "Reduce distractions from YouTube Shorts, Instagram Reels, TikTok, Facebook Reels, and LinkedIn.",
"incognito": "not_allowed",
"content_security_policy": "script-src 'self'; object-src 'self';",
"permissions": [
"storage",
Expand Down
2 changes: 1 addition & 1 deletion options.html
Original file line number Diff line number Diff line change
Expand Up @@ -1559,7 +1559,7 @@ <h2 class="section-title">Data & Privacy</h2>

<section class="card about-section">
<h2 class="about-title">FocusTube</h2>
<p class="about-version">Version 2.3.1</p>
<p class="about-version">Version 2.3.2</p>
<div class="about-btns">
<button class="action-btn" id="starRepo">
<svg
Expand Down
10 changes: 5 additions & 5 deletions tests/live-browser.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ function candidate() {
const hashes = Object.fromEntries(files.map((file) => [file, digest(path.join(root, file))]));
const buildRoot = path.join(root, "dist-release-builds");
for (const browser of ["chromium", "firefox"]) {
const directory = path.join(buildRoot, "FocusTube-release-" + browser + "-v2.3.1");
const directory = path.join(buildRoot, "FocusTube-release-" + browser + "-v2.3.2");
const sourceManifest = browser === "chromium" ? "chrome-manifest.json" : "firefox-manifest.json";
if (JSON.stringify(JSON.parse(fs.readFileSync(path.join(root, sourceManifest)))) !== JSON.stringify(JSON.parse(fs.readFileSync(path.join(directory, "manifest.json"))))) throw new Error("Retained manifest differs from source");
for (const file of runtimeFiles) if (digest(path.join(directory, file)) !== hashes[file]) throw new Error("Retained candidate differs from source: " + file);
hashes["dist-release-builds/FocusTube-release-" + browser + "-v2.3.1.zip"] = digest(path.join(buildRoot, "FocusTube-release-" + browser + "-v2.3.1.zip"));
hashes["dist-release-builds/FocusTube-release-" + browser + "-v2.3.2.zip"] = digest(path.join(buildRoot, "FocusTube-release-" + browser + "-v2.3.2.zip"));
}
return hashes;
}
Expand Down Expand Up @@ -83,7 +83,7 @@ async function main() {
try {
for (const id of chosen) {
const browser = available[id];
const buildDir = path.join(root, "dist-release-builds", "FocusTube-release-" + (id === "firefox" ? "firefox" : "chromium") + "-v2.3.1");
const buildDir = path.join(root, "dist-release-builds", "FocusTube-release-" + (id === "firefox" ? "firefox" : "chromium") + "-v2.3.2");
const profileDir = path.join(local, "profiles", id);
if (fs.existsSync(profileDir) && fs.lstatSync(profileDir).isSymbolicLink()) throw new Error("Profile must not be a symlink/junction");
report.data.browsers.push({ name: browser.name, executablePath: browser.executablePath || null, profile: path.relative(root, profileDir) });
Expand Down Expand Up @@ -112,10 +112,10 @@ async function main() {
continue;
}
const page = await session.newPage();
await report.case({ id: "extension-load", site: "extension", scope: "extension-ui", route: "popup.html", expected: "The exact 2.3.1 manifest is loaded" }, page, async () => {
await report.case({ id: "extension-load", site: "extension", scope: "extension-ui", route: "popup.html", expected: "The exact 2.3.2 manifest is loaded" }, page, async () => {
await page.goto(session.extensionURL + "popup.html");
const manifest = await page.evaluate(() => chrome.runtime.getManifest());
if (manifest.version !== "2.3.1") throw new Error("Wrong version loaded");
if (manifest.version !== "2.3.2") throw new Error("Wrong version loaded");
const loadedHashes = await page.evaluate(async (files) => {
const entries = [];
for (const file of files) {
Expand Down
6 changes: 3 additions & 3 deletions tests/live/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Live Browser Validation

This optional harness tests the retained 2.3.1 release candidate, not a rebuilt or patched extension. It never publishes anything. Use the existing deterministic suite first; live-site results complement it, not replace it.
This optional harness tests the retained 2.3.2 release candidate, not a rebuilt or patched extension. It never publishes anything. Use the existing deterministic suite first; live-site results complement it, not replace it.

## Setup on Windows

Expand All @@ -15,7 +15,7 @@ npm.cmd run test:live:harness

The Firefox setup downloads pinned geckodriver 0.37.1 from Mozilla's official GitHub release and checks its SHA-256. No Selenium dependency is needed. The harness uses Playwright for Chromium browsers and the WebDriver protocol for Firefox.

The extracted release folders and ZIPs must already exist under `dist-release-builds`, with names `FocusTube-release-chromium-v2.3.1` and `FocusTube-release-firefox-v2.3.1`. Runtime files must match the working candidate exactly. The harness refuses stale packages and checks that candidate bytes remain unchanged afterwards.
The extracted release folders and ZIPs must already exist under `dist-release-builds`, with names `FocusTube-release-chromium-v2.3.2` and `FocusTube-release-firefox-v2.3.2`. Runtime files must match the working candidate exactly. The harness refuses stale packages and checks that candidate bytes remain unchanged afterwards.

## One-Time Browser and Login Steps

Expand All @@ -26,7 +26,7 @@ npm.cmd run test:live -- --setup chrome
npm.cmd run test:live -- --setup edge
```

In the opened extension manager, enable Developer mode, choose **Load unpacked**, and select `dist-release-builds/FocusTube-release-chromium-v2.3.1`. Return to the terminal and press Enter. Do not choose your normal browser profile.
In the opened extension manager, enable Developer mode, choose **Load unpacked**, and select `dist-release-builds/FocusTube-release-chromium-v2.3.2`. Return to the terminal and press Enter. Do not choose your normal browser profile.

Sign in only where needed, using your own keyboard in these isolated profiles:

Expand Down
4 changes: 2 additions & 2 deletions tests/live/chromium-driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ async function launchChromium(options) {
chrome.developerPrivate.getExtensionsInfo({ includeDisabled: true }, resolve);
}));
} catch (error) { errors.push("Extension inventory unavailable: " + error.message); }
const installed = extensions.find((item) => item.name?.startsWith("FocusTube") && item.version === "2.3.1");
const installed = extensions.find((item) => item.name?.startsWith("FocusTube") && item.version === "2.3.2");
if (installed?.state === "ENABLED") extensionId = installed.id;
if (!extensionId && install) {
try { extensionId = (await cdp.send("Extensions.loadUnpacked", { path: buildDir })).id; }
Expand All @@ -115,7 +115,7 @@ async function launchChromium(options) {
if (!worker.url().startsWith("chrome-extension://")) continue;
try {
const manifest = await worker.evaluate(() => chrome.runtime.getManifest());
if (manifest.name.startsWith("FocusTube") && manifest.version === "2.3.1") {
if (manifest.name.startsWith("FocusTube") && manifest.version === "2.3.2") {
extensionId = new URL(worker.url()).host;
break;
}
Expand Down
59 changes: 44 additions & 15 deletions tests/live/firefox-driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

const fs = require('node:fs');
const fsp = fs.promises;
const net = require('node:net');
const path = require('node:path');
const { spawn } = require('node:child_process');

Expand All @@ -25,14 +24,41 @@ async function assertRealProfile(profileDir) {
return absolute;
}

async function freePort() {
function parseListeningPort(output) {
const match = /(?:^|\s)Listening on 127\.0\.0\.1:(\d+)(?:\s|$)/.exec(output);
const port = Number(match?.[1]);
return Number.isInteger(port) && port > 0 && port <= 65535 ? port : null;
}

function waitForDriverPort(processHandle, logFile) {
return new Promise((resolve, reject) => {
const server = net.createServer();
server.once('error', reject);
server.listen({ host: '127.0.0.1', port: 0 }, () => {
const address = server.address();
server.close(() => resolve(address.port));
});
let output = '';
let settled = false;
const timer = setTimeout(() => finish(new Error('Timed out waiting for geckodriver to bind')), START_TIMEOUT_MS);
const onData = (chunk) => {
const text = chunk.toString('utf8');
if (logFile) fs.appendFileSync(logFile, text);
if (settled) return;
output = (output + text).slice(-4096);
const port = parseListeningPort(output);
if (port) finish(null, port);
};
const onError = (error) => finish(error);
const onExit = (code) => finish(new Error(`geckodriver exited before binding (${code})`));
const finish = (error, port) => {
if (settled) return;
settled = true;
clearTimeout(timer);
processHandle.off('error', onError);
processHandle.off('exit', onExit);
if (error) reject(error);
else resolve(port);
};

processHandle.stdout.on('data', onData);
processHandle.stderr.on('data', onData);
processHandle.once('error', onError);
processHandle.once('exit', onExit);
});
}

Expand Down Expand Up @@ -214,12 +240,15 @@ async function launchFirefox({
}

async function start(load) {
driver = { port: await freePort(), process: null };
const args = ['--port', String(driver.port), '--allow-system-access'];
const logFd = logFile ? fs.openSync(logFile, 'a') : null;
const output = logFd === null ? 'ignore' : logFd;
driver.process = spawn(driverPath, args, { windowsHide: true, stdio: ['ignore', output, output] });
if (logFd !== null) fs.closeSync(logFd);
const args = ['--host', '127.0.0.1', '--port', '0', '--allow-system-access'];
driver = {
port: null,
process: spawn(driverPath, args, {
windowsHide: true,
stdio: ['ignore', 'pipe', 'pipe'],
}),
};
driver.port = await waitForDriverPort(driver.process, logFile);
await waitForDriver();
const prefs = {};
if (persistent) prefs['xpinstall.signatures.required'] = false;
Expand Down Expand Up @@ -382,4 +411,4 @@ async function launchFirefox({
};
}

module.exports = { launchFirefox };
module.exports = { launchFirefox, parseListeningPort };
2 changes: 1 addition & 1 deletion tests/live/report.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class Report {
for (const record of this.data.cases) counts[record.status]++;
this.data.counts = counts;
fs.writeFileSync(path.join(this.directory, "results.json"), JSON.stringify(this.data, null, 2) + "\n");
const text = ["# FocusTube 2.3.1 Browser Validation", "", "Started: " + this.data.startedAt,
const text = ["# FocusTube 2.3.2 Browser Validation", "", "Started: " + this.data.startedAt,
"", "PASS proves only the named scope. Fixtures, instrumented timers and live sites are not interchangeable.",
"Run limits: " + JSON.stringify({ quick: this.data.quick, sitesOnly: this.data.sitesOnly, extensionOnly: this.data.extensionOnly, selectedSites: this.data.selectedSites }),
"", "| Site | " + names.join(" | ") + " |", "| --- | " + names.map(() => "---").join(" | ") + " |",
Expand Down
Loading