add firefox support, add cross-browser storage, update todos

tests
lartsch 2022-11-18 09:13:31 -05:00
rodzic 252e7d62d5
commit bac0aa6d32
8 zmienionych plików z 47 dodań i 19 usunięć

Wyświetl plik

@ -39,12 +39,14 @@ Right now, you need to install it using developer mode. The extension is already
![Redirect Indication](https://github.com/lartsch/FediFollow-Chrome/blob/main/img/screenshot2.PNG?raw=true)
## Todos / Planned features
- Add support for Firefox
- Fix some rare cases where an instance runs on a subdomain but the handle uses the domain without subdomain (need to get the handle directly from the profile instead of URL)
- Add support for post interactions
- Add support for other implementations (Plemora, GNU Social, ...)
- Publish to Chrome Webstore (in progress, currently in review by Google)
- Publish to Chrome Webstore (IN PROGRESS)
- Find additional layouts/flavours to add identifiers for
- Support for profiles views with follow button disabled
- Add support for Firefox (DONE)
- Add support for whitelist/blacklist (DONE)
- Add feature to indicate if you are already following a user when browsing his profile on another instance (this requires calls to the home instance, will look into it soon)
- Review if permissions in current manifest are actually needed like that
- If I find myself to be bored, probably more

BIN
firefox/firefox.zip 100644

Plik binarny nie jest wyświetlany.

Wyświetl plik

@ -0,0 +1,27 @@
{
"name": "FediFollow",
"version": "0.1.0",
"description": "Simplifies following Fediverse user on other instances than your own. Visit https://github.com/lartsch/FediFollow-Chrome for more.",
"manifest_version": 2,
"content_scripts": [
{
"matches": ["*://*/*"],
"js": ["src/lib/jquery-3.6.1.min.js","src/inject.js"],
"run_at": "document_start"
}
],
"permissions": [
"storage",
"https://*/*",
"http://*/*"
],
"browser_action":
{
"default_popup": "src/popup.html",
"default_icon": "src/icon/48.png",
"default_title": "FediFollow settings"
},
"icons": {
"48": "src/icon/48.png"
}
}

1
firefox/src 120000
Wyświetl plik

@ -0,0 +1 @@
../src

Wyświetl plik

@ -6,13 +6,12 @@
"content_scripts": [
{
"matches": ["*://*/*"],
"js": ["lib/jquery-3.6.1.min.js","inject.js"],
"js": ["src/lib/jquery-3.6.1.min.js","src/inject.js"],
"run_at": "document_start"
}
],
"permissions": [
"storage",
"tabs"
"storage"
],
"host_permissions": [
"https://*/*",
@ -20,11 +19,11 @@
],
"action":
{
"default_popup": "popup.html",
"default_icon": "icon/48.png",
"default_title": "Home instance setting"
"default_popup": "src/popup.html",
"default_icon": "src/icon/48.png",
"default_title": "FediFollow settings"
},
"icons": {
"48": "icon/48.png"
"48": "src/icon/48.png"
}
}

Wyświetl plik

@ -18,6 +18,9 @@ var settings = {
fedifollow_target: "_blank"
}
// fix for cross-browser storage api compatibility
var browser, chrome;
// wrappers to prepend to log messages
function log(text) {
if (enableConsoleLog) {
@ -240,9 +243,4 @@ function runWithSettings(settings) {
}
function loadSettings() {
const waitForSettings = (chrome || browser).storage.local.get(settings);
waitForSettings.then(runWithSettings, logerr);
}
loadSettings();
(browser || chrome).storage.local.get(settings).then(runWithSettings, logerr);

Wyświetl plik

@ -40,7 +40,6 @@
</div>
</div>
<script src="lib/jquery-3.6.1.min.js"></script>
<script src="lib/chrome-local-storage-api.js"></script>
<script src="popup.js"></script>
</body>
</html>

Wyświetl plik

@ -9,6 +9,9 @@ var settings = {
fedifollow_target: "_blank"
}
// fix for cross-browser storage api compatibility
var browser, chrome;
function onError(error){
console.error(`[FediFollow] Error: ${error}`)
}
@ -32,7 +35,7 @@ function popupTasks(settings) {
settings.fedifollow_blacklist = $("textarea#blacklist_content").val();
settings.fedifollow_target = $("select#target").val();
// write to storage
const waitForSaved = (chrome || browser).storage.local.set(settings);
const waitForSaved = (browser || chrome).storage.local.set(settings);
// show saved indicator after successful save
waitForSaved.then(showConfirmation(), onError);
}
@ -77,5 +80,4 @@ function popupTasks(settings) {
}
const waitForSettings = (chrome || browser).storage.local.get(settings);
waitForSettings.then(popupTasks, onError);
(browser || chrome).storage.local.get(settings).then(popupTasks, onError);