From 42de3d29e14c85eadb1405a8ce285de6bba784d6 Mon Sep 17 00:00:00 2001 From: Glen Whitney Date: Tue, 20 Feb 2024 22:06:22 -0800 Subject: [PATCH] chore: get working again on chrome and ready to distribute unpacked --- README.md | 74 ++++++++++++++++++++++++++++++++++++++++++- etc/manifest.json | 9 +++++- etc/options.html | 1 + package.json5 | 2 +- tools/fetchDeps.bash | 1 + tools/makePlugin.bash | 14 ++++++-- 6 files changed, 96 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index f8cab18..e783239 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,75 @@ # archematics -Browser plugin to uncover lost mathematical treasures on the web \ No newline at end of file +Browser plugin to uncover lost mathematical treasures on the web. + +More details on its features and operation can be found in the +[options page](etc/options.html). + +### Installing archematics + +Currently archematics may only be installed as a "development" plugin; +although it is fully implemented and uses only well-known standard +packages, publication policies of the various browsers will require some +changes before it can receive approval as a plugin that can be installed +normally. (For example, Firefox requires that all files in a plugin be +under 4MB, but one of the packages this depends on is only distributed with +files larger than that.) Therefore, to install it, you must: + +First, create a distribution directory by either + +* the build process below, in which case you are looking for the subdirectory + named "archematics" of the top-level directory of the repository, or +* or, if you have a link to a zip file of a distribution directory (perhaps + one was given to you), download the zip file and unzip it into the directory + of your choice. + +How you then install archematics as a development plugin depends on the +browser: + +* **Firefox:** open a new tab and enter "about:debugging" in the URL bar. + Then click the "This Firefox" entry in the left column. Near the top right + you will see a "Load Temporary Add-on" button. Click this button and + navigate to the "manifest.json" file in your distribution directory in the + resulting file browser. Select that file and the plugin will load. Then + select the "Add-ons and Themes" item in the main Firefox menu and make sure + the archematics plugin is enabled, and on its preferences tab the parts + of it you want to use are activated. Then you can navigate to a web page + where it applies. You will have to give it permission to run on that + domain (using the "puzzle-piece" plug-in icon at the top right), and then + reload the page and you should see it take effect. + + Note in Firefox, each time you quit and restart the browser you will need + to reinstall the extension if you want to use it (since it is only loaded + as a development extension). + +* **Chrome:** open a new tab and enter "chrome://extensions" in the URL bar. + In the top right-hand corner, enable "Developer mode". Then click on the + "Load unpacked" button at the top left. Navigate to the distribution + directory in the resulting file browser, and click on Select. Once the + extension is loaded, click on the "Details" button. About halfway down the + page under "Site access" you can give archematics permission to work + with the sites you want; and most of the way down the page click on\ + "Extension options" to make sure the features you want are enabled. + + In Chrome, the extension should remain installed for future browsing + sessions as well, even when you stop and restart the browser. + +* **Edge:** open a new tab and enter "edge://extensions" in the URL bar. + On the left side near the bottom, activate "Developer Mode." Click on the + "Load unpacked" button, and proceed as for Chrome. + +* For other browsers, check the browser's documentation for how to load a + tempory or unpacked extension; we'd be happy to include the procedures + here if you let us know what worked for you. You can contact the + developers by email at + glen at archematics dot app + +Enjoy seeing math treasures on the web in a whole old-that-is-new-again way! + +### Building archematics + +1) Install node v20 or later and pnpm v8.11 or later in your build environment +2) Clone the repository https://code.studioinfinity.org/glen/archematics.git + and enter its top-level directory +3) Execute `pnpm install` +4) Execute `pnpm build` diff --git a/etc/manifest.json b/etc/manifest.json index 7b61060..5585891 100644 --- a/etc/manifest.json +++ b/etc/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 3, "name": "archematics", - "version": "1.0", + "version": "<>", "description": "unearths mathematical treasures lost in the web", "icons": { @@ -11,6 +11,12 @@ }, "author": "Glen Whitney ", "homepage_url": "https://archematics.app", + "browser_specific_settings": { + "gecko": { + "id": "{8b22a3b8-57f1-45f4-8e87-9043115a8093}", + "update_url": "https://archematics.app/updates.json" + } + }, "content_scripts": [ { "matches": ["*://*/*"], @@ -40,6 +46,7 @@ "deps/x_ite/assets/components/KeyDeviceSensor.js", "deps/x_ite/assets/components/Scripting.js", "deps/x_ite/assets/components/Text.js", + "deps/x_ite/assets/images/logo.128.png", "adapptlet.js", "adapptypes.js", "conway.js", diff --git a/etc/options.html b/etc/options.html index b9f6eae..4df019b 100644 --- a/etc/options.html +++ b/etc/options.html @@ -76,6 +76,7 @@
+ diff --git a/package.json5 b/package.json5 index db040e2..df1f603 100644 --- a/package.json5 +++ b/package.json5 @@ -1,6 +1,6 @@ { name: 'archematics', - version: '0.1.0', + version: '0.3.0', description: 'Uncovering lost digital mathematical treasures', scripts: { test: 'echo "Error: no test specified" && exit 1', diff --git a/tools/fetchDeps.bash b/tools/fetchDeps.bash index bc816ef..49941af 100644 --- a/tools/fetchDeps.bash +++ b/tools/fetchDeps.bash @@ -2,6 +2,7 @@ mkdir -p etc/deps/geotypes mkdir -p etc/deps/x_ite/assets/components mkdir -p etc/deps/x_ite/assets/images +// source code at https://github.com/geogebra/geogebra/releases/tag/5.2.823.0 curl 'https://download.geogebra.org/installers/5.2/geogebra-math-apps-bundle-5-2-823-0.zip' --output etc/deps/geo.zip unzip -o -d etc/deps etc/deps/geo.zip rm etc/deps/geo.zip diff --git a/tools/makePlugin.bash b/tools/makePlugin.bash index 191afc9..77ef3cd 100644 --- a/tools/makePlugin.bash +++ b/tools/makePlugin.bash @@ -1,7 +1,16 @@ # Takes one parameter, the destination directory mkdir -p $1/deps/x_ite/assets/images mkdir -p $1/deps/x_ite/assets/components -cp etc/manifest.json etc/options.html $1 +versionLine=$(grep version package.json5) +regex="'(.*)'" +if [[ $versionLine =~ $regex ]] +then + version=${BASH_REMATCH[1]} +fi +echo "Building plugin version $version" + +sed "s/<>/$version/" etc/manifest.json > $1/manifest.json +cp etc/options.html $1 cp etc/deps/x_ite/x_ite.css $1/deps/x_ite cp etc/deps/x_ite/assets/images/logo.128.png $1/deps/x_ite/assets/images cp etc/deps/x_ite/x_ite.mjs $1/deps/x_ite @@ -30,4 +39,5 @@ mkdir -p $1/assets cp public/assets/arch*.png $1/assets cp public/assets/*Example.png $1/assets # Wrap it all up -zip -r $1 $1 +cd $1 +zip -r ../$1 *