Skip to content

Commit 3515e4c

Browse files
committed
Initial commit
0 parents  commit 3515e4c

17 files changed

+462
-0
lines changed

.github/workflows/deploy.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [master]
6+
7+
jobs:
8+
build:
9+
name: Build Docusaurus
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: oven-sh/setup-bun@v2
14+
15+
- name: Install dependencies
16+
run: bun install --frozen-lockfile
17+
- name: Build website
18+
run: bun build
19+
20+
- name: Upload Build Artifact
21+
uses: actions/upload-pages-artifact@v3
22+
with:
23+
path: build
24+
25+
deploy:
26+
name: Deploy to GitHub Pages
27+
needs: build
28+
29+
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
30+
permissions:
31+
pages: write # to deploy to Pages
32+
id-token: write # to verify the deployment originates from an appropriate source
33+
34+
# Deploy to the github-pages environment
35+
environment:
36+
name: github-pages
37+
url: ${{ steps.deployment.outputs.page_url }}
38+
39+
runs-on: ubuntu-latest
40+
steps:
41+
- name: Deploy to GitHub Pages
42+
id: deployment
43+
uses: actions/deploy-pages@v4

.gitignore

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Dependencies
2+
/node_modules
3+
4+
# Production
5+
/build
6+
7+
# Generated files
8+
.docusaurus
9+
.cache-loader
10+
11+
# Misc
12+
.DS_Store
13+
.env.local
14+
.env.development.local
15+
.env.test.local
16+
.env.production.local
17+
18+
*-debug.log*
19+
*-error.log*
20+
21+
.idea

README.md

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Website
2+
3+
This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.
4+
5+
### Installation
6+
7+
```
8+
$ yarn
9+
```
10+
11+
### Local Development
12+
13+
```
14+
$ yarn start
15+
```
16+
17+
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
18+
19+
### Build
20+
21+
```
22+
$ yarn build
23+
```
24+
25+
This command generates static content into the `build` directory and can be served using any static contents hosting service.
26+
27+
### Deployment
28+
29+
Using SSH:
30+
31+
```
32+
$ USE_SSH=true yarn deploy
33+
```
34+
35+
Not using SSH:
36+
37+
```
38+
$ GIT_USER=<Your GitHub username> yarn deploy
39+
```
40+
41+
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.

bun.lockb

484 KB
Binary file not shown.

