From d4ad23b893c05b4d1c98ec251f6c34f7f42cb812 Mon Sep 17 00:00:00 2001 From: Jaidyn Ann <10477760+JadedCtrl@users.noreply.github.com> Date: Mon, 4 Mar 2024 12:58:05 -0600 Subject: [PATCH] Display an error-page when not fully installed --- _locales/en/messages.json | 60 +++++++++++++++++++++++++++++++++++++++ _locales/eo/messages.json | 53 ++++++++++++++++++++++++++++++++-- background.js | 13 +++++++++ error.html | 32 +++++++++++++++++++++ error.js | 17 +++++++++++ 5 files changed, 173 insertions(+), 2 deletions(-) create mode 100644 error.html create mode 100644 error.js diff --git a/_locales/en/messages.json b/_locales/en/messages.json index cb6715e..83b70e7 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -149,5 +149,65 @@ "optionsSaveButton": { "message": "Apply", "description": "Name of button in options-page to save changes." + }, + + "errorPageTitle": { + "message": "Shellfox error", + "description": "Title of the error-page." + }, + + "errorTitle": { + "message": "Shellfox failed to run command", + "description": "Heading-title of the error-page." + }, + + "errorNotInstalled": { + "message": "It seems that Shellfox is not fully installed!", + "description": "Summary of not-installed error." + }, + + "errorNotInstalledDesc": { + "message": "Shellfox, unlike most extensions, requires a script to be installed on your computer. This script, shellfox.sh, is what allows us to execute shell commands.It seems that Shellfox is not fully installed!", + "description": "Detailed description of not-installed error." + }, + + "repairInstallTitle": { + "message": "Completing installation", + "description": "Title of the repair-section for installation." + }, + + "repairInstallIntro": { + "message": "To install Shellfox’es local component:", + "description": "Intro to the installation guide, following by an itemized list of steps." + }, + + "repairInstallStep1": { + "message": "Download the script through the repository’s ZIP archive here.", + "description": "Step in the installation guide." + }, + + "repairInstallStep2": { + "message": "Extract the ZIP archive: This leaves a shellfox/ folder.", + "description": "Step in the installation guide." + }, + + "repairInstallStep3": { + "message": "Open a terminal within that shellfox/ folder.", + "description": "Step in the installation guide." + }, + + "repairInstallStep4": { + "message": "Run the command, $ sudo make native-install", + "description": "Step in the installation guide." + }, + + "repairInstallStep5": { + "message": "You’re done: Party!!", + "description": "Light-hearted celebration step in the installation guide." + }, + + "repairInstallTerminalIntro": { + "message": "From a terminal, that would look something like:", + "description": "Intro to a terminal-based installation description." } } diff --git a/_locales/eo/messages.json b/_locales/eo/messages.json index 902eb71..ddfd52a 100644 --- a/_locales/eo/messages.json +++ b/_locales/eo/messages.json @@ -1,12 +1,12 @@ { "extensionName": { "message": "Ŝelvulpo", - "description": "Nomo de la aldonaĵo." + "description": "Nomo de la etendaĵo." }, "extensionDescription": { "message": "Ruli ŝel-ordonojn de Firefox, facile.", - "description": "Priskribo de la aldonaĵo." + "description": "Priskribo de la etendaĵo." }, "pageActionName": { @@ -149,5 +149,54 @@ "optionsSaveButton": { "message": "Konservi", "description": "Nomo de butono ĉe agordopaĝo por konservi ŝanĝojn." + }, + + "errorPageTitle": { + "message": "Ŝelvulpo eraris" + }, + + "errorTitle": { + "message": "Ŝelvulpo malsukcesis ruli ordonon" + }, + + "errorNotInstalled": { + "message": "Ŝajnas ke Ŝelvulpo ne estas fininstalita!" + }, + + "errorNotInstalledDesc": { + "message": "Ŝelvulpo, malkiel aliaj etendaĵoj, postulas instalon de skripto je via komputilo. Estas tiu skripto, shellfox.sh, kiu povigas la etendaĵon ruli ŝel-ordonojn je via komputilo." + }, + + "repairInstallTitle": { + "message": "Kiel fininstali" + }, + + "repairInstallIntro": { + "message": "Por instali la sisteman skripton Ŝelvulpan:" + }, + + "repairInstallStep1": { + "message": "Elŝutu la skripton per ZIP-arĥivo de la koddeponejo, de ĉi tie." + }, + + "repairInstallStep2": { + "message": "Elarĥivigu la ZIP-dosieron: Ĉi tio kreos shellfox-dosierujon." + }, + + "repairInstallStep3": { + "message": "Rulu terminalon en la ĵus elarĥivigita dosierujo shellfox/." + + }, + + "repairInstallStep4": { + "message": "Rulu terminale, $ sudo make native-install" + }, + + "repairInstallStep5": { + "message": "Gratulegon: Vi venkis!!!" + }, + + "repairInstallTerminalIntro": { + "message": "Farita sole en terminalo, aspektus jene:" } } diff --git a/background.js b/background.js index afd5aff..790057a 100644 --- a/background.js +++ b/background.js @@ -6,6 +6,19 @@ function initShellfoxProgram() { port.onDisconnect.addListener((port) => { console.log(port.error); port = undefined; + + // Tell the user about the error… + browser.tabs.query({"active": true}).then((tabs) => { + let openerTab = undefined; + if (tabs && tabs.length > 0) + openerTab = tabs[0].id; + + browser.tabs.create({ + "active": true, + "url": "/error.html", + "openerTabId": openerTab + }) + }); }); } diff --git a/error.html b/error.html new file mode 100644 index 0000000..f99225a --- /dev/null +++ b/error.html @@ -0,0 +1,32 @@ + + + + + Shellfox error + + + +

Shellfox failed to run command

+

+ +

It seems that Shellfox is not fully installed!

+

Shellfox, unlike most extensions, requires a script to be installed on your computer. This script, shellfox.sh, is what allows us to execute shell commands.

+ +

Completing installation

+

To install Shellfox’es local component:

+
    +
  1. Download the script through the repository’s ZIP archive here.
  2. +
  3. Extract the ZIP archive: This leaves a shellfox/ folder.
  4. +
  5. Open a terminal within that shellfox/ folder.
  6. +
  7. Run the command, $ sudo make native-install
  8. +
  9. You’re done: Party!!
  10. +
+ +

From a terminal, that would look something like:

+ $ curl https://hak.xwx.moe/jadedctrl/shellfox/archive/master.tar.gz | tar -xzv
+ $ cd shellfox/
+ $ sudo make native-install
+ + + + diff --git a/error.js b/error.js new file mode 100644 index 0000000..68e1ec9 --- /dev/null +++ b/error.js @@ -0,0 +1,17 @@ +document.getElementsByTagName("html")[0].setAttribute("lang", browser.i18n.getMessage("@@ui_locale")); + +document.getElementById("errorPageTitle").innerText = browser.i18n.getMessage("errorPageTitle"); +document.getElementById("errorTitle").innerText = browser.i18n.getMessage("errorTitle"); +document.getElementById("notInstalled").innerText = browser.i18n.getMessage("errorNotInstalled"); +document.getElementById("notInstalledDesc").innerHTML = browser.i18n.getMessage("errorNotInstalledDesc"); + +document.getElementById("installTitle").innerText = browser.i18n.getMessage("repairInstallTitle"); +document.getElementById("installIntro").innerText = browser.i18n.getMessage("repairInstallIntro"); +document.getElementById("installStep1").innerHTML = browser.i18n.getMessage("repairInstallStep1"); +document.getElementById("installStep2").innerHTML = browser.i18n.getMessage("repairInstallStep2"); +document.getElementById("installStep3").innerHTML = browser.i18n.getMessage("repairInstallStep3"); +document.getElementById("installStep4").innerHTML = browser.i18n.getMessage("repairInstallStep4"); +document.getElementById("installStep5").innerText = browser.i18n.getMessage("repairInstallStep5"); +document.getElementById("installTerminalIntro").innerText = browser.i18n.getMessage("repairInstallTerminalIntro"); + +document.getElementById("zip_link").setAttribute("href", "https://hak.xwx.moe/jadedctrl/shellfox/archive/master.zip");