Compare commits
2 Commits
fcb42c4ceb
...
1c73d74f75
Author | SHA1 | Date | |
---|---|---|---|
Anthony Wang | 1c73d74f75 | ||
Anthony Wang | aa548d1d7f |
26
backup
26
backup
|
@ -29,33 +29,31 @@ nice -n19 ionice -c3 \
|
|||
--exclude='/var/log/journal' \
|
||||
--exclude='/var/lib/systemd/coredump' \
|
||||
--exclude='/var/lib/woodpecker-agent' \
|
||||
--exclude-rx='.qcow2' \
|
||||
--exclude-rx='.journal' \
|
||||
--exclude='/var/lib/gitea/indexers' \
|
||||
--exclude='/var/lib/peertube/storage/thumbnails' \
|
||||
--exclude='/var/lib/synapse/media_store/remote_content' \
|
||||
--exclude='/var/lib/synapse/media_store/remote_thumbnail' \
|
||||
--exclude-rx='.go' \
|
||||
--exclude-rx='.3ds' \
|
||||
--exclude-rx='.xci' \
|
||||
--exclude-rx='.nsp' \
|
||||
--exclude-rx='.wbfs' \
|
||||
--exclude-rx='.wine' \
|
||||
--exclude-rx='.yarn' \
|
||||
--exclude-rx='.qcow2' \
|
||||
--exclude-rx='.julia' \
|
||||
--exclude-rx='.gradle' \
|
||||
--exclude-rx='.sonarlint' \
|
||||
--exclude-rx='.minecraft' \
|
||||
--exclude-rx='.lunarclient' \
|
||||
--exclude-rx='node_modules' \
|
||||
--exclude-rx='.cargo' \
|
||||
--exclude-rx='.nix-profile' \
|
||||
--exclude-rx='venv' \
|
||||
--exclude-rx='vendor' \
|
||||
--exclude-rx='cache' \
|
||||
--exclude-rx='Cache' \
|
||||
--exclude-rx='remote_content' \
|
||||
--exclude-rx='remote_thumbnail' \
|
||||
--exclude-rx='repos.bleve' \
|
||||
--exclude-rx='peertube/storage/thumbnails' \
|
||||
--exclude-rx='vendor' \
|
||||
--exclude-rx='node_modules' \
|
||||
--exclude-rx='.local/share/yuzu' \
|
||||
--exclude-rx='.local/share/Trash' \
|
||||
--exclude-rx='.local/share/containers' \
|
||||
--exclude-rx='.local/share/torbrowser' \
|
||||
--exclude-rx='.local/share/yuzu' \
|
||||
'/home' '/etc' '/var' '/srv'
|
||||
'/etc' '/var' '/srv' '/home/ta180m'
|
||||
|
||||
echo "Backing up ${name} to '${repository}'..."
|
||||
nice -n19 ionice -c3 \
|
||||
|
|
25
srvuser.py
25
srvuser.py
|
@ -1,5 +1,5 @@
|
|||
from subprocess import run, check_output
|
||||
from json import loads
|
||||
from urllib.parse import parse_qs
|
||||
|
||||
from http.server import BaseHTTPRequestHandler
|
||||
from adduser import adduser
|
||||
|
@ -9,14 +9,29 @@ from ldappass import code
|
|||
class srvuser(BaseHTTPRequestHandler):
|
||||
"""User management HTTP server"""
|
||||
|
||||
def do_GET(self):
|
||||
"""Handle GET requests"""
|
||||
|
||||
body = 'It worked!'
|
||||
self.send_response(200)
|
||||
self.send_header('Content-Type', 'text/plain')
|
||||
self.send_header('Content-Length', str(len(body)))
|
||||
self.end_headers()
|
||||
self.wfile.write(body.encode('utf-8'))
|
||||
|
||||
def do_POST(self):
|
||||
"""Handle registration POST requests"""
|
||||
"""Handle API POST requests"""
|
||||
|
||||
content_length = int(self.headers['Content-Length'])
|
||||
data = loads(self.rfile.read(content_length).decode('utf-8'))
|
||||
print([data[key] for key in data.keys() if key != 'password']) # Print data
|
||||
data = parse_qs(self.rfile.read(content_length).decode('utf-8'))
|
||||
|
||||
if data['type'] == 'new':
|
||||
# Print debug data
|
||||
debug = data.copy()
|
||||
debug.pop('password')
|
||||
debug.pop('confirmpassword')
|
||||
print(debug)
|
||||
|
||||
if self.path == '/api/join':
|
||||
# New user
|
||||
if data['code'] != code():
|
||||
print('Incorrect code')
|
||||
|
|
Loading…
Reference in New Issue