From 019ee09f6d1b02fd91b72d91661a2e57a15bf114 Mon Sep 17 00:00:00 2001
From: Pierre-Jean CHANCELLIER <paidge_cs@hotmail.com>
Date: Wed, 2 Mar 2022 13:47:56 +0100
Subject: [PATCH] web extension config

---
 layouts/error.vue         |  7 ++++++-
 package.json              |  2 +-
 web-ext/launch-web-ext.js |  7 +++++++
 web-ext/manifest.json     | 19 +++++++++++++++++++
 4 files changed, 33 insertions(+), 2 deletions(-)
 create mode 100644 web-ext/launch-web-ext.js
 create mode 100644 web-ext/manifest.json

diff --git a/layouts/error.vue b/layouts/error.vue
index ca51e9c..7b37ffb 100644
--- a/layouts/error.vue
+++ b/layouts/error.vue
@@ -26,7 +26,12 @@ export default {
 		$nuxt.$emit("changeRoute", this.breadcrumb)
 	},
 	props: ["error"],
-	layout: "error"
+	layout: "error",
+	mounted() {
+		if (this.error.statusCode === 404) {
+			this.$router.push(this.localePath("/"))
+		}
+	}
 }
 </script>
 
diff --git a/package.json b/package.json
index 916c741..912d345 100644
--- a/package.json
+++ b/package.json
@@ -7,7 +7,7 @@
 		"trad": "sh ./utils/findMissingI18nKeys.sh",
 		"build": "npm-run-all -p build-fragment nuxt-build",
 		"start": "npm-run-all -p build-fragment nuxt-start",
-		"generate": "npm-run-all -p build-fragment nuxt-generate",
+		"generate": "npm-run-all -p build-fragment nuxt-generate && cp ./web-ext/* ./dist/",
 		"analyze": "nuxt build --analyze",
 		"build-fragment": "node graphql/schemaQuery.js",
 		"nuxt-build": "nuxt build",
diff --git a/web-ext/launch-web-ext.js b/web-ext/launch-web-ext.js
new file mode 100644
index 0000000..75048cc
--- /dev/null
+++ b/web-ext/launch-web-ext.js
@@ -0,0 +1,7 @@
+function openPage() {
+  browser.tabs.create({
+    url: "/fr/index.html"
+  });
+}
+
+browser.browserAction.onClicked.addListener(openPage);
diff --git a/web-ext/manifest.json b/web-ext/manifest.json
new file mode 100644
index 0000000..536c69c
--- /dev/null
+++ b/web-ext/manifest.json
@@ -0,0 +1,19 @@
+{
+	"manifest_version": 2,
+	"name": "Wotwizard UI",
+	"description": "Le magicien de la toile de confiance",
+	"version": "1.0.0",
+	"homepage_url": "https://wotwizard.axiom-team.fr",
+	"browser_action": {
+		"browser_style": true,
+		"default_icon": "/_nuxt/icons/icon_64x64.0424c5.png",
+		"default_title": "Wotwizard UI"
+	},
+	"background" : {
+        "scripts": ["/launch-web-ext.js"]
+    },
+	"icons": {
+		"64": "/_nuxt/icons/icon_64x64.0424c5.png",
+		"120": "/_nuxt/icons/icon_120x120.0424c5.png"
+	}
+}
-- 
GitLab