dhowe / AdNauseam

AdNauseam: Fight back against advertising surveillance
GNU General Public License v3.0
4.45k stars 187 forks source link

Feature request: Auto update option for the extension #2477

Open dave90dave opened 7 months ago

dave90dave commented 7 months ago

Hi,

Since Adnauseam is banned from the chrome store, it is unpractical to update the extension manually every time, Also are users probably not check very often for new extension updates manually.

Wherefore, I would really to like suggest an automatic extension update functionality. Is there already such functionality being developed at this time?

I also hope that the AdNauseam extension becomes better accessable for users to install soon, because for most users it is inpractical to install the extension for chrome using developer mode.

Regards Dave

dhowe commented 7 months ago

Thanks @dave90dave is there an existing extension that does auto-update from outside the chrome store (that we could use as a model)?

dave90dave commented 7 months ago

Well as far as I know there are not a lot chrome extensions like that. Most extensions do use the chrome webstore API's to update their plugins, and since the Chrome's security model generally prevents extensions from updating themselves without going through the Chrome Web Store, it is likely that a working update script needs still to be written.

Since Adnauseam is only available outside the chrome web store, it seems that the most fluent way for updating would be writing a script that checks for the latest version periodically, to download the new extension from something like a external web server.

I also would like to recommend you the following:

According to the DMA, paragraph 5, gatekeepers (like Chrome web store) are required to:

This promotes user choice and prevents gatekeepers from limiting access to certain services. So if you would like to get Adnauseam back into the chrome store again, you might consider filing a complaint when the DMA starts to work next year.

There is a chance that if you file a notice of objection to Google, grounded on those laws, that they might be required to reëxamine the extension, and probably are required to enable it again in the web store (at least in Europe).

It might be worth the try.

mneunomne commented 7 months ago

From what I was able to research, auto-update for extensions not supported on google web store is currently only possible when using Chrome Enterprise Policies, which are Chrome browsers custumised to be used within an organization.

https://developer.chrome.com/docs/apps/autoupdate/

If you are hosting a CRX file on a web server and using enterprise policies to push it to managed devices, keep reading. You should also read Hosting and Packaging

Previously when off-store extensions were supported, it was possible to have the native binaries and the extension be updated in lock step. However, extensions hosted on the Chrome Web Store are updated via the Chrome update mechanism which developers do not control. Extension developers should be careful about updating extensions that have a dependency on the native binary (for example, legacy extensions using NPAPI).

And about entreprise policies:

As enterprises adopt Chrome Browser and ChromeOS, they often require added controls and configurations to meet their productivity and security needs. This can be achieved through the management of Chrome Enterprise policies. Chrome Enterprise policies give IT admins the power to configure Chrome for their organization or business. You can manage browsers on-premise for Windows or Mac/Linux, or manage browsers for all desktop platforms using Chrome Browser Cloud Management.

But it all seems rather unclear to me. I think we should contact them directly about this.

dave90dave commented 7 months ago

If auto-update from the browser is not possible, maybe an idea could be, that you can install an auto updater application (.exe file), that places organisation like policies on the local pc, and that enforces the periodic update of the extension? Maybe an easy installer application from AdNauseam with an auto-updater feature by enforcing organisation policy's on the local computer might be a working solution to this?

dhowe commented 7 months ago

This might also be something to consider rolling ourselves, if its correct that no one has done similar. What steps would be required for a simple, possibly interactive, update mechanism ?

Could this be done from within the extension (or via specific page-visits), rather than via app or exe?

dave90dave commented 6 months ago

Well, it's not possible for a Google Chrome extension to directly overwrite existing files on a user's system. Chrome extensions operate within a secure sandbox environment to prevent security vulnerabilities and unauthorized access to user data.

Extensions primarily have access to web-based resources and can interact with web pages through the Document Object Model (DOM). They are limited in their ability to interact with the user's file system for security reasons. Extensions can use the chrome.fileSystem API to interact with files, but they can't directly overwrite files on a user's system. Therefore, using a external application to keep the extension up-to-date is probably imminent.

Since the extension is being installed manually, it might be useful to create a windows-services that checks the extension updates periodically, and overwrites the old extension somehow.

dave90dave commented 6 months ago

You'll need:

