From 4b346c60e66db4f59dc4535d6379bcde79b11871 Mon Sep 17 00:00:00 2001 From: shockrah Date: Sat, 13 Feb 2021 17:14:41 -0800 Subject: [PATCH 1/6] Starting content to test deployment --- .gitignore | 4 ++ .gitlab-ci.yml | 14 +++++ docs/archetypes/default.md | 6 ++ docs/config.toml | 7 +++ docs/content/structures/_index.md | 97 +++++++++++++++++++++++++++++++ docs/layouts/partials/logo.html | 3 + 6 files changed, 131 insertions(+) create mode 100644 docs/archetypes/default.md create mode 100644 docs/config.toml create mode 100644 docs/content/structures/_index.md create mode 100644 docs/layouts/partials/logo.html diff --git a/.gitignore b/.gitignore index a63de2d..bc773c8 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,7 @@ server-api/.vscode/launch.json tui/example-config.json bin/ + +# Genereated in pipelines only +docs/resources +docs/public/ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 28a94a7..fa4f254 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,6 +1,7 @@ image: shockrah/freechat:0.4 stages: + - docs - build - test @@ -49,3 +50,16 @@ test-json-api: expire_in: 1 week name: json-api + +build-wiki: + only: [ "docs" ] + stage: docs + + script: + - cd docs/ + - hugo + - cp public/ ../ + + artifacts: + paths: + - public diff --git a/docs/archetypes/default.md b/docs/archetypes/default.md new file mode 100644 index 0000000..00e77bd --- /dev/null +++ b/docs/archetypes/default.md @@ -0,0 +1,6 @@ +--- +title: "{{ replace .Name "-" " " | title }}" +date: {{ .Date }} +draft: true +--- + diff --git a/docs/config.toml b/docs/config.toml new file mode 100644 index 0000000..9d9eb9b --- /dev/null +++ b/docs/config.toml @@ -0,0 +1,7 @@ +baseURL = "https://freechat.shockrah.xyz" +languageCode = "en-us" +theme = "kraiklyn" +title = "Freechat Reference" + +[params] +externalTitle = "Freechat docs" diff --git a/docs/content/structures/_index.md b/docs/content/structures/_index.md new file mode 100644 index 0000000..f7ad36b --- /dev/null +++ b/docs/content/structures/_index.md @@ -0,0 +1,97 @@ +# Structures + +This section details what kind of data structures are returned by the json-api. + +**IMPORTANT**: All structures are returned in [JSON form](https://www.json.org/json-en.html). + +## General Data Notation + +* u64 + + * Unsigned 64 bit integer + +* i64 + + * Signed 64 bit integer + +* String + +## Channels + +Channels are made up of the following components + + Name | Type +:------:|:--------: + id | `u64` + name | `String` + kind | `i32` + + +Channels have two valid types or (more semantically) `kind` values: + +* Voice Channel = 1 + +* Text Channel = 2 + +## Users + +### Personal User + +If you need to get your own user data, with `/users/me` then the data received on success has the following fields: + +Name | Type +:------:|:-----: + id | `u64` + secret | `String` +joindate| `i64` +status | `i32` +permissions| `u64` + +### JWT + +This data is retrieved after a sucessful `/login` hit. + + Name | Type +:-----:|:------: + jwt | `String` + +### Full Public User + + Name | Type +:-----:|:-----: + id | `u64` +name | `String` +joindate| `i64` +status | `i32` +permissions| `u64` + +For users _without_ the `USER_FETCH` permission the only two fields with actual data is `id` and `name`. The other fields will be set to 0. + +## Messages + + Name | Type +:-----:|:-----: + id | `u64` + time | `i64` + content | `String` + type | `String` +author_id | `u64` +channel_id | `u64` + + +Acceptable values + +## Invites + +When requesting a code from `/invite/create` successful data contains: + + Name | Type +:-----:|:-----: + id | `i64` + uses | `null|i64` +expires| `bool` + +Most clients should format this code for usage as `https://domain.net:port/join?code=`. The other data is merely for tracking the server's end. + + + diff --git a/docs/layouts/partials/logo.html b/docs/layouts/partials/logo.html new file mode 100644 index 0000000..550a309 --- /dev/null +++ b/docs/layouts/partials/logo.html @@ -0,0 +1,3 @@ +
+ From shockrah with <3 +
From c1809e706a2ce8ab3190aef1345c23468a182a85 Mon Sep 17 00:00:00 2001 From: shockrah Date: Sat, 13 Feb 2021 17:15:28 -0800 Subject: [PATCH 2/6] fixing wrong branch name in pipeline --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fa4f254..0b978fe 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -52,7 +52,7 @@ test-json-api: build-wiki: - only: [ "docs" ] + only: [ "wiki" ] stage: docs script: From d2f6ca8c620b488d536115b43bdffb0ec33e4f52 Mon Sep 17 00:00:00 2001 From: shockrah Date: Sat, 13 Feb 2021 17:19:46 -0800 Subject: [PATCH 3/6] Fixing needs relationship for test-json-api --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0b978fe..1c9d80a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -36,6 +36,7 @@ test-json-api: stage: test needs: - build-json-api + only: [ "master" ] dependencies: - build-json-api From 41e5a2169903048f72f6f69b72781344fa57c793 Mon Sep 17 00:00:00 2001 From: shockrah Date: Sat, 13 Feb 2021 17:22:18 -0800 Subject: [PATCH 4/6] amending the incorrect docker image issu --- .gitlab-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1c9d80a..7795693 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -53,6 +53,8 @@ test-json-api: build-wiki: + image: registry.gitlab.com/pages/hugo:latest + only: [ "wiki" ] stage: docs From 89e213b2c1174572a8c9cec45b6495cc5d55fa85 Mon Sep 17 00:00:00 2001 From: shockrah Date: Sat, 13 Feb 2021 17:25:02 -0800 Subject: [PATCH 5/6] -r added to cp --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7795693..cb3d8ef 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -61,7 +61,7 @@ build-wiki: script: - cd docs/ - hugo - - cp public/ ../ + - cp -r public/ ../ artifacts: paths: From 0a06b56da0a7fdebbf7d02e00bfeff52c6cecc60 Mon Sep 17 00:00:00 2001 From: shockrah Date: Sat, 13 Feb 2021 18:11:10 -0800 Subject: [PATCH 6/6] Moving docs building to master since its such a cheap procedure --- .gitlab-ci.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cb3d8ef..3b2f3d3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,6 +5,10 @@ stages: - build - test +workflow: + rules: + - if: '$CI_COMMIT_BRANCH' + variables: CARGO_HOME: $CI_PROJECT_DIR/.cargo @@ -53,9 +57,10 @@ test-json-api: build-wiki: + # Cheap as hell so we run on master basically everytime image: registry.gitlab.com/pages/hugo:latest - only: [ "wiki" ] + only: [ "master" ] stage: docs script: