On the way to durable applications using the PSKOV static site generator example

Pskov veche

Hello, my name is Mikhail Kapelko. I am engaged in professional software development for more than 10 years, in my free time I develop games and tools for their creation.

In this article, I will talk about my first long-lasting desktop application - PSKOV static site generator.


By a durable application, I mean an application that works without a single change on operating systems released between 2010-2030. In other words, a long-lasting application has 10 years of backward compatibility and 10 years of durability. However, PSKOV even works on Windows 2000, so it has 19 years of backward compatibility.

Technically, PSKOV is a single HTML file with packed markup (HTML), styles (CSS) and code (JavaScript). PSKOV is executed strictly in a web browser without interacting with the server.

Such an organization gives PSKOV the following opportunities:

I can’t guarantee 10-year durability, because I don’t own the future. At the same time, the history of HTML, CSS, and JavaScript suggests that these technologies are developing with the highest possible backward compatibility. Firstly, the new JavaScript features do not override the old ones. Secondly, web browser manufacturers are interested in having their web browsers work with as many sites as possible. As a result, for example, the <center> tag , declared obsolete in 2014, works without problems 5 years later in 2019.

At the same time, any application in a web browser has a serious limitation - a cell deceptively called a sandbox. This cell denies access to both the user's local file system and almost all resources on the Internet without the permission of the resource owner (CORS). As a result, the application can give something either to a specific server, or to the user in the form of a file for downloading. It is inconvenient to download files one at a time or in an archive, which is why the server approach now prevails in the world, the problems of which I will touch upon a bit later.

To release PSKOVA from the cell, I had to create LFSD , a tiny Python script that needed to be run with my hands while PSKOVA was working. The LFSD enables PSKOV to work with the user's local file system. Python is selected because of its default presence on Linux and macOS, as well as the ability to install on Windows (even Windows 2000).

Achievement list

PSKOV has been successfully tested to create the following small sites:

Now about the reasons for creating PSKOVA precisely in the form of a durable application for a web browser.

Reason number 1: the accumulation and preservation of knowledge in an accessible form

This is not the first year that I have been working on creating convenient game development tools. Until recently, the accumulated knowledge was native desktop applications , training articles on related technologies or video results . The indicated types of accumulated knowledge are distinguished by the fact that this knowledge is essentially dead:

In many ways, this death is due to inaccessibility: you need to make an unknown amount of effort to achieve an unknown result. It is unlikely that anyone can be lured today. The situation is completely different with an application in a browser that potentially works everywhere: you need to make a known effort - open a link - to achieve an unknown result. The history of the Twitter revolution suggests that almost everyone knows how to open links and like the change of the "bloody regime".

Reason number 2: democracy

Today, anyone sneezing on the Internet is carried out through services that almost always belong to a company: messages , maps , search , music , source code , etc. ... The result of such a usurpation of power is the closure of those services that the controlling company considers unprofitable. Moreover, without any discussion with those users, without which this service would never take off.

In other cases, the company may simply prohibit a competing browser from using its service, as has recently happened with the web version of Skype . However, there are people who disagree with such a policy. Thanks to them, tools to disable locks appear.

In my opinion, this state of affairs is unacceptable. However, the fault lies not only with the feral business, but also with ordinary users, each of us. You can argue that users have no choice, that someone else (power, reptilians, underline, necessary) made this world unfair. Someone may even directly blame the power / reptilians and believe that without them we will live. Unfortunately, the history of mankind says the opposite : "the state is not some kind of hostile horde that occupied the society, but that which grows out of society and mirrors it ."

Being a part of the people, I started with myself and decided to use my power for the good: to create the applications I need so that they work for everyone everywhere and always. PSKOV is the first attempt that more than exceeded my expectations. Of course, PSKOVA has its own limitations in the form of LFSD and work over HTTP without encryption; Much remains to be done to increase the availability of PSKOV, but now I am ready to argue with anyone: PSKOV will work without a single change in 10 years. As the saying goes, remember this tweet.

This concludes the story of my first long-term desktop application - PSKOV static site generator.

Source: https://habr.com/ru/post/462685/

All Articles