The data stored should be backed-up too, just in case a update fails. I expect that the browser might give a pop-up after updating, with the question to re-enable the extension. So that's also something to consider.

dhowe commented 6 months ago

I don't think a separate app is something we have the resources to support at this point. I'm more interested in an interactive mechanism within the addon, as mentioned above. For users who have this enabled, it might do something like:

At very least users will know when they are an out-of-date, which is not the case now

mneunomne commented 5 months ago

@dhowe I made this simple shell script that checks online for the latest non-prerelease and if not updated, download and substitute the folder. I guess this can be adapted for some kind of auto-update function for chromium users.

#!/bin/bash

# Path to the adnauseam.chromium directory
EXTENSION_DIR="adnauseam.chromium"

# Path to the manifest.json file
MANIFEST_FILE="$EXTENSION_DIR/manifest.json"

# Check if the directory exists
if [ -d "$EXTENSION_DIR" ]; then
    # Get the current version from the manifest file
    CURRENT_VERSION=$(jq -r .version "$MANIFEST_FILE")
    CURRENT_VERSION="v$CURRENT_VERSION"
    echo "Current version: $CURRENT_VERSION"

    # Replace URL with the actual URL you want to use
    URL="https://api.github.com/repos/dhowe/AdNauseam/releases/latest"

    # Get the latest release information using curl and jq
    LATEST_RELEASE=$(curl -s "$URL" | jq -r '.tag_name')

    # Check if the latest version is different from the current version
    if [ "$LATEST_RELEASE" != "$CURRENT_VERSION" ]; then
        echo "Updating AdNauseam extension..."

        # Download and extract the latest release
        curl -L -o "$EXTENSION_DIR.zip" "https://github.com/dhowe/AdNauseam/releases/download/$LATEST_RELEASE/adnauseam.chromium.zip"
        unzip -q "$EXTENSION_DIR.zip" -d "./"
        rm "$EXTENSION_DIR.zip"

        echo "Update complete. Installed version: $LATEST_RELEASE"
    else
        echo "AdNauseam is already up to date. Installed version: $CURRENT_VERSION"
    fi
else
    echo "AdNauseam extension directory not found. Please make sure it is installed."
fi
dhowe commented 5 months ago

@mneunomne thanks for this -- how do you imagine it being used ?

Mikaela commented 4 months ago

It looks like Microsoft isn't blocking Chromium or Chrome from using its update server so the following enterprise policy will at least result to the extension being installed and I don't see why it wouldn't keep getting updated as long as Microsoft won't block other browsers:

{
  "ExtensionSettings": {
      "mlojlfildnehdpnlmpkeiiglhhkofhpb": {
      "installation_mode": "normal_installed",
      "override_update_url": true,
      "toolbar_pin": "force_pinned",
      "update_url": "https://edge.microsoft.com/extensionwebstorebase/v1/crx"
      }
  }
}

The enterprise profile locations are:

And the json can be named whatever as long as it ends to .json, the only restrictions I have learned in a month of on-off playing around with browser policies are banner about policy being managed by organization and that the setting can only appear in one file at a time (in other words no specifying ExtensionSettings{} in multiple policies). Oh and DoH locks itself unless a policy says "DnsOverHttpsMode": "automatic".

dhowe commented 4 months ago

@mneunomne can you look into this -- we should do it anyway for Edge users, but would be a nice workaround for Chrome (thanks @Mikaela)

mneunomne commented 4 months ago

Thanks @Mikaela I will test it myself on edge on my computer and understand how far we can go with it.

dave90dave commented 3 months ago

Hello,

I've been away from some time, but I might have a better suggestion. Although, this will only work within the European Union.

Since this month, a new regulation was entered into force, in the EU called: Digital Markets Act

It is now possible to appeal the decision of google to take down the Adnauseam extenstion from the chrome webstore. The Digital Markets Act requires Google (and other large companies) to safeguard the human rights in their systems (Freedom of speech/press)

If you want to reinstate the extension in the Chrome Webstore, this might be the way. Please let me know if you want more information to get Adnauseam in the Chrome Webstore again.

Mikaela commented 1 month ago

https://github.com/uBlockOrigin/uBlock-issues/discussions/2977#discussioncomment-9536634 might also be of interest here.