comparison bin/hurl @ 11469:5a1e15fb9528 draft

<fizzie> sled bin/hurl//s,hackego.esolangs.org/fshg,hack.esolangs.org/repo,g;s,/index\\.cgi,,
author HackEso <hackeso@esolangs.org>
date Sun, 08 Apr 2018 18:19:59 +0100
parents c1a6de70613d
children
comparison
equal deleted inserted replaced
11468:ff752d36eb0e 11469:5a1e15fb9528
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 import sys, os.path, re, urllib 2 import sys, os.path, re, urllib
3 if len(sys.argv) <= 1: 3 if len(sys.argv) <= 1:
4 print "https://hackego.esolangs.org/fshg/" 4 print "https://hack.esolangs.org/repo/"
5 else: 5 else:
6 f = os.path.abspath(sys.argv[1]) 6 f = os.path.abspath(sys.argv[1])
7 f = re.sub(r"^/+hackenv/", "", f) 7 f = re.sub(r"^/+hackenv/", "", f)
8 if re.match(r"/|(?:\.hg|tmp)(?:/|$)",f): 8 if re.match(r"/|(?:\.hg|tmp)(?:/|$)",f):
9 sys.exit("File is outside web-viewable filesystem repository.") 9 sys.exit("File is outside web-viewable filesystem repository.")
10 else: 10 else:
11 print ("https://hackego.esolangs.org/fshg/index.cgi/log/tip/" + 11 print ("https://hack.esolangs.org/repo/log/tip/" +
12 urllib.quote(f)) 12 urllib.quote(f))