Hell of a hack for naughty bug + handle offline reload
This commit is contained in:
parent
1a21c902cb
commit
10d6c3110f
|
@ -14,8 +14,6 @@ Use "av-98.py --sync" to build a cache containing your bookmarks and all links i
|
|||
* FIXME5: offline web browser use os.system because it’s the only one that understands the ">> file.txt"
|
||||
* FIXME6: sync-only always tries to download "uncachable" content (such as XML, forms, gopher…) This is somewhat related to FIXME1.
|
||||
|
||||
* TODO: handle request done offline and retrieve them later
|
||||
* TODO: reload while offline should mark the url for syncing
|
||||
* TODO: number of cache updated in blackbox
|
||||
|
||||
This is a fork of the original [AV-98](https://tildegit.org/solderpunk/AV-98)
|
||||
|
|
13
av98.py
13
av98.py
|
@ -159,6 +159,11 @@ class GeminiItem():
|
|||
if self.cache_path.endswith("/"):
|
||||
self.cache_path += "index.gmi"
|
||||
elif not self.cache_path.endswith(".gmi"):
|
||||
# That’s really a naughty hack
|
||||
# but else, accessing gemini://mysite/~user while offline
|
||||
# will truncate all relative links
|
||||
# mysite/~user/page.gmi would become mysite/page.gmi
|
||||
self.url += "/"
|
||||
self.cache_path += "/index.gmi"
|
||||
|
||||
def is_cache_valid(self):
|
||||
|
@ -1343,7 +1348,13 @@ you'll be able to transparently follow links to Gopherspace!""")
|
|||
@needs_gi
|
||||
def do_reload(self, *args):
|
||||
"""Reload the current URL."""
|
||||
self._go_to_gi(self.gi, check_cache=False)
|
||||
if self.offline_only:
|
||||
with open(self.syncfile,mode='a') as sf:
|
||||
line = self.gi.url + '\n'
|
||||
sf.write(line)
|
||||
sf.close()
|
||||
else:
|
||||
self._go_to_gi(self.gi, check_cache=False)
|
||||
|
||||
@needs_gi
|
||||
def do_up(self, *args):
|
||||
|
|
Loading…
Reference in New Issue