Skip to content

Commit a4eb8f7

Browse files
Inactive List (#489)
* Add inactive file + schema. * Bulk add inactive servers.
1 parent d4898c3 commit a4eb8f7

File tree

6 files changed

+103
-1
lines changed

6 files changed

+103
-1
lines changed

.github/workflows/validate-upload.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
run: pip install -r scripts/requirements.txt
2626

2727
- name: Validate Server JSON
28-
run: python scripts/validate_json.py --servers_dir servers --metadata_schema metadata.schema.json
28+
run: python scripts/validate_json.py --servers_dir servers --metadata_schema metadata.schema.json --inactive_file inactive.json --inactive_schema inactive.schema.json
2929

3030
- name: Validate Server Media
3131
run: python scripts/validate_media.py --servers_dir servers

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ We ask that this repository is only used to store mappings for *public* Minecraf
4949

5050
Lunar Client also reserves the right to omit any servers that do not comply with our [Terms of Service](https://www.lunarclient.com/terms).
5151

52+
## Inactive Server Policy
53+
54+
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.
55+
56+
If you think your server has been added to this list by mistake, please make a support ticket at the link below.
57+
5258
## Can I use this data for ___?
5359

5460
Go for it.

inactive.json

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
[
2+
"alpharip",
3+
"antique",
4+
"arashimc",
5+
"arcane",
6+
"beepvp",
7+
"betterpvp",
8+
"betterpvpnt",
9+
"brithnobar",
10+
"cavrynetwork",
11+
"chillcenter",
12+
"cloudnetwork",
13+
"crystal",
14+
"darkmc",
15+
"eclipsepvp",
16+
"faithfulmc",
17+
"fraze",
18+
"galaxycore",
19+
"glade",
20+
"glancenetwork",
21+
"goldzonecz",
22+
"hikari",
23+
"hivemc",
24+
"inertianetwork",
25+
"juvymc",
26+
"kira",
27+
"koupahgames",
28+
"limaru",
29+
"lynxmc",
30+
"madnetwork",
31+
"mcgamer",
32+
"minearcade",
33+
"minebox",
34+
"minechaos",
35+
"minedestiny",
36+
"mizu",
37+
"mythicalmc",
38+
"ncea",
39+
"neptuniummc",
40+
"potpvpbrazil",
41+
"ravenhub",
42+
"renshu",
43+
"savanapvp",
44+
"skillwars",
45+
"starcraftmc",
46+
"starpvp",
47+
"teamfightcc",
48+
"tropical",
49+
"valley",
50+
"vealypvp",
51+
"vestpvp",
52+
"warfaremc",
53+
"ymzc",
54+
"zoltixnetwork"
55+
]

inactive.schema.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "array",
3+
"items": {
4+
"type": "string",
5+
"pattern": "^[a-z0-9_.-]+$"
6+
}
7+
}

scripts/utils.py

+14
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
def get_all_servers(servers_dir):
55
servers = []
66

7+
# Open inactive.json
8+
inactive = []
9+
with open(f"inactive.json") as inactive_file:
10+
inactive = json.load(inactive_file)
11+
712
# Looping over each server folder
813
for root, _dirs, _files in os.walk(servers_dir):
914
server_id = root.split(os.path.sep)[-1]
@@ -14,6 +19,15 @@ def get_all_servers(servers_dir):
1419
with open(f"{servers_dir}/{server_id}/metadata.json") as server_file:
1520
server = json.load(server_file)
1621

22+
# Images
23+
logo_path = f'{servers_dir}/{server_id}/logo.png'
24+
background_path = f'{servers_dir}/{server_id}/background.png'
25+
26+
# Enrich server data
27+
server["inactive"] = server["id"] in inactive
28+
server["enriched"] = os.path.isfile(logo_path) and os.path.isfile(background_path)
29+
30+
# Add to list
1731
servers.append(server)
1832

1933
# Sort A-Z

scripts/validate_json.py

+20
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,28 @@ def main():
88
parser = argparse.ArgumentParser()
99
parser.add_argument('--servers_dir', required=True, type=str)
1010
parser.add_argument('--metadata_schema', required=True, type=str)
11+
parser.add_argument('--inactive_file', required=True, type=str)
12+
parser.add_argument('--inactive_schema', required=True, type=str)
1113
args = parser.parse_args()
1214

15+
# Validate Inactive File
16+
inactive_schema = {}
17+
with open(args.inactive_schema) as inactive_schema_file:
18+
inactive_schema = json.load(inactive_schema_file)
19+
20+
inactive_file = []
21+
with open(args.inactive_file) as inactive_file_file:
22+
inactive_file = json.load(inactive_file_file)
23+
24+
print(f'Validating inactive.json file...')
25+
26+
try:
27+
jsonschema.validate(instance=inactive_file, schema=inactive_schema)
28+
except jsonschema.ValidationError:
29+
raise ValueError('inactive.json does not match the schema.')
30+
31+
print(f'Successfully validated inactive.json file!')
32+
1333
# Load server mappings Schema
1434
metadata_schema = {}
1535
with open(args.metadata_schema) as schema_file:

0 commit comments

Comments
 (0)