Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resource Pack Self-Hosting (Draft) #8

Open
BehrRiley opened this issue Feb 16, 2024 · 1 comment
Open

Resource Pack Self-Hosting (Draft) #8

BehrRiley opened this issue Feb 16, 2024 · 1 comment
Assignees
Labels
⬆️Feature Request Specific addition or interest for improvement 📄To-Do Something that needs done

Comments

@BehrRiley
Copy link
Member

Three parts to this system, allowing us to host the resource pack directly from our web cloud and the server directly.

Save and Compile Pack

This piece is the first piece but can be skipped for the moment since we can manually upload the pack to it's file location on the web cloud.

Generate the Pack SHA-1

This should be simple; the endpoint opened explicitly for this file: https://api.behr.dev/resource/b.zip
That should make the entirety of the script, excluding any debugging or error handling:

- ~webget https://api.behr.dev/resource/b.zip headers:[User-Agent=b] save:response
- flag server behr.essentials.resource.SHA-1:<entry[response].result_binary.hash[SHA-1].to_hex>

this can be updated on startup:

after server start:
  - run resource_fetch

Serve the Resource Pack

Lastly and simply, just serving it on join:

after player joins:
  - resourcepack https://api.behr.dev/resource/b.zip hash:<server.flag[behr.essentials.resource.SHA-1]>

Likely may need something to do with the resource pack status event

@BehrRiley BehrRiley added ⬆️Feature Request Specific addition or interest for improvement 📄To-Do Something that needs done labels Feb 16, 2024
@BehrRiley
Copy link
Member Author

BehrRiley commented Mar 8, 2024

The zipping can be done via a script Python API script:

  • listen on localhost as an API
  • runs git pull to verify synced with upstream
  • zips the folder in correspondence to the gitignore
@echo off
SETLOCAL

set "FOLDER_NAME=b-resource"
set "ZIP_FILE=b.zip"

cd %FOLDER_NAME%

REM Pull the latest changes from the remote repository
echo Pulling latest changes from the git repository...
git pull

REM Check for git pull errors
if errorlevel 1 (
    echo Error encountered during 'git pull'. Aborting script.
    goto End
)

REM Using git to archive non-ignored files
echo Creating archive of non-ignored files...
git archive -o "../%ZIP_FILE%" HEAD

echo Archive created successfully.

:End
ENDLOCAL

@BehrRiley BehrRiley self-assigned this Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⬆️Feature Request Specific addition or interest for improvement 📄To-Do Something that needs done
Projects
None yet
Development

No branches or pull requests

1 participant