diff --git a/CHANGELOG.md b/CHANGELOG.md index 6431e67..b897b67 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 d003507..97c1125 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 cf46598..7afe7aa 100644 --- a/cfg/conf.sample.php +++ b/cfg/conf.sample.php @@ -227,3 +227,20 @@ 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?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 = "" + +; (optional) the URL of the YOURLS API, called to shorten a PrivateBin URL +; apiurl = "" diff --git a/i18n/ar.json b/i18n/ar.json index 1827ddf..dbc85bc 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 717c5f1..ec8f540 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 0165198..154110d 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 21ca71e..90b6811 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 82cb173..6996f9a 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 42752f2..7ab5705 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 15df67b..4f1a601 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 2ba6068..ac71b5a 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 641ef3b..c368702 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 f02cefb..3a73b83 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 90b5673..1956bf4 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 2f3d491..19f99c0 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 503dbc1..3d25ff3 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 4df6aa7..4eee382 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 c9acb04..19f7f16 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 1edeb99..b3171df 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 e00ce31..c724e1f 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 330032f..6f6d9ac 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 82cea90..8bb399a 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 bca4347..adb5cd5 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 fe6c400..ef2bdf7 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 76b2816..25684e4 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 6157bfa..8fbb878 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 eda1e4c..a221524 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 f074d91..4890f4a 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 b6127ca..09bfb25 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 72d0250..f7cc09b 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 f1d237b..677de76 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 f1815da..a1efd04 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 27c4361..b1628fc 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 bb61329..ac8a584 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 47d249c..3b3ad12 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 2dbc6f4..c2f2c5f 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 9bcad31..004f592 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/Configuration.php b/lib/Configuration.php index fad44a2..6f3a822 100644 --- a/lib/Configuration.php +++ b/lib/Configuration.php @@ -93,6 +93,10 @@ class Configuration 'model_options' => array( 'dir' => 'data', ), + 'yourls' => array( + 'signature' => '', + 'apiurl' => '', + ), ); /** diff --git a/lib/Controller.php b/lib/Controller.php index 62fa1e9..1efd114 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('NAME', $this->_conf->getKey('name')); - $page->assign('BASEPATH', I18n::_($this->_conf->getKey('basepath'))); + $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('BASEPATH', I18n::_($this->_conf->getKey('basepath'))); $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 2eff8a9..ea566f5 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,10 @@ 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'])) { + if (strpos($this->getRequestUri(), '/shortenviayourls') !== false) { + $this->_operation = 'yourlsproxy'; + } } } diff --git a/lib/YourlsProxy.php b/lib/YourlsProxy.php new file mode 100644 index 0000000..858317a --- /dev/null +++ b/lib/YourlsProxy.php @@ -0,0 +1,132 @@ +getKey('basepath') . '/?') === false) { + $this->_error = 'Trying to shorten a URL that isn\'t pointing at our instance.'; + 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( + $yourls_api_url, 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, + ) + ), + ), + ) + ) + ); + try { + $data = Json::decode($data); + } catch (Exception $e) { + $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) && + $data['statusCode'] == 200 && + array_key_exists('shorturl', $data) + ) { + $this->_url = $data['shorturl']; + } else { + $this->_error = 'Error parsing YOURLS response.'; + } + } + + /** + * 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/tpl/yourlsproxy.php b/tpl/yourlsproxy.php new file mode 100644 index 0000000..f642047 --- /dev/null +++ b/tpl/yourlsproxy.php @@ -0,0 +1,27 @@ + + +
+ + + + +%s (Hit [Ctrl]+[c] to copy)', $SHORTURL, $SHORTURL); ?>
+ +