以PSKOV静态站点生成器为例,在持久应用中

以PSKOV静态站点生成器为例,在持久应用中

Hi, my name is Michael Kapelko. I have been developing software professionally for more than 10 years. I develop games and game development tools in my spare time.

嗨,我叫Michael Kapelko。 我从事专业软件开发已有十多年了。 我在业余时间开发游戏和游戏开发工具。

This article describes my first durable application for desktop PCs: PSKOV static site generator.

本文介绍了我在台式机上的第一个耐用应用程序:PSKOV静态站点生成器。

Durability

耐用性

A durable application is an application that functions without a single change on operating systems released in years 2010-2030. In other words, a durable application has backward compatibility of 10 years and has the stability to run for 10 years. Actually, PSKOV runs even under Windows 2000, so PSKOV has backward compatibility of 19 years.

持久性应用程序是一种功能,其功能在2010-2030年发布的操作系统上没有任何更改。 换句话说,持久的应用程序具有10年的向后兼容性,并且具有10年运行的稳定性。 实际上, PSKOV甚至可以在Windows 2000下运行,因此PSKOV具有19年的向后兼容性。

From technical side, PSKOV is a single HTML file with layout (HTML), styles (CSS), and code (JavaScript) packed inside. PSKOV runs strictly inside a web browser without connecting to any server.

从技术角度来看,PSKOV是一个单独HTML文件,其中包含布局(HTML),样式(CSS)和代码(JavaScript)。 PSKOV严格在Web浏览器中运行,而无需连接任何服务器。

Such an implementation gives PSKOV the following features:

这样的实现为PSKOV提供了以下功能:

  • it can be copied without restrictions

    可以不受限制地复制
  • it can be hosted anywhere

    它可以在任何地方托管
  • it can run locally

    它可以在本地运行
  • it can operate without Internet

    它可以在没有互联网的情况下运行

I can't guarantee stability for 10 years because I can't control the future. However, the history of HTML, CSS, and JavaScript evolution tells us these technologies are developed with maximum backward compatibility. First, new JavaScript features leave older ones still working. Second, web browser developers are interested in making their web browsers work with as many web sites as possible. For example, <center> tag, being declared deprecated in 2014, still works as expected 5 years since, in 2019.

我无法保证10年的稳定,因为我无法控制未来。 但是,HTML,CSS和JavaScript的发展历史告诉我们,这些技术的开发具有最大的向后兼容性。 首先,新JavaScript功能使旧功能仍然可以使用。 其次,Web浏览器开发人员对使他们的Web浏览器与尽可能多的网站一起使用感兴趣。 例如,在2014年宣布弃用的<center>标签自2019年起五年后仍能按预期工作。

At the same time, each web browser application has a serious restriction called sandbox, a deceptive name for a cage. The cage prevents access to both local file system of users and almost any Internet resource without its owner's explicit permission (CORS). As a result, the application can only communicate with users either through the distinct server, or by offering files to download manually. Downloading files one by one or as an archive is inconvenient, that's why nowadays server oriented approach reigns the world. I'll touch problems of that approach in a moment.

同时,每个Web浏览器应用程序都有一个严格的限制,称为沙箱,这是笼子的一个欺骗性名称。 笼子阻止未经其所有者的显式许可(CORS)访问用户的本地文件系统和几乎所有Internet资源。 结果,该应用程序只能通过单独的服务器或通过提供文件以手动下载来与用户通信。 逐个下载文件或将其作为档案下载是不方便的,这就是当今面向服务器的方法占据统治地位的原因。 我将在稍后讨论这种方法的问题。

To free PSKOV from the cage, LFSA was created, a tiny Python script that needs to be run manually while PSKOV is running. LFSA allows PSKOV to access the user’s local file system. Python was selected because Linux and macOS have Python installed by default, and users can easily install Python on Windows (even Windows 2000).

为了从笼子中释放PSKOV ,创建了LFSA是一个很小的Python脚本,需要在PSKOV运行时手动运行。 LFSA允许PSKOV访问用户的本地文件系统。 选择Python是因为Linux和macOS默认情况下已安装Python,并且用户可以轻松地在Windows(甚至Windows 2000)上安装Python。

Track record

跟踪记录

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

PSKOV已成功用于创建以下小型站点:

Now let's see why PSKOV was created as a durable application for web browsers.

现在让我们看看为什么PSKOV是作为Web浏览器的持久应用程序创建的。

