ubiquity / onboard.ubq.fi

onboard.ubq.fi
0 stars 7 forks source link

Onboarding v2 #22

Open rndquu opened 1 month ago

rndquu commented 1 month ago

Right now https://onboard.ubq.fi/ generates a bot's config for v1 which is obsolete.

As a part of this issue we should update https://onboard.ubq.fi to support the following features:

  1. Generate a new config for bot v2
  2. Update an existing config
  3. Encrypt plugin parameters (depends on https://github.com/ubiquity/ubiquibot-kernel/issues/90)
  4. Fetch and display available plugins with options and descriptions (depends on a "marketplace" issue which is not ready yet)
  5. Add an additional step of approves permit2 contract if https://github.com/ubiquibot/conversation-rewards plugin is used

This is a very high level description which might change in the future.

0x4007 commented 1 month ago

Also, perhaps GitHub updated their API but the PUT doesn't work anymore at onboard.ubq.fi. This can be easily handled as part of this task.

We require a SHA parameter.

In the PUT request, the sha should be included in the JSON payload. Here’s an example of how it should look:

curl 'https://api.github.com/repos/ubiquity/ubiquibot-config/contents/.github%2Fubiquibot-config.yml' \
-X 'PUT' \
-H 'accept: application/vnd.github.v3+json' \
-H 'authorization: token YOUR_TOKEN' \
-H 'content-type: application/json' \
--data-raw '{
  "message": "your commit message",
  "content": "your_base64_encoded_content",
  "sha": "your_sha_value_here"
}'

Key Points:

  • Replace "your_sha_value_here" with the actual sha value you retrieved from the GET request.
  • Replace "your_base64_encoded_content" with your content encoded in base64.
  • Ensure that "your commit message" reflects the changes you're making.

The sha is necessary to let GitHub know which specific version of the file you are updating. Without it, the API will return an error because it won't know which version of the file to modify.