Basically the whole day of hacking on the little decentralization project today. Good progress. This thing is becoming surprisingly usable.
I will announce the new name (it's going to either be SideWays or Samizdat, most probably) early next week, and full code will follow shortly.
Haven't had a project I was that excited about for a long while. I missed that feeling a lot!
Well that went fast! Rename complete, code a bit cleaned, stuff tested.
I give you Saмiзdaт:
Go on, test in modern Firefox, Chromium, or Chrome.
There are g-glitches every now and then, but basically once the ServiceWorker kicks in you should see a "YES" there on the example page. When you do, you should also notice the favicon appearing. That means IPFS is working; there is no favicon on that server!
#Samizdat is moving forward nicely. We now have some basic explanation on the landing page, a nicer display of methods used to fetch content, and (just implemented, hot from the CI/CD pipeline!) info on which resources were fetched using which method.
Check it out:
Pretty sweet, if I may be so bold to say so!
This is still Proof-of-Concept quality, and so many things can be done so much better. But it works already, in a way.
For those new to the #Samizdat thing:
1. if you want to test it, load it, and then reload it -- or even close the tab and open a new one to load it again; this way the ServiceWorker will kick in and stuff will start happening;
2. it will not work without JS (sorry...), and it will not work in incognito/private mode.
To those who had already looked at it: I would be super interested if your service worker kicked in! You might not get the full functionality until the service worker reloads.
TFW you need to refactor your code to use a completely new (to you) technique of dealing with some particular problem, using technology you don't really feel that comfortable with...
...and 2h later stuff actually works:
I am very okay with this.
Also, #Samizdat can now chain multiple delivery plugins. Which means I should now be able to implement caching using Caching API.
Do I have a ticket where I am tracking this, you ask?
Why yes, yes I do:
@rysiek what's the best way for a random internet person like myself to contribute? I don't think I can just make an account on OCCRP's gitlab. Is there another way to trigger merge requests?
@rysiek hrm, not sure. i've got accounts at gittlab.com, bitbucket and github, so i'll find you wherever. I've just been doing a light organization on the index.html first, getting your scripts all together and deferred in the right order.
FF is being a jerk about serviceworkers on localhost, so i probably need to switch to my other machine and use chrome to do further testing. Or maybe just pagekite it... hmmm
@tomasino oh man, much obliged! One thing that was on my todo list was to separate stuff properly, have a general samizdat library with all the things that are useful to all plugins etc as a separate file.
I am not very good with JS, so it's kind of unclear to me how to do it *properly*.
@rysiek it looks like you're trying to avoid build tasks, so that does limit your options a tiny bit. What browser targets are you looking at? Modern evergreen only? You're using fetch, and arrow functions so it looks like no IE. If you go a bit MORE modern, you get native browser "import" support for modules.
I'll do stuff with a light touch first and give you a PR so I know I'm on the right track with what you're doing.
@tomasino build tasks are fine, we just wanted to keep it as simple as possible to deploy. We do have a beefy Gitlab CI/CD set-up, but I'd like this to be easily deployable by a random admin with a WordPress site. ;)
@tomasino [re: confusing functionality of gun-ipfs.js]
There are two intertwined things here:
1. a plugin, to be used in the service worker, that pulls content from IPFS using Gun for addressing
2. a tool to *push* content to Gun and IPFS, which the way it's currently implemented has to happen in the browser window context because it's using window.performance.getEntriesByType("resource")
It was just easier for me to implement it like that. No strong feelings about it, though!
@tomasino plus there are things that can be moved out to a general Samizdat library to be available in both contexts perhaps (listLocalResources)
So yeah, it's a mess. And it would benefit greatly from me being able to rubber duck it all with someone. So as soon as I'm back in 101, first coffee's on me!
- service-worker.js is entirely service worker
- samizdat.js is entirely browser window (and some stuff from index.html and from gun-ipfs.js should probably be moved there)
- gun-ipfs.js is... complicated, and needs cleaning up, but feels like it should remain a separate "plugin" file, so that adding new plugins is not too hard.
"I appreciate SDF but it's a general-purpose server and the name doesn't make it obvious that it's about art." - Eugen Rochko