feat: Add license and documentation for noCDNbs

Introduces MIT License for the project to clarify usage rights.
Adds README with setup instructions and project details.
Enhances app.py to allow configurable port via environment variable.
This commit is contained in:
Kumi 2024-11-27 12:58:39 +01:00
parent d54cd76f99
commit ef2ab5e519
Signed by: kumi
GPG key ID: ECBCC9082395383F
3 changed files with 65 additions and 1 deletions

19
LICENSE Normal file
View file

@ -0,0 +1,19 @@
Copyright (c) 2024 Private.coffee Team <support@private.coffee>
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.

42
README.md Normal file
View file

@ -0,0 +1,42 @@
# noCDNbs - a privacy-friendly cdnjs proxy
noCDNbs is a Flask app that acts as a proxy for cdnjs. It allows you to use the CDN without disclosing your website visitors' IP addresses to Cloudflare.
## How it works
noCDNbs works by fetching the assets from Cloudflare and serving them to the client. This way, the client's IP address is never disclosed to Cloudflare. It does not store any data about the client.
Note that it does *not* modify the assets in any way. This means that the loaded assets may still contain tracking code or create connections to third-party servers, including cdnjs. You should always review the assets you load from a CDN.
## Setup
1. Clone the repository
```bash
git clone https://git.private.coffee/PrivateCoffee/nocdnbs.git
cd nocdnbs
```
2. Create a virtual environment and install the dependencies
```bash
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
```
3. Use the flask command or a WSGI server to run the app
```bash
flask run
```
In production, you should use a WSGI server like uWSGI, and a reverse proxy like Caddy. Ensure that your server does not log the client's IP address!
## Configuration
noCDNbs does not require any configuration. However, if you use `flask run`, you can set the `PORT` environment variable to change the port the app listens on. By default, it listens on port 5679.
## License
noCDNbs is licensed under the MIT License. See [LICENSE](LICENSE) for more information.

5
app.py
View file

@ -5,6 +5,8 @@ from urllib.request import urlopen
from urllib.error import HTTPError
from urllib.parse import unquote
import os
app = Flask(__name__)
@ -47,4 +49,5 @@ def proxy(url):
if __name__ == "__main__":
app.run()
app.run(host="0.0.0.0", port=os.environ.get("PORT", 5679))