mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-02-07 11:50:21 +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):
|
def getSynopsis(self):
|
||||||
return "%s webopen [ALIAS:PATH]" % (os.path.basename(sys.argv[0]),)
|
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):
|
class ManifestOptions(VDriveOptions):
|
||||||
optFlags = [
|
optFlags = [
|
||||||
|
@ -7,12 +7,15 @@ def webopen(options, opener=None):
|
|||||||
if not nodeurl.endswith("/"):
|
if not nodeurl.endswith("/"):
|
||||||
nodeurl += "/"
|
nodeurl += "/"
|
||||||
where = options.where
|
where = options.where
|
||||||
rootcap, path = get_alias(options.aliases, where, DEFAULT_ALIAS)
|
if where:
|
||||||
if path == '/':
|
rootcap, path = get_alias(options.aliases, where, DEFAULT_ALIAS)
|
||||||
path = ''
|
if path == '/':
|
||||||
url = nodeurl + "uri/%s" % urllib.quote(rootcap)
|
path = ''
|
||||||
if path:
|
url = nodeurl + "uri/%s" % urllib.quote(rootcap)
|
||||||
url += "/" + escape_path(path)
|
if path:
|
||||||
|
url += "/" + escape_path(path)
|
||||||
|
else:
|
||||||
|
url = nodeurl
|
||||||
if not opener:
|
if not opener:
|
||||||
import webbrowser
|
import webbrowser
|
||||||
opener = webbrowser.open
|
opener = webbrowser.open
|
||||||
|
@ -474,6 +474,7 @@ class CreateAlias(GridTestMixin, CLITestMixin, unittest.TestCase):
|
|||||||
aliases = get_aliases(self.get_clientdir())
|
aliases = get_aliases(self.get_clientdir())
|
||||||
node_url_file = os.path.join(self.get_clientdir(), "node.url")
|
node_url_file = os.path.join(self.get_clientdir(), "node.url")
|
||||||
nodeurl = open(node_url_file, "r").read().strip()
|
nodeurl = open(node_url_file, "r").read().strip()
|
||||||
|
self.welcome_url = nodeurl
|
||||||
uribase = nodeurl + "uri/"
|
uribase = nodeurl + "uri/"
|
||||||
self.tahoe_url = uribase + urllib.quote(aliases["tahoe"])
|
self.tahoe_url = uribase + urllib.quote(aliases["tahoe"])
|
||||||
self.tahoe_subdir_url = self.tahoe_url + "/subdir"
|
self.tahoe_subdir_url = self.tahoe_url + "/subdir"
|
||||||
@ -505,7 +506,7 @@ class CreateAlias(GridTestMixin, CLITestMixin, unittest.TestCase):
|
|||||||
d.addCallback(_check_add_duplicate)
|
d.addCallback(_check_add_duplicate)
|
||||||
|
|
||||||
def _test_urls(junk):
|
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(["/"], self.tahoe_url)
|
||||||
self._test_webopen(["tahoe:"], self.tahoe_url)
|
self._test_webopen(["tahoe:"], self.tahoe_url)
|
||||||
self._test_webopen(["tahoe:/"], self.tahoe_url)
|
self._test_webopen(["tahoe:/"], self.tahoe_url)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user