forked from r4sas/PBinCLI
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>
This commit is contained in:
parent
9d82c727b6
commit
682b47fbd3
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -1,2 +1,3 @@
|
|||||||
.gitattributes export-ignore
|
.gitattributes export-ignore
|
||||||
.gitignore export-ignore
|
.gitignore export-ignore
|
||||||
|
README.md export-ignore
|
||||||
|
@ -2,6 +2,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
__author__ = "R4SAS <r4sas@i2pmail.org>"
|
__author__ = "R4SAS <r4sas@i2pmail.org>"
|
||||||
__version__ = "0.2.2b1"
|
__version__ = "0.3.0"
|
||||||
__copyright__ = "Copyright (c) R4SAS"
|
__copyright__ = "Copyright (c) R4SAS"
|
||||||
__license__ = "MIT"
|
__license__ = "MIT"
|
||||||
|
@ -98,8 +98,19 @@ class Shortener:
|
|||||||
def _yourls_init(self, settings):
|
def _yourls_init(self, settings):
|
||||||
if not settings['short_url']:
|
if not settings['short_url']:
|
||||||
PBinCLIError("YOURLS: An API URL is required")
|
PBinCLIError("YOURLS: An API URL is required")
|
||||||
self.apiurl = settings['short_url']
|
|
||||||
|
|
||||||
|
# setting API URL
|
||||||
|
apiurl = settings['short_url']
|
||||||
|
if apiurl.endswith('/yourls-api.php'):
|
||||||
|
self.apiurl = apiurl
|
||||||
|
elif apiurl.endswith('/'):
|
||||||
|
self.apiurl = apiurl + 'yourls-api.php'
|
||||||
|
else:
|
||||||
|
PBinCLIError("YOURLS: Incorrect URL is provided.\n" +
|
||||||
|
"It must contain full address to 'yourls-api.php' script (like https://example.com/yourls-api.php)\n" +
|
||||||
|
"or just contain instance URL with '/' at the end (like https://example.com/)")
|
||||||
|
|
||||||
|
# validating for required credentials
|
||||||
if settings['short_user'] and settings['short_pass'] and settings['short_token'] is None:
|
if settings['short_user'] and settings['short_pass'] and settings['short_token'] is None:
|
||||||
self.auth_args = {'username': settings['short_user'], 'password': settings['short_pass']}
|
self.auth_args = {'username': settings['short_user'], 'password': settings['short_pass']}
|
||||||
elif settings['short_user'] is None and settings['short_pass'] is None and settings['short_token']:
|
elif settings['short_user'] is None and settings['short_pass'] is None and settings['short_token']:
|
||||||
|
Loading…
Reference in New Issue
Block a user