Working on a Dynamic version of LocalCDN #10

Closed
opened 2 years ago by Jaap · 8 comments
Jaap commented 2 years ago

Hey Nobody,

I've been working on a dynamic version of Decentraleyes / LocalCDN.
It downloads a requested JS / CSS once from a CDN and keeps it in browser.storage.local.

I would like to make this available to the general public in some form.
It currently shares some code with LocalCDN / Decentraleyes and is of course heavily inspired by both.

Do you have an opinion on this?
Do you want to be involved?

Regards, Jaap

Hey Nobody, I've been working on a dynamic version of Decentraleyes / LocalCDN. It downloads a requested JS / CSS once from a CDN and keeps it in `browser.storage.local`. I would like to make this available to the general public in some form. It currently shares some code with LocalCDN / Decentraleyes and is of course heavily inspired by both. Do you have an opinion on this? Do you want to be involved? Regards, Jaap
Owner

Hey Jaap,

the idea is not bad (someone asked for it, but I cannot find the GitLab issue at the moment), but I'm skeptical about the used storage.

As an example, let's take jQuery. There are 152 releases (including beta, RC, etc.) available on GitHub. Cloudflare currently supports 75 versions that can be integrated. Decentraleyes contains 60 versions and LocalCDN currently 5 versions.

The size of the Decentraleyes repository is currently 20.2 MB and contains ~15 different frameworks (e.g. jQuery: 60 versions with 5.4 MB). The size of the LocalCDN repository is 26.8 MB and contains ~75 different frameworks (e.g. jQuery: 5 versions with 478.9 kB). jQuery is relatively small compared to Bootstrap, but if you had as many versions of Bootstrap (CSS and JS) in memory, it would of course grow even faster.

If you browse the web for a while, the extension memory will grow bigger and bigger, because every single version is stored, while the differences between the versions are rather minimal (Major versions excluded). In addition, the extension would also store frameworks that are not necessary to operate the website at all, e.g. for cookies or tracking.

The extension would be relatively small in the beginning, but would grow larger over time. You would also have to make sure that frameworks are removed if they haven't been used for a while.

Hey Jaap, the idea is not bad (someone asked for it, but I cannot find the GitLab issue at the moment), but I'm skeptical about the used storage. As an example, let's take jQuery. There are 152 releases (including beta, RC, etc.) available on GitHub. Cloudflare currently supports 75 versions that can be integrated. Decentraleyes contains 60 versions and LocalCDN currently 5 versions. The size of the Decentraleyes repository is currently 20.2 MB and contains ~15 different frameworks (e.g. jQuery: 60 versions with 5.4 MB). The size of the LocalCDN repository is 26.8 MB and contains ~75 different frameworks (e.g. jQuery: 5 versions with 478.9 kB). jQuery is relatively small compared to Bootstrap, but if you had as many versions of Bootstrap (CSS and JS) in memory, it would of course grow even faster. If you browse the web for a while, the extension memory will grow bigger and bigger, because every single version is stored, while the differences between the versions are rather minimal (Major versions excluded). In addition, the extension would also store frameworks that are not necessary to operate the website at all, e.g. for cookies or tracking. The extension would be relatively small in the beginning, but would grow larger over time. You would also have to make sure that frameworks are removed if they haven't been used for a while.
Poster

Yes those are good points you raise.

I was thinking that the user can choose the max size of the cache, and a LRU/ARC/CART mechanism would be used to evict stale entries.

All of the smart strategies you use to keep the cache size smaller could also be applied here (like storing only v10.0.7 out of v10.0.1 .. v10.0.7 etc)

Yes those are good points you raise. I was thinking that the user can choose the max size of the cache, and a LRU/ARC/CART mechanism would be used to evict stale entries. All of the smart strategies you use to keep the cache size smaller could also be applied here (like storing only v10.0.7 out of v10.0.1 .. v10.0.7 etc)
Owner

Hmm, I don't know if the extra effort is worth it, because it also makes the extension more prone to errors. You also have to consider a lot of things to make it work. We could see this in the method for removing attributes of origin and integrity. I didn't expect that non-UTF-8 still be used so frequently.

At the moment, I think it's best if such an extension works silently in the background with as little user interaction as possible. But I could imagine that such an extension could be integrated as a "Pro feature" and experienced users could activate it optionally (similar to uBlock).

Independently of this, it was the intention of Decentraleyes/LocalCDN to make a site usable and not to replace all frameworks, e.g. no Google Fonts or any tracking libraries.

Hmm, I don't know if the extra effort is worth it, because it also makes the extension more prone to errors. You also have to consider a lot of things to make it work. We could see this in the method for removing attributes of origin and integrity. I didn't expect that non-UTF-8 still be used so frequently. At the moment, I think it's best if such an extension works silently in the background with as little user interaction as possible. But I could imagine that such an extension could be integrated as a "Pro feature" and experienced users could activate it optionally (similar to uBlock). Independently of this, it was the intention of Decentraleyes/LocalCDN to make a site usable and not to replace all frameworks, e.g. no Google Fonts or any tracking libraries.
Poster

Ok no problem.
I'll make a separate extension under my own name.
Do i need to be careful not to share any code with LocalCDN?
Can i point to LocalCDN in the description of my extension?

Ok no problem. I'll make a separate extension under my own name. Do i need to be careful not to share any code with LocalCDN? Can i point to LocalCDN in the description of my extension?
Owner

You're welcome to do that. 👍 LocalCDN (and Decentraleyes) are licensed under MPL2.0, this should not be a problem as long as the extension is also distributed under MPL2.0 (but I'm not a licensing expert 😉 )

You're welcome to do that. :+1: LocalCDN (and Decentraleyes) are licensed under [MPL2.0](https://www.mozilla.org/en-US/MPL/2.0/), this should not be a problem as long as the extension is also distributed under MPL2.0 (but I'm not a licensing expert :wink: )
nobody closed this issue 2 years ago

@Jaap
Interested in this. I had a slightly crazy (?) idea for something similar. But where the extension would have a corresponding 'webapp' hosted either locally, or remotely, rather than using browser storage.

The major downside to this is it would be unusable for non technical users who were unable to setup a web server and install a webapp.

On the plus side, in theory, all that would be needed by the extension would be a list of the URL's of CDN's. THe actual scripts would update dynamically. Same as your idea. Which I like.

Just a daydream of mine. I don't have the skills to pull it off atm.

But if you make any progress let me know here, and hopefully I'll be notified.

@Jaap Interested in this. I had a slightly crazy (?) idea for something similar. But where the extension would have a corresponding 'webapp' hosted either locally, or remotely, rather than using browser storage. The major downside to this is it would be unusable for non technical users who were unable to setup a web server and install a webapp. On the plus side, in theory, all that would be needed by the extension would be a list of the URL's of CDN's. THe actual scripts would update dynamically. Same as your idea. Which I like. Just a daydream of mine. I don't have the skills to pull it off atm. But if you make any progress let me know here, and hopefully I'll be notified.
Poster

It's gonna be called JSLibCache:
https://gitlab.com/Jaaap/jslibcache/

It's gonna be called JSLibCache: https://gitlab.com/Jaaap/jslibcache/

Ok cool I'll keep an eye on it.

Ok cool I'll keep an eye on it.
Sign in to join this conversation.
No Milestone
No Assignees
3 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.