From b0f17f0a91cdebbfd6732781943f1e04ce3311f7 Mon Sep 17 00:00:00 2001 From: "Jens-U. Mozdzen" Date: Sun, 23 Oct 2022 00:18:56 +0200 Subject: [PATCH 01/15] added server-side YOURLS shortener call --- shortenviayourls.php | 85 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 shortenviayourls.php diff --git a/shortenviayourls.php b/shortenviayourls.php new file mode 100644 index 00000000..28022819 --- /dev/null +++ b/shortenviayourls.php @@ -0,0 +1,85 @@ +getKey( "basepath") . "/?")) { + + // Init the CURL session + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $conf->getKey( "apiurl", "yourls")); + curl_setopt($ch, CURLOPT_HEADER, 0); // No header in the result + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Return, do not echo result + curl_setopt($ch, CURLOPT_POST, 1); // This is a POST request + curl_setopt($ch, CURLOPT_POSTFIELDS, array( // Data to POST + 'signature' => $conf->getKey( "signature", "yourls"), + 'format' => 'json', + 'action' => 'shorturl', + 'url' => $originalUrl + )); + // Fetch and return content + $data = curl_exec($ch); + curl_close($ch); + if (!($data === FALSE) && is_string($data)) + { + $data = json_decode( $data, true); + + if (!is_null($data) && array_key_exists('statusCode', $data) + && array_key_exists('shorturl', $data) && ($data['statusCode'] == 200)) + { + $shortenedUrl = $data['shorturl']; + $opSuccess = TRUE; + } else { + // error with contents of YOURLS response. + $errCode = 3; + } + } else { + // error when calling YOURLS - probably a PrivateBin configuration issue, like wrong/missing apiurl or signature + $errCode = 2; + } + } else { + // trying to shorten a URL not pointing to our PrivateBin instance. + $errCode = 1; + } +} + +if ($opSuccess) +{ + print("
Your shortened paste is $shortenedUrl"); +} +else +{ + print("
Error: An error occured while trying to shorten the given URL (error code $errCode)"); +} + +function getGetData() { + $data = http_build_query($_GET); + return $data; +} + +function startsWith($haystack, $needle) +{ + $length = strlen($needle); + return (substr($haystack, 0, $length) === $needle); +} +?> From 3115cb8883cae1d4c08f8df54cb3e521f29cd465 Mon Sep 17 00:00:00 2001 From: "Jens-U. Mozdzen" Date: Sun, 23 Oct 2022 00:19:43 +0200 Subject: [PATCH 02/15] added parameters for server-side YOURLS shortener call --- cfg/conf.sample.php | 12 ++++++++++++ lib/Configuration.php | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/cfg/conf.sample.php b/cfg/conf.sample.php index cf465980..487a20ae 100644 --- a/cfg/conf.sample.php +++ b/cfg/conf.sample.php @@ -227,3 +227,15 @@ dir = PATH "data" ;bucket = "my-bucket" ;accesskey = "access key id" ;secretkey = "secret access key" + +[yourls] +; don't mix this up with "urlshortener" config item: +; - when using a standard configuration, "urlshortener" will point to the YOURLS API, including access credentials, and will be part of the PrivateBin public web page (insecure!) +; - when using the parameters in this section ("signature" and "apiurl"), "urlshortener" will point to a fixed PrivateBin page ("$basepath/shortenviayourls.php") and +; that PHP will in turn call YOURLS server-side, using the URL from "apiurl" and using the "access signature" from "signature" parameter. + +; (optional) the "signature" (access key) issued by YOURLS for the using account +; signature = "" + +; (optional) the URL of the YOURLS API, called to shorten a PrivateBin URL +; apiurl = "" diff --git a/lib/Configuration.php b/lib/Configuration.php index fad44a27..c2a5316b 100644 --- a/lib/Configuration.php +++ b/lib/Configuration.php @@ -93,6 +93,10 @@ class Configuration 'model_options' => array( 'dir' => 'data', ), + 'yourls' => array( + 'signature' => '', + 'apiurl' => '', + ), ); /** From dce8b8d3521811f2f34a6d5e31708cd759377fb4 Mon Sep 17 00:00:00 2001 From: "Jens-U. Mozdzen" Date: Sun, 23 Oct 2022 01:07:43 +0200 Subject: [PATCH 03/15] updated code formatting --- lib/Configuration.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Configuration.php b/lib/Configuration.php index c2a5316b..6f3a8225 100644 --- a/lib/Configuration.php +++ b/lib/Configuration.php @@ -95,7 +95,7 @@ class Configuration ), 'yourls' => array( 'signature' => '', - 'apiurl' => '', + 'apiurl' => '', ), ); From 0dc9ab7576d5a1296debeb788afb2ae9c72d137c Mon Sep 17 00:00:00 2001 From: El RIDO Date: Sun, 23 Oct 2022 08:10:56 +0200 Subject: [PATCH 04/15] refactor shortenviayourls.php for our MVC framework --- lib/Controller.php | 28 +++++++++- lib/Request.php | 6 +++ lib/YourlsProxy.php | 120 +++++++++++++++++++++++++++++++++++++++++++ shortenviayourls.php | 85 ------------------------------ tpl/yourlsproxy.php | 25 +++++++++ 5 files changed, 177 insertions(+), 87 deletions(-) create mode 100644 lib/YourlsProxy.php delete mode 100644 shortenviayourls.php create mode 100644 tpl/yourlsproxy.php diff --git a/lib/Controller.php b/lib/Controller.php index 62fa1e99..8d7f0f13 100644 --- a/lib/Controller.php +++ b/lib/Controller.php @@ -136,6 +136,9 @@ class Controller case 'jsonld': $this->_jsonld($this->_request->getParam('jsonld')); return; + case 'yourlsproxy': + $this->_yourlsproxy($this->_request->getParam('link')); + break; } // output JSON or HTML @@ -378,9 +381,15 @@ class Controller ); $page = new View; + $page->assign('CSPHEADER', $metacspheader); + $page->assign('ERROR', I18n::_($this->_error)); + if ($this->_request->getOperation() === 'yourlsproxy') { + $page->assign('SHORTURL', $this->_status); + $page->draw('yourlsproxy'); + return; + } $page->assign('NAME', $this->_conf->getKey('name')); $page->assign('BASEPATH', I18n::_($this->_conf->getKey('basepath'))); - $page->assign('ERROR', I18n::_($this->_error)); $page->assign('STATUS', I18n::_($this->_status)); $page->assign('VERSION', self::VERSION); $page->assign('DISCUSSION', $this->_conf->getKey('discussion')); @@ -405,7 +414,6 @@ class Controller $page->assign('HTTPWARNING', $this->_conf->getKey('httpwarning')); $page->assign('HTTPSLINK', 'https://' . $this->_request->getHost() . $this->_request->getRequestUri()); $page->assign('COMPRESSION', $this->_conf->getKey('compression')); - $page->assign('CSPHEADER', $metacspheader); $page->draw($this->_conf->getKey('template')); } @@ -439,6 +447,22 @@ class Controller echo $content; } + /** + * proxies link to YOURLS, updates status or error with response + * + * @access private + * @param string $link + */ + private function _yourlsproxy($link) + { + $yourls = new YourlsProxy($this->_conf, $link); + if ($yourls->isError()) { + $this->_error = $yourls->getError(); + } else { + $this->_status = $yourls->getUrl(); + } + } + /** * prepares JSON encoded status message * diff --git a/lib/Request.php b/lib/Request.php index 2eff8a96..9ed73074 100644 --- a/lib/Request.php +++ b/lib/Request.php @@ -120,6 +120,7 @@ class Request if ( !array_key_exists('pasteid', $this->_params) && !array_key_exists('jsonld', $this->_params) && + !array_key_exists('link', $this->_params) && array_key_exists('QUERY_STRING', $_SERVER) && !empty($_SERVER['QUERY_STRING']) ) { @@ -135,6 +136,11 @@ class Request } } elseif (array_key_exists('jsonld', $this->_params) && !empty($this->_params['jsonld'])) { $this->_operation = 'jsonld'; + } elseif (array_key_exists('link', $this->_params) && !empty($this->_params['link'])) { + $request_url = filter_var($_SERVER['REQUEST_URI'], FILTER_SANITIZE_URL); + if (strpos($request_url, '/shortenviayourls?link=') !== false) { + $this->_operation = 'yourlsproxy'; + } } } diff --git a/lib/YourlsProxy.php b/lib/YourlsProxy.php new file mode 100644 index 00000000..6cc0f24e --- /dev/null +++ b/lib/YourlsProxy.php @@ -0,0 +1,120 @@ +getKey('basepath') . '/?') !== false) { + // Init the CURL session + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $conf->getKey("apiurl", "yourls")); + curl_setopt($ch, CURLOPT_HEADER, 0); // No header in the result + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Return, do not echo result + curl_setopt($ch, CURLOPT_POST, 1); // This is a POST request + curl_setopt($ch, CURLOPT_POSTFIELDS, array( // Data to POST + 'signature' => $conf->getKey("signature", "yourls"), + 'format' => 'json', + 'action' => 'shorturl', + 'url' => $link + )); + // Fetch and return content + $data = curl_exec($ch); + curl_close($ch); + + if (!($data === FALSE) && is_string($data)) + { + $data = json_decode( $data, true); + + if (!is_null($data) && array_key_exists('statusCode', $data) + && array_key_exists('shorturl', $data) && ($data['statusCode'] == 200)) + { + $this->_url = $data['shorturl']; + $opSuccess = TRUE; + } else { + $this->_error = 'Error parsing YOURLS response.'; + } + } else { + $this->_error = 'Error calling YOURLS. Probably a configuration issue, like wrong or missing "apiurl" or "signature".'; + } + } else { + $this->_error = 'Trying to shorten a URL not pointing to our PrivateBin instance.'; + } + } + + /** + * Returns the (untranslated) error message + * + * @access public + * @return string + */ + public function getError() + { + return $this->_error; + } + + /** + * Returns the shortened URL + * + * @access public + * @return string + */ + public function getUrl() + { + return $this->_url; + } + + /** + * Returns true if any error has occurred + * + * @access public + * @return bool + */ + public function isError() + { + return !empty($this->_error); + } +} diff --git a/shortenviayourls.php b/shortenviayourls.php deleted file mode 100644 index 28022819..00000000 --- a/shortenviayourls.php +++ /dev/null @@ -1,85 +0,0 @@ -getKey( "basepath") . "/?")) { - - // Init the CURL session - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $conf->getKey( "apiurl", "yourls")); - curl_setopt($ch, CURLOPT_HEADER, 0); // No header in the result - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Return, do not echo result - curl_setopt($ch, CURLOPT_POST, 1); // This is a POST request - curl_setopt($ch, CURLOPT_POSTFIELDS, array( // Data to POST - 'signature' => $conf->getKey( "signature", "yourls"), - 'format' => 'json', - 'action' => 'shorturl', - 'url' => $originalUrl - )); - // Fetch and return content - $data = curl_exec($ch); - curl_close($ch); - if (!($data === FALSE) && is_string($data)) - { - $data = json_decode( $data, true); - - if (!is_null($data) && array_key_exists('statusCode', $data) - && array_key_exists('shorturl', $data) && ($data['statusCode'] == 200)) - { - $shortenedUrl = $data['shorturl']; - $opSuccess = TRUE; - } else { - // error with contents of YOURLS response. - $errCode = 3; - } - } else { - // error when calling YOURLS - probably a PrivateBin configuration issue, like wrong/missing apiurl or signature - $errCode = 2; - } - } else { - // trying to shorten a URL not pointing to our PrivateBin instance. - $errCode = 1; - } -} - -if ($opSuccess) -{ - print("
Your shortened paste is $shortenedUrl"); -} -else -{ - print("
Error: An error occured while trying to shorten the given URL (error code $errCode)"); -} - -function getGetData() { - $data = http_build_query($_GET); - return $data; -} - -function startsWith($haystack, $needle) -{ - $length = strlen($needle); - return (substr($haystack, 0, $length) === $needle); -} -?> diff --git a/tpl/yourlsproxy.php b/tpl/yourlsproxy.php new file mode 100644 index 00000000..c451c5a2 --- /dev/null +++ b/tpl/yourlsproxy.php @@ -0,0 +1,25 @@ + + + + + + + + <?php echo I18n::_($NAME); ?> + + + +

%s (Hit [Ctrl]+[c] to copy)', $SHORTURL, $SHORTURL); ?>

+ +

+ + + From 0a2094f0698860fb0d7cc71c811fe8cbf7810ac9 Mon Sep 17 00:00:00 2001 From: El RIDO Date: Sun, 23 Oct 2022 08:16:05 +0200 Subject: [PATCH 05/15] code style --- lib/YourlsProxy.php | 68 +++++++++++++++++++++++---------------------- 1 file changed, 35 insertions(+), 33 deletions(-) diff --git a/lib/YourlsProxy.php b/lib/YourlsProxy.php index 6cc0f24e..9d4cee8c 100644 --- a/lib/YourlsProxy.php +++ b/lib/YourlsProxy.php @@ -48,40 +48,42 @@ class YourlsProxy */ public function __construct(Configuration $conf, $link) { - if (strpos($link, $conf->getKey('basepath') . '/?') !== false) { - // Init the CURL session - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $conf->getKey("apiurl", "yourls")); - curl_setopt($ch, CURLOPT_HEADER, 0); // No header in the result - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Return, do not echo result - curl_setopt($ch, CURLOPT_POST, 1); // This is a POST request - curl_setopt($ch, CURLOPT_POSTFIELDS, array( // Data to POST - 'signature' => $conf->getKey("signature", "yourls"), - 'format' => 'json', - 'action' => 'shorturl', - 'url' => $link - )); - // Fetch and return content - $data = curl_exec($ch); - curl_close($ch); - - if (!($data === FALSE) && is_string($data)) - { - $data = json_decode( $data, true); - - if (!is_null($data) && array_key_exists('statusCode', $data) - && array_key_exists('shorturl', $data) && ($data['statusCode'] == 200)) - { - $this->_url = $data['shorturl']; - $opSuccess = TRUE; - } else { - $this->_error = 'Error parsing YOURLS response.'; - } - } else { - $this->_error = 'Error calling YOURLS. Probably a configuration issue, like wrong or missing "apiurl" or "signature".'; - } - } else { + if (strpos($link, $conf->getKey('basepath') . '/?') === false) { $this->_error = 'Trying to shorten a URL not pointing to our PrivateBin instance.'; + return; + } + + // Init the CURL session + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $conf->getKey("apiurl", "yourls")); + curl_setopt($ch, CURLOPT_HEADER, 0); // No header in the result + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Return, do not echo result + curl_setopt($ch, CURLOPT_POST, 1); // This is a POST request + curl_setopt($ch, CURLOPT_POSTFIELDS, array( // Data to POST + 'signature' => $conf->getKey("signature", "yourls"), + 'format' => 'json', + 'action' => 'shorturl', + 'url' => $link + )); + // Fetch and return content + $data = curl_exec($ch); + curl_close($ch); + + if ($data === false || !is_string($data)) { + $this->_error = 'Error calling YOURLS. Probably a configuration issue, like wrong or missing "apiurl" or "signature".'; + return; + } + + $data = json_decode($data, true); + if ( + !is_null($data) && + array_key_exists('statusCode', $data) && + array_key_exists('shorturl', $data) && + $data['statusCode'] == 200 + ) { + $this->_url = $data['shorturl']; + } else { + $this->_error = 'Error parsing YOURLS response.'; } } From b768a2e8cb5e58497c21f1418d704112a70725d8 Mon Sep 17 00:00:00 2001 From: El RIDO Date: Sun, 23 Oct 2022 08:21:37 +0200 Subject: [PATCH 06/15] use JSON wrapper for decoding error catching --- lib/YourlsProxy.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/YourlsProxy.php b/lib/YourlsProxy.php index 9d4cee8c..b5161103 100644 --- a/lib/YourlsProxy.php +++ b/lib/YourlsProxy.php @@ -12,7 +12,9 @@ namespace PrivateBin; +use Exception; use PrivateBin\Configuration; +use PrivateBin\Json; /** * YourlsProxy @@ -74,7 +76,13 @@ class YourlsProxy return; } - $data = json_decode($data, true); + try { + $data = Json::decode($data); + } catch (Exception $e) { + $this->_error = $e->getMessage(); + return; + } + if ( !is_null($data) && array_key_exists('statusCode', $data) && From f4000150faa1d410678be719f23d9547b9646798 Mon Sep 17 00:00:00 2001 From: El RIDO Date: Sun, 23 Oct 2022 09:05:17 +0200 Subject: [PATCH 07/15] avoid cURL dependency, native functions should suffice for such a simple call --- lib/YourlsProxy.php | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/lib/YourlsProxy.php b/lib/YourlsProxy.php index b5161103..dc19e24d 100644 --- a/lib/YourlsProxy.php +++ b/lib/YourlsProxy.php @@ -55,22 +55,24 @@ class YourlsProxy return; } - // Init the CURL session - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $conf->getKey("apiurl", "yourls")); - curl_setopt($ch, CURLOPT_HEADER, 0); // No header in the result - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Return, do not echo result - curl_setopt($ch, CURLOPT_POST, 1); // This is a POST request - curl_setopt($ch, CURLOPT_POSTFIELDS, array( // Data to POST - 'signature' => $conf->getKey("signature", "yourls"), - 'format' => 'json', - 'action' => 'shorturl', - 'url' => $link - )); - // Fetch and return content - $data = curl_exec($ch); - curl_close($ch); - + $data = file_get_contents( + $conf->getKey('apiurl', 'yourls'), false, stream_context_create( + array( + 'http' => array( + 'method' => 'POST', + 'header' => "Content-Type: application/x-www-form-urlencoded\r\n", + 'content' => http_build_query( + array( + 'signature' => $conf->getKey('signature', 'yourls'), + 'format' => 'json', + 'action' => 'shorturl', + 'url' => $link + ) + ) + ) + ) + ) + ); if ($data === false || !is_string($data)) { $this->_error = 'Error calling YOURLS. Probably a configuration issue, like wrong or missing "apiurl" or "signature".'; return; From 2a162d075c962ea212d253811b4e19cc8fac6474 Mon Sep 17 00:00:00 2001 From: El RIDO Date: Sun, 23 Oct 2022 09:12:31 +0200 Subject: [PATCH 08/15] allow unit tests to pass --- tpl/yourlsproxy.php | 4 +++- tst/ViewTest.php | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tpl/yourlsproxy.php b/tpl/yourlsproxy.php index c451c5a2..f642047d 100644 --- a/tpl/yourlsproxy.php +++ b/tpl/yourlsproxy.php @@ -17,7 +17,9 @@ if (empty($ERROR)) : -

+
+

+
diff --git a/tst/ViewTest.php b/tst/ViewTest.php index 1e4d9374..3e8a8aea 100644 --- a/tst/ViewTest.php +++ b/tst/ViewTest.php @@ -106,6 +106,10 @@ class ViewTest extends PHPUnit_Framework_TestCase $content, $template . ': outputs error correctly' ); + if ($template === 'yourlsproxy') { + // yourlsproxy template only displays error message + continue; + } $this->assertRegExp( '#<[^>]+id="password"[^>]*>#', $content, From 69034ef9d1e76be4968729ca52a215633cc74af7 Mon Sep 17 00:00:00 2001 From: El RIDO Date: Sun, 23 Oct 2022 09:16:55 +0200 Subject: [PATCH 09/15] apply StyleCI recommendations --- lib/YourlsProxy.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/YourlsProxy.php b/lib/YourlsProxy.php index dc19e24d..4162a6fa 100644 --- a/lib/YourlsProxy.php +++ b/lib/YourlsProxy.php @@ -13,8 +13,6 @@ namespace PrivateBin; use Exception; -use PrivateBin\Configuration; -use PrivateBin\Json; /** * YourlsProxy @@ -66,10 +64,10 @@ class YourlsProxy 'signature' => $conf->getKey('signature', 'yourls'), 'format' => 'json', 'action' => 'shorturl', - 'url' => $link + 'url' => $link, ) - ) - ) + ), + ), ) ) ); From 4bd5ef9cda32c95b63c2468ba4a35a896167bcca Mon Sep 17 00:00:00 2001 From: El RIDO Date: Sun, 23 Oct 2022 10:50:18 +0200 Subject: [PATCH 10/15] add new messages to translate --- i18n/ar.json | 5 ++++- i18n/bg.json | 5 ++++- i18n/ca.json | 5 ++++- i18n/co.json | 5 ++++- i18n/cs.json | 5 ++++- i18n/de.json | 5 ++++- i18n/el.json | 5 ++++- i18n/en.json | 5 ++++- i18n/es.json | 5 ++++- i18n/et.json | 5 ++++- i18n/fi.json | 5 ++++- i18n/fr.json | 5 ++++- i18n/he.json | 5 ++++- i18n/hi.json | 5 ++++- i18n/hu.json | 5 ++++- i18n/id.json | 5 ++++- i18n/it.json | 5 ++++- i18n/ja.json | 5 ++++- i18n/jbo.json | 5 ++++- i18n/ku.json | 5 ++++- i18n/la.json | 5 ++++- i18n/lt.json | 5 ++++- i18n/nl.json | 5 ++++- i18n/no.json | 5 ++++- i18n/oc.json | 5 ++++- i18n/pl.json | 5 ++++- i18n/pt.json | 5 ++++- i18n/ru.json | 5 ++++- i18n/sk.json | 5 ++++- i18n/sl.json | 5 ++++- i18n/sv.json | 5 ++++- i18n/tr.json | 5 ++++- i18n/uk.json | 5 ++++- i18n/zh.json | 5 ++++- lib/YourlsProxy.php | 2 +- 35 files changed, 137 insertions(+), 35 deletions(-) diff --git a/i18n/ar.json b/i18n/ar.json index 1827ddf2..dbc85bcf 100644 --- a/i18n/ar.json +++ b/i18n/ar.json @@ -186,5 +186,8 @@ "Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.": "Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.", "URL shortener may expose your decrypt key in URL.": "URL shortener may expose your decrypt key in URL.", "Save paste": "Save paste", - "Your IP is not authorized to create pastes.": "Your IP is not authorized to create pastes." + "Your IP is not authorized to create pastes.": "Your IP is not authorized to create pastes.", + "Trying to shorten a URL that isn't pointing at our instance.": "Trying to shorten a URL that isn't pointing at our instance.", + "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".": "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".", + "Error parsing YOURLS response.": "Error parsing YOURLS response." } diff --git a/i18n/bg.json b/i18n/bg.json index 717c5f18..ec8f540d 100644 --- a/i18n/bg.json +++ b/i18n/bg.json @@ -186,5 +186,8 @@ "Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.": "Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.", "URL shortener may expose your decrypt key in URL.": "URL shortener may expose your decrypt key in URL.", "Save paste": "Save paste", - "Your IP is not authorized to create pastes.": "Your IP is not authorized to create pastes." + "Your IP is not authorized to create pastes.": "Your IP is not authorized to create pastes.", + "Trying to shorten a URL that isn't pointing at our instance.": "Trying to shorten a URL that isn't pointing at our instance.", + "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".": "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".", + "Error parsing YOURLS response.": "Error parsing YOURLS response." } diff --git a/i18n/ca.json b/i18n/ca.json index 01651989..154110d4 100644 --- a/i18n/ca.json +++ b/i18n/ca.json @@ -186,5 +186,8 @@ "Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.": "Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.", "URL shortener may expose your decrypt key in URL.": "URL shortener may expose your decrypt key in URL.", "Save paste": "Save paste", - "Your IP is not authorized to create pastes.": "Your IP is not authorized to create pastes." + "Your IP is not authorized to create pastes.": "Your IP is not authorized to create pastes.", + "Trying to shorten a URL that isn't pointing at our instance.": "Trying to shorten a URL that isn't pointing at our instance.", + "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".": "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".", + "Error parsing YOURLS response.": "Error parsing YOURLS response." } diff --git a/i18n/co.json b/i18n/co.json index 21ca71ec..90b6811d 100644 --- a/i18n/co.json +++ b/i18n/co.json @@ -186,5 +186,8 @@ "Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.": "Visitate stu liame per vede a nota. Date l’indirizzu à qualunque li permette d’accede à a nota dinù.", "URL shortener may expose your decrypt key in URL.": "Un ammuzzatore d’indirizzu pò palisà a vostra chjave di dicifratura in l’indirizzu.", "Save paste": "Arregistrà l’appiccicu", - "Your IP is not authorized to create pastes.": "U vostru indirizzu IP ùn hè micca auturizatu à creà l’appiccichi." + "Your IP is not authorized to create pastes.": "U vostru indirizzu IP ùn hè micca auturizatu à creà l’appiccichi.", + "Trying to shorten a URL that isn't pointing at our instance.": "Trying to shorten a URL that isn't pointing at our instance.", + "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".": "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".", + "Error parsing YOURLS response.": "Error parsing YOURLS response." } diff --git a/i18n/cs.json b/i18n/cs.json index 82cb1732..6996f9ad 100644 --- a/i18n/cs.json +++ b/i18n/cs.json @@ -186,5 +186,8 @@ "Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.": "Navštivte tento odkaz pro zobrazení poznámky. Přeposláním URL umožníte také jiným lidem přístup.", "URL shortener may expose your decrypt key in URL.": "Zkracovač URL může odhalit váš dešifrovací klíč v URL.", "Save paste": "Uložit příspěvek", - "Your IP is not authorized to create pastes.": "Vaše IP adresa nemá oprávnění k vytvoření vložení." + "Your IP is not authorized to create pastes.": "Vaše IP adresa nemá oprávnění k vytvoření vložení.", + "Trying to shorten a URL that isn't pointing at our instance.": "Trying to shorten a URL that isn't pointing at our instance.", + "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".": "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".", + "Error parsing YOURLS response.": "Error parsing YOURLS response." } diff --git a/i18n/de.json b/i18n/de.json index 42752f2f..7ab57050 100644 --- a/i18n/de.json +++ b/i18n/de.json @@ -186,5 +186,8 @@ "Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.": "Besuche diesen Link um das Dokument zu sehen. Wird die URL an eine andere Person gegeben, so kann diese Person ebenfalls auf dieses Dokument zugreifen.", "URL shortener may expose your decrypt key in URL.": "Der URL-Verkürzer kann den Schlüssel in der URL enthüllen.", "Save paste": "Text speichern", - "Your IP is not authorized to create pastes.": "Deine IP ist nicht berechtigt, Texte zu erstellen." + "Your IP is not authorized to create pastes.": "Deine IP ist nicht berechtigt, Texte zu erstellen.", + "Trying to shorten a URL that isn't pointing at our instance.": "Trying to shorten a URL that isn't pointing at our instance.", + "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".": "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".", + "Error parsing YOURLS response.": "Error parsing YOURLS response." } diff --git a/i18n/el.json b/i18n/el.json index 15df67be..4f1a601c 100644 --- a/i18n/el.json +++ b/i18n/el.json @@ -186,5 +186,8 @@ "Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.": "Επισκεφτείτε αυτόν τον σύνδεσμο για να δείτε το μήνυμα. Δίνοντας τον σύνδεσμο σε οποιονδήποτε, του επιτρέπετε να επισκεφτεί το μήνυμα επίσης.", "URL shortener may expose your decrypt key in URL.": "Συντομευτές συνδέσμων πιθανώς να δημοσιοποιήσουν το κλειδί αποκρυπτογράφισης στον σύνδεσμο.", "Save paste": "Αποθήκευση επικόλλησης", - "Your IP is not authorized to create pastes.": "Η IP σας δεν επιτρέπεται να δημιουργεί επικολλήσεις." + "Your IP is not authorized to create pastes.": "Η IP σας δεν επιτρέπεται να δημιουργεί επικολλήσεις.", + "Trying to shorten a URL that isn't pointing at our instance.": "Trying to shorten a URL that isn't pointing at our instance.", + "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".": "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".", + "Error parsing YOURLS response.": "Error parsing YOURLS response." } diff --git a/i18n/en.json b/i18n/en.json index 2ba6068f..ac71b5ae 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -186,5 +186,8 @@ "Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.": "Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.", "URL shortener may expose your decrypt key in URL.": "URL shortener may expose your decrypt key in URL.", "Save paste": "Save paste", - "Your IP is not authorized to create pastes.": "Your IP is not authorized to create pastes." + "Your IP is not authorized to create pastes.": "Your IP is not authorized to create pastes.", + "Trying to shorten a URL that isn't pointing at our instance.": "Trying to shorten a URL that isn't pointing at our instance.", + "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".": "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".", + "Error parsing YOURLS response.": "Error parsing YOURLS response." } diff --git a/i18n/es.json b/i18n/es.json index 641ef3ba..c3687023 100644 --- a/i18n/es.json +++ b/i18n/es.json @@ -186,5 +186,8 @@ "Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.": "Visite este enlace para ver la nota. Dar la URL a cualquier persona también les permite acceder a la nota.", "URL shortener may expose your decrypt key in URL.": "El acortador de URL puede exponer su clave de descifrado en el URL.", "Save paste": "Guardar \"paste\"", - "Your IP is not authorized to create pastes.": "Tu IP no está autorizada para crear contenido." + "Your IP is not authorized to create pastes.": "Tu IP no está autorizada para crear contenido.", + "Trying to shorten a URL that isn't pointing at our instance.": "Trying to shorten a URL that isn't pointing at our instance.", + "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".": "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".", + "Error parsing YOURLS response.": "Error parsing YOURLS response." } diff --git a/i18n/et.json b/i18n/et.json index f02cefba..3a73b83f 100644 --- a/i18n/et.json +++ b/i18n/et.json @@ -186,5 +186,8 @@ "Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.": "Kirja nägemiseks külasta seda linki. Teistele URL-i andmine lubab ka neil ligi pääseda kirjale.", "URL shortener may expose your decrypt key in URL.": "URL-i lühendaja võib paljastada sinu dekrüpteerimisvõtme URL-is.", "Save paste": "Salvesta kleebe", - "Your IP is not authorized to create pastes.": "Your IP is not authorized to create pastes." + "Your IP is not authorized to create pastes.": "Your IP is not authorized to create pastes.", + "Trying to shorten a URL that isn't pointing at our instance.": "Trying to shorten a URL that isn't pointing at our instance.", + "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".": "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".", + "Error parsing YOURLS response.": "Error parsing YOURLS response." } diff --git a/i18n/fi.json b/i18n/fi.json index 90b56733..1956bf41 100644 --- a/i18n/fi.json +++ b/i18n/fi.json @@ -186,5 +186,8 @@ "Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.": "Käy tässä linkissä nähdäksesi viestin. URL:n antaminen kenellekään antaa heidänkin päästä katsomeen viestiä. ", "URL shortener may expose your decrypt key in URL.": "URL-lyhentäjä voi paljastaa purkuavaimesi URL:ssä.", "Save paste": "Tallenna paste", - "Your IP is not authorized to create pastes.": "IP:llesi ei ole annettu oikeutta luoda pasteja." + "Your IP is not authorized to create pastes.": "IP:llesi ei ole annettu oikeutta luoda pasteja.", + "Trying to shorten a URL that isn't pointing at our instance.": "Trying to shorten a URL that isn't pointing at our instance.", + "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".": "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".", + "Error parsing YOURLS response.": "Error parsing YOURLS response." } diff --git a/i18n/fr.json b/i18n/fr.json index 2f3d491e..19f99c0a 100644 --- a/i18n/fr.json +++ b/i18n/fr.json @@ -186,5 +186,8 @@ "Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.": "Visiter ce lien pour voir la note. Donner l'URL à une autre personne lui permet également d'accéder à la note.", "URL shortener may expose your decrypt key in URL.": "Raccourcir l'URL peut exposer votre clé de déchiffrement dans l'URL.", "Save paste": "Sauver le paste", - "Your IP is not authorized to create pastes.": "Votre adresse IP n'est pas autorisée à créer des pastes." + "Your IP is not authorized to create pastes.": "Votre adresse IP n'est pas autorisée à créer des pastes.", + "Trying to shorten a URL that isn't pointing at our instance.": "Trying to shorten a URL that isn't pointing at our instance.", + "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".": "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".", + "Error parsing YOURLS response.": "Error parsing YOURLS response." } diff --git a/i18n/he.json b/i18n/he.json index 503dbc16..3d25ff33 100644 --- a/i18n/he.json +++ b/i18n/he.json @@ -186,5 +186,8 @@ "Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.": "נא לבקר בקישור כדי לצפות בהערה. מסירת הקישור לאנשים כלשהם תאפשר גם להם לגשת להערה.", "URL shortener may expose your decrypt key in URL.": "URL shortener may expose your decrypt key in URL.", "Save paste": "Save paste", - "Your IP is not authorized to create pastes.": "Your IP is not authorized to create pastes." + "Your IP is not authorized to create pastes.": "Your IP is not authorized to create pastes.", + "Trying to shorten a URL that isn't pointing at our instance.": "Trying to shorten a URL that isn't pointing at our instance.", + "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".": "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".", + "Error parsing YOURLS response.": "Error parsing YOURLS response." } diff --git a/i18n/hi.json b/i18n/hi.json index 4df6aa71..4eee3825 100644 --- a/i18n/hi.json +++ b/i18n/hi.json @@ -186,5 +186,8 @@ "Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.": "Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.", "URL shortener may expose your decrypt key in URL.": "URL shortener may expose your decrypt key in URL.", "Save paste": "Save paste", - "Your IP is not authorized to create pastes.": "Your IP is not authorized to create pastes." + "Your IP is not authorized to create pastes.": "Your IP is not authorized to create pastes.", + "Trying to shorten a URL that isn't pointing at our instance.": "Trying to shorten a URL that isn't pointing at our instance.", + "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".": "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".", + "Error parsing YOURLS response.": "Error parsing YOURLS response." } diff --git a/i18n/hu.json b/i18n/hu.json index c9acb042..19f7f16d 100644 --- a/i18n/hu.json +++ b/i18n/hu.json @@ -186,5 +186,8 @@ "Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.": "Látogasd meg ezt a hivatkozást a bejegyzés megtekintéséhez. Ha mások számára is megadod ezt a linket, azzal hozzáférnek ők is.", "URL shortener may expose your decrypt key in URL.": "URL shortener may expose your decrypt key in URL.", "Save paste": "Save paste", - "Your IP is not authorized to create pastes.": "Your IP is not authorized to create pastes." + "Your IP is not authorized to create pastes.": "Your IP is not authorized to create pastes.", + "Trying to shorten a URL that isn't pointing at our instance.": "Trying to shorten a URL that isn't pointing at our instance.", + "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".": "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".", + "Error parsing YOURLS response.": "Error parsing YOURLS response." } diff --git a/i18n/id.json b/i18n/id.json index 1edeb997..b3171df8 100644 --- a/i18n/id.json +++ b/i18n/id.json @@ -186,5 +186,8 @@ "Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.": "Kunjungi tautan ini untuk melihat catatan. Memberikan alamat URL pada siapapun juga, akan mengizinkan mereka untuk mengakses catatan, so pasti gitu loh Kaka.", "URL shortener may expose your decrypt key in URL.": "Pemendek URL mungkin akan menampakkan kunci dekrip Anda dalam URL.", "Save paste": "Simpan paste", - "Your IP is not authorized to create pastes.": "Your IP is not authorized to create pastes." + "Your IP is not authorized to create pastes.": "Your IP is not authorized to create pastes.", + "Trying to shorten a URL that isn't pointing at our instance.": "Trying to shorten a URL that isn't pointing at our instance.", + "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".": "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".", + "Error parsing YOURLS response.": "Error parsing YOURLS response." } diff --git a/i18n/it.json b/i18n/it.json index e00ce310..c724e1fd 100644 --- a/i18n/it.json +++ b/i18n/it.json @@ -186,5 +186,8 @@ "Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.": "Visita questo collegamento per vedere la nota. Dare l'URL a chiunque consente anche a loro di accedere alla nota.", "URL shortener may expose your decrypt key in URL.": "URL shortener può esporre la tua chiave decrittografata nell'URL.", "Save paste": "Salva il messagio", - "Your IP is not authorized to create pastes.": "Il tuo IP non è autorizzato a creare dei messaggi." + "Your IP is not authorized to create pastes.": "Il tuo IP non è autorizzato a creare dei messaggi.", + "Trying to shorten a URL that isn't pointing at our instance.": "Trying to shorten a URL that isn't pointing at our instance.", + "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".": "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".", + "Error parsing YOURLS response.": "Error parsing YOURLS response." } diff --git a/i18n/ja.json b/i18n/ja.json index 330032fd..6f6d9acd 100644 --- a/i18n/ja.json +++ b/i18n/ja.json @@ -186,5 +186,8 @@ "Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.": "Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.", "URL shortener may expose your decrypt key in URL.": "URL shortener may expose your decrypt key in URL.", "Save paste": "Save paste", - "Your IP is not authorized to create pastes.": "Your IP is not authorized to create pastes." + "Your IP is not authorized to create pastes.": "Your IP is not authorized to create pastes.", + "Trying to shorten a URL that isn't pointing at our instance.": "Trying to shorten a URL that isn't pointing at our instance.", + "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".": "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".", + "Error parsing YOURLS response.": "Error parsing YOURLS response." } diff --git a/i18n/jbo.json b/i18n/jbo.json index 82cea900..8bb399a3 100644 --- a/i18n/jbo.json +++ b/i18n/jbo.json @@ -186,5 +186,8 @@ "Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.": "Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.", "URL shortener may expose your decrypt key in URL.": "URL shortener may expose your decrypt key in URL.", "Save paste": "rejgau fukpi", - "Your IP is not authorized to create pastes.": "Your IP is not authorized to create pastes." + "Your IP is not authorized to create pastes.": "Your IP is not authorized to create pastes.", + "Trying to shorten a URL that isn't pointing at our instance.": "Trying to shorten a URL that isn't pointing at our instance.", + "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".": "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".", + "Error parsing YOURLS response.": "Error parsing YOURLS response." } diff --git a/i18n/ku.json b/i18n/ku.json index bca43477..adb5cd5b 100644 --- a/i18n/ku.json +++ b/i18n/ku.json @@ -186,5 +186,8 @@ "Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.": "Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.", "URL shortener may expose your decrypt key in URL.": "URL shortener may expose your decrypt key in URL.", "Save paste": "Save paste", - "Your IP is not authorized to create pastes.": "Your IP is not authorized to create pastes." + "Your IP is not authorized to create pastes.": "Your IP is not authorized to create pastes.", + "Trying to shorten a URL that isn't pointing at our instance.": "Trying to shorten a URL that isn't pointing at our instance.", + "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".": "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".", + "Error parsing YOURLS response.": "Error parsing YOURLS response." } diff --git a/i18n/la.json b/i18n/la.json index fe6c4001..ef2bdf7f 100644 --- a/i18n/la.json +++ b/i18n/la.json @@ -186,5 +186,8 @@ "Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.": "Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.", "URL shortener may expose your decrypt key in URL.": "URL shortener may expose your decrypt key in URL.", "Save paste": "Save paste", - "Your IP is not authorized to create pastes.": "Your IP is not authorized to create pastes." + "Your IP is not authorized to create pastes.": "Your IP is not authorized to create pastes.", + "Trying to shorten a URL that isn't pointing at our instance.": "Trying to shorten a URL that isn't pointing at our instance.", + "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".": "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".", + "Error parsing YOURLS response.": "Error parsing YOURLS response." } diff --git a/i18n/lt.json b/i18n/lt.json index 76b28163..25684e4f 100644 --- a/i18n/lt.json +++ b/i18n/lt.json @@ -186,5 +186,8 @@ "Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.": "Norėdami matyti užrašus, aplankykite šį tinklalapį. Pasidalinus šiuo URL adresu su kitais žmonėmis, jiems taip pat bus leidžiama prieiga prie šių užrašų.", "URL shortener may expose your decrypt key in URL.": "URL trumpinimo įrankis gali atskleisti URL adrese jūsų iššifravimo raktą.", "Save paste": "Įrašyti įdėjimą", - "Your IP is not authorized to create pastes.": "Jūsų IP adresas neturi įgaliojimų kurti įdėjimų." + "Your IP is not authorized to create pastes.": "Jūsų IP adresas neturi įgaliojimų kurti įdėjimų.", + "Trying to shorten a URL that isn't pointing at our instance.": "Trying to shorten a URL that isn't pointing at our instance.", + "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".": "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".", + "Error parsing YOURLS response.": "Error parsing YOURLS response." } diff --git a/i18n/nl.json b/i18n/nl.json index 6157bfa3..8fbb8781 100644 --- a/i18n/nl.json +++ b/i18n/nl.json @@ -186,5 +186,8 @@ "Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.": "Bezoek deze link om de notitie te bekijken. Als je de URL aan iemand geeft, kan die de notitie ook bekijken.", "URL shortener may expose your decrypt key in URL.": "URL-verkorter kan uw ontcijferingssleutel in URL blootleggen.", "Save paste": "Notitie opslaan", - "Your IP is not authorized to create pastes.": "Uw IP-adres is niet gemachtigd om geplakte tekst te maken." + "Your IP is not authorized to create pastes.": "Uw IP-adres is niet gemachtigd om geplakte tekst te maken.", + "Trying to shorten a URL that isn't pointing at our instance.": "Trying to shorten a URL that isn't pointing at our instance.", + "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".": "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".", + "Error parsing YOURLS response.": "Error parsing YOURLS response." } diff --git a/i18n/no.json b/i18n/no.json index eda1e4c5..a2215245 100644 --- a/i18n/no.json +++ b/i18n/no.json @@ -186,5 +186,8 @@ "Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.": "Besøk denne lenken for å se notatet. Hvis lenken deles med andre, vil de også kunne se notatet.", "URL shortener may expose your decrypt key in URL.": "URL forkorter kan avsløre dekrypteringsnøkkelen.", "Save paste": "Lagre utklipp", - "Your IP is not authorized to create pastes.": "Your IP is not authorized to create pastes." + "Your IP is not authorized to create pastes.": "Your IP is not authorized to create pastes.", + "Trying to shorten a URL that isn't pointing at our instance.": "Trying to shorten a URL that isn't pointing at our instance.", + "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".": "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".", + "Error parsing YOURLS response.": "Error parsing YOURLS response." } diff --git a/i18n/oc.json b/i18n/oc.json index f074d919..4890f4a4 100644 --- a/i18n/oc.json +++ b/i18n/oc.json @@ -186,5 +186,8 @@ "Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.": "Visitatz aqueste ligam per veire la nòta. Fornir lo ligam a qualqu’un mai li permet tanben d’accedir a la nòta.", "URL shortener may expose your decrypt key in URL.": "Los espleches d’acorchiment d’URL pòdon expausar la clau de deschiframent dins l’URL.", "Save paste": "Enregistrar lo tèxt", - "Your IP is not authorized to create pastes.": "Vòstra adreça IP a pas l’autorizacion de crear de tèxtes." + "Your IP is not authorized to create pastes.": "Vòstra adreça IP a pas l’autorizacion de crear de tèxtes.", + "Trying to shorten a URL that isn't pointing at our instance.": "Trying to shorten a URL that isn't pointing at our instance.", + "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".": "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".", + "Error parsing YOURLS response.": "Error parsing YOURLS response." } diff --git a/i18n/pl.json b/i18n/pl.json index b6127cad..09bfb25b 100644 --- a/i18n/pl.json +++ b/i18n/pl.json @@ -186,5 +186,8 @@ "Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.": "Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.", "URL shortener may expose your decrypt key in URL.": "URL shortener may expose your decrypt key in URL.", "Save paste": "Save paste", - "Your IP is not authorized to create pastes.": "Your IP is not authorized to create pastes." + "Your IP is not authorized to create pastes.": "Your IP is not authorized to create pastes.", + "Trying to shorten a URL that isn't pointing at our instance.": "Trying to shorten a URL that isn't pointing at our instance.", + "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".": "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".", + "Error parsing YOURLS response.": "Error parsing YOURLS response." } diff --git a/i18n/pt.json b/i18n/pt.json index 72d0250f..f7cc09bd 100644 --- a/i18n/pt.json +++ b/i18n/pt.json @@ -186,5 +186,8 @@ "Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.": "Visite esse link para ver a nota. Dar a URL para qualquer um permite que eles também acessem a nota.", "URL shortener may expose your decrypt key in URL.": "URL shortener may expose your decrypt key in URL.", "Save paste": "Save paste", - "Your IP is not authorized to create pastes.": "Your IP is not authorized to create pastes." + "Your IP is not authorized to create pastes.": "Your IP is not authorized to create pastes.", + "Trying to shorten a URL that isn't pointing at our instance.": "Trying to shorten a URL that isn't pointing at our instance.", + "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".": "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".", + "Error parsing YOURLS response.": "Error parsing YOURLS response." } diff --git a/i18n/ru.json b/i18n/ru.json index f1d237b2..677de762 100644 --- a/i18n/ru.json +++ b/i18n/ru.json @@ -186,5 +186,8 @@ "Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.": "Посетите эту ссылку чтобы просмотреть запись. Передача ссылки кому либо позволит им получить доступ к записи тоже.", "URL shortener may expose your decrypt key in URL.": "Сервис сокращения ссылок может получить ваш ключ расшифровки из ссылки.", "Save paste": "Сохранить запись", - "Your IP is not authorized to create pastes.": "Вашему IP адресу не разрешено создавать записи." + "Your IP is not authorized to create pastes.": "Вашему IP адресу не разрешено создавать записи.", + "Trying to shorten a URL that isn't pointing at our instance.": "Trying to shorten a URL that isn't pointing at our instance.", + "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".": "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".", + "Error parsing YOURLS response.": "Error parsing YOURLS response." } diff --git a/i18n/sk.json b/i18n/sk.json index f1815da3..a1efd043 100644 --- a/i18n/sk.json +++ b/i18n/sk.json @@ -186,5 +186,8 @@ "Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.": "Ak chcete zobraziť poznámku, navštívte tento odkaz. Poskytnutie adresy URL komukoľvek im umožní prístup aj k poznámke.", "URL shortener may expose your decrypt key in URL.": "Skracovač adries URL môže odhaliť váš dešifrovací kľúč v adrese URL.", "Save paste": "Uložiť príspevok", - "Your IP is not authorized to create pastes.": "Vaša IP adresa nie je oprávnená vytvárať príspevky." + "Your IP is not authorized to create pastes.": "Vaša IP adresa nie je oprávnená vytvárať príspevky.", + "Trying to shorten a URL that isn't pointing at our instance.": "Trying to shorten a URL that isn't pointing at our instance.", + "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".": "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".", + "Error parsing YOURLS response.": "Error parsing YOURLS response." } diff --git a/i18n/sl.json b/i18n/sl.json index 27c43611..b1628fc3 100644 --- a/i18n/sl.json +++ b/i18n/sl.json @@ -186,5 +186,8 @@ "Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.": "Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.", "URL shortener may expose your decrypt key in URL.": "URL shortener may expose your decrypt key in URL.", "Save paste": "Save paste", - "Your IP is not authorized to create pastes.": "Your IP is not authorized to create pastes." + "Your IP is not authorized to create pastes.": "Your IP is not authorized to create pastes.", + "Trying to shorten a URL that isn't pointing at our instance.": "Trying to shorten a URL that isn't pointing at our instance.", + "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".": "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".", + "Error parsing YOURLS response.": "Error parsing YOURLS response." } diff --git a/i18n/sv.json b/i18n/sv.json index bb613296..ac8a5843 100644 --- a/i18n/sv.json +++ b/i18n/sv.json @@ -186,5 +186,8 @@ "Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.": "Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.", "URL shortener may expose your decrypt key in URL.": "URL shortener may expose your decrypt key in URL.", "Save paste": "Save paste", - "Your IP is not authorized to create pastes.": "Your IP is not authorized to create pastes." + "Your IP is not authorized to create pastes.": "Your IP is not authorized to create pastes.", + "Trying to shorten a URL that isn't pointing at our instance.": "Trying to shorten a URL that isn't pointing at our instance.", + "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".": "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".", + "Error parsing YOURLS response.": "Error parsing YOURLS response." } diff --git a/i18n/tr.json b/i18n/tr.json index 47d249cd..3b3ad126 100644 --- a/i18n/tr.json +++ b/i18n/tr.json @@ -186,5 +186,8 @@ "Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.": "Notu görmek için bu bağlantıyı ziyaret et. Bağlantıya sahip olan birisi notu görebilir.", "URL shortener may expose your decrypt key in URL.": "URL kısaltıcı şifreleme anahtarınızı URL içerisinde gösterebilir.", "Save paste": "Yazıyı kaydet", - "Your IP is not authorized to create pastes.": "IP adresinizin yazı oluşturmaya yetkisi yoktur." + "Your IP is not authorized to create pastes.": "IP adresinizin yazı oluşturmaya yetkisi yoktur.", + "Trying to shorten a URL that isn't pointing at our instance.": "Trying to shorten a URL that isn't pointing at our instance.", + "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".": "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".", + "Error parsing YOURLS response.": "Error parsing YOURLS response." } diff --git a/i18n/uk.json b/i18n/uk.json index 2dbc6f40..c2f2c5f4 100644 --- a/i18n/uk.json +++ b/i18n/uk.json @@ -186,5 +186,8 @@ "Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.": "Відвідайте посилання, щоб переглянути нотатку. Передача посилання будь-кому дозволить їм переглянути нотатку.", "URL shortener may expose your decrypt key in URL.": "Сервіс скорочення посилань може викрити ваш ключ дешифрування з URL.", "Save paste": "Зберегти вставку", - "Your IP is not authorized to create pastes.": "Вашому IP не дозволено створювати вставки." + "Your IP is not authorized to create pastes.": "Вашому IP не дозволено створювати вставки.", + "Trying to shorten a URL that isn't pointing at our instance.": "Trying to shorten a URL that isn't pointing at our instance.", + "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".": "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".", + "Error parsing YOURLS response.": "Error parsing YOURLS response." } diff --git a/i18n/zh.json b/i18n/zh.json index 9bcad318..004f5926 100644 --- a/i18n/zh.json +++ b/i18n/zh.json @@ -186,5 +186,8 @@ "Visit this link to see the note. Giving the URL to anyone allows them to access the note, too.": "访问此链接来查看该笔记。将此 URL 发送给任何人即可允许其访问该笔记。", "URL shortener may expose your decrypt key in URL.": "短链接服务可能会暴露您在 URL 中的解密密钥。", "Save paste": "保存内容", - "Your IP is not authorized to create pastes.": "您的 IP 无权创建粘贴。" + "Your IP is not authorized to create pastes.": "您的 IP 无权创建粘贴。", + "Trying to shorten a URL that isn't pointing at our instance.": "Trying to shorten a URL that isn't pointing at our instance.", + "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".": "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".", + "Error parsing YOURLS response.": "Error parsing YOURLS response." } diff --git a/lib/YourlsProxy.php b/lib/YourlsProxy.php index 4162a6fa..8a1a4d9e 100644 --- a/lib/YourlsProxy.php +++ b/lib/YourlsProxy.php @@ -49,7 +49,7 @@ class YourlsProxy public function __construct(Configuration $conf, $link) { if (strpos($link, $conf->getKey('basepath') . '/?') === false) { - $this->_error = 'Trying to shorten a URL not pointing to our PrivateBin instance.'; + $this->_error = 'Trying to shorten a URL that isn\'t pointing at our instance.'; return; } From 78e915e049e47dc3e2dfe2636062c8375d5301a0 Mon Sep 17 00:00:00 2001 From: El RIDO Date: Sun, 23 Oct 2022 13:09:54 +0200 Subject: [PATCH 11/15] adding tests for YOURLS functionality --- lib/Controller.php | 2 +- lib/Request.php | 3 +- lib/YourlsProxy.php | 20 ++++++----- tst/ControllerTest.php | 6 ++++ tst/JsonApiTest.php | 51 ++++++++++++++++++++++------ tst/YourlsProxyTest.php | 75 +++++++++++++++++++++++++++++++++++++++++ 6 files changed, 135 insertions(+), 22 deletions(-) create mode 100644 tst/YourlsProxyTest.php diff --git a/lib/Controller.php b/lib/Controller.php index 8d7f0f13..1efd1145 100644 --- a/lib/Controller.php +++ b/lib/Controller.php @@ -383,12 +383,12 @@ class Controller $page = new View; $page->assign('CSPHEADER', $metacspheader); $page->assign('ERROR', I18n::_($this->_error)); + $page->assign('NAME', $this->_conf->getKey('name')); if ($this->_request->getOperation() === 'yourlsproxy') { $page->assign('SHORTURL', $this->_status); $page->draw('yourlsproxy'); return; } - $page->assign('NAME', $this->_conf->getKey('name')); $page->assign('BASEPATH', I18n::_($this->_conf->getKey('basepath'))); $page->assign('STATUS', I18n::_($this->_status)); $page->assign('VERSION', self::VERSION); diff --git a/lib/Request.php b/lib/Request.php index 9ed73074..ea566f5c 100644 --- a/lib/Request.php +++ b/lib/Request.php @@ -137,8 +137,7 @@ class Request } elseif (array_key_exists('jsonld', $this->_params) && !empty($this->_params['jsonld'])) { $this->_operation = 'jsonld'; } elseif (array_key_exists('link', $this->_params) && !empty($this->_params['link'])) { - $request_url = filter_var($_SERVER['REQUEST_URI'], FILTER_SANITIZE_URL); - if (strpos($request_url, '/shortenviayourls?link=') !== false) { + if (strpos($this->getRequestUri(), '/shortenviayourls') !== false) { $this->_operation = 'yourlsproxy'; } } diff --git a/lib/YourlsProxy.php b/lib/YourlsProxy.php index 8a1a4d9e..858317a2 100644 --- a/lib/YourlsProxy.php +++ b/lib/YourlsProxy.php @@ -53,8 +53,14 @@ class YourlsProxy return; } + $yourls_api_url = $conf->getKey('apiurl', 'yourls'); + if (empty($yourls_api_url)) { + $this->_error = 'Error calling YOURLS. Probably a configuration issue, like wrong or missing "apiurl" or "signature".'; + return; + } + $data = file_get_contents( - $conf->getKey('apiurl', 'yourls'), false, stream_context_create( + $yourls_api_url, false, stream_context_create( array( 'http' => array( 'method' => 'POST', @@ -71,23 +77,19 @@ class YourlsProxy ) ) ); - if ($data === false || !is_string($data)) { - $this->_error = 'Error calling YOURLS. Probably a configuration issue, like wrong or missing "apiurl" or "signature".'; - return; - } - try { $data = Json::decode($data); } catch (Exception $e) { - $this->_error = $e->getMessage(); + $this->_error = 'Error calling YOURLS. Probably a configuration issue, like wrong or missing "apiurl" or "signature".'; + error_log('Error calling YOURLS: ' . $e->getMessage()); return; } if ( !is_null($data) && array_key_exists('statusCode', $data) && - array_key_exists('shorturl', $data) && - $data['statusCode'] == 200 + $data['statusCode'] == 200 && + array_key_exists('shorturl', $data) ) { $this->_url = $data['shorturl']; } else { diff --git a/tst/ControllerTest.php b/tst/ControllerTest.php index 5c951273..e1637c11 100644 --- a/tst/ControllerTest.php +++ b/tst/ControllerTest.php @@ -48,6 +48,7 @@ class ControllerTest extends PHPUnit_Framework_TestCase */ public function testView() { + $_SERVER['HTTP_HOST'] = 'example.com'; $_SERVER['QUERY_STRING'] = Helper::getPasteId(); $_GET[Helper::getPasteId()] = ''; ob_start(); @@ -64,6 +65,11 @@ class ControllerTest extends PHPUnit_Framework_TestCase $content, 'doesn\'t output shortener button' ); + $this->assertRegExp( + '# href="https://' . preg_quote($_SERVER['HTTP_HOST']) . '/">switching to HTTPS#', + $content, + 'outputs configured https URL correctly' + ); } /** diff --git a/tst/JsonApiTest.php b/tst/JsonApiTest.php index 6d9732a5..058bd320 100644 --- a/tst/JsonApiTest.php +++ b/tst/JsonApiTest.php @@ -15,6 +15,9 @@ class JsonApiTest extends PHPUnit_Framework_TestCase { /* Setup Routine */ $this->_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'privatebin_data'; + if (!is_dir($this->_path)) { + mkdir($this->_path); + } $this->_model = Filesystem::getInstance(array('dir' => $this->_path)); ServerSalt::setStore($this->_model); @@ -186,8 +189,6 @@ class JsonApiTest extends PHPUnit_Framework_TestCase */ public function testJsonLdPaste() { - $paste = Helper::getPaste(); - $this->_model->create(Helper::getPasteId(), $paste); $_GET['jsonld'] = 'paste'; ob_start(); new Controller; @@ -205,8 +206,6 @@ class JsonApiTest extends PHPUnit_Framework_TestCase */ public function testJsonLdComment() { - $paste = Helper::getPaste(); - $this->_model->create(Helper::getPasteId(), $paste); $_GET['jsonld'] = 'comment'; ob_start(); new Controller; @@ -224,8 +223,6 @@ class JsonApiTest extends PHPUnit_Framework_TestCase */ public function testJsonLdPasteMeta() { - $paste = Helper::getPaste(); - $this->_model->create(Helper::getPasteId(), $paste); $_GET['jsonld'] = 'pastemeta'; ob_start(); new Controller; @@ -243,8 +240,6 @@ class JsonApiTest extends PHPUnit_Framework_TestCase */ public function testJsonLdCommentMeta() { - $paste = Helper::getPaste(); - $this->_model->create(Helper::getPasteId(), $paste); $_GET['jsonld'] = 'commentmeta'; ob_start(); new Controller; @@ -262,8 +257,6 @@ class JsonApiTest extends PHPUnit_Framework_TestCase */ public function testJsonLdInvalid() { - $paste = Helper::getPaste(); - $this->_model->create(Helper::getPasteId(), $paste); $_GET['jsonld'] = CONF; ob_start(); new Controller; @@ -271,4 +264,42 @@ class JsonApiTest extends PHPUnit_Framework_TestCase ob_end_clean(); $this->assertEquals('{}', $content, 'does not output nasty data'); } + + /** + * @runInSeparateProcess + */ + public function testShortenViaYourls() + { + $mock_yourls_service = $this->_path . DIRECTORY_SEPARATOR . 'yourls.json'; + $options = parse_ini_file(CONF, true); + $options['main']['basepath'] = 'https://example.com/path'; + $options['main']['urlshortener'] = 'https://example.com/path/shortenviayourls?link='; + $options['yourls']['apiurl'] = $mock_yourls_service; + Helper::createIniFile(CONF, $options); + + // the real service answer is more complex, but we only look for the shorturl & statusCode + file_put_contents($mock_yourls_service, '{"shorturl":"https:\/\/example.com\/1","statusCode":200}'); + + $_SERVER['REQUEST_URI'] = '/path/shortenviayourls?link=https%3A%2F%2Fexample.com%2Fpath%2F%3Ffoo%23bar'; + $_GET['link'] = 'https://example.com/path/?foo#bar'; + ob_start(); + new Controller; + $content = ob_get_contents(); + ob_end_clean(); + $this->assertContains('id="pasteurl" href="https://example.com/1"', $content, 'outputs shortened URL correctly'); + } + + /** + * @runInSeparateProcess + */ + public function testShortenViaYourlsFailure() + { + $_SERVER['REQUEST_URI'] = '/path/shortenviayourls?link=https%3A%2F%2Fexample.com%2Fpath%2F%3Ffoo%23bar'; + $_GET['link'] = 'https://example.com/path/?foo#bar'; + ob_start(); + new Controller; + $content = ob_get_contents(); + ob_end_clean(); + $this->assertContains('Error calling YOURLS.', $content, 'outputs error correctly'); + } } diff --git a/tst/YourlsProxyTest.php b/tst/YourlsProxyTest.php new file mode 100644 index 00000000..8c90112c --- /dev/null +++ b/tst/YourlsProxyTest.php @@ -0,0 +1,75 @@ +_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'privatebin_data'; + if (!is_dir($this->_path)) { + mkdir($this->_path); + } + $this->_mock_yourls_service = $this->_path . DIRECTORY_SEPARATOR . 'yourls.json'; + $options = parse_ini_file(CONF_SAMPLE, true); + $options['main']['basepath'] = 'https://example.com'; + $options['main']['urlshortener'] = 'https://example.com/shortenviayourls?link='; + $options['yourls']['apiurl'] = $this->_mock_yourls_service; + Helper::confBackup(); + Helper::createIniFile(CONF, $options); + $this->_conf = new Configuration; + } + + public function tearDown() + { + /* Tear Down Routine */ + unlink(CONF); + Helper::confRestore(); + Helper::rmDir($this->_path); + } + + public function testYourlsProxy() + { + // the real service answer is more complex, but we only look for the shorturl & statusCode + file_put_contents($this->_mock_yourls_service, '{"shorturl":"https:\/\/example.com\/1","statusCode":200}'); + + $yourls = new YourlsProxy($this->_conf, 'https://example.com/?foo#bar'); + $this->assertFalse($yourls->isError()); + $this->assertEquals($yourls->getUrl(), 'https://example.com/1'); + } + + public function testForeignUrl() + { + $yourls = new YourlsProxy($this->_conf, 'https://other.example.com/?foo#bar'); + $this->assertTrue($yourls->isError()); + $this->assertEquals($yourls->getError(), 'Trying to shorten a URL that isn\'t pointing at our instance.'); + } + + public function testYourlsError() + { + // when statusCode is not 200, shorturl may not have been set + file_put_contents($this->_mock_yourls_service, '{"statusCode":403}'); + + $yourls = new YourlsProxy($this->_conf, 'https://example.com/?foo#bar'); + $this->assertTrue($yourls->isError()); + $this->assertEquals($yourls->getError(), 'Error parsing YOURLS response.'); + } + + public function testServerError() + { + // simulate some other server error that results in a non-JSON reply + file_put_contents($this->_mock_yourls_service, ''); + + $yourls = new YourlsProxy($this->_conf, 'https://example.com/?foo#bar'); + $this->assertTrue($yourls->isError()); + $this->assertEquals($yourls->getError(), 'Error calling YOURLS. Probably a configuration issue, like wrong or missing "apiurl" or "signature".'); + } +} \ No newline at end of file From 0a949d39032e940fe131995eb23aa9ef24bc84a3 Mon Sep 17 00:00:00 2001 From: El RIDO Date: Sun, 23 Oct 2022 13:10:55 +0200 Subject: [PATCH 12/15] credit change, document it and improve wording --- CHANGELOG.md | 1 + CREDITS.md | 1 + cfg/conf.sample.php | 11 ++++++++--- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6431e67f..b897b676 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ * CHANGED: Upgrading libraries to: zlib 1.2.13 * FIXED: Revert to CREATE INDEX without IF NOT EXISTS clauses, to support MySQL (#943) * FIXED: Apply table prefix to indexes as well, to support multiple instances sharing a single database (#943) + * FIXED: YOURLS integration via new proxy, storing signature in configuration (#725) * **1.4 (2022-04-09)** * ADDED: Translations for Corsican, Estonian, Finnish and Lojban * ADDED: new HTTP headers improving security (#765) diff --git a/CREDITS.md b/CREDITS.md index d0035077..97c11251 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -30,6 +30,7 @@ * Mark van Holsteijn - Google Cloud Storage backend * Austin Huang - Oracle database support * Felix J. Ogris - S3 Storage backend +* Mounir Idrassi & J. Mozdzen - secure YOURLS integration ## Translations * Hexalyse - French diff --git a/cfg/conf.sample.php b/cfg/conf.sample.php index 487a20ae..7afe7aae 100644 --- a/cfg/conf.sample.php +++ b/cfg/conf.sample.php @@ -230,9 +230,14 @@ dir = PATH "data" [yourls] ; don't mix this up with "urlshortener" config item: -; - when using a standard configuration, "urlshortener" will point to the YOURLS API, including access credentials, and will be part of the PrivateBin public web page (insecure!) -; - when using the parameters in this section ("signature" and "apiurl"), "urlshortener" will point to a fixed PrivateBin page ("$basepath/shortenviayourls.php") and -; that PHP will in turn call YOURLS server-side, using the URL from "apiurl" and using the "access signature" from "signature" parameter. +; - when using a standard configuration, "urlshortener" will point to the YOURLS +; API, including access credentials, and will be part of the PrivateBin public +; web page (insecure!) +; - when using the parameters in this section ("signature" and "apiurl"), +; "urlshortener" will point to a fixed PrivateBin page +; ("$basepath/shortenviayourls?link=") and that URL will in turn call YOURLS +; server-side, using the URL from "apiurl" and the "access signature" from the +; "signature" parameters below. ; (optional) the "signature" (access key) issued by YOURLS for the using account ; signature = "" From 2776033997c5b7d18a6c929bf983653ccc9aa124 Mon Sep 17 00:00:00 2001 From: El RIDO Date: Sun, 23 Oct 2022 13:13:12 +0200 Subject: [PATCH 13/15] apply StyleCI recommendations --- tst/JsonApiTest.php | 2 +- tst/YourlsProxyTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tst/JsonApiTest.php b/tst/JsonApiTest.php index 058bd320..6f48b1b4 100644 --- a/tst/JsonApiTest.php +++ b/tst/JsonApiTest.php @@ -295,7 +295,7 @@ class JsonApiTest extends PHPUnit_Framework_TestCase public function testShortenViaYourlsFailure() { $_SERVER['REQUEST_URI'] = '/path/shortenviayourls?link=https%3A%2F%2Fexample.com%2Fpath%2F%3Ffoo%23bar'; - $_GET['link'] = 'https://example.com/path/?foo#bar'; + $_GET['link'] = 'https://example.com/path/?foo#bar'; ob_start(); new Controller; $content = ob_get_contents(); diff --git a/tst/YourlsProxyTest.php b/tst/YourlsProxyTest.php index 8c90112c..6e4df607 100644 --- a/tst/YourlsProxyTest.php +++ b/tst/YourlsProxyTest.php @@ -72,4 +72,4 @@ class YourlsProxyTest extends PHPUnit_Framework_TestCase $this->assertTrue($yourls->isError()); $this->assertEquals($yourls->getError(), 'Error calling YOURLS. Probably a configuration issue, like wrong or missing "apiurl" or "signature".'); } -} \ No newline at end of file +} From 44f78ffcdf6d59ca370d51608f5d0724bd5686e4 Mon Sep 17 00:00:00 2001 From: El RIDO Date: Sun, 23 Oct 2022 13:14:27 +0200 Subject: [PATCH 14/15] apply StyleCI recommendations --- tst/JsonApiTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tst/JsonApiTest.php b/tst/JsonApiTest.php index 6f48b1b4..4ad629ee 100644 --- a/tst/JsonApiTest.php +++ b/tst/JsonApiTest.php @@ -281,7 +281,7 @@ class JsonApiTest extends PHPUnit_Framework_TestCase file_put_contents($mock_yourls_service, '{"shorturl":"https:\/\/example.com\/1","statusCode":200}'); $_SERVER['REQUEST_URI'] = '/path/shortenviayourls?link=https%3A%2F%2Fexample.com%2Fpath%2F%3Ffoo%23bar'; - $_GET['link'] = 'https://example.com/path/?foo#bar'; + $_GET['link'] = 'https://example.com/path/?foo#bar'; ob_start(); new Controller; $content = ob_get_contents(); From a66f170c5e9812bf4564db9909b459086e165d29 Mon Sep 17 00:00:00 2001 From: El RIDO Date: Sun, 23 Oct 2022 13:21:22 +0200 Subject: [PATCH 15/15] PHP 5.6 seems to tolerate an empty string as valid JSON --- tst/YourlsProxyTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tst/YourlsProxyTest.php b/tst/YourlsProxyTest.php index 6e4df607..2e372995 100644 --- a/tst/YourlsProxyTest.php +++ b/tst/YourlsProxyTest.php @@ -66,7 +66,7 @@ class YourlsProxyTest extends PHPUnit_Framework_TestCase public function testServerError() { // simulate some other server error that results in a non-JSON reply - file_put_contents($this->_mock_yourls_service, ''); + file_put_contents($this->_mock_yourls_service, '500 Internal Server Error'); $yourls = new YourlsProxy($this->_conf, 'https://example.com/?foo#bar'); $this->assertTrue($yourls->isError());