Skip to main content

Johan Bové

Pinning files from a website to IPFS with a Windows bat script using curl

With ipfs version 0.12.0

3 min read

:: http://steve-jansen.github.io/guides/windows-batch-scripting/part-2-variables.html
:: Saves the JSON files to IPFS
@ECHO OFF
SETLOCAL ENABLEEXTENSIONS

:: script global variables
SET me=%~n0
SET parent=%~dp0
SET folder=export
SET event=https://ukraine.bellingcat.com/ukraine-server/api/ukraine
SET page1=%event%/export_events/deeprows
SET file1=%folder%\export_events.json
SET page2=%event%/export_associations/deeprows
SET file2=%folder%\export_associations.json
SET page3=%event%/export_sources/deepids
SET file3=%folder%\export_sources.json
SET log=%parent%\%me%.log
:: Generate the ipfs key with `ipfs key gen --type=rsa --size=2048 bellingcat_ukraine`
SET ipfskey=k2k4r8k7lcogpmkq9mkf3ykg1rexvhmxcinz5z91k8v49gbem6ivjp1v
SET ipfskeyName=bellingcat_ukraine

ECHO %me%: %date% %time% started...
ECHO --- >> %log%
ECHO %me%: %date% %time% started... >> %log%

curl %page1% > %file1%
curl %page2% > %file2%
curl %page3% > %file3%

SET size=0
call :filesize %file1%
ECHO file 1 size is %size% >> %log%
if %size%==0 goto :eof

call :filesize %file2%
ECHO file 2 size is %size% >> %log%
if %size%==0 goto :eof

call :filesize %file3%
ECHO file 3 size is %size% >> %log%
if %size%==0 goto :eof

ECHO "Files copied..."

:: copies the files in the folder as they appear on the original site
COPY /Y %file1% %folder%\export_events\deeprow >> %log%
COPY /Y %file2% %folder%\export_associations\deeprow >> %log%
COPY /Y %file3% %folder%\export_sources\deepid >> %log%

SET ipfshash='';
SET ipfsbase32='';
FOR /F "usebackq delims=" %%f IN (`ipfs add -q -r %folder%`) DO SET ipfshash=%%f
FOR /F "usebackq delims=" %%f IN (`ipfs cid base32 %ipfshash%`) DO SET ipfsbase32=%%f

ECHO CID: %ipfshash% >> %log%
ECHO https://%ipfsbase32%.ipfs.dweb.link >> %log%

ECHO %me%: Pinning... >> %log%
ipfs pin add %ipfshash% >> %log%

:: ECHO %me%: Pinning to Pinata >> %log%
:: Turned off in favor of web3.storage
@REM ipfs pin remote add --service=Pinata --name=%ipfskeyName% %ipfshash% >> %log%

ECHO %me%: Uploading files to Web3.storage...
:: See https://web3.storage/docs/examples/getting-started/
node C:\Users\johan\Projects\IPFS\web3-storage-quickstart\put-files.js --token=%WEB3_STORAGE_KEY_PC1% %folder% >> %log%

ECHO %me%: Publishing to IPNS key %ipfskeyName% ... >> %log%
ipfs name publish --key=%ipfskeyName% %ipfshash% >> %log%

ECHO %me%: Done! Check the log curl-to-ipfs.log for details.

:: Thank you https://stackoverflow.com/a/11479359
:: Set filesize of first argument in %size% variable, and return
:filesize
  set size=%~z1
  exit /b 0

:: force execution to quit at the end of the "main" logic
EXIT %ERRORLEVEL%

Also available as a gist on Github

Feedback and comments more than welcome!

Johan Bové

My reasons to support the Gemini Internet Protocol

3 min read

Why do I believe Gemini is great for personal Internet presences? First of all, it's a real grass-roots initiative which I am very excited about.

If you're reading this, chances are high you are already using Gemini. But for history reasons and to share my opinions of Gemini I would like to offer you here some views of mine.

Collecting some of the strong-points of Gemini from my perspective of having some experience with Gopher and running personal websites.

Fast and lightweight

  • It's very easy on the system resources. So the protocol works really well on slower hardware without any problems. Hosting on a Raspberry Pi3 is easy-peasy.
  • Since there are no fancy design in Gemini capsules, it is really optimized for low bandwidth.
  • It should work really fine on a feature-phone, like for KaiOS. I don't believe there is a client yet for KaiOs at this time.
  • It's fairly easy to build clients and servers for the protocol.

Simple yet complete

  • The specifications provide enough functionality to do basically what you would expect to be able to do online.
  • Much lower learning curve compared to Gopher and HTML. You can start publishing Gemini pages within minutes.
  • Even-though the syntax is limited, it still gives enough playroom for creative expression.
  • Use of TLS certificates promises security and privacy.
  • It is more international than US-centric Gopher.
  • The procol supports the UTF-8 character set so any language can be used to publish sites in.
  • This should help make the protocol more popular in non-ascii wielding regions in the World.

Easy to publish

  • Content will be probably first of all stored in static text files which are future-proof and easy to maintain.
  • Many servers already available that require minimal technical skills.
  • Yes, you still need a server, but there are many collectives which you can join to facilitate this.

Focus

  • No popups, animations, videos, sound effects.
  • Focus on actual content instead of fluff and effects.
  • No advertisemens and commercial tracking.
  • No Facebook, Google or Twitter.

Accessible

  • Power of formatting goes into the clients or readers. Like in the good old days of the early Web, people are expected to style the content to their own liking.
  • It's pure text, has simple navigation rules, so should be great for people with disabilities.
  • No JavaScript so you really see what you get.

And on top of this, the young Gemini community is driven to make this a success!

I'm sold.

