A configurable Electron application that renders web content with advanced domain restrictions. This app allows you to wrap any website in a desktop application with granular control over navigation and security.
- π Render any website in a desktop application
- π Advanced domain restriction with allowlists and blocklists
- π― Subdomain control for fine-grained access management
- βοΈ Highly configurable through a JSON configuration file
- π‘οΈ Security-focused with Electron best practices
- π¨ Optional custom CSS injection
- π§ TypeScript for better code quality and developer experience
- Node.js (v16 or later)
- npm or yarn
-
Clone and install dependencies:
git clone https://github.com/pilot2254/electron-web-renderer cd electron-web-renderer npm install -
Build the application:
npm run build
-
Start the application:
npm start
The app will create a default configuration file on first run and load your GitHub profile.
The configuration file is automatically created at:
- Windows:
%APPDATA%\electron-web-renderer\config.json - macOS:
~/Library/Application Support/electron-web-renderer/config.json - Linux:
~/.config/electron-web-renderer/config.json
{
"app": {
"title": "GitHub Profile Viewer",
"iconPath": "path/to/icon.png",
"openDevTools": false
},
"window": {
"width": 1200,
"height": 800,
"minWidth": 800,
"minHeight": 600,
"maximized": false,
"fullscreen": false
},
"target": {
"url": "https://github.com/pilot2254",
"openLinksExternally": true,
"restrictToDomain": true,
"domainConfig": {
"allowedDomains": ["github.com", "githubusercontent.com"],
"blockedDomains": [],
"allowSubdomains": true
},
"injectCSS": false,
"cssPath": "path/to/custom.css"
}
}allowedDomains: Array of domains that are permitted within the appblockedDomains: Array of domains that should always open externally (takes precedence over allowedDomains)allowSubdomains: Whether to allow subdomains of allowed domains
{
"target": {
"restrictToDomain": true,
"domainConfig": {
"allowedDomains": ["github.com"],
"blockedDomains": [],
"allowSubdomains": true
}
}
}Result: Only GitHub and its subdomains (api.github.com, docs.github.com, etc.) are allowed.
{
"target": {
"restrictToDomain": true,
"domainConfig": {
"allowedDomains": [
"github.com",
"stackoverflow.com",
"developer.mozilla.org",
"nodejs.org",
"npmjs.com"
],
"blockedDomains": ["facebook.com", "twitter.com"],
"allowSubdomains": true
}
}
}Result: Multiple development-related sites are allowed, but social media is blocked.
{
"target": {
"restrictToDomain": true,
"domainConfig": {
"allowedDomains": ["github.com"],
"blockedDomains": [
"facebook.com",
"twitter.com",
"instagram.com",
"youtube.com",
"reddit.com",
"tiktok.com"
],
"allowSubdomains": false
}
}
}Result: Only exact GitHub domain allowed, all social media blocked, and no subdomains.
{
"target": {
"restrictToDomain": false,
"domainConfig": {
"allowedDomains": [],
"blockedDomains": [],
"allowSubdomains": true
}
}
}Result: No restrictions, users can navigate anywhere.
- Blocked Domains First: If a domain is in
blockedDomains, it's always blocked (takes precedence) - Allowed Domains: If
allowedDomainsis not empty, only those domains are permitted - Empty Allowed List: If
allowedDomainsis empty, only the original domain fromurlis allowed - Subdomain Handling: If
allowSubdomainsis true, subdomains of allowed domains are also permitted
With "allowSubdomains": true and "allowedDomains": ["github.com"]:
- β
github.com- Allowed - β
api.github.com- Allowed (subdomain) - β
docs.github.com- Allowed (subdomain) - β
gitlab.com- Blocked (different domain)
With "allowSubdomains": false:
- β
github.com- Allowed - β
api.github.com- Blocked (subdomain not allowed) - β
docs.github.com- Blocked (subdomain not allowed)
npm run dev: Build and start with development loggingnpm run build: Build TypeScript to JavaScriptnpm run build:watch: Watch for changes and rebuildnpm run dev:watch: Development mode with auto-restartnpm run lint: Run ESLintnpm run lint:fix: Fix linting issues automatically
- Enable Developer Tools: Set
"openDevTools": truein config for debugging - Watch Mode: Use
npm run dev:watchfor development with auto-reload - Domain Testing: Check console output for detailed domain checking logs
- Configuration Testing: The app logs all navigation attempts and decisions
npm run pack # Creates unpacked app in dist/
npm run dist # Creates installer/packagenpm run dist:all # Creates packages for Windows, macOS, and Linux- Check console output for domain checking logs
- Verify domain names in config don't include protocols (use
github.com, nothttps://github.com) - Check if
allowSubdomainssetting matches your needs - Ensure
blockedDomainsdoesn't conflict withallowedDomains
- Validate JSON syntax in config file
- Check console output for configuration loading errors
- Delete config file to regenerate defaults
- Use examples from
examples/config-examples.json
- Disable
openDevToolsin production - Consider enabling
injectCSSto hide unnecessary page elements - Use specific domains instead of allowing all subdomains if possible
- The app follows Electron security best practices
- Context isolation and sandboxing are enabled
- Node.js integration is disabled in the renderer
- Domain restrictions help prevent malicious navigation
- Blocked domains take precedence over allowed domains for security
- GitHub Profile Viewer: Browse GitHub while blocking distracting sites
- Company Development Environment: Allow work-related sites only
- Educational Tool: Restrict students to educational domains
- Focused Browsing: Block social media while allowing work sites
- Kiosk Mode: Restrict navigation to specific company domains
MIT License - feel free to modify and distribute.