Update 'readme.md'

This commit is contained in:
DOLBY ATMOSFEAR 2020-08-09 07:42:44 +00:00
parent a5a1d3bad9
commit a0a4b9898a

248
readme.md
View File

@ -1,9 +1,13 @@
1. * 1. 1. ### This is the forum board source, this is the assembled version of the forum,
1. * 1. 1. ### this git will be used to work the themes without having to worries about having to assemble it.
1. * 1. 1.
1. * 1. 1. https://is.privy.ws
1. * 1.
### This is the forum board source, this is the assembled version of the forum,
### this git will be used to work the themes without having to worries about having to assemble it.
https://is.privy.ws
# What is PRiVY?
> PRiVY is a mixed bag of acquaintances.
> We build Communication network for modern hackers security needs.
> We strongly believes in the right to share and right to privacy.
> PRiVY will always be fully transparent and open towards people using our services
*PRiVYBB is an unique bulletin board / forum, written entirely in assembly language (FASM) and not WASM and using SQLEET(sSQLITE) as a forum database engine.
It is designed to be extremely portables and easy to deploy.
@ -11,11 +15,11 @@ It is designed to be extremely portables and easy to deploy.
The main and major change in this release is the support for encrypted forum database. The great SQLite plugin SQLeet is used. According to the specification it supports:
* ** PBKDF2-HMAC-SHA256 key derivation with a 16-byte salt and 12345 iterations.**
* **
* ChaCha20 stream cipher with one-time keys.
* **
* Poly1305 authentication tags. **
> PBKDF2-HMAC-SHA256 key derivation with a 16-byte salt and 12345 iterations.
>
> ChaCha20 stream cipher with one-time keys.
>
> Poly1305 authentication tags.
##
## PRiVY template engine reference
@ -43,27 +47,27 @@ proc RenderTemplate, .pText, .hTemplate, .sqlite_statement, .pSpecial
Return value:
The procedure returns the TText structure (possibly reallocated) in the register EAX.
Template symbols escape
> The procedure returns the TText structure (possibly reallocated) in the register EAX.
> Template symbols escape
>
> There are 4 special characters used in the template commands that must to be escaped in the template text that is not command. These characters are: [, ], | and ^.
>
> The escaped characters should be prefixed by the escape character ^ when used as a part of the text. I.e. ^[, ^], ^| and ^^.
> Template database fields
>
> The database fields from the passed SQLite statement can be inserted in the template text by simply enclosing the field name in square brackets:
>
> For example:
>
> The user [UserName] has been banned!
>
> The field names are case insensitive.
>
> The content of the field is always rendered as a text (if the field is NULL, then it is rendered as an empty string) and the content is HTML encoded.
>
> In order to include a database field not HTML encoded (for example, it it already contains HTML code) it need to be nested in a [html:] command (read bellow):
There are 4 special characters used in the template commands that must to be escaped in the template text that is not command. These characters are: [, ], | and ^.
The escaped characters should be prefixed by the escape character ^ when used as a part of the text. I.e. ^[, ^], ^| and ^^.
Template database fields
The database fields from the passed SQLite statement can be inserted in the template text by simply enclosing the field name in square brackets:
For example:
The user [UserName] has been banned!
The field names are case insensitive.
The content of the field is always rendered as a text (if the field is NULL, then it is rendered as an empty string) and the content is HTML encoded.
In order to include a database field not HTML encoded (for example, it it already contains HTML code) it need to be nested in a [html:] command (read bellow):
For example:
# For example:
This is my HTML formatted [html:[signature]].
@ -139,7 +143,7 @@ The rendering of the nested commands is almost always (except the [case:] comman
tagprefix - returns a web site specific unique prefix that to be used for creating globally unique IDs for the Atom feeds. Tag URI scheme is used.
hostroot - returns the root part of the forum URLs - for example: "https://board.asm32.info" for this very site.
hostroot - returns the root part of the forum URLs - for example: "https://is.privy.ws" for this very site.
allstyles - returns all CSS styles used until this moment in the templates (see the command [css:] bellow) Depending on the forum settings it returns the CSS in a form of set of <link> tags, or as a <style> tag.
@ -318,99 +322,99 @@ permDelOwn = 64
permDelAll = 128
permAdmin = $80000000
```
"avatar_max_size" - integer (default: 50KB); The maximal size of the user uploaded images in bytes.
"avatar_width" - integer (default: 128px); The width of the user uploaded avatars. Avatars with different width are rejected. Notice, that the avatars already uploaded to the database will not be affected by the change of this parameter.
"avatar_height" - integer (default: 128px); The height of the user uploaded avatars. Avatars with different height are rejected. Notice, that the avatars already uploaded to the database will not be affected by the change of this parameter.
More important of these parameters can be set from the /!settings (settings panel) of the forum.
The remaining should be set from the SQLite console. Something like:
```
insert or replace into Params values ("avatar_max_size", 10*1024);
```
The parameter can be deleted by:
delete from Params where id="avatar_max_size";
The whole content of the table can be displayed by:
select * from Params;
>
> "avatar_max_size" - integer (default: 50KB); The maximal size of the user uploaded images in bytes.
>
> "avatar_width" - integer (default: 128px); The width of the user uploaded avatars. Avatars with different width are rejected. Notice, that the avatars already uploaded to the database will not be affected by the change of this parameter.
>
> "avatar_height" - integer (default: 128px); The height of the user uploaded avatars. Avatars with different height are rejected. Notice, that the avatars already uploaded to the database will not be affected by the change of this parameter.
>
> More important of these parameters can be set from the /!settings (settings panel) of the forum.
>
> The remaining should be set from the SQLite console. Something like:
>
> ```
> insert or replace into Params values ("avatar_max_size", 10*1024);
> ```
>
> The parameter can be deleted by:
>
> delete from Params where id="avatar_max_size";
>
> The whole content of the table can be displayed by:
>
> select * from Params;
>
Templates
Introduction
The templates are text files, with extension ".tpl" located in the directory "/templates". They contains some text, mixed with special commands, interpreted by the forum engine in order to create the HTML code of the pages, sent to the user.
By editing the template files, it is possible to change the appearance of the forum to any desirable visual skin.
The commands are enclosed in square brackets and can be nested recursively. Each command in fact returns some text value, replacing the command itself.
The template engine is always called with 2 (optional) parameters:
1. Active SQLite statement, containing one row of some SQL query and
2. Pointer to an array of engine internal variables about the currently served HTTP request.
This way, the commands are two types - commands returning information from the internal data structures of the engine and commands returning information from the SQL statement.
Commands returning request information
[special:KEYWORD] It is group of commands, returning information from the internal data structure.
Depending on KEYWORD, there are:
[special:version] - Returns the version of the engine executable file.
[special:timestamp] - Returns the time elapsed from the beginning of the current HTTP request, formatted as a decimal number with 3 digits after the decimal point. The time is measured in milliseconds with resolution in microseconds.
[special:title] - Returns the full current page title.
[special:username] - Returns the username of the user that made the request, or empty string if the user is not logged in.
[special:userid] - Returns the ID of the user (as in Users table of the database) that made the request, or 0 if the user is not logged in.
[special:permissions] - Returns the permissions of the user that made the request. If the user is not logged in - returns 0.
[special:isadmin] - 1 if the user is admin. 0 - if not admin or not logged in.
[special:canlogin] - 1 if the user is permitted to login. Currently, it is always 1, but in the future versions is possible to be used to ban users by IP.
[special:canpost] - 1 if the user is permitted to post messages in existing threads.
[special:canstart] - 1 if the user is permitted to start new threads.
[special:canedit] - 1 if the user can edit the currently displayed post. 0 elsewhere. This flag is a little bit tricky. It will be 1 only if the user has global editing permission or if the current SQL statement, passed to the template engine has field "userid" equal to the userid of the current user and this current user has editing permissions for its own content.
[special:candel] - 1 if the user can delete the currently displayed post. See [special:canedit] for detailed explanation.
[special:page] - Returns the number of the page, as specified in the requested URL or 0 if no page is specified. It has meaning only for the thread lists and threads pages.
[special:dir] - Returns the current directory (in other words the current selected tag) as specified in the requested URL.
[special:thread] - Returns the slug of the thread as specified in the request URL. Has meaning only for threads.
[special:referer] - Returns the page from where the user came. i.e. the HTTP_REFERER header of the request.
[special:alltags] - Returns all tags, of the forum, that have at least 1 thread attached, formatted in HTML with sizes, proportional to their popularity (i.e. the number of threads tagged with every tag). This command is aimed especially to construct the tag list displayed at the top of the pages. Can be styled by CSS or/and JS if needed.
[special:setupmode] - Special tag, that has value of 1 only when the forum is in setup mode, i.e. the Users table is empty. In this mode, only the admin created form is displayed by the forum. Should not be used in the templates actually.
[special:search] - Returns the current search query of the forum search engine.
[special:posters=THREAD_ID] - Returns list of the usernames of the thread starter and first several posters in the thread with ID=THREAD_ID. Can be used in the thread list summary representation of the thread. The list is formatted in HTML.
[special:threadtags=THREAD_ID] - Similar to the previous command, returns a list of the tags, assigned to a thread with ID=THREAD_ID.
Commands for data processing
[minimag:MARKDOWN_TEXT] - This command parses the markdown formatted text MARKDOWN_TEXT and converts it into HTML. The markup is very similar to the base markdown, but has some differences.
[case:INDEX|TEXT0|TEXT1|TEXT2..|TEXTN] - case operator, depending on the value of INDEX, one of the "|" delimited texts is returned. The operator works with saturation. If the value of INDEX is bigger than the number of provided texts, the last text is returned.
[sql:SQL_STATEMENT|PARAM1|PARAM2|...|PARAMN] - Prepares SQL statement SQL_STATEMENT, binds the "?" parameters to the provided, "|" separated values and executes the query. The query must be scalar - i.e. to return only one value and this value is returned as a result of the operation. If the query ends with empty set or error, an empty string is returned. Notice: this is extremely dangerous command that can destroy the data base! Use only "select" statements and always use fixed query and parameter bindings.
>
> The templates are text files, with extension ".tpl" located in the directory "/templates". They contains some text, mixed with special commands, interpreted by the forum engine in order to create the HTML code of the pages, sent to the user.
>
> By editing the template files, it is possible to change the appearance of the forum to any desirable visual skin.
>
> The commands are enclosed in square brackets and can be nested recursively. Each command in fact returns some text value, replacing the command itself.
>
> The template engine is always called with 2 (optional) parameters:
>
> 1. Active SQLite statement, containing one row of some SQL query and
>
> 2. Pointer to an array of engine internal variables about the currently served HTTP request.
>
> This way, the commands are two types - commands returning information from the internal data structures of the engine and commands returning information from the SQL statement.
> Commands returning request information
>
> [special:KEYWORD] It is group of commands, returning information from the internal data structure.
>
> Depending on KEYWORD, there are:
>
> [special:version] - Returns the version of the engine executable file.
>
> [special:timestamp] - Returns the time elapsed from the beginning of the current HTTP request, formatted as a decimal number with 3 digits after the decimal point. The time is measured in milliseconds with resolution in microseconds.
>
> [special:title] - Returns the full current page title.
>
> [special:username] - Returns the username of the user that made the request, or empty string if the user is not logged in.
>
> [special:userid] - Returns the ID of the user (as in Users table of the database) that made the request, or 0 if the user is not logged in.
>
> [special:permissions] - Returns the permissions of the user that made the request. If the user is not logged in - returns 0.
>
> [special:isadmin] - 1 if the user is admin. 0 - if not admin or not logged in.
>
> [special:canlogin] - 1 if the user is permitted to login. Currently, it is always 1, but in the future versions is possible to be used to ban users by IP.
>
> [special:canpost] - 1 if the user is permitted to post messages in existing threads.
>
> [special:canstart] - 1 if the user is permitted to start new threads.
>
> [special:canedit] - 1 if the user can edit the currently displayed post. 0 elsewhere. This flag is a little bit tricky. It will be 1 only if the user has global editing permission or if the current SQL statement, passed to the template engine has field "userid" equal to the userid of the current user and this current user has editing permissions for its own content.
>
> [special:candel] - 1 if the user can delete the currently displayed post. See [special:canedit] for detailed explanation.
>
> [special:page] - Returns the number of the page, as specified in the requested URL or 0 if no page is specified. It has meaning only for the thread lists and threads pages.
>
> [special:dir] - Returns the current directory (in other words the current selected tag) as specified in the requested URL.
>
> [special:thread] - Returns the slug of the thread as specified in the request URL. Has meaning only for threads.
>
> [special:referer] - Returns the page from where the user came. i.e. the HTTP_REFERER header of the request.
>
> [special:alltags] - Returns all tags, of the forum, that have at least 1 thread attached, formatted in HTML with sizes, proportional to their popularity (i.e. the number of threads tagged with every tag). This command is aimed especially to construct the tag list displayed at the top of the pages. Can be styled by CSS or/and JS if needed.
>
> [special:setupmode] - Special tag, that has value of 1 only when the forum is in setup mode, i.e. the Users table is empty. In this mode, only the admin created form is displayed by the forum. Should not be used in the templates actually.
>
> [special:search] - Returns the current search query of the forum search engine.
>
> [special:posters=THREAD_ID] - Returns list of the usernames of the thread starter and first several posters in the thread with ID=THREAD_ID. Can be used in the thread list summary representation of the thread. The list is formatted in HTML.
>
> [special:threadtags=THREAD_ID] - Similar to the previous command, returns a list of the tags, assigned to a thread with ID=THREAD_ID.
> Commands for data processing
>
> [minimag:MARKDOWN_TEXT] - This command parses the markdown formatted text MARKDOWN_TEXT and converts it into HTML. The markup is very similar to the base markdown, but has some differences.
>
> [case:INDEX|TEXT0|TEXT1|TEXT2..|TEXTN] - case operator, depending on the value of INDEX, one of the "|" delimited texts is returned. The operator works with saturation. If the value of INDEX is bigger than the number of provided texts, the last text is returned.
>
> [sql:SQL_STATEMENT|PARAM1|PARAM2|...|PARAMN] - Prepares SQL statement SQL_STATEMENT, binds the "?" parameters to the provided, "|" separated values and executes the query. The query must be scalar - i.e. to return only one value and this value is returned as a result of the operation. If the query ends with empty set or error, an empty string is returned. Notice: this is extremely dangerous command that can destroy the data base! Use only "select" statements and always use fixed query and parameter bindings.
Actually this command is usually used not for extracting data from the database, but simply as a calculator to compute complex expressions by using the SQLite expression parser. In this case the command looks like: