chore: get working again on chrome and ready to distribute unpacked (#69)

Organize the plugin for submission, and restore its operation on Chrome. Unfortunately GeoGebra's files block submission, so further work will be needed to create a plugin installer.

Reviewed-on: #69
Co-authored-by: Glen Whitney <glen@studioinfinity.org>
Co-committed-by: Glen Whitney <glen@studioinfinity.org>
This commit is contained in:
Glen Whitney 2024-02-21 15:46:43 +00:00 committed by Glen Whitney
parent 0567da019f
commit c895f2d30f
6 changed files with 96 additions and 5 deletions

View File

@ -1,3 +1,75 @@
# archematics # archematics
Browser plugin to uncover lost mathematical treasures on the web 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`

View File

@ -1,7 +1,7 @@
{ {
"manifest_version": 3, "manifest_version": 3,
"name": "archematics", "name": "archematics",
"version": "1.0", "version": "<<FROM_PACKAGE_JSON>>",
"description": "unearths mathematical treasures lost in the web", "description": "unearths mathematical treasures lost in the web",
"icons": { "icons": {
@ -11,6 +11,12 @@
}, },
"author": "Glen Whitney <glen@archematics.app>", "author": "Glen Whitney <glen@archematics.app>",
"homepage_url": "https://archematics.app", "homepage_url": "https://archematics.app",
"browser_specific_settings": {
"gecko": {
"id": "{8b22a3b8-57f1-45f4-8e87-9043115a8093}",
"update_url": "https://archematics.app/updates.json"
}
},
"content_scripts": [ "content_scripts": [
{ {
"matches": ["*://*/*"], "matches": ["*://*/*"],
@ -40,6 +46,7 @@
"deps/x_ite/assets/components/KeyDeviceSensor.js", "deps/x_ite/assets/components/KeyDeviceSensor.js",
"deps/x_ite/assets/components/Scripting.js", "deps/x_ite/assets/components/Scripting.js",
"deps/x_ite/assets/components/Text.js", "deps/x_ite/assets/components/Text.js",
"deps/x_ite/assets/images/logo.128.png",
"adapptlet.js", "adapptlet.js",
"adapptypes.js", "adapptypes.js",
"conway.js", "conway.js",

View File

@ -76,6 +76,7 @@
<br/> <br/>
<label for="algebra">Show the GeoGebra algebra pane</label> <label for="algebra">Show the GeoGebra algebra pane</label>
<input type="checkbox" id="algebra"> <input type="checkbox" id="algebra">
<script src="browser-polyfill.js" type="module"></script>
<script src="options.js" type="module"></script> <script src="options.js" type="module"></script>
</body> </body>

View File

@ -1,6 +1,6 @@
{ {
name: 'archematics', name: 'archematics',
version: '0.1.0', version: '0.3.0',
description: 'Uncovering lost digital mathematical treasures', description: 'Uncovering lost digital mathematical treasures',
scripts: { scripts: {
test: 'echo "Error: no test specified" && exit 1', test: 'echo "Error: no test specified" && exit 1',

View File

@ -2,6 +2,7 @@ mkdir -p etc/deps/geotypes
mkdir -p etc/deps/x_ite/assets/components mkdir -p etc/deps/x_ite/assets/components
mkdir -p etc/deps/x_ite/assets/images 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 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 unzip -o -d etc/deps etc/deps/geo.zip
rm etc/deps/geo.zip rm etc/deps/geo.zip

View File

@ -1,7 +1,16 @@
# Takes one parameter, the destination directory # Takes one parameter, the destination directory
mkdir -p $1/deps/x_ite/assets/images mkdir -p $1/deps/x_ite/assets/images
mkdir -p $1/deps/x_ite/assets/components 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/<<FROM_PACKAGE_JSON>>/$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/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/assets/images/logo.128.png $1/deps/x_ite/assets/images
cp etc/deps/x_ite/x_ite.mjs $1/deps/x_ite 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/arch*.png $1/assets
cp public/assets/*Example.png $1/assets cp public/assets/*Example.png $1/assets
# Wrap it all up # Wrap it all up
zip -r $1 $1 cd $1
zip -r ../$1 *