new option --disable-http
This commit is contained in:
parent
1cb3f48845
commit
8de8c9ff7f
|
@ -4,7 +4,9 @@
|
||||||
New Features:
|
New Features:
|
||||||
- "less full" allows to see the full html page instead of only the article view
|
- "less full" allows to see the full html page instead of only the article view
|
||||||
- Option --depth to customize your sync. Be warned, more than 1 is crazy.
|
- Option --depth to customize your sync. Be warned, more than 1 is crazy.
|
||||||
|
- Option --disable-http to allows deep syncing of gemini-only
|
||||||
Other Small Improvements:
|
Other Small Improvements:
|
||||||
|
- Improved HTML rendering
|
||||||
- Disabled https_everywhere by default (caching problems and some websites not supporting it)
|
- Disabled https_everywhere by default (caching problems and some websites not supporting it)
|
||||||
- Modified --sync logic to make it more intuitive (thanks Bjorn Westergard)
|
- Modified --sync logic to make it more intuitive (thanks Bjorn Westergard)
|
||||||
- Caching more problems to avoid refetch
|
- Caching more problems to avoid refetch
|
||||||
|
|
22
offpunk.py
22
offpunk.py
|
@ -889,6 +889,7 @@ class GeminiClient(cmd.Cmd):
|
||||||
self.visited_hosts = set()
|
self.visited_hosts = set()
|
||||||
self.offline_only = False
|
self.offline_only = False
|
||||||
self.sync_only = False
|
self.sync_only = False
|
||||||
|
self.do_http = _DO_HTTP
|
||||||
self.automatic_choice = "n"
|
self.automatic_choice = "n"
|
||||||
|
|
||||||
self.client_certs = {
|
self.client_certs = {
|
||||||
|
@ -1002,12 +1003,15 @@ you'll be able to transparently follow links to Gopherspace!""")
|
||||||
elif not self.offline_only and not gi.local:
|
elif not self.offline_only and not gi.local:
|
||||||
try:
|
try:
|
||||||
if gi.scheme in ("http", "https"):
|
if gi.scheme in ("http", "https"):
|
||||||
if _DO_HTTP:
|
if self.do_http:
|
||||||
gi = self._fetch_http(gi)
|
gi = self._fetch_http(gi)
|
||||||
else:
|
elif handle and not self.sync_only:
|
||||||
print("Install python3-requests to handle http requests natively")
|
if not _DO_HTTP:
|
||||||
|
print("Install python3-requests to handle http requests natively")
|
||||||
webbrowser.open_new_tab(gi.url)
|
webbrowser.open_new_tab(gi.url)
|
||||||
return
|
return
|
||||||
|
else:
|
||||||
|
return
|
||||||
else:
|
else:
|
||||||
gi = self._fetch_over_network(gi)
|
gi = self._fetch_over_network(gi)
|
||||||
except UserAbortException:
|
except UserAbortException:
|
||||||
|
@ -2564,6 +2568,8 @@ def main():
|
||||||
help='run non-interactively to build cache by exploring bookmarks')
|
help='run non-interactively to build cache by exploring bookmarks')
|
||||||
parser.add_argument('--assume-yes', action='store_true',
|
parser.add_argument('--assume-yes', action='store_true',
|
||||||
help='assume-yes when asked questions about certificates/redirections during sync')
|
help='assume-yes when asked questions about certificates/redirections during sync')
|
||||||
|
parser.add_argument('--disable-http',action='store_true',
|
||||||
|
help='do not try to get http(s) links (but already cached will be displayed)')
|
||||||
parser.add_argument('--fetch-later', action='store_true',
|
parser.add_argument('--fetch-later', action='store_true',
|
||||||
help='run non-interactively with an URL as argument to fetch it later')
|
help='run non-interactively with an URL as argument to fetch it later')
|
||||||
parser.add_argument('--depth',
|
parser.add_argument('--depth',
|
||||||
|
@ -2624,6 +2630,9 @@ def main():
|
||||||
gc.cmdqueue.append("tour %s" % url)
|
gc.cmdqueue.append("tour %s" % url)
|
||||||
gc.cmdqueue.append("tour")
|
gc.cmdqueue.append("tour")
|
||||||
|
|
||||||
|
if args.disable_http:
|
||||||
|
gc.do_http = False
|
||||||
|
|
||||||
# Endless interpret loop
|
# Endless interpret loop
|
||||||
if args.fetch_later:
|
if args.fetch_later:
|
||||||
if args.url:
|
if args.url:
|
||||||
|
@ -2653,6 +2662,9 @@ def main():
|
||||||
if gitem.is_cache_valid():
|
if gitem.is_cache_valid():
|
||||||
print(" -> adding to tour: %s" %gitem.url)
|
print(" -> adding to tour: %s" %gitem.url)
|
||||||
gc.list_add_line("tour",gi=gitem,verbose=False)
|
gc.list_add_line("tour",gi=gitem,verbose=False)
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
def fetch_gitem(gitem,depth=0,validity=0,savetotour=False,count=[0,0],strin=""):
|
def fetch_gitem(gitem,depth=0,validity=0,savetotour=False,count=[0,0],strin=""):
|
||||||
#savetotour = True will save to tour newly cached content
|
#savetotour = True will save to tour newly cached content
|
||||||
|
@ -2695,8 +2707,8 @@ def main():
|
||||||
counter += 1
|
counter += 1
|
||||||
fetch_gitem(l,depth=depth,validity=validity,savetotour=tourchildren,count=[counter,end])
|
fetch_gitem(l,depth=depth,validity=validity,savetotour=tourchildren,count=[counter,end])
|
||||||
if tourandremove:
|
if tourandremove:
|
||||||
add_to_tour(l)
|
if add_to_tour(l):
|
||||||
gc.list_rm_url(l.url,list)
|
gc.list_rm_url(l.url,list)
|
||||||
|
|
||||||
if args.cache_validity:
|
if args.cache_validity:
|
||||||
refresh_time = int(args.cache_validity)
|
refresh_time = int(args.cache_validity)
|
||||||
|
|
Loading…
Reference in New Issue