mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-21 20:21:38 +00:00
Prevent misuse of RequestAccess
This commit is contained in:
parent
91cba1b0e9
commit
dcfdf7fabd
2 changed files with 29 additions and 6 deletions
|
|
@ -314,9 +314,16 @@ function App:releaseSyncLock()
|
|||
Log.trace("Could not release sync lock because it is owned by {}", lock.Value)
|
||||
end
|
||||
|
||||
function App:requestPermission(source: string, name: string, apis: {string}, initialState: {[string]: boolean?}): {[string]: boolean}
|
||||
function App:requestPermission(plugin: Plugin, source: string, name: string, apis: {string}, initialState: {[string]: boolean?}): {[string]: boolean}
|
||||
local responseEvent = Instance.new("BindableEvent")
|
||||
|
||||
Log.info("The third-party plugin '{}' is requesting permission to use the API!", name)
|
||||
|
||||
local unloadProtection = plugin.Unloading:Connect(function()
|
||||
Log.warn("Cancelling API permission request for '{}' because the third-party plugin has been removed.", name)
|
||||
responseEvent:Fire(initialState)
|
||||
end)
|
||||
|
||||
self:setState(function(state)
|
||||
state.popups[source .. " Permissions"] = {
|
||||
name = name,
|
||||
|
|
@ -338,6 +345,7 @@ function App:requestPermission(source: string, name: string, apis: {string}, ini
|
|||
|
||||
local response = responseEvent.Event:Wait()
|
||||
responseEvent:Destroy()
|
||||
unloadProtection:Disconnect()
|
||||
|
||||
self:setState(function(state)
|
||||
state.popups[source .. " Permissions"] = nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue