Infohub v1.3.9

InfoHub is your private place on the web where you can have private data and only share between your own devices.

At 2022-06-17 I released Infohub v1.3.9.

The highlights are changes made to Launcher to make it simpler and perhaps easier to understand.
Reduced memory requirements on the server. Logging if peak memory or execution time is too large.
Improving document handling.

Here I will go more into depth with the new things in this release.

Added – new features

HUB-1598, messages now return the from-parameter from the server. For debug purposes.

Previously it was not possible to see who delivered the answer message. Now that information is part of the message.
That makes it easier for you to debug messages that come from another node.

HUB-1604, Rewritten plugins_request to not do any subCall at all

Doing sub calls means the data need to be put on the stack in the message itself. That takes time, cpu power and memory consumption. That is usually called “the cost”.
I have reduce the cost when the client is asking the server for plugins by limiting the size of the response.
The plugins you do not get is listed and you can ask again to get them.
All JS plugins are now minified by default. You can set in config what plugins to not minify for debug purposes.

This reduce the memory consumption on the server. Reduces the size of the answer.

HUB-1606, Now return peak memory usage. Also added more plugins to start.js to get a faster start.

The server now return the peak memory usage in the answer to you. With that information you can optimise your server side code to use less memory.

In this task I have also added more plugins to the startup procedure. Plugins that will be used along the way when you login and load the Workbench.
That speeds up the startup because no separate requests are needed to get a missing plugin during startup.

HUB-1607, log_if_memory_peak_usage_above_mb = 8

One of the goals of InfoHub is to run the server on Raspberry Pi 3 or 4 or Zero. Then “the cost” need to be low.
One tool for detecting high cost is the memory limit logging. Now you can define a memory limit and all calls that is above that limit will be logged.
Default is 8Mb for each request to the server.

HUB-1608, log_if_execution_time_is_above_seconds = 1.0

If code execute for a long time it means it has a high CPU cost. With the new execution time logging a call is logged if it executes for too long time.
THe default max execution time is 1 second. The server must be done executing within that time or else the call wil be logged.

HUB-1620, server, infohub_doc, internal_GetDocument – Added document size

When we want to download all documents to the client it was previously no problem to request them all and get a hugh response.
Now there are even more documents and we get out of memory. We need to limit the response and ask for more documents.
One step on the way is to actually know how large a document is. This task add the size of the document.

HUB-1619, server, infohub_doc, get_documents_list

You can ask the server for the complete list of documents. The list is cached. A config setting set the cache time out to 24 hours.
With this cache the request to get_documents_list became 100ms quicker when the list was read from the cache.

HUB-1623, Removed HTML from Markdown document before download to client

Some Markdown documents are not totally clean from HTML. The README.md file is one example. This change strip all HTML from the data before the file is downloaded to the client.

HUB-1623, Embedded images that have a path. Making the README.md less problematic. It must work on GitHub too.

The InfoHub client do not allow 3rd party links. Some Markdown documents like the README.md have links to images on the GitHUb repo. Those images are now embedded instead.

Changed – changes in existing functionality

HUB-1585, Launcher, Show all icons if my list is empty on startup

Previously the my-list was always shown first and you had to click on the switch button to get the list with all plugins.
That confused users. Now the full list of plugins are shown if the my-list is empty.
I hope that it will lower the confusion for new users.

HUB-1593, render_doc now call infohub_doc_get to get the document instead of asking the server directly

Now the documents use the infohub_doc_get and that means the documents get downloaded and stored locally before rendered.

HUB-1602, Sending large messages get out of memory. Instead of splitting the packageJson I now pull out the section to send

Previously I split the outgoing package JSON into pieces and sent each piece. That took extra memory.
The new way is to send a part of the package JSON with substr without splitting the data. That reduces memory consumption on the server.

HUB-1611, plugins_request – Now do not add the last plugin if the package become too large

Previously I stopped adding plugins to the response when the limit was broken. Now I stop before the limit is broken.
When no more plugins fit the answer then it is returned.

HUB-1609, Lowered the PHP memory from 16Mb to 12Mb. Still works

The max PHP memory was set to 16Mb for each request. That is low but can we go lower?
The max memory is now set to 12 Mb and there are no problems.

HUB-1621, infohub_doc PHP/JS – Refactored doc_name to document_name docName to documentName

I am allergic towards abbreviations. An abbreviation can mean something different to different persons and it can also have multiple meanings.
It is always better to be specific.

HUB-1618, server, infohub_doc, get_documents_list – add checksum and size to each document.

The document list did not have the document checksum and document size. With them it is easy to later determine if you should keep your copy of the document if they have the same checksum.
We can also request a fair amount of documents when we know their sizes.

Renamed checksum_same to is_checksum_same

By using is or has when it comes to booleans you make it easier to follow the logic.

HUB-1624, Launcher, Start is now first button

Previously you could click on a plugin and get a list with buttons where the first buttons were to add / remove from your list.
Now the first button is to start the plugin.

My list is renamed to Favorites. A favorite is a concept that more people is familiar with.
Button to swap lists all/favorites have been moved down. Hope this makes it easier for first time users. They look so confused.

HUB-1622, server, infohub_doc, get_all_documents

Added a config to limit response size from get_all_documents.

HUB-1601, server, infohub_doc, get_all_documents

Now the function require wanted_documents_list. If you want any documents then you need to get the document list and check what you have and then ask for the ones that are new or updated.

HUB-1626, server, infohub_doc, get_all_documents

Now returns the list ask_again_documents_list for documents you have asked for but they did not fit in the answer.
You need to ask again if you want them.

HUB-1631, _Translate() can now convert a key without a translation into english

The function that translate centences look into the plugin translations and find a match depending on your preferred language.
If there are no translations to be found at all you previously got the key itself. For example: PRESS_ENTER_TO_SAVE.
Now that string is converted to english Press enter to save.

HUB-1632, Launcher, Translations updated for sv, en, es

After all changes to InfoHub Launcher there were some translations that were not needed any more, and some new ones.
I have updated the english, spanish, swedish language files.

Removed – now removed features

HUB-1587, Workbench: Remove “Help” button. Because the button confuse users

The help button was confusing and not much help. I removed it entirely.

Fixed – bug fixes

HUB-1543, Config Local – Language, remove I prefer: sv,en

The comment was confusing. Removed it.

HUB-1592, Fixed all eight PHPStan errors with PHPStan v1.6.9

A new version of PHPStan revealed new issues with the PHP code. I fixed them.

HUB-1596, Documents with one word in the name were not found

The code only look for documents that contain a _. But now single named document are also found.

HUB-1612, Error log, infohub_file – read only real files.

internal_Read returned false when it should return true. This is fixed.

HUB-1614, Error, Allowed asset types have wrong data type.

It was a default value that should have been an array but was a string.

HUB-1615, Error, Avoided Ajax call with no messages in the package when using debug keys

I saw that sometimes there is an empty ajax call to the server. Made that call disappear.

Investigated

HUB-1594, render_doc must cache the rendered document.

No need when it now gets the document from infohub_doc_get

HUB-1563, Libre Translate – Documents do not render

Yes it does.

HUB-1545, Node contacts – Doc do not work

Yes it does.

HUB-1586, Doc: All doc buttons must ask InfoHub Doc to render the document

And they do.

HUB-1595, Offline – Are documents really downloaded?

Yes but there are much more docs now, so we get out of memory. Will fix that in HUB-1601

HUB-1610, Refresh full list – Get 28 same messages in one request

Investigated and I do not get that anymore

HUB-1613, Refresh full list – Lower memory peak Mb from 10 to 8.

I failed. It is 8Mb when I debug all the way. It is 10Mb when I run without debugger

End of document