From fb3a7c48fd06252197b5783307a0164f5f871ca0 Mon Sep 17 00:00:00 2001 From: vaporvee Date: Thu, 1 Feb 2024 19:22:05 +0100 Subject: [PATCH] continued working on docs --- astro.config.mjs | 16 ++++- package-lock.json | 72 +++++++++++++++++++++++ package.json | 3 + src/pages/docs.astro | 11 ++-- src/pages/docs/discord-sdk-godot.mdx | 0 src/pages/docs/discord-sdk-godot/index.md | 71 ++++++++++++++++++++++ src/styles/home.scss | 4 ++ src/styles/main.scss | 21 ++++++- 8 files changed, 189 insertions(+), 9 deletions(-) delete mode 100644 src/pages/docs/discord-sdk-godot.mdx create mode 100644 src/pages/docs/discord-sdk-godot/index.md diff --git a/astro.config.mjs b/astro.config.mjs index 9e117aa..6082a1b 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -1,10 +1,20 @@ import { defineConfig } from 'astro/config'; import minify from 'astro-min'; import metaTags from "astro-meta-tags"; - -import mdx from "@astrojs/mdx"; +import rehypeSlug from 'rehype-slug' +import rehypeAutolinkHeadings from 'rehype-autolink-headings'; // https://astro.build/config export default defineConfig({ - integrations: [minify(), metaTags(), mdx()] + integrations: [minify(), metaTags()], + markdown: { + rehypePlugins: [ + rehypeSlug, + [rehypeAutolinkHeadings, { behavior: 'prepend' }], + ], + drafts: true, + shikiConfig: { + theme: 'dracula', + }, + }, }); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 66a37cb..aafab83 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,11 +8,14 @@ "name": "vaporvees-website", "version": "0.0.1", "dependencies": { + "@astrojs/markdown-remark": "^4.2.1", "@astrojs/mdx": "^2.1.1", "astro": "^4.2.6", "astro-meta-tags": "^0.2.1", "astro-min": "^1.1.0-dev.4", "npx": "^3.0.0", + "rehype-autolink-headings": "^7.1.0", + "rehype-slug": "^6.0.0", "sass": "^1.70.0" } }, @@ -2728,6 +2731,30 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/hast-util-heading-rank": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/hast-util-heading-rank/-/hast-util-heading-rank-3.0.0.tgz", + "integrity": "sha512-EJKb8oMUXVHcWZTDepnr+WNbfnXKFNf9duMesmr4S8SXTJBJ9M4Yok08pu9vxdJwdlGRhVumk9mEhkEvKGifwA==", + "dependencies": { + "@types/hast": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/hast-util-is-element": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/hast-util-is-element/-/hast-util-is-element-3.0.0.tgz", + "integrity": "sha512-Val9mnv2IWpLbNPqc/pUem+a7Ipj2aHacCwgNfTiK0vJKl0LF+4Ba4+v1oPHFpf3bLYmreq0/l3Gud9S5OH42g==", + "dependencies": { + "@types/hast": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/hast-util-parse-selector": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/hast-util-parse-selector/-/hast-util-parse-selector-4.0.0.tgz", @@ -2871,6 +2898,18 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/hast-util-to-string": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/hast-util-to-string/-/hast-util-to-string-3.0.0.tgz", + "integrity": "sha512-OGkAxX1Ua3cbcW6EJ5pT/tslVb90uViVkcJ4ZZIMW/R33DX/AkcJcRrPebPwJkHYwlDHXz4aIwvAAaAdtrACFA==", + "dependencies": { + "@types/hast": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/hast-util-whitespace": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/hast-util-whitespace/-/hast-util-whitespace-3.0.0.tgz", @@ -6418,6 +6457,23 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/rehype-autolink-headings": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/rehype-autolink-headings/-/rehype-autolink-headings-7.1.0.tgz", + "integrity": "sha512-rItO/pSdvnvsP4QRB1pmPiNHUskikqtPojZKJPPPAVx9Hj8i8TwMBhofrrAYRhYOOBZH9tgmG5lPqDLuIWPWmw==", + "dependencies": { + "@types/hast": "^3.0.0", + "@ungap/structured-clone": "^1.0.0", + "hast-util-heading-rank": "^3.0.0", + "hast-util-is-element": "^3.0.0", + "unified": "^11.0.0", + "unist-util-visit": "^5.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/rehype-parse": { "version": "9.0.0", "resolved": "https://registry.npmjs.org/rehype-parse/-/rehype-parse-9.0.0.tgz", @@ -6446,6 +6502,22 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/rehype-slug": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/rehype-slug/-/rehype-slug-6.0.0.tgz", + "integrity": "sha512-lWyvf/jwu+oS5+hL5eClVd3hNdmwM1kAC0BUvEGD19pajQMIzcNUd/k9GsfQ+FfECvX+JE+e9/btsKH0EjJT6A==", + "dependencies": { + "@types/hast": "^3.0.0", + "github-slugger": "^2.0.0", + "hast-util-heading-rank": "^3.0.0", + "hast-util-to-string": "^3.0.0", + "unist-util-visit": "^5.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/rehype-stringify": { "version": "10.0.0", "resolved": "https://registry.npmjs.org/rehype-stringify/-/rehype-stringify-10.0.0.tgz", diff --git a/package.json b/package.json index ec57e01..90ee2b7 100644 --- a/package.json +++ b/package.json @@ -10,11 +10,14 @@ "astro": "astro" }, "dependencies": { + "@astrojs/markdown-remark": "^4.2.1", "@astrojs/mdx": "^2.1.1", "astro": "^4.2.6", "astro-meta-tags": "^0.2.1", "astro-min": "^1.1.0-dev.4", "npx": "^3.0.0", + "rehype-autolink-headings": "^7.1.0", + "rehype-slug": "^6.0.0", "sass": "^1.70.0" } } diff --git a/src/pages/docs.astro b/src/pages/docs.astro index d7bbbd5..3b657f1 100644 --- a/src/pages/docs.astro +++ b/src/pages/docs.astro @@ -1,10 +1,11 @@ --- -import { date } from "astro/zod"; import Layout from "../layouts/Layout.astro"; -const allDocs = await Astro.glob("./docs/*.mdx"); -const fileteredDocs = allDocs.sort( - (a, b) => +new Date(b.frontmatter.date) - +new Date(a.frontmatter.date), -); +const unsortedDocs = await Astro.glob("./docs/*/*.md"); +const docs = unsortedDocs + .sort( + (a, b) => +new Date(b.frontmatter.date) - +new Date(a.frontmatter.date), + ) + .filter((doc) => !doc.frontmatter.draft); --- [!IMPORTANT] +> The GameSDK's Achievements, Applications, Voice, Images, Lobbies, Networking, Storage, and Store (purchases and discounts) features have been deprecated and will not be added.
However the rest is and will still be supported by Discord. + +**[![apple](https://github.com/vaporvee/discord-sdk-godot/assets/80621863/6d2c7a54-bfc9-4c8d-955a-40fa5c9e8c74)About MacOS Support](https://github.com/vaporvee/discord-sdk-godot/wiki/Building#macos-support)**
+> [!WARNING] +> The plugin only works with 4.2 and above for the current version + +> [!NOTE] +> To make anything work in the plugin make sure to run +> ```gdscript +>func _process(_delta): +> DiscordSDK.run_callbacks() +> ``` +> This happens normaly inside the Autoload wich should be automatically added by the plugin.
+> Something that does **not get added automatically** is your `app_id`. It is also mandatory to be able to use anything in the plugin. +> ```gdscript +> DiscordSDK.app_id = # +> ``` + +# Quick start +| Recommended | Manual | +| ----------- | ------ | +| 1. Open the AssetLib tab in your Godot Editor.
2. Search for "discord" and install all the files from this plugin | 1. [Download the addon](https://github.com/vaporvee/discord-sdk-godot/releases/latest/download/ADDON-Discord-SDK-Godot.zip/)
2. Put the `addons/` folder in the root of your Godot project | +3. Enable the addon in your Project Settings under "Plugins" and "DiscordSDK".
(Also adds DiscordSDKLoader autoload wich should be ignored. It needs to run in the background to comunicate with the Discord client) +4. Restart your project with the window that should now appear.
+
+5. Create an Application under https://discord.com/developers/applications and get the Application ID +6. While you're here, head to the "OAuth2" section of your application and add `http://127.0.0.1` as a redirect URI for your application.
(Discord says you should do that but it doesn't change anything) +7. (optional) Set images under "Rich Presence" and "Art Assets" and remember the keys +8. Create a gdscript wich gets run for example at startup wich looks something like the following +```gdscript +extends Node + +func _ready(): + DiscordSDK.app_id = 1099618430065324082 # Application ID + DiscordSDK.details = "A demo activity by vaporvee" + DiscordSDK.state = "Checkpoint 23/23" + + DiscordSDK.large_image = "example_game" # Image key from "Art Assets" + DiscordSDK.large_image_text = "Try it now!" + DiscordSDK.small_image = "boss" # Image key from "Art Assets" + DiscordSDK.small_image_text = "Fighting the end boss! D:" + + DiscordSDK.start_timestamp = int(Time.get_unix_time_from_system()) # "02:46 elapsed" + # DiscordSDK.end_timestamp = int(Time.get_unix_time_from_system()) + 3600 # +1 hour in unix time / "01:00:00 remaining" + + DiscordSDK.refresh() # Always refresh after changing the values! +``` +**Then it will look similar to this:** + + + +[**Try a built demo**](https://github.com/vaporvee/discord-sdk-godot/releases/latest/download/Demo-Export.zip)

+ +# Troubleshooting +> [!TIP] +> First of all try reinstalling the plugin and restart both your Godot Editor and your Discord client. +>
+> I have no errors in my Godot console from the plugin but my Activity doesn't show up in my Discord Client. +>

Make sure a `DiscordSDK.run_callbacks()` function runs in a `_process(delta)` function. This should happen in the Autoload added by the plugin. If it still doesn't help, try the Demo above. If still nothing appears in your Discord profile card, you have to reset the depending settings in you Discord or reinstall it.

+>
+>
+> I have a lot of `DiscordSDK not declared` errors spammed in my Godot Console and i can't use the plugin. +>

Make sure the plugin is actually enabled. Then the plugin should work and after the second restart you shouldn't get any errors from the plugin. But if it still gives you the errors delete the file `/addons/discord-sdk-gd/bin/.gdignore` and restart the editor manually.

+
\ No newline at end of file diff --git a/src/styles/home.scss b/src/styles/home.scss index 506b0d0..c5062ca 100644 --- a/src/styles/home.scss +++ b/src/styles/home.scss @@ -14,6 +14,10 @@ main { justify-self: flex-start; margin-right: 5vw; + h1 { + font-size: 72px; + } + .home-title { margin: 0; color: #FFF; diff --git a/src/styles/main.scss b/src/styles/main.scss index d590fac..1d98750 100644 --- a/src/styles/main.scss +++ b/src/styles/main.scss @@ -12,7 +12,6 @@ body { h1 { font-family: "Tanker-Regular", "Arial"; - font-size: 72px; } .content { @@ -24,6 +23,13 @@ h1 { margin: 4vw; } + +td { + border-inline: 15px solid; + border-color: #ffffff00; +} + + b { font-family: "Satoshi-Bold"; color: $accent; @@ -31,4 +37,17 @@ b { a { color: $link; +} + +.astro-code { + padding: 15px; + border-radius: 25px; +} + +code { + background-color: #282a36; + padding-inline: 10px; + padding-block: 2px; + margin: 2px; + border-radius: 25px; } \ No newline at end of file