docs/index.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Welcome!
2+
3+
This is the documentation for the [Miwa.lol](https://miwa.lol) API. Please be aware that this is a work in progress and may not be fully accurate.

docs/oauth2/index.md

+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# OAuth2 Apps
2+
3+
OAuth2 apps are used to authenticate with the API. They are used to generate access tokens which are used to authenticate requests to the API.
4+
5+
## Creating an OAuth2 App
6+
7+
:::warning
8+
9+
We currently do not have a way to create OAuth2 apps. This will be added in the future.
10+
11+
:::
12+
13+
## Authorizing an OAuth2 App
14+
15+
To authorize an OAuth2 app, you must visit the following URL:
16+
17+
```
18+
https://miwa.lol/oauth2/authorize?client_id=<YOUR_CLIENT_ID>&redirect_uri=<YOUR_REDIRECT_URI>&response_type=code&scope=<SCOPES>
19+
```
20+
21+
Replace:
22+
- `<YOUR_CLIENT_ID>` with your OAuth2 app's client
23+
- `<YOUR_REDIRECT_URI>` with your OAuth2 app's redirect URI
24+
- `<SCOPES>` with the scopes you want to request. See [Scopes](/oauth2/scopes) for more information.
25+
26+
After visiting the URL, you will be prompted to log in and authorize the app. If you authorize the app, you will be redirected to the redirect URI with a `code` query parameter.
27+
28+
## Exchanging the Authorization Code for an Access Token
29+
30+
To exchange the authorization code for an access token, you must make a `POST` request to the following URL: `https://miwa.lol/api/oauth2/token`.
31+
32+
The request must include the following parameters:
33+
34+
- `client_id`: Your OAuth2 app's client ID
35+
- `client_secret`: Your OAuth2 app's client secret
36+
- `code`: The authorization code you received
37+
- `grant_type`: `authorization_code`
38+
- `redirect_uri`: Your OAuth2 app's redirect URI
39+
40+
If the request is successful, you will receive a JSON response with an `access_token` and `refresh_token`.
41+
42+
:::warning
43+
44+
The `client_secret` should **never** be exposed to the client. It should only be used server-side.
45+
46+
:::
47+
48+
### Example
49+
50+
Here is an example of how to exchange an authorization code for an access token using `curl`:
51+
52+
```bash
53+
curl -X POST https://miwa.lol/api/oauth2/token \
54+
-d "client_id=YOUR_CLIENT_ID" \
55+
-d "client_secret=YOUR_CLIENT_SECRET" \
56+
-d "code=157845" \
57+
-d "grant_type=authorization_code" \
58+
-d "redirect_uri=https://example.com/callback"
59+
```
60+
61+
## Refreshing an Access Token
62+
63+
Access tokens expire after a certain amount of time. To refresh an access token, you must make a `POST` request to the following URL: `https://miwa.lol/api/oauth2/token`.
64+
65+
The request must include the following parameters:
66+
- `client_id`: Your OAuth2 app's client ID
67+
- `client_secret`: Your OAuth2 app's client secret
68+
- `refresh_token`: The refresh token you received
69+
- `grant_type`: `refresh_token`
70+
71+
If the request is successful, you will receive a JSON response with a new `access_token` and `refresh_token`.
72+
73+
### Example
74+
75+
Here is an example of how to refresh an access token using `curl`:
76+
77+
```bash
78+
curl -X POST https://miwa.lol/api/oauth2/token \
79+
-d "client_id=YOUR_CLIENT_ID" \
80+
-d "client_secret=YOUR_CLIENT_SECRET" \
81+
-d "refresh_token=YOUR_REFRESH_TOKEN" \
82+
-d "grant_type=refresh_token"
83+
```
84+
85+
## Revoking an Access Token
86+
87+
:::warning
88+
89+
You can't revoke access tokens at the moment. This will be added in the future.
90+
91+
:::

docs/oauth2/scopes.md

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Scopes
2+
3+
Scopes are used to grant access to specific resources and actions. They are used to limit the access of an access token to specific resources and actions. The scopes are defined by the API and are requested by the client during the authorization process.
4+
5+
## Available Scopes
6+
7+
The following scopes are available:
8+
9+
### `identify`
10+
11+
The `identify` scope grants access to the user's basic information, such as their username, display name, and avatar.
12+
13+
### `email`
14+
15+
The `email` scope grants access to the user's email address.

docusaurus.config.ts

+130
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
import {themes as prismThemes} from 'prism-react-renderer';
2+
import type {Config} from '@docusaurus/types';
3+
import type * as Preset from '@docusaurus/preset-classic';
4+
5+
// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)
6+
7+
const config: Config = {
8+
title: 'Miwa.lol Developers',
9+
tagline: 'Miwa.lol documentation for developers - API & OAuth2',
10+
favicon: '/favicon.ico',
11+
12+
// Set the production url of your site here
13+
url: 'https://developers.miwa.lol',
14+
// Set the /<baseUrl>/ pathname under which your site is served
15+
// For GitHub pages deployment, it is often '/<projectName>/'
16+
baseUrl: '/',
17+
18+
// GitHub pages deployment config.
19+
// If you aren't using GitHub pages, you don't need these.
20+
organizationName: 'miwalol', // Usually your GitHub org/user name.
21+
projectName: 'docs', // Usually your repo name.
22+
23+
onBrokenLinks: 'throw',
24+
onBrokenMarkdownLinks: 'warn',
25+
26+
// Even if you don't use internationalization, you can use this field to set
27+
// useful metadata like html lang. For example, if your site is Chinese, you
28+
// may want to replace "en" with "zh-Hans".
29+
i18n: {
30+
defaultLocale: 'en',
31+
locales: ['en'],
32+
},
33+
34+
presets: [
35+
[
36+
'classic',
37+
{
38+
docs: {
39+
sidebarPath: './sidebars.ts',
40+
editUrl: 'https://github.com/miwalol/docs/tree/master/',
41+
routeBasePath: '/',
42+
},
43+
blog: false,
44+
theme: {
45+
customCss: './src/css/custom.css',
46+
},
47+
} satisfies Preset.Options,
48+
],
49+
],
50+
51+
themeConfig: {
52+
// Replace with your project's social card
53+
image: '/img/og-card.png',
54+
navbar: {
55+
title: 'Miwa.lol Developers',
56+
logo: {
57+
alt: 'Miwa.lol Logo',
58+
src: '/img/logo.png',
59+
},
60+
items: [
61+
{
62+
type: 'docSidebar',
63+
sidebarId: 'docsSidebar',
64+
position: 'left',
65+
label: 'Docs',
66+
},
67+
{
68+
href: 'https://github.com/facebook/docusaurus',
69+
label: 'GitHub',
70+
position: 'right',
71+
},
72+
],
73+
},
74+
colorMode: {
75+
defaultMode: 'dark',
76+
disableSwitch: false,
77+
respectPrefersColorScheme: true,
78+
},
79+
footer: {
80+
style: 'dark',
81+
links: [
82+
{
83+
title: 'Our Socials',
84+
items: [
85+
{
86+
label: 'Discord',
87+
href: 'https://discord.gg/miwa',
88+
},
89+
{
90+
label: 'X',
91+
href: 'https://x.com/MiwaTeam',
92+
},
93+
{
94+
label: 'Instagram',
95+
href: 'https://www.instagram.com/miwa_lol',
96+
},
97+
{
98+
label: 'Threads',
99+
href: 'https://www.threads.net/miwa_lol',
100+
},
101+
{
102+
label: 'BlueSky',
103+
href: 'https://bsky.app/profile/miwa.lol',
104+
}
105+
],
106+
},
107+
{
108+
title: 'Legal',
109+
items: [
110+
{
111+
label: 'Terms of Service',
112+
href: 'https://miwa.lol/terms',
113+
},
114+
{
115+
label: 'Privacy Policy',
116+
href: 'https://miwa.lol/privacy',
117+
},
118+
],
119+
},
120+
],
121+
copyright: `Copyright © ${new Date().getFullYear()} Miwa.lol &bull; Built with <a href="https://docusaurus.io/" target="_blank">Docusaurus</a>.`,
122+
},
123+
prism: {
124+
theme: prismThemes.github,
125+
darkTheme: prismThemes.dracula,
126+
},
127+
} satisfies Preset.ThemeConfig,
128+
};
129+
130+
export default config;

0 commit comments

Comments
 (0)