From bdf1688b30f1fecb27c3faf279badd90e26072b2 Mon Sep 17 00:00:00 2001 From: Mcat12 Date: Thu, 15 Feb 2018 23:27:17 -0500 Subject: [PATCH 1/2] If the web interface is accessed over a special port, use it for the API Signed-off-by: Mcat12 --- src/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils.js b/src/utils.js index 2453107..e78fae5 100644 --- a/src/utils.js +++ b/src/utils.js @@ -157,7 +157,7 @@ export const api = { else if(config.developmentMode) apiLocation = "pi.hole/admin/api"; else - apiLocation = window.location.hostname + "/admin/api"; + apiLocation = window.location.hostname + (window.location.port ? ':' + window.location.port : '') + "/admin/api"; return window.location.protocol + "//" + apiLocation + "/" + endpoint; } From 30f658266823f363c2c61dd9aab22a827723b146 Mon Sep 17 00:00:00 2001 From: Mcat12 Date: Fri, 23 Feb 2018 23:32:51 -0500 Subject: [PATCH 2/2] Add a developer getting started section to the readme Signed-off-by: Mcat12 --- README.md | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 29b7d80..2a0fdc4 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,31 @@ # Pi-hole Web Interface -View stats and control your Pi-hole via this web interface. For the previous PHP-based web interface, see [pi-hole/AdminLTE](https://github.com/pi-hole/AdminLTE/). +View stats and control your Pi-hole via this web interface. For the previous PHP-based web interface, +see [pi-hole/AdminLTE](https://github.com/pi-hole/AdminLTE/). Preview: ![Dashboard](https://user-images.githubusercontent.com/4417660/30337048-1f3b0a06-97b5-11e7-9af3-03c2e763e36a.png) ![Query Log](https://user-images.githubusercontent.com/4417660/30356528-882f7cfc-9807-11e7-99eb-19ff1a5f521f.png) ![Blacklist (Exact)](https://user-images.githubusercontent.com/4417660/30337510-7eba111a-97b6-11e7-8574-6c7355efaa57.png) + +## Getting Started (Development) + +- Install Node + NPM (usually installed together): https://nodejs.org/ + - Install at least 8.x.x + - You should either install it via your package manager or one of the curl | bash scripts they provide: + https://nodejs.org/en/download/package-manager/ +- You should also install your distro's build tools just in case + - `build-essential` for Debian distros, `gcc-c++` and `make` for RHEL distros +- Fork the repository and clone to your computer (not the Pi-hole). In production the Pi-hole only needs the compiled + output of the project, not its source +- Open the folder in the terminal +- Run `npm install` + - This will install all the packages listed in `package.json` and will let you build/run the web interface +- Run `npm start` to make sure that it is working + - This will launch the web interface on port 3000 in debug mode + - If it crashes/has a compile error it will show you the code and the error + - Changes will be automatically applied and the web interface will reload +- If you've never used React, you should read the [React Quick Start](https://reactjs.org/docs/hello-world.html) and/or +the [Tutorial](https://reactjs.org/tutorial/tutorial.html) before diving too deep into the code. +- When you are ready to make changes, make a branch off of `development` in your fork to work in. When you're ready to +make a pull request, base the PR against `development`. \ No newline at end of file