git: 9front

Download patch

ref: ba116b1f2a25bbd12ef04a4521e5471376d8ed46
parent: c97d16f7a91d4eb7f6e8a9014079a7d6759bc33c
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Mon Aug 8 01:35:06 EDT 2016

hgwebfs: make hgwebfs prompt for password

--- a/sys/lib/python/hgext/hgwebfs.py
+++ b/sys/lib/python/hgext/hgwebfs.py
@@ -2,9 +2,26 @@
 
 import mercurial.url
 import re
+import os
 
 class Webconn:
 	def __init__(self, mnt, req):
+		try:
+			self.open(mnt, req)
+		except IOError, e:
+			try:
+				errstr = e.strerror
+				params = errstr[errstr.index("needkey ")+8:]
+				if params.find("!password?") < 0:
+					raise e
+				if os.spawnl(os.P_WAIT, "/boot/factotum", "getkey", "-g", params) != 0:
+					raise e
+				self.open(mnt, req)
+				return
+			except:
+				raise e
+
+	def open(self, mnt, req):
 		if type(req) == str:
 			self.url = req
 		else:
--