{"id":22511709,"url":"https://github.com/zeroxthreef/stsml","last_synced_at":"2025-07-12T17:37:09.910Z","repository":{"id":179796164,"uuid":"282427853","full_name":"zeroxthreef/stsml","owner":"zeroxthreef","description":"A scriptable HTML templating server","archived":false,"fork":false,"pushed_at":"2021-08-12T02:52:12.000Z","size":60,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-28T00:47:02.108Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zeroxthreef.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-07-25T11:12:33.000Z","updated_at":"2021-08-12T02:52:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"5d1775d6-3bfc-45ed-a116-e9e479534af9","html_url":"https://github.com/zeroxthreef/stsml","commit_stats":null,"previous_names":["zeroxthreef/stsml"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/zeroxthreef/stsml","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeroxthreef%2Fstsml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeroxthreef%2Fstsml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeroxthreef%2Fstsml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeroxthreef%2Fstsml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zeroxthreef","download_url":"https://codeload.github.com/zeroxthreef/stsml/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeroxthreef%2Fstsml/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265026157,"owners_count":23699901,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-07T02:13:45.664Z","updated_at":"2025-07-12T17:37:09.901Z","avatar_url":"https://github.com/zeroxthreef.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# STSML\nSTS Markup Language can do simple scriptable html modifications with the scripting language [STS](https://github.com/zeroxthreef/SimpleTinyScript) (simple tiny script). Sort of like of PHP but this is nowhere near that level.\n\nstsml has an asynchronus task system and redis client functions built in.\n\n\n## STSML Documentation\nstsml is different from vanilla STS's syntax in the following examples: (note that any amount of space including none is ok for these)\n\n\n``\u003c% ... %\u003e`` (multiline expression)\u003cbr\u003e\nMultiline STS expressions can be done inside matching brackets. If the file only contains these, nothing will be sent unless explicitly written to the buffer.\n\nExample:\n```\n\u003c%\n\tprint this message will go directly to stderr\n\n\tprint hello :)\n%\u003e\n\u003chtml\u003e\n\t\u003cbody\u003e\n\t\t\u003c% local i 0 %\u003e\n\n\t\t\u003c% loop(\u003c $i 10) { %\u003e\n\n\t\t\t\u003cb\u003ehello, currently at: \u003c%? pass $i %\u003e\u003c/b\u003e\n\n\t\t\u003c% ++ $i; }  # the semicolon is used to put multiple expressions on the same line %\u003e\n\t\u003c/body\u003e\n\u003c/html\u003e\n```\n\n\n``\u003c%! file/path %\u003e`` (include absolute)\u003cbr\u003e\n``\u003c%@ file/path %\u003e`` (include relative)\u003cbr\u003e\nstsml files can be included directly into the current document relative to the current path '@', or relative to the server's working directory '!'. Note that a recursive include will either stack overflow or oom your machine.\n\n\n\n``\u003c%? ... %\u003e``(print single expression string value)\u003cbr\u003e\nPrint directly to the current http buffer using just a single STS expression. Note that this means you have to pass a root expression, which means that if you arent calling a function, a `pass` action needs to be used.\n\nExample:\n```\n\u003c%\n\tlocal test \"hello world\"\n%\u003e\n\u003chtml\u003e\n\t\u003cbody\u003e\n\t\t\u003ch1\u003elocal value: \u003c%? pass $test %\u003e\n\t\t\u003cb\u003e\u003c%? string a b c d e f %\u003e\u003c/b\u003e\n\t\u003c/body\u003e\n\u003c/html\u003e\n```\n\n\n## STSML Function Documentation\n\n`http-write append_string`\u003cbr\u003e\nAppend strings to the current http buffer.\n\n`http-clear`\u003cbr\u003e\nClear the http buffer.\n\n`http-method-get`\u003cbr\u003e\nReturns the current http method as a string like 'GET'.\n\n`http-path-get`\u003cbr\u003e\nReturns the current http not-query string aka the request path\n\n`http-body-get`\u003cbr\u003e\nReturns the raw http body.\n\n`http-post-get post_key_str`\u003cbr\u003e\nReturns post data as a string if found, nil if not.\n\n`http-query-get query_key_str`\u003cbr\u003e\nReturns url query data as a string if found, nil if not.\n\n`http-file-get post_file_name_str`\u003cbr\u003e\nReturns a string of the file uploaded to a path somewhere in /tmp/ if exists, nil if not. Note that this temporary file disappears when the script exits.\n\n`http-cookie-get cookie_key_str`\u003cbr\u003e\nReturns the cookie value if found, nil if not.\n\n`http-cookie-put cookie_key_str cookie_value_str cookie_ttl cookie_flags`\u003cbr\u003e\nSets a cookie. Flags are 1 for httponly and 2 for secure. Bitwise OR both of these and secure httponly cookies will be set.\n\n`http-header-get header_key_str`\u003cbr\u003e\nReturns the header value string if found, nil if not.\n\n`http-header-put header_key_str header_value_str`\u003cbr\u003e\nSet an http header to the header value string.\n\n`http-write-file path_str`\u003cbr\u003e\nWrite a file to the http buffer instead. This is loaded after scripts finish and overrides the regular buffer.\n\n`http-route absolute_str`\u003cbr\u003e\nReroute the server internally. Path is absolute and the root is the working directory.\n\n`redis-connect ip_str port_number`\u003cbr\u003e\nConnects to a Redis server and returns 1.0 on a successful connection, 0.0 otherwise.\n\n`redis ...`\u003cbr\u003e\nSends a Redis command to the global connection. Will only take strings and numbers. Any other value type will be skipped. Note that the total number (not size of arguments, these can be nearly infinite) of arguments is limited to an already absurdly long amount of arguments **(1024 max)**, but nothing bad will happen if this is reached, which is near impossible.\n\nThis returns a value that converts the redis response to an STS value, so it may be an array, string, or any other kind of value.\n\n`task-create script_file ...`\u003cbr\u003e\nCreate a task thread for asynchronus things. Can run forever if necessary. **Note that these do not share globals with the rest of the system** and all arguments passed are recursively copied.\n\n`stop`\u003cbr\u003e\nStop listening for new connections and stop the server process cleanly.\n\n\n## Server Usage\n`-help`\u003cbr\u003e\nPrint help page that lists this section.\n\n`-port`\u003cbr\u003e\nSet the http port. The default is 8080.\n\n`-init`\u003cbr\u003e\nSet the startup STS script. **NOTE: this is NOT FOR STSML SCRIPTS. Only regular STS scripts will work**. All of the same functions will work, but it will not be parsed as an stsml file.\n\n`-last_resort`\u003cbr\u003e\nDisplay an stsml file if everything else fails. Note that this will halt the server if this file is not found.\n\n`-working_dir`\u003cbr\u003e\nSet the server working directory.\n\n\n## Building \u0026 Installing\nstsml depends on [hiredis](https://github.com/redis/hiredis) and [onion](https://github.com/davidmoreno/onion).\n\n**Debian/Ubuntu:**\u003cbr\u003e\n```\nsudo apt install libhiredis-dev\ngit clone https://github.com/davidmoreno/onion.git\ncd onion\n... complete onion install instructions\ncd ..\ngit clone https://github.com/zeroxthreef/stsml.git --recursive\ncd stsml\n./build.sh\nsudo ./install.sh\n```\n\n\n## License\nPublic Domain / Unlicense (pretty much the same)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzeroxthreef%2Fstsml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzeroxthreef%2Fstsml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzeroxthreef%2Fstsml/lists"}