Skip to content

Commit

Permalink
[build & docs] update docs and build-system
Browse files Browse the repository at this point in the history
  • Loading branch information
rywng committed Oct 18, 2023
1 parent a510951 commit f71ec9f
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 27 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.virtualenv/*
__pycache__
database.db
test
dist
build
neoDNS.egg-info
36 changes: 12 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,19 @@
# neoDNS

Lightweight "DNS" that operates by returning http page
Lightweight "DNS" that operates by using http requests

## Operation
### Development

user sends the auth data to server through https, like this:

```json
{
"operation": "get",
"name": "media server",
"password": "12345"
},
{
"operation": "set",
"name": "game server",
"password": "abcde",
"address": "8.8.8.8"
}
```bash
pip install -r requirements.txt
flask run
```

server receives the message and respond to the message:
```json
{
"1.1.1.1"
},
{
"OK"
}
### Deployment

refer to the tutorial [here](https://flask.palletsprojects.com/en/2.3.x/tutorial/deploy/)

```bash
pip install waitress
waitress-serve
```
6 changes: 3 additions & 3 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ def add_address():

@app.route("/set/")
def set_ip():
domain_id = request.args.get("domain_name")
domain_id = request.args.get("domain_id")
password = request.args.get("password")
new_ip = request.args.get("ip")
new_ip = request.args.get("new_ip")
new_pass = request.args.get("new_pass")

if not (domain_id and password):
Expand All @@ -108,7 +108,7 @@ def set_ip():
conn = sqlite3.connect("database.db")
if new_ip:
conn.execute(
"UPDATE domains SET ip = ? WHERE id = ?", new_ip)
"UPDATE domains SET ip = ? WHERE id = ?", (new_ip, domain_id))
if new_pass:
conn.execute(
"UPDATE domains SET password_hash = ? WHERE id = ?",
Expand Down
11 changes: 11 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[build-system]
requires = ["setuptools", "flask", "Werkzeug"]
build-backend = "setuptools.build_meta"

[project]
name = "neoDNS"
version = "0.1"
dependencies = [
"flask",
"Werkzeug"
]
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
flask
Werkzeug

0 comments on commit f71ec9f

Please sign in to comment.