boostorg / website-v2

New Boost website
https://boost.io
Boost Software License 1.0
9 stars 13 forks source link

webhook "import new releases" #1188

Open sdarwin opened 2 months ago

sdarwin commented 2 months ago

On the admin page https://www.boost.io/admin/versions/version/ there is a button "import new releases" that needs to be clicked whenever a new boost release is published, in order to update the website.

The button should continue to function as-is.

A new additional feature would be to also trigger that from a webhook or api endpoint.

The publish_release.py script could tell the website to update, effectively pressing the "import new releases" button.

Leverage any existing REST API or webhook modules (if that is possible) since some are already present in the codebase.

For example, when you visit any doc/ page such as https://www.stage.boost.cppalliance.org/doc/libs/1_71_0/doc/html/array.html , if a user is logged in, it's retrieving the profile pic and information over an API. Could that same sort of API code be used for this issue also? Just an idea.

Let me know the URL to contact, to trigger an "import new releases", and what the curl format of the call would be.

gavinwahl commented 1 week ago

@sdarwin the target of that button could be used directly for your purposes:

curl https://www.boost.io/admin/versions/version/new_version/

sdarwin commented 1 week ago

That's great!
Do you think that is the exact syntax of the curl command? Will it need to specify options on the command line (GET, POST) or anything?

gavinwahl commented 1 week ago

That's the exact syntax

sdarwin commented 5 days ago

Thank you! I have opened another issue in release-tools where I will add the curl command to publish_release.py. Closing.

sdarwin commented 13 hours ago

Hi @gavinwahl ,

Consider this command:

curl https://www.boost.io/admin/versions/version/new_version/

That URL is in the /admin/ panel.

A user is running curl from the command line. Does curl automatically have access to Django's secure admin panel? no...

Does Django use "Basic" HTTP authentication? no...

What is the full command that would get curl logged in, and then able to request the URL? Could you provide a script, targeted at https://www.stage.boost.cppalliance.org/ and have it successfully trigger the /new_version/ link on staging?

gavinwahl commented 9 hours ago

@sdarwin the url does not require authentication (that may be a bug, but it's how it's implemented currently)

sdarwin commented 9 hours ago

If I run the command:

curl https://www.stage.boost.cppalliance.org/admin/versions/version/new_version/

It quietly returns with no output.
(what happened?)
Again with -v for verbose.

curl -v https://www.stage.boost.cppalliance.org/admin/versions/version/new_version/

The -v shows it's a 302 redirect. Asking the user to log in.

< HTTP/2 302 
< server: nginx/1.21.6
< content-type: text/html; charset=utf-8
< location: /admin/login/?next=/admin/versions/version/new_version/

It has not received a 200 OK at the url "/admin/versions/version/new_version/".

Following the 302 redirect leads to "/admin/login/".

gavinwahl commented 9 hours ago

@brianjp93 fixed the possible bug this was relying on 2be29b632237a7411d8cb0fafed804b74318459f

sdarwin commented 8 hours ago

brianjp93 fixed the possible bug

could it be that before the commit, anonymous access was allowed. And after that commit, anonymous access is now blocked?

Which means the current state is.. that it requires auth? (which is probably correct)