{"id":16930635,"url":"https://github.com/l1ghtn1ng/wake","last_synced_at":"2026-02-28T20:02:45.418Z","repository":{"id":16168366,"uuid":"44562154","full_name":"L1ghtn1ng/wake","owner":"L1ghtn1ng","description":"A Flask web app to turn on your computer using wake on lan","archived":false,"fork":false,"pushed_at":"2026-02-21T14:43:19.000Z","size":1337,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-02-21T20:57:42.138Z","etag":null,"topics":["flask","python3","wake-on-lan","wol"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/L1ghtn1ng.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2015-10-19T20:30:26.000Z","updated_at":"2026-02-21T14:43:21.000Z","dependencies_parsed_at":"2023-10-17T06:02:17.913Z","dependency_job_id":"ae949ce2-3e46-40ab-a3ad-3f5cd23eeb75","html_url":"https://github.com/L1ghtn1ng/wake","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/L1ghtn1ng/wake","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/L1ghtn1ng%2Fwake","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/L1ghtn1ng%2Fwake/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/L1ghtn1ng%2Fwake/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/L1ghtn1ng%2Fwake/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/L1ghtn1ng","download_url":"https://codeload.github.com/L1ghtn1ng/wake/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/L1ghtn1ng%2Fwake/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29951075,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-28T18:42:55.706Z","status":"ssl_error","status_checked_at":"2026-02-28T18:42:48.811Z","response_time":90,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flask","python3","wake-on-lan","wol"],"created_at":"2024-10-13T20:42:07.717Z","updated_at":"2026-02-28T20:02:45.404Z","avatar_url":"https://github.com/L1ghtn1ng.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# wake\n\nWake is a Flasgo-based web app for sending Wake-on-LAN packets and checking whether configured machines are reachable.\n\n## Requirements\n\n- Python 3.14+\n- [uv](https://docs.astral.sh/uv/)\n\nRuntime dependencies are defined in [pyproject.toml](/home/jay/code/wake/pyproject.toml):\n\n- `flasgo==0.3.0`\n- `wakeonlan==3.1.0`\n- `PyYAML==6.0.2`\n\n## Installation\n\nClone the repository:\n\n```bash\ngit clone https://github.com/L1ghtn1ng/wake.git\ncd wake\n```\n\nInstall runtime dependencies:\n\n```bash\nuv sync\n```\n\nInstall development dependencies, including `pytest`, `ruff`, and `mypy`:\n\n```bash\nuv sync --extra dev\n```\n\n## Configuration\n\nDefine your machines in `computers.yaml`:\n\n```yaml\ndemo1:\n  mac: 30:5a:3a:56:57:58\n  ip: 10.0.0.2\ndemo2:\n  mac: e0:d4:e8:98:42:11\n  ip: 10.0.0.254\n```\n\nThe app looks for configuration in:\n\n- `computers.yaml`\n- `/var/www/html/wake/computers.yaml`\n\nProduction-facing security settings are driven by environment variables:\n\n- `WAKE_ALLOWED_HOSTS`\n  Comma-separated allowed hostnames for Flasgo's host-header enforcement.\n  Example: `WAKE_ALLOWED_HOSTS=wake.example.com,.example.com`\n- `WAKE_CSRF_TRUSTED_ORIGINS`\n  Comma-separated trusted origins if you need controlled cross-origin form submissions through a reverse proxy.\n  Example: `WAKE_CSRF_TRUSTED_ORIGINS=https://wake.example.com`\n\nIf `WAKE_ALLOWED_HOSTS` is not set, the app falls back to `127.0.0.1` and `localhost`.\n\n## Running\n\nStart the built-in Flasgo development server:\n\n```bash\nuv run python wake.py\n```\n\nBy default the app listens on `0.0.0.0:8080`.\n\nThe wake action uses Flasgo's CSRF protection. The page JavaScript reads the CSRF cookie set on `GET /` and sends it back in the `X-CSRF-Token` header on `POST /`.\n\nRoutes provided by the app:\n\n- `/` renders the UI\n- `POST /` sends a Wake-on-LAN packet for the selected machine\n- `/status` returns JSON machine status data with ETag support and `Cache-Control: max-age=30`\n- `/static/\u003cpath\u003e` is served by Flasgo's built-in static file support\n\n## Deployment\n\nThis project is ASGI-based. The old Apache `mod_wsgi` flow does not apply.\n\nFor direct execution, run `wake.py`.\n\nFor an ASGI server or reverse-proxy setup, use [wake.asgi](/home/jay/code/wake/wake.asgi):\n\n```python\nfrom wake import app\n\napplication = app\n```\n\nThe application uses Flasgo's built-in static file support for `static/`, so an external static-file mapping is optional rather than required.\n\n### Running with Uvicorn behind a reverse proxy\n\nIf you want to run the app with Uvicorn and keep Caddy or Nginx in front of it:\n\n1. Start Uvicorn on localhost only:\n\n```bash\nuv run --with uvicorn uvicorn wake:app \\\n  --host 127.0.0.1 \\\n  --port 8080 \\\n  --proxy-headers \\\n  --forwarded-allow-ips=\"127.0.0.1\"\n```\n\n2. Keep your reverse proxy pointing to `127.0.0.1:8080`.\n\n`--proxy-headers` tells Uvicorn to trust `X-Forwarded-*` headers from the proxy, and `--forwarded-allow-ips` should include only trusted proxy IPs (for example, `127.0.0.1` when proxy and app run on the same host).\n\n### Run on startup with systemd\n\nTo start `wake` automatically when Linux boots, create a `systemd` service.\n\n1. Create `/etc/systemd/system/wake.service` (adjust `User`, `Group`, and paths for your host):\n\n```ini\n[Unit]\nDescription=Wake web app (Uvicorn)\nAfter=network-online.target\nWants=network-online.target\n\n[Service]\nType=simple\nUser=wake\nGroup=wake\nWorkingDirectory=/home/wake/code/wake\nEnvironment=PATH=/home/wake/.local/bin:/usr/local/bin:/usr/bin:/bin\nExecStart=/usr/bin/env uv run --with uvicorn uvicorn wake:app --host 127.0.0.1 --port 8080 --proxy-headers --forwarded-allow-ips=127.0.0.1\nRestart=always\nRestartSec=3\n\n[Install]\nWantedBy=multi-user.target\n```\n\n2. Reload `systemd`, enable the service at boot, and start it now:\n\n```bash\nsudo systemctl daemon-reload\nsudo systemctl enable --now wake.service\n```\n\n3. Check service status and logs:\n\n```bash\nsystemctl status wake.service\njournalctl -u wake.service -f\n```\n\nIf `uv` is installed in a non-standard location, replace `/usr/bin/env uv` in `ExecStart` with the full path from `which uv`.\n\n### Caddy reverse proxy\n\n1. Make sure the app is running on the backend host/port (default `127.0.0.1:8080`).\n2. Add a site block to your `Caddyfile`:\n\n```caddyfile\nwake.example.com {\n    encode zstd gzip\n    reverse_proxy 127.0.0.1:8080\n}\n```\n\n3. Reload Caddy:\n\n```bash\nsudo systemctl reload caddy\n```\n\nCaddy will automatically provision and renew TLS certificates when the hostname is publicly reachable.\n\n### Nginx reverse proxy\n\n1. Make sure the app is running on the backend host/port (default `127.0.0.1:8080`).\n2. Create an Nginx server block (for example `/etc/nginx/sites-available/wake`):\n\n```nginx\nserver {\n    listen 80;\n    server_name wake.example.com;\n\n    location / {\n        proxy_pass http://127.0.0.1:8080;\n        proxy_http_version 1.1;\n        proxy_set_header Host $host;\n        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n        proxy_set_header X-Forwarded-Proto $scheme;\n    }\n}\n```\n\n3. Enable the site and reload Nginx:\n\n```bash\nsudo ln -s /etc/nginx/sites-available/wake /etc/nginx/sites-enabled/wake\nsudo nginx -t\nsudo systemctl reload nginx\n```\n\nFor HTTPS with Nginx, use your preferred certificate flow (for example `certbot`) and add `listen 443 ssl` plus certificate directives.\n\n## Security And Frontend Assets\n\nThe app keeps Flasgo's production-oriented security defaults enabled, including:\n\n- allowed-host enforcement\n- CSRF protection\n- secure session and CSRF cookie defaults\n- `no-store` caching on non-public responses\n- default hardening headers such as `X-Frame-Options` and `Strict-Transport-Security`\n\nThe app customizes the Content Security Policy to allow the current frontend libraries used by [templates/index.html](/home/jay/code/wake/templates/index.html):\n\n- Font Awesome `7.0.1` from `cdnjs.cloudflare.com`\n- Bootstrap `5.3.8` CSS and JS from `cdn.jsdelivr.net`\n\nExternal assets use Subresource Integrity attributes, and the runtime test suite checks that the rendered page still matches the expected CSP and CDN allowlist.\n\nThe `POST /` handler uses Flasgo's built-in form parsing, and static files are served through Flasgo's built-in static directory support.\n\n## Verification\n\nRun the runtime tests:\n\n```bash\n.venv/bin/pytest tests/test_runtime_headers.py -q\n```\n\nThose tests verify:\n\n- homepage responses include exactly one CSP header\n- the CSP allows the expected CDN hosts\n- Flasgo's hardened default headers are present on the homepage\n- external CSS and JS assets include `integrity`\n- `/status` returns an ETag and honors conditional requests\n- `POST /` parses form data, requires the CSRF header flow, and redirects after sending a wake packet\n\n## Notes\n\n- In restricted environments, sending the Wake-on-LAN packet can fail with a socket permission error. In that case the app returns `503 Failed to send wake packet`.\n- Because Flasgo's production cookie defaults are secure, run the app behind HTTPS in production.\n- Machine reachability checks are cached for 30 seconds.\n- Configuration data is cached for 10 minutes.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fl1ghtn1ng%2Fwake","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fl1ghtn1ng%2Fwake","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fl1ghtn1ng%2Fwake/lists"}