fixed up and added some things

This commit is contained in:
2026-06-15 23:59:34 +02:00
parent 96eba42c04
commit 095f516a55
4 changed files with 140 additions and 24 deletions
+40 -4
View File
@@ -3,7 +3,7 @@
## A word of warning!
Currently Amethyst is in very early alpha stage, a lot of things will be broken, names won't be correct,
promised features missing, but I'm very much working on it live!
Every save I do increments the build number by 1, I won't publish all of them, but most of them will be published.
Every save I do increments the build number by 1, I won't publish all of them, but some of them will be published.
Once a milestone is hit (e.g. a new feature fully implemented), I'll publish a release!
## Currently working features:
@@ -21,13 +21,49 @@ They can be found as the `amethyst-prerel-0.a.b` releases. I won't guarantee 100
Install Python, execute `amethyst.py` and change the provided config.
## Minimum requirements:
Python 3.8+
Python 3.10+
And whatever PC that happens to run that.
I recommend Python 3.10 or above though, with a PC running:
I recommend Python 3.12 or above though, with a PC running:
* Windows 8.1+
* macOS 10.15+
* Linux 4.19+
* FreeBSD 13.2R+
* Some other somewhat recent OS.
## Currently W.I.P. Check back later!
## The webserver itself:
The Amethyst webserver is meant to be easy to use and configure. Its configuration takes inspiration from nginx and Caddyfile.
The language the configuration is made in is AmethystConf.
The default config is as follows:
```amethystconf
host * {
directory:./html
apimode:0
block-ua:match("Discordbot")
index:index2.html
}
globals {
http:1
https:1
port:8080
https-port:8443
key:./key.pem
cert:./cert.pem
max-length:8192
}
}
```
It uses a key-value syntax, and uses a `:` as its seperator. A few key directives:
`host`, followed by a hostname signifies a host that will be available. Similar to nginx's `server_name` directive.
`globals` signifies all values that are of global importance, like the key and certificate file.
`directory` signifies the directory to look in for files on that specific host.
`index`, while not in the default config, signifies what path should be returned if the client only asks for `/` (or any subpaths without files).
`apimode` signifies if the API mode must be enabled, allowing the server to run custom Python code to manipulate the request or file further.
`block-ua` signifies if a specific (or loosely matched) User-Agent must be blocked from accessing the site.
`proxy` signifies if a the server needs to get the response from a different (remote) server but still needs to be available at this host.
`max-length` signifies the maximum length a request may have.
AmethystConf has only 4 datatypes: `String`, `Boolean`, `Function` and `None`. A quick rundown:
`String` is the everything datatype. Everything is assumed to be a `String` unless it falls under the other categories.
`Boolean` is the datatype used to enable/disable features. A `Boolean` can have one of two possible values: `1` or `0`.
`Function` is the datatype used in `match()`, it signifies that the parser has to do some work on this string before it can use it.
`None` is the datatype assigned to any key without a value.