Skip to content

Commit 682b47f

Browse files
committed
0.3.0
New: * Added validation of PrivateBin instance URL - #18 (it must contain trailing slash because POST is used) * URL shortener support with various supported services - #19 * Shortener configuration, certificate validation and insecure warning settings can be configured in config file or via env Changed: * Restructured some parts of code by splitting big code chunks in funtions (encrypt/decrypt) * Rework error messaging repeatable code (moved in utils) * Reduce code duplication (requests session configuring) Signed-off-by: r4sas <r4sas@i2pmail.org>
1 parent 9d82c72 commit 682b47f

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
.gitattributes export-ignore
22
.gitignore export-ignore
3+
README.md export-ignore

pbincli/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
# -*- coding: utf-8 -*-
33

44
__author__ = "R4SAS <r4sas@i2pmail.org>"
5-
__version__ = "0.2.2b1"
5+
__version__ = "0.3.0"
66
__copyright__ = "Copyright (c) R4SAS"
77
__license__ = "MIT"

pbincli/api.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,19 @@ def __init__(self, settings=None):
9898
def _yourls_init(self, settings):
9999
if not settings['short_url']:
100100
PBinCLIError("YOURLS: An API URL is required")
101-
self.apiurl = settings['short_url']
102101

102+
# setting API URL
103+
apiurl = settings['short_url']
104+
if apiurl.endswith('/yourls-api.php'):
105+
self.apiurl = apiurl
106+
elif apiurl.endswith('/'):
107+
self.apiurl = apiurl + 'yourls-api.php'
108+
else:
109+
PBinCLIError("YOURLS: Incorrect URL is provided.\n" +
110+
"It must contain full address to 'yourls-api.php' script (like https://example.com/yourls-api.php)\n" +
111+
"or just contain instance URL with '/' at the end (like https://example.com/)")
112+
113+
# validating for required credentials
103114
if settings['short_user'] and settings['short_pass'] and settings['short_token'] is None:
104115
self.auth_args = {'username': settings['short_user'], 'password': settings['short_pass']}
105116
elif settings['short_user'] is None and settings['short_pass'] is None and settings['short_token']:

0 commit comments

Comments
 (0)