mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-18 18:56:28 +00:00
cli: webopen: when called with no arguments, open the Welcome page
This commit is contained in:
parent
e330abc3c3
commit
b640baf500
@ -300,7 +300,7 @@ class WebopenOptions(VDriveOptions):
|
||||
def getSynopsis(self):
|
||||
return "%s webopen [ALIAS:PATH]" % (os.path.basename(sys.argv[0]),)
|
||||
|
||||
longdesc = """Opens a webbrowser to the contents of some portion of the virtual drive."""
|
||||
longdesc = """Opens a webbrowser to the contents of some portion of the virtual drive. When called without arguments, opens to the Welcome page."""
|
||||
|
||||
class ManifestOptions(VDriveOptions):
|
||||
optFlags = [
|
||||
|
@ -7,12 +7,15 @@ def webopen(options, opener=None):
|
||||
if not nodeurl.endswith("/"):
|
||||
nodeurl += "/"
|
||||
where = options.where
|
||||
rootcap, path = get_alias(options.aliases, where, DEFAULT_ALIAS)
|
||||
if path == '/':
|
||||
path = ''
|
||||
url = nodeurl + "uri/%s" % urllib.quote(rootcap)
|
||||
if path:
|
||||
url += "/" + escape_path(path)
|
||||
if where:
|
||||
rootcap, path = get_alias(options.aliases, where, DEFAULT_ALIAS)
|
||||
if path == '/':
|
||||
path = ''
|
||||
url = nodeurl + "uri/%s" % urllib.quote(rootcap)
|
||||
if path:
|
||||
url += "/" + escape_path(path)
|
||||
else:
|
||||
url = nodeurl
|
||||
if not opener:
|
||||
import webbrowser
|
||||
opener = webbrowser.open
|
||||
|
@ -474,6 +474,7 @@ class CreateAlias(GridTestMixin, CLITestMixin, unittest.TestCase):
|
||||
aliases = get_aliases(self.get_clientdir())
|
||||
node_url_file = os.path.join(self.get_clientdir(), "node.url")
|
||||
nodeurl = open(node_url_file, "r").read().strip()
|
||||
self.welcome_url = nodeurl
|
||||
uribase = nodeurl + "uri/"
|
||||
self.tahoe_url = uribase + urllib.quote(aliases["tahoe"])
|
||||
self.tahoe_subdir_url = self.tahoe_url + "/subdir"
|
||||
@ -505,7 +506,7 @@ class CreateAlias(GridTestMixin, CLITestMixin, unittest.TestCase):
|
||||
d.addCallback(_check_add_duplicate)
|
||||
|
||||
def _test_urls(junk):
|
||||
self._test_webopen([], self.tahoe_url)
|
||||
self._test_webopen([], self.welcome_url)
|
||||
self._test_webopen(["/"], self.tahoe_url)
|
||||
self._test_webopen(["tahoe:"], self.tahoe_url)
|
||||
self._test_webopen(["tahoe:/"], self.tahoe_url)
|
||||
|
Loading…
Reference in New Issue
Block a user