diff --git a/docs/README.md b/docs/README.md index 1bf58cff..8d111552 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,3 +1,19 @@ -# Page +--- +description: An alternative to the World Wide Web +--- -test +# Welcome to WebX + +Here you'll find usefull resources, like the User manual for using the WebX and the full developer docs. + +## Main manuals + +[User manual](for-users/basic-user-manual.md#first-thing-first-install-napture) + +[Developer documentation](for-developers/getting-started.md#webx-developer-guide) + +## Useful links + +[Keybinds](for-users/advanced-user-manual.md#keybinds) + +[WebX API reference](for-developers/api-reference.md#api-reference) diff --git a/docs/SUMMARY.md b/docs/SUMMARY.md index 8cfeeb01..a422d37b 100644 --- a/docs/SUMMARY.md +++ b/docs/SUMMARY.md @@ -1,4 +1,17 @@ # Table of contents -* [Page](README.md) -* [Page 1](page-1.md) +* [Welcome to WebX](README.md) + +## For users + +* [User manual](for-users/basic-user-manual.md) +* [Advanced user manual](for-users/advanced-user-manual.md) + +## For developers + +* [Getting started](for-developers/getting-started.md) +* [HTML++](for-developers/html++.md) +* [CSS 3.25](for-developers/css-3.25.md) +* [Luau](for-developers/luau.md) +* [Site publishing & Domain registering](for-developers/site-publishing-and-domain-registering.md) +* [API Reference](for-developers/api-reference.md) diff --git a/docs/borderstyles.png b/docs/borderstyles.png new file mode 100644 index 00000000..08cfe87f Binary files /dev/null and b/docs/borderstyles.png differ diff --git a/docs/for-developers/api-reference.md b/docs/for-developers/api-reference.md new file mode 100644 index 00000000..60b9b81f --- /dev/null +++ b/docs/for-developers/api-reference.md @@ -0,0 +1,333 @@ +# API Reference + +How to work around with WebX's API, hosted at https://api.buss.lol. + +This is the URI of the WebX API, which holds all the DNS of the network. You got different endpoints to do your stuff. +https://api.buss.lol/. + +{% hint style="warning" %} +APIs have rate limits. They are provided in the headers. +{% endhint %} + +## `GET` / +*Provides a basic message explaining the API.* +{% hint style="info" %} +### YOU SEND +| REQUEST METHOD | TARGET URL | +| -------------- | ---------- | +| `GET` | https://api.buss.lol/ | +{% endhint %} + +{% hint style="success" %} +### RETURNS +```txt +Hello, world! The available endpoints are: +GET /domains, +GET /domain/:name/:tld, +POST /domain, +PUT /domain/:key, +DELETE /domain/:key, +GET /tlds. +Ratelimits provided in headers. +``` +{% endhint %} + +## `GET` /domains`?amount={x}&page={y}` +Being `amount` and `page` optional. `amount` for the amount of domains you want the response to have per page (defaults to 15), and `page` what page you want to view. +*Allows you to get the list of all working domains from the network.* + +{% hint style="info" %} +### YOU SEND +| REQUEST METHOD | TARGET URL | +| -------------- | ---------- | +| `GET` | https://api.buss.lol/domains | +{% endhint %} + +{% hint style="success" %} +### RETURNS + +{% code title="response.json" overflow="wrap" lineNumbers="true" %} + +```json +{ + "domains": [ + { + "tld": "it", + "name": "register", + "ip": "https://github.com/face-hh/webx-registrar" + }, + { + "tld": "it", + "name": "dingle", + "ip": "https://github.com/face-hh/dingle-frontend" + } + ], + ... + "page": 1, + "limit": 15 +} +``` + +{% endcode %} + +{% endhint %} + +## `GET` /tlds +*Allows you to get the list of all valid TLDS.* +{% hint style="info" %} +### YOU SEND +| REQUEST METHOD | TARGET URL | +| -------------- | ---------- | +| `GET` | https://api.buss.lol/tlds | +{% endhint %} + +{% hint style="success" %} +### RETURNS +`200 OK` +```json +["mf", "btw", "fr", "yap", "dev", "scam", "zip", "root", "web", "rizz", "habibi", "sigma", "now", "it", "soy", "lol", "uwu"] +``` +{% endhint %} + +## `GET` /domain/`name`/`tld` +*Allows you to get the data from a specific domain.*
+***Being `name` the domain name (e.g. "register") and `tld` it's TLD (e.g. "it").*** +{% hint style="info" %} +### YOU SEND +| REQUEST METHOD | TARGET URL | +| -------------- | ---------- | +| `GET` | https://api.buss.lol/domain/name/tld | +{% endhint %} + +{% hint style="success" %} +### RETURNS +### IF DOMAIN DOES EXIST +```json +{ + "tld":"it", + "name":"register", + "ip":"https://github.com/face-hh/webx-registrar" +} +``` +{% endhint %} + +{% hint style="danger" %} +### IF DOMAIN DOES NOT EXIST +*Does not return anything.* +{% endhint %} + +## `POST` /domain +*Allows you to register a domain from the API* +{% hint style="info" %} +### YOU SEND +| REQUEST METHOD | TARGET URL | HEADERS | +| -------------- | ---------- | ------- | +| `POST` | https://api.buss.lol/domain | `Content-Type: application/json` | + +***AND BODY:*** +```json +{ + "tld": "{tld}", + "name": "{name}", + "ip": "{ip}" +} +``` +*Being `{name}` the `name` you want to use as the domain, `{tld}` the TLD you want to use, and `{ip}` the IP / GitHub URL you want to serve from.* +{% endhint %} + +{% hint style="success" %} +### RETURNS +### IF THE DOMAIN IS CREATED +`200 OK` +```json +{ + "tld": "example_tld", + "ip": "example_ip", + "name": "example_name", + "secret_key": "generated_secret_key" +} +``` +{% endhint %} + +{% hint style="danger" %} +### IF THE BODY OF YOUR `POST` REQUEST IS NOT VALID +`400 Bad Request` + +### IF `{name}` (domain name) IS ALREADY REGISTERED WITH THAT TLD +`409 Bad Request` + +### IF RATE LIMIT HAS BEEN EXCEEDED +`429 Too Many Requests` +{% endhint %} + +## `POST` /domain/check +*Allows you to "search" for domains using domain names and TLDs* +{% hint style="info" %} +### YOU SEND +| REQUEST METHOD | TARGET URL | HEADERS | +| -------------- | ---------- | ------- | +| `POST` | https://api.buss.lol/domain/check | *None* | + +***AND BODY:*** +```json +{ + "tld": "{tld}", + "name": "{name}" +} +``` +*Being `{name}` the `name` you want to search for, and `{tld}` an ***optional*** parameter to also search for a specific TLD.* +{% endhint %} + +{% hint style="info" %} +Quick reminder: unless specified, all parameters are required. +{% endhint %} + +{% hint style="success" %} +### RETURNS +### IF THE DOMAIN IS CREATED +`200 OK` +```json +{ + "tld": "example_tld", + "ip": "example_ip", + "name": "example_name", + "secret_key": "generated_secret_key" +} +``` +{% endhint %} + +{% hint style="danger" %} +### IF THE BODY OF YOUR `POST` REQUEST IS NOT VALID +`400 Bad Request` + +### IF `{name}` (domain name) IS ALREADY REGISTERED WITH THAT TLD +`409 Bad Request` + +### IF RATE LIMIT HAS BEEN EXCEEDED +`429 Too Many Requests` +{% endhint %} + +## `PUT` /domain/`key` +*Allows you to update your domain's IP / GitHub URL. The code's source, basically.* +{% hint style="info" %} +### YOU SEND +| REQUEST METHOD | TARGET URL | HEADERS | +| -------------- | ---------- | ------- | +| `PUT` | https://api.buss.lol/domain/:key | `Content-Type: application/json` | + +*Being `:key` your domain's secret key.* + +***AND BODY:*** +```json +{ + "ip": "{ip}" +} +``` +*Being `{ip}` the new IP you want to set for your domain.* +{% endhint %} + +{% hint style="success" %} +### RETURNS +### IF THE IP IS CORRECTLY UPDATED +`200 OK` + +{% code title="response.json" overflow="wrap" lineNumbers="true" %} + +```json +{ + "ip": "new_ip" +} +``` + +{% endcode %} + +{% endhint %} + +{% hint style="danger" %} +### IF THE BODY OF YOUR `PUT` REQUEST IS NOT VALID *OR* SPECIFIED `KEY` IS NOT VALID +`400 Bad Request` + +### IF THE DOMAIN IS NOT FOUND +`404 Bad Request` +{% endhint %} + +## `DELETE` /domain/`key` +*Allows you to delete your domain from the network. You cannot undo that, so be careful.* +{% hint style="info" %} +### YOU SEND +| REQUEST METHOD | TARGET URL | HEADERS | +| -------------- | ---------- | ------- | +| `DELETE` | https://api.buss.lol/domain/:key | *No headers required* | + +*Being `:key` your domain's secret key.* +{% endhint %} + +{% hint style="success" %} +### RETURNS +### IF THE DOMAIN IS CORRECTLY REMOVED +`200 OK` +{% endhint %} + +{% hint style="danger" %} +### IF THE REQUEST HAS AN INVALID PARAMETER +`400 Bad Request` + +### IF THE DOMAIN IS NOT FOUND +`404 Bad Request` +{% endhint %} + +## `POST` /registry/domain +*Allows to create your own domain using an API key.* + +{% hint style="warning" %} +This is disabled by default as you will need to come up with your own way of validating and distributing API Keys. +{% endhint %} + +{% hint style="info" %} +### YOU SEND +| REQUEST METHOD | TARGET URL | HEADERS | +| -------------- | ---------- | ------- | +| `POST` | https://api.buss.lol/registry/domain/ | `Content-Type: application/json; Authorization = name:token` | + +*Being `:token` your API key.* + +***AND BODY:*** +```json +{ + "tld": "{tld}", + "name": "{name}", + "ip": "{ip}" +} +``` +*Being `{name}` the `name` you want to use as the domain, `{tld}` the TLD you want to use, and `{ip}` the IP / GitHub URL you want to serve from.* +{% endhint %} + +{% hint style="success" %} +### RETURNS +### IF THE DOMAIN IS SUCCESSFULLY CREATED +`200 OK` +```json +{ + "tld": "example_tld", + "ip": "example_ip", + "name": "example_name", + "secret_key": "generated_secret_key" +} +``` +{% endhint %} + +{% hint style="danger" %} +### IF THE BODY OF YOUR `POST` REQUEST IS NOT VALID +`400 Bad Request` + +### IF THE API KEY SYSTEM IS DISABLED +(It can be.) + +`403 Not allowed` + +### IF THE REQUEST DOMAIN IS ALREADY REGISTERED +`409 Conflict` + +### IF THE RATE LIMIT IS EXCEEDED +`429 Too many requests` +{% endhint %} diff --git a/docs/for-developers/css-3.25.md b/docs/for-developers/css-3.25.md new file mode 100644 index 00000000..62b08b74 --- /dev/null +++ b/docs/for-developers/css-3.25.md @@ -0,0 +1,228 @@ +# CSS 3.25 + +CSS 3.25 looks similar to regular CSS 3, but with some differences. Note that B9 is a new engine, not all classic CSS 3 features are supported. + +## Basic structure + +This is an example of a CSS 3.25 file. + +{% code title="styles.css" overflow="wrap" lineNumbers="true" %} + +```css +div { + border-color: #616161; + border-width: 1px; + border-style: solid; + border-radius: 12px; + padding: 10px; + direction: row; + align-items: center; + gap: 10; +} + +h1 { + padding: 20px; + color: #444; +} + +p { + font-size: 16px; + line-height: 1.5; + font-family: Iosevka; + font-weight: bold; + + border-style: solid; + border-width: 5px; + border-color: red; + + border-radius: 12px; +} + +h4 { + font-size: 30px; +} + +a { + color: #007bff; + font-size: 16px; + text-decoration: none; + font-weight: ultralight; + underline: double; + underline-color: #ff0000; + overline: single; + overline-color: #ff0000; + strikethrough: true; + strikethrough-color: #ff0000; + margin-right: 50px; +} + +ul, ol { + margin-left: 20px; +} + +ok { + color: #FF3232; +} + +select { + padding: 5px; + border-width: 1px; + border-style: solid; + border-color: #ccc; + border-radius: 3px; + margin-left: 40px; +} + +hr { + border-color: #ccc; + border-width: 1px; + border-style: solid; +} +``` + +{% endcode %} + +Looks like a lot, huh? It's not that complicated. It's just about taking a few things into account and then just checking a list of properties. + +## Take into account + +1. **No selectors are required:** You don't need to use a dot to select a class (e.g. `.myClass {}`). Since there's no ID's to differentiate with, just put the class name without anything (e.g. `myClass{}`). +2. **Use specific units:** Only **pt** for measures and **HEX** (#123456) for colors are supported. No RGBa, no HSL, no em, no viewport units... +3. **Don't touch the body:** As of B9 v1.2.2, styling the body itself might not work properly. +4. **Remember how the CSS box model works:** We use CSS 3's standard box model, where a box has a SIZE, then a PADDING, then a BORDER ~~and an OUTLINE~~*, and then a MARGIN. +5. **Events are not supported:** As of B9 v1.2.2, events (like `:focused`, `:hover`, and so on) are not supported. + +{% hint style="info" %} +*Outline is not supported by B9 as of 1.2.2 +{% endhint %} + +Noted that? Now let's get to the styling features. + +## Styling +### Global +> Global styles that can be applied to anything + +|
Property
| Possible value | Explanation | +| -------- | ----- | ----------- | +| `padding` | Any `px` value | Gives the text a custom padding. Padding is the space inside of the box. | +| `margin-{direction}` | Any `px` value | Gives the text a custom margin. Margin is the space outside of the box. **See "About margin" before using it"** | +| `border-width` | Any `px` value | Sets the width of the border. It acts as a summoning directive - this means that it needs to be declared and given a value greater than 0 for the border to be rendered in the first place. If you use any other `border-*` directive without declaring width, you won't see anything | +| `border-color` | Any `HEX` value | Sets the color of the border. | +| `border-style` | Any of the following: `none`, `hidden`, `dotted`, `dashed`, `solid`, `double`, `groove`, `ridge`, `inset`, `outset` | Gives the border a custom style. *Since there are a lot of options, scroll down for an image preview of each one*. | +| `border-radius` | Any `px` value | Gives the border a custom roundness. | +| `opacity` | Any numeric value from 0 to 1. Decimals (0.5) supported. | Gives the item a custom opacity. Opacity is the opposite of transparency, being opacity = 1 a fully visible item, opacity = 0 a transparent, invisible item, and opacity = 0.5 something in between, half transparent and half opaque. | +| `background-color` | Any `HEX` value | Gives the item a background color. If not set, will use the default one depending on the user's theme (or not at all). | + +{% hint style="warning" %} +### About margin +`margin` by itself is not supported by B9 as of 1.2.2. You need to give a direction. If you want to set the padding of the top of the box, use `margin-top`, for example. +| CSS 3.25 directive | Direction | +| --------- | -------- | +| `margin-top` | Top of the box (UP) | +| `margin-bottom` | Bottom of the box (DOWN) | +| `margin-left` | Left of the box | +| `margin-right` | Right of the box | +{% endhint %} + +{% hint style="info" %} +![Border preview](../borderstyles.png) +{% endhint %} + +### Layout +> Use these in combination with `
`s to organise your layout. + +|
Property
| Possible value | Explanation | +| -------- | ----- | ----------- | +| `gap` | Any `px` value | Sets the amount of space (in pixels) that will be created between all the elements that are inside of a `
` | +| `direction` | `row` or `column` | The direction all the items inside of the `
` will follow. Default is `column`. Similar to CSS 3's flex display (*but no "display: flex;" required here*). | +| `wrap` | `wrap` or `nowrap` | If enabled, when there are too many elements inside of a parent container, they will be moved to the next line (they will be *wrapped*). If not, the elements will just overflow. Defaults to `nowrap`. | +| `align_items` | Any of the following: `fill`, `start`, `end`, `center` | Defines if the items should be aligned to the center of the container, to the start, or to the end. If set to fill, the item will expand to fill all available horizontal space within its container instead of just moving to get aligned. Defaults to `fill`. | + +### Text +> Use these to style your texts + +|
Property
| Possible value | Explanation | +| -------- | ----- | ----------- | +| `font-size` | Any `px` value | Gives the text a custom size. There is a default for each text tag (`h1`, `h2`, `p`...) | +| `line-height` | Any `px` value | Gives the text a custom line-height. There is a default for each text tag. | +| `font-family` | String value | Gives the text a custom font. `` does not support font files, so the end user must have that font installed. As of B9 v1.2.2, fallback fonts don't seem to be supported. | +| `font-weight` | Any of the following: `ultralight`, `light`, `normal`, `bold`, `ultrabold`, `heavy` | Gives the text a custom font weight. | +| `color` | Any `HEX` value | Gives the text a custom color. | + +{% hint style="warning" %} +As of B9 v1.2.2, built-in colors (such as `red`, `orange`, `lightblue`, and other colors from CSS3) are **not** supported. +{% endhint %} + + + +{% hint style="warning" %} +**On runtime, `px` values get translated to `pt` values** by B9 ***only for `font-size`***. +{% endhint %} + +### Text underline / overline / strikethrough +> Non-standard, this feature doesn't exist on CSS 3. + +|
Property
| Possible value | Explanation | +| -------- | ----- | ----------- | +| `strikethrough` | `true` or `false` | Gives the text a strikethrough. | +| `strikethrough-color` | Any `HEX` value | If strikethrough is present, this will set the color of the strikethrough. | +| `overline` | `none` or `single` | Gives the text an overline (like an underline, but instead of under, over). Single is equivalent to "true" (but don't pass `true` as it won't work). | +| `overline-color` | Any `HEX` value | If overline is present, this will set the color of the overline. | +| `underline` | Any of the following: `none`, `single`, `double`, `low`, `error` | Gives the text an underline. | +| `underline-color` | Any `HEX` value | If underline is present, this will set the color of the overline. | + +### Input and textarea +> Width and height are considered "Layout" directives, but since they are only supported by `` and `