Compare commits

...

4 commits

Author SHA1 Message Date
3641acf94a removed a debug line
Signed-off-by: SpagettiFisch <johmewu@gmail.com>
2024-06-12 17:14:44 +02:00
52537118cf updated README
Signed-off-by: SpagettiFisch <johmewu@gmail.com>
2024-06-12 17:14:13 +02:00
7e132cf481 updated .gitignore
Signed-off-by: SpagettiFisch <johmewu@gmail.com>
2024-06-12 17:06:10 +02:00
d2022b23e7 added example config
Signed-off-by: SpagettiFisch <johmewu@gmail.com>
2024-06-12 17:05:51 +02:00
4 changed files with 15 additions and 6 deletions

2
.gitignore vendored
View file

@ -1,4 +1,4 @@
/config/
/config/config.json
/data/
/modules/__pycache__
/whitelist/paths.txt

View file

@ -1,6 +1,7 @@
For setup:
<b>For setup:</b><br>
Run the setup.py file and follow the instructions.
After this you should find some file named /whitelist/pterodactyl.txt there you need to insert the server id(s) of the server(s) you want to sync the whitelist with and the path for the whitelist (should be 'whitelist.json' for Minecraft). The server's id is the first part of its UUID / Docker Container ID or just https://[your-panel-url]/server/[this part]
After this you should find some file named /whitelist/pterodactyl.txt there you need to insert the server id(s) of the server(s) you want to sync the whitelist with and the path for the whitelist (should be 'whitelist.json' for Minecraft). The server's id is the first part of its UUID / Docker Container ID or just https://[your-panel-url]/server/[this part] on its dashboard site.
Finally, you just have to create a new schedule in your pterodactyl panel to execute the command <code>whitelist reload</code> every now and then to update the sync the whitelist on your server.
Pterodactyl API-key:
<b>Pterodactyl API-key:</b><br>
You have to go to https://[your-panel-url]/admin/api and create a new key. Read and Write acces for Servers should be enough but I recommend just checking it for every category. You also need to specify a description. You then want to go to https://[your-panel-url]/account/api and create another key, there you have to insert the same description as before. This is the key you need to copy and then use for your setup.

View file

@ -0,0 +1,9 @@
{
"discord": [
{
"token": "discord bot token",
"pterodactyl_domain": "https://panel.pterodactyl.com/",
"pterodactyl_apikey": "user api key"
}
]
}

View file

@ -93,5 +93,4 @@ async def syncWhitelistPterodactyl(whitelist):
async def pterodactylWriteFile(serverid, path, data, apikey):
url = f'{init.config().get_pterodactyl_domain()}api/client/servers/{serverid}/files/write?file={urllib.parse.quote(path)}'
requests.post(url, data=data, headers={"Accept": "application/json", "Authorization": f"Bearer {apikey}"})
print('Whitelist abgeschickt')
requests.post(url, data=data, headers={"Accept": "application/json", "Authorization": f"Bearer {apikey}"})