-
-
Notifications
You must be signed in to change notification settings - Fork 455
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
Introduce HTTP API for plugins #5383
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
5a2a45a
to
a32fcb8
Compare
a32fcb8
to
1d850d1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Design question:
Maybe rename the permission from HTTP to Network? I think this more accurately describes what the plugin will actually be allowed to do, with less of a technical description.
"Allows the plugin to make network requests over your network/over the internet/to third party websites".
Bit of an early review, haven't looked into the implementation of anything
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The following code segfaults after a short while:
local function send_req()
local req = c2.HTTPRequest.create(c2.HTTPMethod.Get, "https://postman-echo.com/get")
req:on_success(function(res)
end)
req:on_error(function(result)
end)
req:execute()
c2.later(send_req, 100)
end
send_req()
The crash happens in the handlers of the request. Looking at the captured L
, it's probably the thread from c2.later
getting deleted while the callbacks hold on to it through lua_State
.
I'll have to store an ID of the plugin or something and get the state back then. |
Co-authored-by: nerix <nerixdev@outlook.de>
This is never expected to be hit by any well-formed plugin.
5b9f905
to
5a4e64c
Compare
…re/chatterino-lua-http-api
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
This adds a new API:
c2.HTTPRequest
that requires a new permission:Network
.