Skip to content

Commit f82558c

Browse files
External Documentation (LunarClient#856)
* feat: start external documentation * fix: can't use cool shared workflow * chore: start docs structure * chore: more docs * backgrounds * Updated Intro * Add copyright Callout * Update banner.mdx * Update logo.mdx * Update overview * Fix typos * finish up documentation/README * call out? * fix: file whitelist * Fix typo * Fix typo * banner docs * make banners max be 15 seconds --------- Co-authored-by: Trentin <[email protected]>
1 parent 4bad2cd commit f82558c

21 files changed

+307
-86
lines changed

.github/CODEOWNERS

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
/.github/** @colinmcdonald22 @imconnorngl @ThatKawaiiSam
33

44
# Script changes
5-
/scripts/* @colinmcdonald22 @imconnorngl @ThatKawaiiSam
5+
/.scripts/* @colinmcdonald22 @imconnorngl @ThatKawaiiSam

.github/workflows/docs.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Deploy Documentation
2+
on:
3+
push:
4+
paths:
5+
- ".github/workflows/docs.yml"
6+
- "docs/**"
7+
8+
jobs:
9+
deploy:
10+
name: Deploy Documentation
11+
runs-on: ubuntu-latest
12+
permissions:
13+
id-token: write
14+
contents: read
15+
16+
steps:
17+
- name: Trigger Documentation Deploy
18+
uses: benc-uk/workflow-dispatch@v1
19+
with:
20+
workflow: deploy.yml
21+
repo: LunarClient/lunarclient.dev-Build
22+
ref: refs/heads/master
23+
inputs: '{"repo": "${{ github.repository }}", "ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'
24+
token: ${{ secrets.DISPATCH_TOKEN }}

.github/workflows/ping-servers.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Ping Servers
33
on:
44
push:
55
branches:
6-
- master
6+
- master
77
workflow_dispatch:
88

99
jobs:
@@ -17,10 +17,10 @@ jobs:
1717
- name: Setup Python 3.x
1818
uses: actions/setup-python@v1
1919
with:
20-
python-version: '3.x'
20+
python-version: "3.x"
2121

2222
- name: Install Python dependencies
23-
run: pip install -r scripts/requirements.txt
23+
run: pip install -r .scripts/requirements.txt
2424

2525
- name: Validate Server Status
26-
run: python scripts/validate_status.py --servers_dir servers --inactive_file inactive.json
26+
run: python .scripts/validate_status.py --servers_dir servers --inactive_file inactive.json

.github/workflows/validate-upload.yml

+11-12
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ name: Validate and upload
33
on:
44
push:
55
branches:
6-
- master
6+
- master
77
pull_request:
88
branches:
9-
- master
10-
9+
- master
1110

1211
jobs:
1312
validate-servers:
@@ -23,13 +22,13 @@ jobs:
2322
- name: Setup Python 3.x
2423
uses: actions/setup-python@v1
2524
with:
26-
python-version: '3.x'
25+
python-version: "3.x"
2726

2827
- name: Install Python dependencies
29-
run: pip install -r scripts/requirements.txt
28+
run: pip install -r .scripts/requirements.txt
3029

3130
- name: Validate Servers
32-
run: python scripts/validate.py --servers_dir servers --metadata_schema metadata.schema.json --inactive_file inactive.json --inactive_schema inactive.schema.json
31+
run: python .scripts/validate.py --servers_dir servers --metadata_schema metadata.schema.json --inactive_file inactive.json --inactive_schema inactive.schema.json
3332
env:
3433
PR_ID: ${{ github.event.pull_request.number }}
3534
BOT_PAT: ${{ secrets.GITHUB_TOKEN }}
@@ -40,7 +39,7 @@ jobs:
4039
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
4140

4241
runs-on: ubuntu-latest
43-
42+
4443
permissions:
4544
id-token: write
4645
contents: read
@@ -52,21 +51,21 @@ jobs:
5251
- name: Setup Python 3.x
5352
uses: actions/setup-python@v1
5453
with:
55-
python-version: '3.x'
54+
python-version: "3.x"
5655

5756
- name: Install Python dependencies
58-
run: pip install -r scripts/requirements.txt
57+
run: pip install -r .scripts/requirements.txt
5958

6059
- name: Create output folder
6160
run: mkdir .out/
62-
61+
6362
- name: Output Server Media
64-
run: python scripts/convert_media.py --servers_dir servers --inactive_file inactive.json --servers_logos_output .out/logos --servers_logos_sizes 256 128 64 32 --servers_backgrounds_output .out/backgrounds --servers_backgrounds_sizes 1280x720 852x480 --servers_banners_output .out/banners
63+
run: python .scripts/convert_media.py --servers_dir servers --inactive_file inactive.json --servers_logos_output .out/logos --servers_logos_sizes 256 128 64 32 --servers_backgrounds_output .out/backgrounds --servers_backgrounds_sizes 1280x720 852x480 --servers_banners_output .out/banners
6564
env:
6665
USE_ARGS: "true"
6766

6867
- name: Create Index File
69-
run: python scripts/create_index.py --servers_dir servers --inactive_file inactive.json --index_output .out/servers.json
68+
run: python .scripts/create_index.py --servers_dir servers --inactive_file inactive.json --index_output .out/servers.json
7069

7170
- name: Upload to Cloudflare
7271
env:
File renamed without changes.
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Pillow
2-
webptools
3-
jsonschema
4-
mcstatus
1+
Pillow
2+
webptools
3+
jsonschema
4+
mcstatus
55
requests

scripts/utils.py .scripts/utils.py

+2-11
Original file line numberDiff line numberDiff line change
@@ -190,23 +190,14 @@ def validate_banner(path, server_name):
190190
# loop through all the frames, rather than just do duration * n_frames, because GIF can have different duration for each frame.
191191
for idx in range(1, banner_image.n_frames):
192192
banner_image.seek(idx)
193-
#if banner_image.info['duration'] != duration:
194-
# errors.append(f'{server_name}\'s server banner does not have the same duration for all frames... Please ensure the image meets the requirements before proceeding.')
195-
196193
total_duration += duration
197194

198-
#if total_duration > 10000:
199-
# errors.append(f'{server_name}\'s server banner is more than 10 seconds long (currently {total_duration / 1000})... Please ensure the image meets the requirements before proceeding.')
195+
if total_duration > 15_000:
196+
errors.append(f'{server_name}\'s server banner is more than 15 seconds long (currently {total_duration / 1000})... Please ensure the image meets the requirements before proceeding.')
200197

201198
if total_duration == 0:
202199
errors.append(f'{server_name}\'s server gif server banner seems to not have any duration associated with it... Please ensure the image meets the requirements before proceeding.')
203200

204-
# TODO: some sort of fix so only one of the errors above or below show ( temp atm )
205-
#fps = (banner_image.n_frames / (total_duration / 1000.0)) if total_duration != 0 else 20.0
206-
207-
#if fps != 20.0:
208-
# errors.append(f'{server_name}\'s server banner is not exactly 20 FPS (currently {fps})... Please ensure the image meets the requirements before proceeding.')
209-
210201
aspect_ratio = round(banner_image.width / banner_image.height, 3)
211202

212203
sprite = gif_to_sprite_sheet(path)

scripts/validate.py .scripts/validate.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from utils import get_all_servers, validate_logo, validate_background, validate_banner
88

9-
file_whitelist = ['.git', '.github', '.gitignore', 'inactive.json', 'inactive.schema.json', 'LICENSE', 'metadata.example.json', 'metadata.schema.json', 'README.md', 'scripts', 'servers']
9+
FILE_WHITELIST = ['.git', '.github', '.gitignore', 'inactive.json', 'inactive.schema.json', 'LICENSE', 'metadata.example.json', 'metadata.schema.json', 'README.md', '.scripts', 'servers', 'docs']
1010

1111
def post_comment(messages: dict):
1212
pull_id = os.getenv('PR_ID')
@@ -176,9 +176,9 @@ def check_media(args: argparse.Namespace, current_errors: dict) -> dict:
176176

177177

178178
def validate_root(dir="."):
179-
if any([file not in file_whitelist for file in os.listdir(dir)]):
180-
post_comment({"Overall": ["A file is in the main directory but not in file_whitelist"]})
181-
print("A file is in the main directory but not in file_whitelist")
179+
if any([file not in FILE_WHITELIST for file in os.listdir(dir)]):
180+
post_comment({"Overall": ["A file is in the main directory but not in file whitelist"]})
181+
print("A file is in the main directory but not in file whitelist")
182182
exit(1)
183183

184184
if __name__ == '__main__':
File renamed without changes.

README.md

+11-50
Original file line numberDiff line numberDiff line change
@@ -2,71 +2,32 @@
22

33
## Summary
44

5-
This is a public mapping of server IPs <-> a pretty display name. This data is used extensively around Lunar Client, most notably when displaying server names (or "Private Server", if unknown) on the friends list. Historically, this mapping was handled internally, and server owners did not have a good way to manage data for their server.
5+
Server Mappings is a collection of mappings for Minecraft servers, including the most popular servers such as Hypixel, Mineplex, and more. Server Mappings provides information such as server name, server icon and more.
66

7-
## How do I add/update/remove a server?
8-
9-
Each server in ServerMappings is represented by a folder with an accompanying `metadata.json` and `logo.png`. Open a pull request in this repository whilst following the steps below, and we'll review it as soon as possible. Once merged, Lunar Client services will update over the next 20 minutes. Check out `metadata.example.json` as an example of how to structure your metadata file.
10-
11-
## IP Addresses
12-
13-
The `addresses` array in each server object is actually an array of IP _suffixes_. For example, `"addresses": ["lunar.gg", "other.domain"]` will match `lunar.gg`, `na.lunar.gg`, `play.other.domain`, and so on. The `primaryAddress` field is where you can include the desired subdomain (`na.lunar.gg`, `play.lunar.gg`) for users to connect to your server on and is required to be resolvable. This primary address will be used to ensure that the server remains online and active.
14-
15-
## Primary Info & Minecraft Versions
16-
17-
We also require your server's primary connection information and allowed client versions. The `primaryAddress` field should be an address included** in the `addresses` array.
18-
19-
The `minecraftVersions` field must be an array of client versions allowed on your Minecraft server. *(ie. 1.18.1, 1.19.2)*; The `primaryMinecraftVersion` field must be a subversion of a major version included in the `minecraftVersions` array. **The versions you include must be versions that are directly offered in Lunar Client**, which can be found in the version selector of the Lunar Client Launcher.
20-
21-
If your server supports all of the subversions within a major version, you can list the version in `minecraftVersions` as `1.19.*`, but you will still need to specify the specific subversion in the `primaryMinecraftVersion` as this is the specific version that the client uses to Launch you into the game for Quick Joining.
22-
23-
## Logos
24-
25-
In addition to the data that you will need to provide in your `metadata.json`, you will need to upload a `.png` version of your logo into the same folder. All images are to be _transparent_, _square (1:1 aspect ratio)_, and _a minimum of 512px in width and height_. The file name should be `logo.png`. We require the logo to be large as we perform a number of different transformations for all the various places in Lunar Client!
26-
27-
## Backgrounds
7+
For a full overview of the information which can be found in Server Mappings, [check out our documentation](https://lunarclient.dev/server-mappings/introduction).
288

29-
Servers are also required to provide background image, you will need to upload a `.png` version of the background into the same folder as your `metadata.json`. Images should represent either the artistic style or the content of the server, with images needing to be _a minimum of 1920px in width and 1080px in height, resulting in a 16:9 aspect ratio_. The file name should be `background.png`. Backgrounds should be free of marketing, text, and/or any logos (that isn't part of a build).
30-
31-
## Banners
32-
33-
Servers may also provide a server banner - you will be made aware if this is a requirement for your server. If a banner is provided, it must be uploaded as either a `.png` version named `banner.png` (for static banners,) or a `.gif` version named `banner.gif` (for animated banners,) in the same folder as your `metadata.json`. Banners should represent the content of the server, and prominently feature the server's name and/or IP. All banners must be _a minimum of 340 pixels wide and 45 pixels high, resulting in a 68:9 aspect ratio._ Additionally, animated (GIF) banners must play at _20 frames per second_, and be no more than _10 seconds in duration_.
34-
35-
## Regions
36-
37-
In your `metadata.json`, you can define both a `primaryRegion` and `regions` which your server supports. Below is a table of the regions.
38-
39-
| Region Code | Name |
40-
| --- | --- |
41-
| AF | Africa |
42-
| AS | Asia |
43-
| EU | Europe |
44-
| NA | North America |
45-
| OC | Oceania |
46-
| SA | South America |
47-
48-
## Game Types
49-
50-
Game types help identify the style of games that your server will offer to player. The following are games you may include: `PvP`, `PvE`, `HCF`, `Factions`, `Minigames`, `Skyblock`, `Parkour`, `UHC`, `Hardcore`, `Survival`, `Open World`, `Prison`, `Creative`, `Roleplay`, and `Adventure`.
9+
## How do I add/update/remove a server?
5110

52-
You can add up to 3 unique types on the `gameTypes` field in your `metadata.json`.
11+
You can add your server to Server Mappings by creating a pull request on this repository. We ask that you **must** follow the guidelines detailed in [our documentation](https://lunarclient.dev/server-mappings/adding-servers/overview) on what you should include to have your server added.
5312

5413
## Restrictions
5514

5615
We ask that this repository is only used to store mappings for *public* Minecraft servers. Some server IPs, such as private SMPs, tournament servers, etc. should not be listed in this repository, out of respect for privacy.
5716

58-
Lunar Client also reserves the right to omit any servers that do not comply with our [Terms of Service](https://www.lunarclient.com/terms).
17+
**Lunar Client also reserves the right to omit any servers that do not comply with our [terms of service](https://www.lunarclient.com/terms).**
18+
5919

6020
## Inactive Server Policy
6121

6222
If a server has closed down or has not been joinable for at least 3 months, we will add it to the `inactive.json`. This just flags our internal systems to not include the server in various place, but still retains all of the branding and other metadata you submit.
6323

64-
If you think your server has been added to this list by mistake, please make a support ticket at the link below.
24+
If you believe your server has been incorrectly marked as inactive, please contact us in the [Lunar Client Developers Discord](https://discord.gg/ww4UhsPNwf) or [create an issue](https://github.com/LunarClient/ServerMappings/issues/new).
25+
26+
## Can I use this data for my project?
6527

66-
## Can I use this data for ___?
28+
You are free to use this data for anything you wish. As long as it abides by [our terms of service](https://www.lunarclient.com/terms). You can read how to harness this data in our [documentation](https://lunarclient.dev/server-mappings/using-servermappings).
6729

68-
Go for it!
6930

7031
## Any other questions?
7132

72-
Please contact us at [support.lunarclient.com](https://support.lunarclient.com) for any additional questions.
33+
Please join our [Lunar Client Developers Discord](https://discord.gg/ww4UhsPNwf) for any additional questions.

docs/_meta.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"introduction": "Introduction",
3+
"adding-servers": "Adding Servers",
4+
"using-servermappings": "Using Server Mappings",
5+
"inactive-servers": "Inactive Servers"
6+
}

docs/adding-servers/_meta.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"overview": "Overview",
3+
"metadata": "Metadata",
4+
"logo": "Logo",
5+
"background": "Background",
6+
"banner": "Banner"
7+
}

docs/adding-servers/background.mdx

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { Callout } from "nextra/components";
2+
3+
# Server Background
4+
5+
<Callout type="warning" emoji="⚠️">
6+
Do not include any copyrighted or proprietary graphics without written
7+
permission or ownership.
8+
</Callout>
9+
10+
Servers are required to provide a background image. Please note the following requirements for the background image:
11+
12+
- The background image should be in the `.png` format.
13+
- The image should represent either the artistic style or the content of the server.
14+
- The minimum dimensions for the background image are `1920px` in width and `1080px` in height, resulting in a 16:9 aspect ratio.
15+
- The file name should be `background.png`.
16+
- The background image should be free of marketing, text, and any logos that are not part of the server build.
17+
18+
Please ensure that your background image meets these requirements. Remember that your background image will be manually reviewed before being accepted.

docs/adding-servers/banner.mdx

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { Callout } from "nextra/components";
2+
3+
# Server Banner
4+
5+
<Callout type="warning" emoji="⚠️">
6+
Do not include any copyrighted or proprietary graphics without written
7+
permission or ownership.
8+
</Callout>
9+
10+
Servers may also provide a server banner. If it is required for your server, please take note of the following guidelines:
11+
12+
- If a static banner is provided, it should be uploaded as a `.png` version named `banner.png`.
13+
- If an animated banner is provided, it should be uploaded as a `.gif` version named `banner.gif`.
14+
- The banner should represent the content of the server and prominently feature the server's name and/or IP.
15+
- All banners must have a minimum width of `340` pixels and a height of `45` pixels, resulting in a 68:9 aspect ratio.
16+
- Animated (GIF) banners must not exceed a total duration of 15 seconds.
17+
18+
Please ensure that your server banner meets these requirements. As with other assets, the server banner will be reviewed before being accepted.

docs/adding-servers/logo.mdx

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { Callout } from "nextra/components";
2+
3+
# Server Logo
4+
5+
<Callout type="warning" emoji="⚠️">
6+
Do not include any copyrighted or proprietary graphics without written
7+
permission or ownership.
8+
</Callout>
9+
10+
For your server to be included in Server Mappings, your server will need to include a logo, this logo must:
11+
12+
- Be in the `.png` format.
13+
- Be transparent.
14+
- Be square (1:1 aspect ratio).
15+
- Be a minimum of `512px` in width and height
16+
- Not be upscaled from a smaller low quality image
17+
18+
_Your logo will be manually reviewed before being accepted. Please ensure it meets these requirements._

0 commit comments

Comments
 (0)