소스 검색

Fixes for open url method

oz123 10 년 전
부모
커밋
d96017e881
3개의 변경된 파일18개의 추가작업 그리고 11개의 파일을 삭제
  1. 4 1
      pwman/ui/baseui.py
  2. 8 5
      pwman/ui/mac.py
  3. 6 5
      pwman/ui/win.py

+ 4 - 1
pwman/ui/baseui.py

@@ -238,9 +238,12 @@ class BaseCommands(HelpUIMixin, AliasesMixin):
             return
 
         nodes = self._db.getnodes(ids)
+        ce = CryptoEngine.get()
+
         for node in nodes:
-            ce = CryptoEngine.get()
             url = ce.decrypt(node[3])
+            if not url.startswith(("http://", "https://")):
+                url = "https://" + url
             tools.open_url(url)
 
     def do_exit(self, args):  # pragma: no cover

+ 8 - 5
pwman/ui/mac.py

@@ -61,12 +61,15 @@ class PwmanCliMac(PwmanCli):
         if len(ids) > 1:
             print("Can open only 1 link at a time ...")
             return None
-        try:
-            node = self._db.getnodes(ids)
-            url = node[0].get_url()
+
+        ce = CryptoEngine.get()
+        nodes = self._db.getnodes(ids)
+
+        for node in nodes:
+            url = ce.decrypt(node[3])
+            if not url.startswith(("http://", "https://")):
+                url = "https://" + url
             tools.open_url(url, macosx=True)
-        except Exception as e:
-            self.error(e)
 
     def do_o(self, args):
         self.do_open(args)

+ 6 - 5
pwman/ui/win.py

@@ -189,14 +189,15 @@ class PwmanCliWin(PwmanCli):
         if len(ids) > 1:
             print ("Can open only 1 link at a time ...")
             return None
-        try:
-            node = self._db.getnodes(ids)
-            url = node[0].url
+
+        ce = CryptoEngine.get()
+        nodes = self._db.getnodes(ids)
+
+        for node in nodes:
+            url = ce.decrypt(node[3])
             if not url.startswith(("http://", "https://")):
                 url = "https://" + url
             os.system("start "+url)
-        except Exception as e:
-            self.error(e)
 
     def do_cls(self, args):
         os.system('cls')