eibiflo / cf_cookiemanager

Simple Typo3 Cookie Manager
GNU General Public License v2.0
10 stars 5 forks source link

Skip auto scan and import #14

Closed mikestreety closed 8 months ago

mikestreety commented 9 months ago

Hello,

Thanks for the extension!

Is there a way I can trick the scanner into thinking it has done the scan so I can import some cookies?

It seems the hosting provider my client uses has blacked the IP of your scanner, however I can run a scan via your website (https://cookieapi.coding-freaks.com/scan) on the sitemap.xml which passes. It would be great if I could use this JSON rather than needing the initial scan to be done via the module.

Thanks

eibiflo commented 9 months ago

Hi,

Thank you for the great feedback, I'm pleased to hear that.

Currently, it is not possible without code changes. However, the JSON file is available via the public API, for example, Here

At the moment, you cannot add custom cookies and services via AutoImport; these still need to be added manually (this feature is coming soon). You can find more information here.

Alternatively, it would certainly be possible to convert the JSON into a fake scan and create/or modify a database entry where you can manage the Config.json. This should work, but I'm not sure it helps if I understand your problem correctly, as you want to automatically create custom cookies and services?

mikestreety commented 9 months ago

Thanks for the reply.

My problem is the auto scan doesn't work because the client's server has blocked the IP address for the homepage, however it can still access the sitemap.xml link. (e.g. here)

Is there a way I can configure the URL the "Start Configuration" scan uses? I click it and it just redirects back to the same page

image
eibiflo commented 9 months ago

To put it briefly, are you having trouble installing the plugin? Sorry, that was my mistake. Actually, there is an issue that the extension currently does not account for. During the installation process, the StaticDataUpdateWizard is invoked to load the presets, but this isn't working for you because your IP is blocked.

I need to integrate a solution for this. Right now, I can work on it. When do you need it by? The sooner the better, right? :)

Alternativly you can Configure all Datasets per hand in the Liste Module of typo3, but better i will make also implement a lokale installer witout the external Endpoints.

mikestreety commented 9 months ago

Thanks - we are just investigating cookie managers and this one looked very promising. We don't have a deadline per se.

I have just made a Cloudflare worker which acts as a proxy for your website to help negate the blocked API.

This works with the below code and any request passed to the URL gets loaded directly from your website (but through the edge worker and so appears to have a different URL & IP). It replaces the worker hostname with https://cookieapi.coding-freaks.com

E.g.

https://cookie-manager.liquidlight.workers.dev/api/scan/8f30db5904f90fccc6aa1a2cfb185d77

Is the same as

https://cookieapi.coding-freaks.com/api/scan/8f30db5904f90fccc6aa1a2cfb185d77

The code which does this is:

const baseUrl = 'https://cookieapi.coding-freaks.com';

addEventListener('fetch', event => {
    event.respondWith(handleRequest(event.request));
});

async function handleRequest(request) {
    // Get the path at the end of the workers URL
    const {pathname} = new URL(request.url);
    return await fetch(baseUrl + pathname);
}

Now I have done that and updated my config, am I able to re-trigger the StaticDataUpdateWizard without uninstalling and reinstalling? I suspect, as we install in a dev environment, that installing it locally and deploying it doesn't trigger that method on the live server.

eibiflo commented 9 months ago

Thanks for the Submission, i will have a look.

To retrigger the Wizzard, go to the Typo3 backend and select the Upgrade module in the Admin Tools tab. Open the Upgrade Wizard and Execute the "Cookiemanager Static Data Update" Task.(if not available, uncheck it)

The extension automatically configures itself, by the API and also creates the corresponding data set and Language overlays from site config.yaml.

mikestreety commented 9 months ago

Oh that's done it, perfect! Thank you :)

eibiflo commented 9 months ago

Hey, with the new version 1.4.1, it is now possible to upload presets locally and then install them locally if the API cannot or does not want to be used for whatever reasons.

Since I don't want to include the data in the extension, the only option left is the download and import variant, which I have now implemented.

You can now download the presets on the Cookieapi page, currently only on the Public Test version, as I am generally in the process of restructuring the infrastructure, so don't be confused about why 2 different APIs are online. (Staging Testing Beta: https://cookieapitest.coding-freaks.com/application-programming-interface)

Best regards

eibiflo commented 8 months ago

Dear @mikestreety ,

the API migration has been successfully completed. You can now download the presets by visiting: https://cookieapi.coding-freaks.com/

I would appreciate it if you could consider leaving a star if you find the project usefull, or join us on the Typo3 Extension Slack channel. https://typo3.slack.com/archives/C04NB2ZP30U

Best regards, Florian

mikestreety commented 8 months ago

Thanks - I'll have a proper play and investigation next time I'm there :)