Display an error-page when not fully installed

This commit is contained in:
Jaidyn Ann 2024-03-04 12:58:05 -06:00
parent 2c73b5a956
commit d4ad23b893
5 changed files with 173 additions and 2 deletions

View File

@ -149,5 +149,65 @@
"optionsSaveButton": { "optionsSaveButton": {
"message": "Apply", "message": "Apply",
"description": "Name of button in options-page to save changes." "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, <code>shellfox.sh</code>, 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 Shellfoxes local component:",
"description": "Intro to the installation guide, following by an itemized list of steps."
},
"repairInstallStep1": {
"message": "Download the script through the repositorys ZIP archive <a id='zip_link'>here</a>.",
"description": "Step in the installation guide."
},
"repairInstallStep2": {
"message": "Extract the ZIP archive: This leaves a <code>shellfox/</code> folder.",
"description": "Step in the installation guide."
},
"repairInstallStep3": {
"message": "Open a terminal within that <code>shellfox/</code> folder.",
"description": "Step in the installation guide."
},
"repairInstallStep4": {
"message": "Run the command, <code>$ sudo make native-install</code>",
"description": "Step in the installation guide."
},
"repairInstallStep5": {
"message": "Youre 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."
} }
} }

View File

@ -1,12 +1,12 @@
{ {
"extensionName": { "extensionName": {
"message": "Ŝelvulpo", "message": "Ŝelvulpo",
"description": "Nomo de la aldonaĵo." "description": "Nomo de la etendaĵo."
}, },
"extensionDescription": { "extensionDescription": {
"message": "Ruli ŝel-ordonojn de Firefox, facile.", "message": "Ruli ŝel-ordonojn de Firefox, facile.",
"description": "Priskribo de la aldonaĵo." "description": "Priskribo de la etendaĵo."
}, },
"pageActionName": { "pageActionName": {
@ -149,5 +149,54 @@
"optionsSaveButton": { "optionsSaveButton": {
"message": "Konservi", "message": "Konservi",
"description": "Nomo de butono ĉe agordopaĝo por konservi ŝanĝojn." "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, <code>shellfox.sh</code>, 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, <a id='zip_link'>de ĉi tie</a>."
},
"repairInstallStep2": {
"message": "Elarĥivigu la ZIP-dosieron: Ĉi tio kreos <code>shellfox</code>-dosierujon."
},
"repairInstallStep3": {
"message": "Rulu terminalon en la ĵus elarĥivigita dosierujo <code>shellfox/</code>."
},
"repairInstallStep4": {
"message": "Rulu terminale, <code>$ sudo make native-install</code>"
},
"repairInstallStep5": {
"message": "Gratulegon: Vi venkis!!!"
},
"repairInstallTerminalIntro": {
"message": "Farita sole en terminalo, aspektus jene:"
} }
} }

View File

@ -6,6 +6,19 @@ function initShellfoxProgram() {
port.onDisconnect.addListener((port) => { port.onDisconnect.addListener((port) => {
console.log(port.error); console.log(port.error);
port = undefined; 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
})
});
}); });
} }

32
error.html Normal file
View File

@ -0,0 +1,32 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf8" />
<title id="errorPageTitle">Shellfox error</title>
</head>
<body>
<h1 id="errorTitle">Shellfox failed to run command</h1>
<h2><span class="command"></span></h2>
<h3 id="notInstalled">It seems that Shellfox is not fully installed!</h3>
<p id="notInstalledDesc">Shellfox, unlike most extensions, requires a script to be installed on your computer. This script, <code>shellfox.sh</code>, is what allows us to execute shell commands.</p>
<h3 id="installTitle">Completing installation</h3>
<p id="installIntro">To install Shellfoxes local component:</p>
<ol>
<li id="installStep1">Download the script through the repositorys ZIP archive <a href="https://hak.xwx.moe/jadedctrl/shellfox/archive/master.zip">here</a>.</li>
<li id="installStep2">Extract the ZIP archive: This leaves a <code>shellfox/</code> folder.</li>
<li id="installStep3">Open a terminal within that <code>shellfox/</code> folder.</li>
<li id="installStep4">Run the command, <code>$ sudo make native-install</code></li>
<li id="installStep5">Youre done: Party!!</li>
</ol>
<p id="installTerminalIntro">From a terminal, that would look something like:</p>
<code>$ curl https://hak.xwx.moe/jadedctrl/shellfox/archive/master.tar.gz | tar -xzv</code><br>
<code>$ cd shellfox/</code><br>
<code>$ sudo make native-install</code><br>
</body>
<script src="error.js"></script>
</html>

17
error.js Normal file
View File

@ -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");