diff --git a/.gitignore b/.gitignore index 9419646..72b0dc8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ *.o +*.elf +*.bin .DS_Store build/ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..fda4adb --- /dev/null +++ b/LICENSE @@ -0,0 +1,45 @@ +MIT License + +Copyright (c) 2026 mortyzip + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +---------------------------------------------------------------------------- + +The QR code encoder in src/index.html is based on the QR Code generator +library by Project Nayuki (https://www.nayuki.io/page/qr-code-generator-library), +used under the following terms: + +Copyright (c) Project Nayuki. (MIT License) + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: +- The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. +- The Software is provided "as is", without warranty of any kind, express or + implied, including but not limited to the warranties of merchantability, + fitness for a particular purpose and noninfringement. In no event shall the + authors or copyright holders be liable for any claim, damages or other + liability, whether in an action of contract, tort or otherwise, arising from, + out of or in connection with the Software or the use or other dealings in the + Software. diff --git a/Makefile b/Makefile index fbd3fef..290cb3e 100644 --- a/Makefile +++ b/Makefile @@ -61,6 +61,7 @@ $(PS4_BIN): src/ps4.c $(DEPS) # Runs the PS5 code on this computer with the console calls stubbed out, for # working on the control page: make host && ./build/keepawake_host +# Needs BSD network headers (struct if_data), so macOS or BSD only. host: build/keepawake_host build/keepawake_host: src/ps5.c tools/host_stubs.c $(DEPS) diff --git a/README.md b/README.md index df0d313..2525158 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Download the payloads from the [Releases](https://github.com/mortyzip/KeepAwake/ | PS5 | `keepawake_ps5_v.elf` | ELF loader, port 9021 | | PS4 | `keepawake_ps4_v.bin` | GoldHEN BinLoader, port 9090 | -- **Start:** send the payload. The control page opens in the console's browser, and the toast shows its address for other devices, for example "Keep Awake v enabled / Control it at http://192.168.1.50:9031". To stop the page opening on the console, switch off "Open on the PS5 at start" on the page. The setting is saved to `/data/keepawake.cfg`. +- **Start:** send the payload. The control page opens in the console's browser, and the toast shows its address for other devices, for example "Keep Awake v enabled / Control it at http://192.168.1.50:9031". To stop the page opening on the console, switch off "Open on the PS5/PS4 at start" on the page. The setting is saved to `/data/keepawake.cfg`. - **Turn off and on:** use the control page. Turning it off lets the console go into rest mode, but the payload keeps running, so you can turn it back on from the page without sending the payload again. - **Timer:** pick 30 min, 1 hour, 2 hours or 4 hours on the page, or set your own (up to 7 days). When the time is up, Keep Awake turns itself off and shows a toast. The payload keeps running, so you can turn it back on from the page. - **While transferring:** keeps the console awake only while the network is busy, such as a download, an FTP transfer or a PKG install, then lets it rest. Rest mode suspends payloads, so this stops homebrew transfers from being cut off. See [While transferring](#while-transferring). @@ -21,6 +21,8 @@ Download the payloads from the [Releases](https://github.com/mortyzip/KeepAwake/ Only one copy runs at a time. It uses TCP port 9031 to know whether it's already running. +There is no password. Anyone on your network can open the page and use the API. Browsers on other sites can't, since POSTs with a foreign `Origin` header are refused, but don't expose port 9031 outside your LAN. + ### Control page While it's running, open `http://:9031` in a browser. The page shows: @@ -78,7 +80,7 @@ The page is [src/index.html](src/index.html). The build embeds it into both payl make host && ./build/keepawake_host ``` -Then open http://localhost:9031. +Then open http://localhost:9031. This needs BSD network headers, so it builds on macOS or BSD, not Linux. ## Releasing @@ -94,8 +96,12 @@ The workflow builds the payloads and creates the GitHub Release with them attach - [src/ps5.c](src/ps5.c): built with the [ps5-payload-sdk](https://github.com/ps5-payload-dev/sdk). - [src/ps4.c](src/ps4.c): built against libPS4 from the [Scene-Collective ps4-payload-sdk](https://github.com/Scene-Collective/ps4-payload-sdk). libPS4 has no `select()`, so this version checks for connections ten times a second. - [src/web.h](src/web.h): the HTTP server for the control page, shared by both. -- [src/index.html](src/index.html): the control page, including a small QR code encoder (byte mode, error correction level M, up to 106 bytes). +- [src/index.html](src/index.html): the control page, including a small QR code encoder (byte mode, error correction level M, up to 106 bytes) based on [Project Nayuki's](https://www.nayuki.io/page/qr-code-generator-library). ## Support Keep Awake is free. If it's useful to you, you can [buy me a coffee](https://buymeacoffee.com/mortyzip). The control page has a link too, or a QR code when it's open on the console. + +## License + +[MIT](LICENSE). diff --git a/src/index.html b/src/index.html index 34525da..cfd88f9 100644 --- a/src/index.html +++ b/src/index.html @@ -173,9 +173,9 @@ button.link.confirm { color: var(--danger); font-weight: 600; } .settings { padding: 20px 20px 6px; } .setting { display: flex; align-items: center; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); cursor: pointer; } .settings h2 + .setting { border-top: 0; margin-top: 4px; } -.setting div { flex: 1; min-width: 0; } +.setting .text { flex: 1; min-width: 0; } .setting strong { display: block; font-weight: 600; } -.setting span { display: block; color: var(--muted); font-size: 14px; margin-top: 2px; } +.setting small { display: block; color: var(--muted); font-size: 14px; margin-top: 2px; } .setting select { flex: none; font: inherit; @@ -314,37 +314,31 @@ button.link.confirm { color: var(--danger); font-weight: 600; } @@ -370,11 +364,12 @@ button.link.confirm { color: var(--danger); font-weight: 600; }