From bc1a2bc25649807d1c2543a2577c65dacb9e56fd Mon Sep 17 00:00:00 2001 From: Andrei Mihu Date: Tue, 22 Oct 2024 12:49:38 +0100 Subject: [PATCH] Add JS SessionRefresh before/after hook functions --- server/runtime_javascript_init.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/server/runtime_javascript_init.go b/server/runtime_javascript_init.go index fb3fd88fc..924f64f3a 100644 --- a/server/runtime_javascript_init.go +++ b/server/runtime_javascript_init.go @@ -137,6 +137,8 @@ func (im *RuntimeJavascriptInitModule) mappings(r *goja.Runtime) map[string]func "registerAfterAuthenticateGoogle": im.registerAfterAuthenticateGoogle(r), "registerBeforeAuthenticateSteam": im.registerBeforeAuthenticateSteam(r), "registerAfterAuthenticateSteam": im.registerAfterAuthenticateSteam(r), + "registerBeforeSessionRefresh": im.registerBeforeSessionRefresh(r), + "registerAfterSessionRefresh": im.registerAfterSessionRefresh(r), "registerBeforeListChannelMessages": im.registerBeforeListChannelMessages(r), "registerAfterListChannelMessages": im.registerAfterListChannelMessages(r), "registerBeforeListFriends": im.registerBeforeListFriends(r), @@ -498,6 +500,14 @@ func (im *RuntimeJavascriptInitModule) registerAfterAuthenticateSteam(r *goja.Ru return im.registerHook(r, RuntimeExecutionModeAfter, "registerAfterAuthenticateSteam", "authenticatesteam") } +func (im *RuntimeJavascriptInitModule) registerBeforeSessionRefresh(r *goja.Runtime) func(goja.FunctionCall) goja.Value { + return im.registerHook(r, RuntimeExecutionModeBefore, "registerBeforeSessionRefresh", "sessionrefresh") +} + +func (im *RuntimeJavascriptInitModule) registerAfterSessionRefresh(r *goja.Runtime) func(goja.FunctionCall) goja.Value { + return im.registerHook(r, RuntimeExecutionModeAfter, "registerAfterSessionRefresh", "sessionrefresh") +} + func (im *RuntimeJavascriptInitModule) registerBeforeListChannelMessages(r *goja.Runtime) func(goja.FunctionCall) goja.Value { return im.registerHook(r, RuntimeExecutionModeBefore, "registerBeforeListChannelMessages", "listchannelmessages") }