Addon cleanup

This commit is contained in:
Thomas Weber committed 2021-01-25 17:45:57 -06:00
1 parent 2f619b531a
commit a6831de286
7 files changed
+28 -56

No files matched your search

-17
View File
@@ -1,17 +0,0 @@
Addons, translations, and libraries are from the "Scratch Addons" browser extension.
These addons are licensed under the GNU General Public License v3.0, not the BSD-3-Clause License. See README.md and LICENSE_GPL in the root of this repository for more information.
We apply some patches on top of the original source files. These patches are maintained in https://github.com/GarboMuffin/ScratchAddons/tree/tw. We attempt to maintain a minimal diff.
Any bugs or feature requests in these addons should be sent upstream.
Folder structure:
+ addons - the addons
+ addons-l10n - addon translations
+ libraries - libraries used by addons loaded with `import`
+ libraries-raw - libraries used by addons loaded with `addon.tab.loadScript`
+ api-libraries - libraries used by addon API
+ settings - the settings page
addons, addons-l10m, libraries, and libraries-raw and managed by pull.js and any changes may get overwritten.
+20
View File
@@ -0,0 +1,20 @@
# Addons
Addons and translations are from the [Scratch Addons browser extension](https://scratchaddons.com/). Any bugs or feature requests in these addons should be sent [upstream](https://github.com/ScratchAddons/ScratchAddons/issues).
Everything in this folder is licensed under the GNU General Public License v3.0, not the BSD-3-Clause License. See README.md and LICENSE_GPL in the root of this repository for more information.
We apply some patches on top of the original source files. These patches are maintained in https://github.com/GarboMuffin/ScratchAddons/tree/tw.
entry.js is the script that will actually run the addons.
pull.js is a magical script that automatically pulls code from GitHub, parses it with regex, and copies everything to the proper folders.
Directory structure:
- addons - the addons (managed by pull.js)
- addons-l10n - addon translations (managed by pull.js)
- libraries - libraries used by addons loaded with `import` (managed by pull.js)
- libraries-raw - libraries used by addons loaded with `addon.tab.loadScript` (managed by pull.js)
- api-libraries - libraries used by addon API
- settings - the settings page and its translations
+1 -1
View File
@@ -294,7 +294,7 @@ history.pushState = function (...args) {
emitUrlChange();
};
SettingsStore.addEventListener('reread', () => {
SettingsStore.addEventListener('store-changed', () => {
for (const runner of AddonRunner.instances) {
runner.settingsChanged();
}
-35
View File
@@ -1,35 +0,0 @@
/**
* @license
* Copyright (c) 2021 Thomas Weber
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {ipcRenderer} from 'electron';
import AddonRunner from './api';
import addons from './addon-manifests';
import SettingsStore from './settings-store';
for (const [id, manifest] of Object.entries(addons)) {
if (!SettingsStore.getAddonEnabled(id)) {
continue;
}
const runner = new AddonRunner(id, manifest);
runner.run();
}
ipcRenderer.on('addon-settings-changed', (event, settings) => {
SettingsStore.store = settings;
SettingsStore.dispatchEvent(new CustomEvent('reread'));
});
File renamed without changes.
+5
View File
@@ -288,6 +288,11 @@ class SettingsStore extends EventTarget {
}
}
}
setStore (store) {
this.store = store;
SettingsStore.dispatchEvent(new CustomEvent('store-changed'));
}
}
export default new SettingsStore();
+2 -3
View File
@@ -55,8 +55,7 @@ window.addEventListener('message', e => {
location.reload();
}
if (data.type === 'settings-changed') {
SettingsStore.store = data.store;
SettingsStore.dispatchEvent(new CustomEvent('reread'));
SettingsStore.setStore(data.store);
}
});
@@ -66,7 +65,7 @@ const handleClickAddonSettings = () => {
};
const handleLoadAddons = () => {
import(/* webpackChunkName: "addons" */ '../addons/entry-web');
import(/* webpackChunkName: "addons" */ '../addons/entry');
};
const WrappedMenuBar = compose(