A Safari Web Extension that prevents doomscrolling on social media sites and tracks news reading time with intelligent blocking mechanisms.
- Scroll Detection: Monitors scrolling behavior on social media sites (Facebook, Twitter/X, Instagram, Reddit, TikTok, etc.)
- 4000px Threshold: Triggers warning and blocking after excessive scrolling
- 60-Minute Blocks: Individual site blocking with countdown timer
- Choice Dialog: Choose between full functionality, timer-only, or immediate block
- Time Tracking: Monitors time spent across all news sites (CNN, BBC, Spiegel, NZZ, etc.)
- 20-Minute Daily Limit: Cumulative tracking across all news sources
- 1-Hour Block: Blocks all news sites when daily limit exceeded
- International Support: Includes German, Swiss, and Austrian news outlets
- Persistent Timer: Draggable timer showing accumulated daily time
- Cross-Platform: Works on both social media and news sites
- Daily Reset: Automatically resets at midnight
- Click to Hide: Hide timer until next page reload
- Glassmorphism Design: Beautiful blur effects and transparency
- Choice Dialog: Clean 3-option interface on site visits
- Blocking Screen: Personalized suggestions and countdown timer
- Dark Mode Support: Optimized for both light and dark themes
ScrollStop provides intelligent protection against both doomscrolling and excessive news consumption:
- Social Media Sites: Detects excessive scrolling (4000px) and blocks individual sites for 60 minutes
- News Sites: Tracks reading time across all news sources with a 20-minute daily limit
- Choice System: Users choose how to engage with each site on every visit
- Timer Tracking: Continuous time tracking with daily reset functionality
- macOS 11.0+ or iOS 14.0+
- Safari 14.0+
- Xcode 13.0+ (for building)
-
Clone the repository:
git clone https://github.com/oliverstaub/ScrollStop.git cd ScrollStop -
Install dependencies:
npm install
-
Run tests and validation:
npm test -
Open in Xcode:
open ScrollStop.xcodeproj
-
Build and run:
- Select "ScrollStop (macOS)" or "ScrollStop (iOS)" scheme
- Build and run the project
- Enable the extension in Safari preferences
Always run tests after making changes:
# Run all tests (unit + integration)
npm test
# Run only unit tests
npm run test:unit
# Run only integration tests
npm run test:integration
# Run tests in watch mode during development
npm run test:watch
# Generate coverage report
npm run test:coverage# Lint JavaScript code
npm run lint
# Auto-fix linting issues
npm run lint:fix
# Check code formatting
npm run format:check
# Auto-format code
npm run format
# Validate all files (lint + format + tests)
npm run validate# Validate manifest.json structure
npm run validate:manifest
# Validate sites.json configuration
npm run validate:sites
# Check manifest file paths (critical for build)
npm run build:checkIMPORTANT: Always run this before committing:
npm run precommitThis runs the complete validation and formatting suite:
- π¨ Prettier code formatting (auto-fixes formatting issues)
- β ESLint code quality checks
- β Prettier format validation
- β Unit and integration tests
- β Manifest and sites validation
- β File path verification
Note: Prettier will automatically fix formatting issues before validation, ensuring consistent code style across the entire codebase.
- Make your changes to the extension code
- Run tests:
npm test - Validate code:
npm run validate - Test in Safari: Build and test the extension
- Commit changes: Tests run automatically via GitHub Actions
- Create PR: Full CI/CD pipeline validates your changes
Our test suite covers:
- Unit Tests: Core modules (TimeManager, StorageHelper, TimerTracker)
- Integration Tests: Full extension flow and site detection
- Validation Tests: Manifest structure and sites configuration
- Security Tests: Code scanning and dependency checks
Target coverage: >80% for all critical paths.
- File Paths: The build process flattens all files. Only use flat filenames in
manifest.json - Testing: Run
npm testafter every change - this is enforced by CI/CD - Validation: Scripts automatically check manifest and sites configuration
- Memory: Tests include memory leak detection for timer components
ScrollStop/
βββ Shared (App)/ # iOS/macOS host app resources
βββ Shared (Extension)/ # Safari extension code
β βββ Resources/
β βββ manifest.json # Extension manifest
β βββ sites.json # Blocked/news sites config
β βββ content.js # Main coordinator
β βββ background.js # Background script
β βββ modules/ # Core modules
βββ iOS (App|Extension)/ # iOS-specific code
βββ macOS (App|Extension)/ # macOS-specific code
βββ tests/ # Test suite
β βββ unit/ # Unit tests
β βββ integration/ # Integration tests
β βββ mocks/ # Test mocks
βββ scripts/ # Validation scripts
content.js: Main coordinator orchestrating all modulestime-manager.js: Handles time blocks and news time trackingstorage-helper.js: Cross-browser storage abstractiontimer-tracker.js: Persistent timer with drag functionalitychoice-dialog.js: User choice interfaceblocking-screen.js: Full-page blocking with countdown
Our comprehensive GitHub Actions pipeline ensures code quality and reliability across all platforms.
The CI/CD system consists of 6 parallel jobs that run on every push and pull request:
Purpose: Code quality validation and testing
Runtime: ~2-3 minutes (with caching)
- ESLint code quality checks
- Prettier formatting validation
- Manifest.json structure validation
- Sites.json configuration validation
- File path verification (critical for Xcode builds)
- Unit tests (TimeManager, StorageHelper, TimerTracker)
- Integration tests (full extension workflow)
- Test coverage generation and Codecov uploadPurpose: macOS Safari extension build verification
Runtime: ~3-4 minutes
- Xcode latest-stable setup
- ScrollStop (macOS) scheme build
- Release configuration compilation
- Artifact archival (7-day retention)Purpose: iOS Safari extension build verification
Runtime: ~3-4 minutes
- Xcode latest-stable setup
- ScrollStop (iOS) scheme build
- iOS generic platform targeting
- Release configuration compilation
- Artifact archival (7-day retention)Purpose: Security vulnerability detection
Runtime: ~1-2 minutes
- Semgrep security analysis (JavaScript, secrets, security-audit)
- SARIF report generation and upload
- TruffleHog secret detection with verification
- CodeQL integration for GitHub Security tabPurpose: Dependency security and licensing
Runtime: ~1-2 minutes
- npm audit for known vulnerabilities
- Dependency review for license compliance
- Package version conflict detectionPurpose: Performance monitoring (placeholder)
Runtime: ~30 seconds
- Performance test framework (to be implemented)
- Memory leak detection (to be implemented)
- Extension load time monitoring (planned)npm Dependencies: Dual-layer caching for optimal speed
setup-node@v4built-in npm cacheactions/cache@v4for node_modules- Cache key:
runner.os-node-hashFiles('package-lock.json') - Performance: 5 minutes β 30 seconds on cache hits
Development Process:
- Create feature branch:
git checkout -b feature/feature-name - Make changes and run
npm run precommit - Push branch:
git push origin feature/feature-name - Create Pull Request β Triggers full CI/CD validation
- Review results, fix any failures
- Merge after all checks pass
Benefits:
- β Catches issues before main branch
- β Ensures all tests pass before merge
- β Validates cross-platform builds
- β Security scanning on every change
- β Code quality enforcement
- Push to main/develop: Full pipeline execution
- Pull Request to main: Full pipeline + dependency review
- Manual dispatch: Available for all workflows
Monitor pipeline status via:
- GitHub Actions tab
- README badges (CI/CD Pipeline, SonarCloud Quality Gate)
- Email notifications on failures
- Codecov reports for test coverage trends
To enable SonarCloud code quality analysis:
- Create SonarCloud Account: Go to sonarcloud.io and sign in with GitHub
- Import Repository: Add your GitHub repository to SonarCloud
- Configure Project:
- Project Key:
oliverstaub_ScrollStop - Organization:
oliverstaub
- Project Key:
- Generate Token:
- Go to My Account β Security β Generate Token
- Copy the token value
- Add GitHub Secret:
- Repository Settings β Secrets and Variables β Actions
- Add secret:
SONAR_TOKENwith your token value
- Quality Gate: The workflow uses
continue-on-error: trueso missing token won't fail builds
To enable test coverage reporting:
- Create Codecov Account: Go to codecov.io and sign in with GitHub
- Add Repository: Import your GitHub repository to Codecov
- Get Token (optional for public repos):
- Copy the repository upload token from Codecov dashboard
- Add as GitHub secret:
CODECOV_TOKEN
- Coverage Reports: The workflow automatically uploads
coverage/lcov.infoafter tests
- macOS/iOS builds: Run only on pull requests (10x cost savings)
- Regular pushes: Run Ubuntu-based jobs only (lint, test, security)
- Pull requests: Full validation including cross-platform builds
- Estimated savings: ~80% reduction in GitHub Actions minutes
This project is proprietary software. All rights reserved.
Commercial License: This software is intended for commercial distribution via the Apple App Store. Unauthorized copying, distribution, or modification is prohibited without explicit written permission from the author.
Year: 2024
This project was developed from scratch specifically for Safari, with custom implementations for cross-platform compatibility and news tracking functionality.