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

question on challenge load hooks for plugins #58

Open
frankli0324 opened this issue Jan 3, 2024 · 1 comment
Open

question on challenge load hooks for plugins #58

frankli0324 opened this issue Jan 3, 2024 · 1 comment

Comments

@frankli0324
Copy link
Contributor

frankli0324 commented Jan 3, 2024

as implemented in async loadChallenge(challengeId), core-beta invokes displayChallenge in CTFd.js which downloads view.js for a challenge and does this:

https://github.com/CTFd/CTFd.js/blob/65df4e05fa039b6e464d50e62423e4536580f318/pages/challenge.js#L18-L33

before core-beta, postRender is invoked after the html is actually rendered, yet core-beta uses alpinejs, so show() the modal takes effect after the entire displayChallenge, which breaks the logic of a plugin which relied on postRender to get the challenge id with jquery($('#challenge-id')) and load the challenge info.

I think what I really need is CTFd._internal.challenge.data.id, yet I still wonder should postRender keep the previous behavior when virtual dom is actually rendered? otherwise what's the point of the postRender hook?

frankli0324 added a commit to frankli0324/ctfd-whale that referenced this issue Jan 3, 2024
@frankli0324
Copy link
Contributor Author

two things are in between of displayChallenge and postRender:

  • alpine nextTick
  • bootstrap Modal.show() is async (resolves with an event)

frankli0324 added a commit to frankli0324/ctfd-whale that referenced this issue Jan 4, 2024
* adjust model and assets to fit CTFd 3.6
* router config should be checked before resetting
* view.js fix and 404 message fix

reference: CTFd/core-beta#58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant