Return to home page

Laika.LK Logbook

2021-01-05 - A Gemlog like script

My last log entries were too opinion-centered. Today, I am publishing the script that registers the likes on this logbook. By making these files public, I also intend to help everyone to know what I do with the personal information saved in this capsule.

I was inspired by makeworld's Gemlikes script, but I wanted the number of likes and the "like button" to be visible in the page itself, and also to be possible to unlike the page.

makeworld's original announcement of his Gemlikes script.

The script saves the IP of the user after he/she likes the page. Only the IPv4 is saved, not even the date, hour or other information. The IP is written on a file linked to that page. Anytime later, if the user is connected through the same IP, it is possible for him/her to unlike the page, having the IP erased from that file. There is no record of every likes that have ever been registered. If you like a page, and immediately unlike it, I will never know.

The variables mentioned are used as described in the Jetforce gemini server documentation.

[https] The Jetforce server GitHub page

Below, a brief explanation on how each file works.

== Private files (not made public directly at you Gemini capsule directory)

  likescript   Prints the number of likes and the like/unlike button.

               This file is embedded into the page, which has to be itself a CGI
               executable. Personally, I build my pages as shell scripts, so I
               would just have this line at the end of the page, and the content
               will show up:

                   /dir-to-file/likescript


  likeable     Each line of this file is part of the URL as set by the
               SCRIPT_NAME variable when checked by the 'likescript' file, and
               the PATH_INFO variable when checked by the 'like' file.
               Example, taken directly from my capsule:

                  $ cat likeable
                  /capsule/20201201-liftoff.log
                  /capsule/20201227-like-a-laika.log
                  /capsule/20201229-my-programming-skills.log


 <other files> These files are named after the files in the 'likeable' file,
               but their content is only the IP of those users who liked th
               page with the same name.


== Public file (which can be summoned directly by the client)

 like          Registers the like or unline of the page which part of URL is
               appended.

               For example:
               When summoned as gemini://domain.com/like/20210101-hello.gmi,
               the gemini://domain.com/20210101-hello.gmi page gets a like or
               unlike, but only if /20210101-hello.gmi is a line of the
               'likeable' file.

The 'likescript' file.

The 'like' file.

Thanks for surviving the reading. Any kind of replies are welcome. My expectation is that the version 2.0 might feature live comments and 3D holograms.

--Maimere

===============

72 guests liked this.

Like this page.