ps. I published this first in plain text on my Gemini capsule and now that I copy paste this into a HTML document I can really tell just how easy it is to publish on Gemini.

Johan Bové

Twitter Interests page checkboxes are terribly bad implemented

It's almost that they don't really want you to edit your interests

2 min read

See this page if you have a Twitter account and want to control what kind of ads you get served: https://twitter.com/settings/your_twitter_data/twitter_interests

It contained over 300 keywords, some of them I totally did not know why they would be added to my profile, some clearly wrong (Loud Orange Face was in there too) - so I started curating the list. The UX of this page is terrible.

In my case, there are over 300 checkboxes in a long list and there is no way to go through the process of unchecking the boxes easily because on EVERY click a POST request is sent to Twitter, which creates a brief moment where the user needs to wait before they can click on the next checkbox.

So obviously when a lot of people do this at the same time, especially now after watching the Social Dilemma documentary, clearly this page was not designed with that kind of traffic and server load in mind.

Was it done deliberately to discourage people to maintain this list? After 10 clicks or so the server is responding with error 503 ("Service Unavailable" or "over capacity") and none of the changes you make to the list is actually stored. I only noticed this after a reload. Yes, you can happily click further ignoring the error toast notification, but none of your changes will be saved.

This smells like a dark pattern, doesn't it?

Johan Bové

Gimme A Token "client mismatch" in Known

Figuring out why Gimme A Token is not working for my Known instance

2 min read

Trying to obtain an Access Token for IndiePub with IndieAuth to be used in IFTTT requests so I can link other Web Services with my site.

I was able before to get a token using https://gimme-a-token.5eb.nl/, and the integration with Pocket, Deezer and others worked, but I revoked all access tokens and today it no longer works to create a new token on my Known instance running version 1.2.2.

This post is about trying to solve this issue.

Got the endpoints of my server using:
https://indieweb-endpoints.cc/search?url=https%3A%2F%2Fsocial.johanbove.info

After entering all the fields in "Gimme A Token" and going through the process to get the access token, I end up on https://social.johanbove.info/indieauth/token with the message "Client mismatch". And I'm not sure where to go next.

What is causing this "client mismatch"? Did Known get safer or is "gimme-a-token" broken?

Going to reach out to Seb and Marcus in the next days.

Found that Greg had a similar issue with Monocle some months ago: https://gist.github.com/jgmac1106/3d4df34f99f9a2bd34d47262f26bf508

Update 2020-06-29 19:00

So I can rule out that "Gimme-A-Token" is broken.

Thanks to the greate people on the IRC channel (thanks Aaron, Greg and sknebel) I have a pointer towards htaccess and http/https redirecting. Looking into that now.

Update 2020-06-29 23:20

It seems that for a correct IndieAuth authentication, I had to add a hard-coded "me" url in the head of the Known head.tpl.php file so the Known homepage would always have this link:

<!-- Hardcoded me url -->
<link href="https://social.johanbove.info" rel="me" class="u-url">

This resolved the https://monocle.p3k.io site error message and I can log in in one flow without having to retry.

But unfortunately I'm still getting "Client mismatch" errors with "Gimme a token" most of the time. I did manage to get once an actual token which I can now use again for IFTTT PESOS syndication.

Johan Bové

Gophering along

2 min read

A screenshot of Johan's Gopherhole

I've been spending way too much time on servers in the last couple of days.

The Gopher Web is intriguing and fascinating and I totally understand the attraction of an ad-free, cookie-free, not-for-profit, underground(-ish) alternative to today's crowded and over-commericially exploited (according to many) HTTP Web.

It's not super straightforward to access, even-though there are good dedicated free browsers (for all platforms) available that totally support the Gopher protocol.

But I have the feeling that because the Gopher Web is a little harder to access, it is actually part of the attractiveness. Lots of humans tired of the current state of the WWW, who still want to publish
content and share stuff, are finding an alternative, albeit archaic, in the Gopher web.

Setting up a Gopher server wasn't hard either thanks to open-source software from dedicated hobbyist developers.

Formatting plain-text files has been interesting too. It's amazing how much effort some Gopher Hole Phloggers take to create beautiful ASCII art and line-out their paragraphs!

Discovering Phlogs has been an eye-opener and inspiring. There are many Phloggers who are publishing worthwile stories and interesting articles in plain text files in their Gopher holes or gopher burrows.

And I had some fun first-time experiences too playing a funny text-based adventure game called "Lost Pig" (2007) -  it's an interactive story, with lots of funny dialogue and plenty of character which by itself is also proof that Gopher pages can also be entertaining.

The Floodgap Gopher (Gopher proxy) site is a great place to start.

Johan Bové

Known Questions

2 min read

These are some questions I have about my Known server instance.

Q1. Redis Support?

My web host supports Redis. Anyone know if there is a plugin for Known which activates Redis cache? Does it make sense to activate Redis for a single-user Known site?

Q2. AsynchronousQueue on a shared web host without sudo access?

Also, I'm on a shared web host where I have access to a limited SSH access, without sudo; how can I set up Known cron for the AsynchronousQueue event queue?

Q3. Which PHP 7.3 Extensions should be active?

Which PHP (7.3) extensions should be active for a Known server instance? See my list here in the screenshot below:

screenshot of active PHP 7.3 extensions

 

Q4. RESOLVED - How can I get the Twitter POSSE plugin working? 

I currently need to manually mention the https://brid.gy publish webmention endpoints to repost my posts and status updates. The Twitter plugin by Known doesn't work on my server. Suspecting an outdated dependency on the tmhOAuh PHP library. Would be awesome if I can get that to work.

Resolution: update the tmhOAuth plugin and cacert.pem certificate.

Q5. Tagging with Known input forms is missing the dedicated tags field

Check why.

To be continued...