allow force pulls

This commit is contained in:
Didier Slof 2022-12-18 23:46:56 +01:00
parent c6499882b1
commit 89750c97e7
Signed by: didier
GPG key ID: 01E71F18AA4398E5

View file

@ -11,7 +11,7 @@ class handler(BaseHTTPRequestHandler):
self.send_response(200) self.send_response(200)
self.send_header('Content-type','text/plain') self.send_header('Content-type','text/plain')
self.end_headers() self.end_headers()
if (time.time() - os.path.getmtime('./lib/deploy.sh') > 86400): if (time.time() - os.path.getmtime('./lib/deploy.sh') > 86400) or self.path == '/pull':
subprocess.call(['git', 'pull']) subprocess.call(['git', 'pull'])
with open('./lib/deploy.sh') as f: with open('./lib/deploy.sh') as f:
self.wfile.write(bytes(f.read(), 'utf-8')) self.wfile.write(bytes(f.read(), 'utf-8'))