From d0e03e5167f5714da720a088915df75509356f42 Mon Sep 17 00:00:00 2001 From: El RIDO Date: Sat, 27 Jan 2024 18:26:19 +0100 Subject: [PATCH] change logic into asking for loading confirmation also: - fixes #1039 - email buttons overlapping in some languages - fixes #1191 - language change URL mangling - adds focus to password input in modal - prevents needless reload on visiting default URL --- i18n/ar.json | 4 +- i18n/bg.json | 4 +- i18n/ca.json | 4 +- i18n/co.json | 4 +- i18n/cs.json | 4 +- i18n/de.json | 4 +- i18n/el.json | 4 +- i18n/en.json | 4 +- i18n/es.json | 4 +- i18n/et.json | 4 +- i18n/fi.json | 4 +- i18n/fr.json | 4 +- i18n/he.json | 4 +- i18n/hi.json | 4 +- i18n/hu.json | 4 +- i18n/id.json | 4 +- i18n/it.json | 4 +- i18n/ja.json | 4 +- i18n/jbo.json | 4 +- i18n/ku.json | 4 +- i18n/la.json | 4 +- i18n/lt.json | 4 +- i18n/nl.json | 4 +- i18n/no.json | 4 +- i18n/oc.json | 4 +- i18n/pl.json | 4 +- i18n/pt.json | 4 +- i18n/ru.json | 4 +- i18n/sk.json | 4 +- i18n/sl.json | 4 +- i18n/sv.json | 4 +- i18n/th.json | 4 +- i18n/tr.json | 4 +- i18n/uk.json | 4 +- i18n/zh.json | 4 +- js/privatebin.js | 152 +++++++++++++++++++--------------------------- tpl/bootstrap.php | 52 +++++++++------- tpl/page.php | 2 +- 38 files changed, 196 insertions(+), 150 deletions(-) diff --git a/i18n/ar.json b/i18n/ar.json index 06d50166..3752a362 100644 --- a/i18n/ar.json +++ b/i18n/ar.json @@ -214,5 +214,7 @@ "Your IP is not authorized to create pastes.": "عنوان IP الخاص بك غير مصرح له بإنشاء لصُق.", "Trying to shorten a URL that isn't pointing at our instance.": "محاولة تقصير عنوان URL لا يشير إلى خادمنا.", "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".": "خطأ في الاتصال بـ YOURLS. ربما تكون هناك مشكلة في التضبيط، مثل \"apiurl\" أو \"التوقيع\" الخاطئ أو المفقود.", - "Error parsing YOURLS response.": "خطأ في تحليل استجابة YOURLS." + "Error parsing YOURLS response.": "خطأ في تحليل استجابة YOURLS.", + "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?": "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?", + "Yes, load it": "Yes, load it" } diff --git a/i18n/bg.json b/i18n/bg.json index 9327467a..e7cb35a3 100644 --- a/i18n/bg.json +++ b/i18n/bg.json @@ -214,5 +214,7 @@ "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." + "Error parsing YOURLS response.": "Error parsing YOURLS response.", + "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?": "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?", + "Yes, load it": "Yes, load it" } diff --git a/i18n/ca.json b/i18n/ca.json index b9c5efbd..7ed9846b 100644 --- a/i18n/ca.json +++ b/i18n/ca.json @@ -214,5 +214,7 @@ "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." + "Error parsing YOURLS response.": "Error parsing YOURLS response.", + "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?": "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?", + "Yes, load it": "Yes, load it" } diff --git a/i18n/co.json b/i18n/co.json index 0be1ff54..b848f0ef 100644 --- a/i18n/co.json +++ b/i18n/co.json @@ -214,5 +214,7 @@ "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.": "Pruvate d’ammuzzà un indirizzu web chì ùn punta micca versu a vostra instanza.", "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".": "Sbagliu à a chjama di YOURLS. Seria forse una cunfigurazione gattiva, tale una \"apiurl\" o \"signature\" falsa o assente.", - "Error parsing YOURLS response.": "Sbagliu durante l’analisa di a risposta di YOURLS." + "Error parsing YOURLS response.": "Sbagliu durante l’analisa di a risposta di YOURLS.", + "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?": "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?", + "Yes, load it": "Yes, load it" } diff --git a/i18n/cs.json b/i18n/cs.json index c049c733..49afae50 100644 --- a/i18n/cs.json +++ b/i18n/cs.json @@ -214,5 +214,7 @@ "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." + "Error parsing YOURLS response.": "Error parsing YOURLS response.", + "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?": "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?", + "Yes, load it": "Yes, load it" } diff --git a/i18n/de.json b/i18n/de.json index fce60cc3..8e81f73c 100644 --- a/i18n/de.json +++ b/i18n/de.json @@ -214,5 +214,7 @@ "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.": "Versuch eine URL zu verkürzen, die nicht auf unsere Instanz zeigt.", "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".": "Fehler beim Aufruf von YOURLS. Wahrscheinlich ein Konfigurationsproblem, wie eine falsche oder fehlende \"apiurl\" oder \"signature\".", - "Error parsing YOURLS response.": "Fehler beim Verarbeiten der YOURLS-Antwort." + "Error parsing YOURLS response.": "Fehler beim Verarbeiten der YOURLS-Antwort.", + "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?": "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?", + "Yes, load it": "Yes, load it" } diff --git a/i18n/el.json b/i18n/el.json index 388edec6..94e13fb9 100644 --- a/i18n/el.json +++ b/i18n/el.json @@ -214,5 +214,7 @@ "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." + "Error parsing YOURLS response.": "Error parsing YOURLS response.", + "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?": "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?", + "Yes, load it": "Yes, load it" } diff --git a/i18n/en.json b/i18n/en.json index 68ff1aae..6ef3280b 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -214,5 +214,7 @@ "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." + "Error parsing YOURLS response.": "Error parsing YOURLS response.", + "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?": "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?", + "Yes, load it": "Yes, load it" } diff --git a/i18n/es.json b/i18n/es.json index 97fab2fb..e5e4c9b5 100644 --- a/i18n/es.json +++ b/i18n/es.json @@ -214,5 +214,7 @@ "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.": "Intentando acortar una URL que no apunta a nuestra instancia.", "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." + "Error parsing YOURLS response.": "Error parsing YOURLS response.", + "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?": "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?", + "Yes, load it": "Yes, load it" } diff --git a/i18n/et.json b/i18n/et.json index 3cc47d55..e123e7f9 100644 --- a/i18n/et.json +++ b/i18n/et.json @@ -214,5 +214,7 @@ "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." + "Error parsing YOURLS response.": "Error parsing YOURLS response.", + "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?": "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?", + "Yes, load it": "Yes, load it" } diff --git a/i18n/fi.json b/i18n/fi.json index 063df4a3..da935c52 100644 --- a/i18n/fi.json +++ b/i18n/fi.json @@ -214,5 +214,7 @@ "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.": "Yritetään lyhentää URL-osoite, joka ei osoita meidän instanssiiin.", "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".": "Virhe kutsuttaessa YOURLS. Luultavasti asetusongelma kuten väärä tai puuttuuva \"apiurl\" tai \"signature\".", - "Error parsing YOURLS response.": "Virhe jäsennettäessä YOURLS-vastausta." + "Error parsing YOURLS response.": "Virhe jäsennettäessä YOURLS-vastausta.", + "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?": "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?", + "Yes, load it": "Yes, load it" } diff --git a/i18n/fr.json b/i18n/fr.json index ad9012db..d90f8578 100644 --- a/i18n/fr.json +++ b/i18n/fr.json @@ -214,5 +214,7 @@ "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." + "Error parsing YOURLS response.": "Error parsing YOURLS response.", + "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?": "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?", + "Yes, load it": "Yes, load it" } diff --git a/i18n/he.json b/i18n/he.json index 93509e63..658e586b 100644 --- a/i18n/he.json +++ b/i18n/he.json @@ -214,5 +214,7 @@ "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." + "Error parsing YOURLS response.": "Error parsing YOURLS response.", + "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?": "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?", + "Yes, load it": "Yes, load it" } diff --git a/i18n/hi.json b/i18n/hi.json index 68ff1aae..6ef3280b 100644 --- a/i18n/hi.json +++ b/i18n/hi.json @@ -214,5 +214,7 @@ "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." + "Error parsing YOURLS response.": "Error parsing YOURLS response.", + "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?": "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?", + "Yes, load it": "Yes, load it" } diff --git a/i18n/hu.json b/i18n/hu.json index 9384be7e..d9161090 100644 --- a/i18n/hu.json +++ b/i18n/hu.json @@ -214,5 +214,7 @@ "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." + "Error parsing YOURLS response.": "Error parsing YOURLS response.", + "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?": "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?", + "Yes, load it": "Yes, load it" } diff --git a/i18n/id.json b/i18n/id.json index 85439d03..a0e844e8 100644 --- a/i18n/id.json +++ b/i18n/id.json @@ -214,5 +214,7 @@ "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." + "Error parsing YOURLS response.": "Error parsing YOURLS response.", + "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?": "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?", + "Yes, load it": "Yes, load it" } diff --git a/i18n/it.json b/i18n/it.json index f12ed03b..c23b1655 100644 --- a/i18n/it.json +++ b/i18n/it.json @@ -214,5 +214,7 @@ "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.": "Tantativo in corso di accorciare un URL che non punta alla nostra istanza.", "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".": "Errore nella chiamata a YOURLS. Probabilmente un problema di configurazione, come un \"apiurl\" o una \"signature\" sbagliati o mancanti.", - "Error parsing YOURLS response.": "Errore nell'analizzare la risposta YOURLS." + "Error parsing YOURLS response.": "Errore nell'analizzare la risposta YOURLS.", + "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?": "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?", + "Yes, load it": "Yes, load it" } diff --git a/i18n/ja.json b/i18n/ja.json index f06f37be..07323772 100644 --- a/i18n/ja.json +++ b/i18n/ja.json @@ -214,5 +214,7 @@ "Your IP is not authorized to create pastes.": "あなたのIPアドレスにはペーストを作成する権限がありません。", "Trying to shorten a URL that isn't pointing at our instance.": "このインスタンスを指していないURLを短縮しようとしています。", "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".": "YOURLSの呼び出し中にエラーが発生しました。\"apiurl\"または\"signature\"等の設定に問題がある可能性があります。", - "Error parsing YOURLS response.": "YOURLSレスポンスの解析中にエラーが発生しました。" + "Error parsing YOURLS response.": "YOURLSレスポンスの解析中にエラーが発生しました。", + "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?": "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?", + "Yes, load it": "Yes, load it" } diff --git a/i18n/jbo.json b/i18n/jbo.json index a8105510..f729f613 100644 --- a/i18n/jbo.json +++ b/i18n/jbo.json @@ -214,5 +214,7 @@ "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." + "Error parsing YOURLS response.": "Error parsing YOURLS response.", + "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?": "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?", + "Yes, load it": "Yes, load it" } diff --git a/i18n/ku.json b/i18n/ku.json index 68ff1aae..6ef3280b 100644 --- a/i18n/ku.json +++ b/i18n/ku.json @@ -214,5 +214,7 @@ "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." + "Error parsing YOURLS response.": "Error parsing YOURLS response.", + "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?": "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?", + "Yes, load it": "Yes, load it" } diff --git a/i18n/la.json b/i18n/la.json index 8ee0d6db..895f0b02 100644 --- a/i18n/la.json +++ b/i18n/la.json @@ -214,5 +214,7 @@ "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." + "Error parsing YOURLS response.": "Error parsing YOURLS response.", + "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?": "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?", + "Yes, load it": "Yes, load it" } diff --git a/i18n/lt.json b/i18n/lt.json index 25364269..81dfe123 100644 --- a/i18n/lt.json +++ b/i18n/lt.json @@ -214,5 +214,7 @@ "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.": "Bandoma sutrumpinti URL adresą, kuris nenurodo į mūsų egzempliorių.", "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".": "Klaida iškviečiant YOURLS. Tikriausiai, konfigūracijos klaida, pavyzdžiui, neteisingi „apiurl“ ar „signature“, arba jų nėra.", - "Error parsing YOURLS response.": "Klaida nagrinėjant YOURLS atsaką." + "Error parsing YOURLS response.": "Klaida nagrinėjant YOURLS atsaką.", + "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?": "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?", + "Yes, load it": "Yes, load it" } diff --git a/i18n/nl.json b/i18n/nl.json index d7a26664..fc058a20 100644 --- a/i18n/nl.json +++ b/i18n/nl.json @@ -214,5 +214,7 @@ "Your IP is not authorized to create pastes.": "Je IP-adres is niet gemachtigd om pastes te maken.", "Trying to shorten a URL that isn't pointing at our instance.": "Proberen om een URL te verkorten dat niet naar ons systeem wijst.", "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".": "Foutmelding ophalen YOURLS. Waarschijnlijk een configuratiefout, zoals een verkeerde of missende \"apiurl\" of \"signature\".", - "Error parsing YOURLS response.": "Foutmelding bij parsen van YOURLS respons." + "Error parsing YOURLS response.": "Foutmelding bij parsen van YOURLS respons.", + "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?": "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?", + "Yes, load it": "Yes, load it" } diff --git a/i18n/no.json b/i18n/no.json index fbbd5dc5..00417f24 100644 --- a/i18n/no.json +++ b/i18n/no.json @@ -214,5 +214,7 @@ "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." + "Error parsing YOURLS response.": "Error parsing YOURLS response.", + "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?": "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?", + "Yes, load it": "Yes, load it" } diff --git a/i18n/oc.json b/i18n/oc.json index 4c5c40f2..7553fb0e 100644 --- a/i18n/oc.json +++ b/i18n/oc.json @@ -214,5 +214,7 @@ "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.": "Ensag d’abracar una URL que mena pas a nòstra instància.", "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".": "Error en cridant YOURLS. Es probablament un problèma de configuracion, quicòm coma « apirul » o « signature » marrit o absent.", - "Error parsing YOURLS response.": "Error d'analisi de la responsa YOURLS." + "Error parsing YOURLS response.": "Error d'analisi de la responsa YOURLS.", + "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?": "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?", + "Yes, load it": "Yes, load it" } diff --git a/i18n/pl.json b/i18n/pl.json index 6bd76b99..ec1930dd 100644 --- a/i18n/pl.json +++ b/i18n/pl.json @@ -214,5 +214,7 @@ "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." + "Error parsing YOURLS response.": "Error parsing YOURLS response.", + "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?": "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?", + "Yes, load it": "Yes, load it" } diff --git a/i18n/pt.json b/i18n/pt.json index 4adb56c4..3b7866db 100644 --- a/i18n/pt.json +++ b/i18n/pt.json @@ -214,5 +214,7 @@ "Your IP is not authorized to create pastes.": "Seu IP não está autorizado a criar cópias.", "Trying to shorten a URL that isn't pointing at our instance.": "Tentando encurtar uma URL que não aponta para a nossa instância.", "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." + "Error parsing YOURLS response.": "Error parsing YOURLS response.", + "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?": "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?", + "Yes, load it": "Yes, load it" } diff --git a/i18n/ru.json b/i18n/ru.json index 54f8239f..00084dc8 100644 --- a/i18n/ru.json +++ b/i18n/ru.json @@ -214,5 +214,7 @@ "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." + "Error parsing YOURLS response.": "Error parsing YOURLS response.", + "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?": "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?", + "Yes, load it": "Yes, load it" } diff --git a/i18n/sk.json b/i18n/sk.json index bab0ab36..c73fe638 100644 --- a/i18n/sk.json +++ b/i18n/sk.json @@ -214,5 +214,7 @@ "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.": "Pokúšate sa skrátiť adresu URL, ktorá neukazuje na túto inštanciu.", "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." + "Error parsing YOURLS response.": "Error parsing YOURLS response.", + "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?": "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?", + "Yes, load it": "Yes, load it" } diff --git a/i18n/sl.json b/i18n/sl.json index 1a93bed5..f3baab91 100644 --- a/i18n/sl.json +++ b/i18n/sl.json @@ -214,5 +214,7 @@ "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." + "Error parsing YOURLS response.": "Error parsing YOURLS response.", + "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?": "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?", + "Yes, load it": "Yes, load it" } diff --git a/i18n/sv.json b/i18n/sv.json index 68ff1aae..6ef3280b 100644 --- a/i18n/sv.json +++ b/i18n/sv.json @@ -214,5 +214,7 @@ "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." + "Error parsing YOURLS response.": "Error parsing YOURLS response.", + "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?": "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?", + "Yes, load it": "Yes, load it" } diff --git a/i18n/th.json b/i18n/th.json index 48237005..4325ab1d 100644 --- a/i18n/th.json +++ b/i18n/th.json @@ -214,5 +214,7 @@ "Your IP is not authorized to create pastes.": "IP ของคุณไม่ได้รับอนุญาตให้สร้างการฝากโค้ด", "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\".": "เกิดข้อผิดพลาดในการเรียก YOURLS อาจเป็นปัญหามาจากการกำหนดค่า เช่น \"apiurl\" หรือ \"signature\" ไม่ถูกต้องหรือขาดหายไป", - "Error parsing YOURLS response.": "เกิดข้อผิดพลาดในการแยกวิเคราะห์การตอบสนองของ YOURLS" + "Error parsing YOURLS response.": "เกิดข้อผิดพลาดในการแยกวิเคราะห์การตอบสนองของ YOURLS", + "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?": "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?", + "Yes, load it": "Yes, load it" } diff --git a/i18n/tr.json b/i18n/tr.json index 4dc8c4a4..5164aee6 100644 --- a/i18n/tr.json +++ b/i18n/tr.json @@ -214,5 +214,7 @@ "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." + "Error parsing YOURLS response.": "Error parsing YOURLS response.", + "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?": "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?", + "Yes, load it": "Yes, load it" } diff --git a/i18n/uk.json b/i18n/uk.json index ad80289f..0d514b5a 100644 --- a/i18n/uk.json +++ b/i18n/uk.json @@ -214,5 +214,7 @@ "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." + "Error parsing YOURLS response.": "Error parsing YOURLS response.", + "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?": "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?", + "Yes, load it": "Yes, load it" } diff --git a/i18n/zh.json b/i18n/zh.json index 61b32cbd..421622f5 100644 --- a/i18n/zh.json +++ b/i18n/zh.json @@ -214,5 +214,7 @@ "Your IP is not authorized to create pastes.": "您的 IP 无权创建粘贴。", "Trying to shorten a URL that isn't pointing at our instance.": "尝试缩短一个不指向我们实例的URL。", "Error calling YOURLS. Probably a configuration issue, like wrong or missing \"apiurl\" or \"signature\".": "调用 YOURLS 时出错。可能是配置问题,例如“apiurl”或“signature”错误或缺失。", - "Error parsing YOURLS response.": "解析 YOURLS 响应时出错。" + "Error parsing YOURLS response.": "解析 YOURLS 响应时出错。", + "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?": "Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?", + "Yes, load it": "Yes, load it" } diff --git a/js/privatebin.js b/js/privatebin.js index 23a4fe20..83865562 100644 --- a/js/privatebin.js +++ b/js/privatebin.js @@ -77,6 +77,13 @@ jQuery.PrivateBin = (function($, RawDeflate) { } }; + /** + * URL fragment prefix requiring load confirmation + * + * @private + */ + const loadConfirmPrefix = '#?'; + /** * CryptoData class * @@ -1512,15 +1519,11 @@ jQuery.PrivateBin = (function($, RawDeflate) { me.getPasteKey = function() { if (symmetricKey === null) { - let pos = 1; - const pt = '#protected/'; - if(window.location.hash.startsWith(pt)) { - pos = pt.length; - } - let newKey = window.location.hash.substring(pos); - if (newKey === '') { - throw 'no encryption key given'; + let startPos = 1; + if(window.location.hash.startsWith(loadConfirmPrefix)) { + startPos = loadConfirmPrefix.length; } + let newKey = window.location.hash.substring(startPos); // Some web 2.0 services and redirectors add data AFTER the anchor // (such as &utm_source=...). We will strip any additional data. @@ -1529,6 +1532,9 @@ jQuery.PrivateBin = (function($, RawDeflate) { { newKey = newKey.substring(0, ampersandPos); } + if (newKey === '') { + throw 'no encryption key given'; + } // version 2 uses base58, version 1 uses base64 without decoding try { @@ -2242,7 +2248,7 @@ jQuery.PrivateBin = (function($, RawDeflate) { * @function * @param {Event} event */ - async function submitPasswordModal(event) + function submitPasswordModal(event) { event.preventDefault(); @@ -2252,37 +2258,37 @@ jQuery.PrivateBin = (function($, RawDeflate) { // hide modal $passwordModal.modal('hide'); - // check if protected pathname - const url = new URL(window.location); - - // if protected request password - if(url.hash.startsWith('#protected/')) { - const pt = '#protected/'; - let pos = pt.length; - let newKey = window.location.hash.substring(pos); - if (newKey === '') { - throw 'no encryption key given'; - } - - // Some web 2.0 services and redirectors add data AFTER the anchor - // (such as &utm_source=...). We will strip any additional data. - let ampersandPos = newKey.indexOf('&'); - if (ampersandPos > -1) - { - newKey = newKey.substring(0, ampersandPos); - } - const enc = CryptTool.base58decode(newKey).padStart(32, '\u0000'); - const dt = JSON.parse(enc); - const cipherdata = [dt.ct, dt.adata] - - const plaindata = await CryptTool.decipher(dt.k, password, cipherdata); - window.location.replace(Helper.baseUri() + plaindata); - return; - } - PasteDecrypter.run(); } + /** + * Request users confirmation to load possibly burn after reading paste + * + * @name Prompt.requestLoadConfirmation + * @function + */ + me.requestLoadConfirmation = function() + { + const $loadconfirmmodal = $('#loadconfirmmodal'); + if ($loadconfirmmodal.length > 0) { + const $loadconfirmOpenNow = $loadconfirmmodal.find('#loadconfirm-open-now'); + $loadconfirmOpenNow.off('click.loadPaste'); + $loadconfirmOpenNow.on('click.loadPaste', PasteDecrypter.run); + const $loadconfirmClose = $loadconfirmmodal.find('.close'); + $loadconfirmClose.off('click.close'); + $loadconfirmClose.on('click.close', Controller.newPaste); + $loadconfirmmodal.modal('show'); + } else { + if (window.confirm( + I18n._('Burn after reading pastes can only be displayed once upon loading it. Do you want to open it now?') + )) { + PasteDecrypter.run(); + } else { + Controller.newPaste(); + } + } + } + /** * ask the user for the password and set it * @@ -2297,6 +2303,7 @@ jQuery.PrivateBin = (function($, RawDeflate) { backdrop: 'static', keyboard: false }); + $passwordDecrypt.focus(); return; } @@ -3844,6 +3851,7 @@ jQuery.PrivateBin = (function($, RawDeflate) { { document.cookie = 'lang=' + $(event.target).data('lang') + ';secure'; UiHelper.reloadHome(); + event.preventDefault(); } /** @@ -3999,10 +4007,6 @@ jQuery.PrivateBin = (function($, RawDeflate) { const $emailconfirmmodal = $('#emailconfirmmodal'); if ($emailconfirmmodal.length > 0) { if (expirationDate !== null) { - I18n._( - $emailconfirmmodal.find('#emailconfirm-display'), - 'Recipient may become aware of your timezone, convert time to UTC?' - ); const $emailconfirmTimezoneCurrent = $emailconfirmmodal.find('#emailconfirm-timezone-current'); const $emailconfirmTimezoneUtc = $emailconfirmmodal.find('#emailconfirm-timezone-utc'); $emailconfirmTimezoneCurrent.off('click.sendEmailCurrentTimezone'); @@ -4851,44 +4855,16 @@ jQuery.PrivateBin = (function($, RawDeflate) { * @param {int} status * @param {object} data */ - async function showCreatedPaste(status, data) { + function showCreatedPaste(status, data) { Alert.hideLoading(); Alert.hideMessages(); // show notification - const baseUri = Helper.baseUri(), - deleteUrl = baseUri + '?pasteid=' + data.id + '&deletetoken=' + data.deletetoken; - let url; - - const pw = TopNav.getPassword() - - // only execute when it is a single time view - if(pw && pw.length && TopNav.getBurnAfterReading()) { - - const sm = CryptTool.getSymmetricKey(); - - let openUri = '?' + data.id + '#' + CryptTool.base58encode(data.encryptionKey); - let cipherResult = await CryptTool.cipher(sm, pw, openUri, []); - - let dt = {} - dt['v'] = 2; - dt['ct'] = cipherResult[0]; - dt['adata'] = cipherResult[1]; - dt['k'] = sm; - - const encUrl = CryptTool.base58encode(JSON.stringify(dt)) - - url = baseUri + '#protected/' + encUrl; - } else { - url = baseUri + '?' + data.id + '#' + CryptTool.base58encode(data.encryptionKey); - } - + const baseUri = Helper.baseUri() + '?', + url = baseUri + data.id + (TopNav.getBurnAfterReading() ? loadConfirmPrefix : '#') + CryptTool.base58encode(data.encryptionKey), + deleteUrl = baseUri + 'pasteid=' + data.id + '&deletetoken=' + data.deletetoken; PasteStatus.createPasteNotification(url, deleteUrl); - - - - // show new URL in browser bar history.pushState({type: 'newpaste'}, document.title, url); @@ -5033,12 +5009,7 @@ jQuery.PrivateBin = (function($, RawDeflate) { // prepare server interaction ServerInteraction.prepare(); - if(!TopNav.getBurnAfterReading()) { - ServerInteraction.setCryptParameters(TopNav.getPassword()); - } else { - // not needed in this scenario - ServerInteraction.setCryptParameters(''); - } + ServerInteraction.setCryptParameters(TopNav.getPassword()); // set success/fail functions ServerInteraction.setSuccess(showCreatedPaste); @@ -5309,7 +5280,7 @@ jQuery.PrivateBin = (function($, RawDeflate) { Alert.hideMessages(); Alert.showLoading('Decrypting paste…', 'cloud-download'); - if (typeof paste === 'undefined') { + if (typeof paste === 'undefined' || paste.type === 'click') { // get cipher data and wait until it is available Model.getPasteData(me.run); return; @@ -5416,7 +5387,10 @@ jQuery.PrivateBin = (function($, RawDeflate) { AttachmentViewer.removeAttachmentData(); Alert.hideLoading(); - history.pushState({type: 'create'}, document.title, Helper.baseUri()); + // only push new state if we are coming from a different one + if (Helper.baseUri() != window.location) { + history.pushState({type: 'create'}, document.title, Helper.baseUri()); + } // clear discussion DiscussionViewer.prepareNewDiscussion(); @@ -5442,6 +5416,12 @@ jQuery.PrivateBin = (function($, RawDeflate) { } } + // check if we should request loading confirmation + if(window.location.hash.startsWith(loadConfirmPrefix)) { + Prompt.requestLoadConfirmation(); + return; + } + // show proper elements on screen PasteDecrypter.run(); }; @@ -5624,16 +5604,6 @@ jQuery.PrivateBin = (function($, RawDeflate) { try { Model.getPasteId(); } catch (e) { - - // check if protected pathname - const url = new URL(window.location); - - // if protected request password - if(url.hash.startsWith('#protected/')) { - return Prompt.requestPassword(); - - } - // otherwise create a new paste return me.newPaste(); } diff --git a/tpl/bootstrap.php b/tpl/bootstrap.php index d1a54fcb..70b1b0cf 100644 --- a/tpl/bootstrap.php +++ b/tpl/bootstrap.php @@ -73,7 +73,7 @@ endif; ?> - + @@ -123,22 +123,32 @@ if (count($class)) { + -