Reason №1: collect and keep knowledge in an accessible form

原因1:以易于访问的形式收集和保留知识

I have been creating convenient game development tools for several years now. So far the collected knowledge was represented by native applications for desktop PCs, education articles for related technologies, and showcase videos. Such forms of the collected knowledge are basically dead:

几年来,我一直在开发便捷的游戏开发工具。 到目前为止,所收集的知识以台式PC的本机应用程序 ,相关技术的教育文章以及展示视频为代表 。 这些收集的知识的形式基本上已死:

  • few would download an unknown application

    很少有人会下载未知的应用程序
  • few would watch some videos

    很少有人会看一些视频
  • even fewer would read some articles

    更少的人会读一些文章

In many ways, this death is due to inaccessibility: one has to make an unknown amount of effort to achieve an unknown result. Hardly anyone would have interest in this. A web browser application, potentially accessible anywhere, is a totally different deal: you only need to make a known effort, click a link, to achieve an unknown result. The history of conducting twitter revolutions proves that almost anyone can open a link and "like" the change of a "bloody regime".

在许多方面,这种死亡是由于无法到达而造成的:人们必须付出未知的努力才能获得未知的结果。 几乎没有人对此感兴趣。 Web浏览器应用程序(可能在任何地方都可以访问)是完全不同的交易:您只需做出已知的努力,单击链接即可获得未知的结果。 进行推特革命的历史证明,几乎任何人都可以打开链接并“喜欢”“血腥政权”的变化。

Reason №2: rule by people

原因之二:人治

Nowadays any Internet activity is performed by the means of services that almost always belong to some company: messages, maps, search, music, source code, etc. Such power usurpation leads to shutdowns of services that their owning companies deem unprofitable. They usually do it without any consent with those users who brought life to these services in the first place.

如今,任何Internet活动都是通过几乎总是属于某家公司的服务来执行的: 消息地图搜索音乐源代码等。这种权力篡夺导致其所属公司认为无利可图的服务 关闭 。 他们通常在没有第一时间将生命带入这些服务的用户的情况下进行此操作。

Other times companies simply block competing browsers from accessing their service, as it was recently the case with the web version of Skype. Luckily there are people who don’t agree with such politics. Thanks to them, unlocking tools appear.

有时,公司只是阻止竞争的浏览器访问其服务,就像最近的网络版Skype一样 。 幸运的是,有些人不同意这种政治。 多亏了他们, 解锁工具出现了。

As for me, I deem such a way of handling things as inappropriate. However, savage business is not the only one to blame here; average users, every one of us is guilty, too. You may argue that users have no choice, that someone else (government, aliens, underline what you like) made this world unfair. Some people even blame government/aliens directly and believe that without them, life would be amazing. However, human history tells us a different story: "the state is not some enemy horde that occupied the society, but that which grows out of society and mirrors it".

对于我来说,我认为这种处理事情的方式不合适。 但是,野蛮的生意并不是唯一应归咎于此的人。 普通用户,我们每个人也都感到内gui。 您可能会争辩说,用户别无选择,其他人(政府,外星人,强调您所喜欢的东西)使这个世界变得不公平。 有些人甚至直接责怪政府/外国人,并相信没有他们,生活会很棒。 但是,人类历史告诉我们一个不同的故事 :“ 国家不是占领社会的敌对部落,而是从社会成长出来并反映出来的国家 ”。

Being part of the people, I decided to start with myself and use my power for the best: create applications that I need in such a way to make them usable and accessible to everyone everywhere. PSKOV is the first attempt, which already exceeded my expectations. Sure, PSKOV has limitations like LFSA and unencrypted HTTP; there's a lot to do to increase the accessibility of PSKOV, however, I'm ready to dare anyone: current PSKOV version will keep functioning for 10 years to come without any maintenance.

作为人们的一部分,我决定从我自己开始,并尽我最大的力量:创建我需要的应用程序,以使它们对任何地方的所有人都可用和可访问。 PSKOV是第一次尝试,已经超出了我的期望。 当然,PSKOV具有LFSA和未加密的HTTP之类的限制; 要提高PSKOV的可访问性,还有很多工作要做,但是,我已经敢于挑战任何人:当前的PSKOV版本将在没有任何维护的情况下继续运行10年。

That's it for describing my first durable application for desktop PCs: PSKOV static site generator.

这就是描述我的第一个台式机持久应用程序:PSKOV静态站点生成器。

翻译自: https://habr.com/en/post/462693/