diff options
author | Jack <66967891+ASpoonPlaysGames@users.noreply.github.com> | 2023-10-07 11:40:31 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-07 12:40:31 +0200 |
commit | 15b3b65fc4e88fe98ba12b4d7603e396fba91fb3 (patch) | |
tree | 2bda073e3a7340445dfa8e5b2ea0288ef2efe815 /Northstar.Client/mod/scripts/vscripts/ui | |
parent | 1c3bafd8efd56c4f0bb11a952fb192f60bcf42c0 (diff) | |
download | NorthstarMods-15b3b65fc4e88fe98ba12b4d7603e396fba91fb3.tar.gz NorthstarMods-15b3b65fc4e88fe98ba12b4d7603e396fba91fb3.zip |
Display origin auth failure in a dialog (#648)v1.19.5-rc1v1.19.5
Currently, we don't do anything with origin auth failure, meaning the next request just fails, and we get not particularly relevant error messages (player not found, invalid masterserver token)
Diffstat (limited to 'Northstar.Client/mod/scripts/vscripts/ui')
-rw-r--r-- | Northstar.Client/mod/scripts/vscripts/ui/atlas_auth.nut | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/Northstar.Client/mod/scripts/vscripts/ui/atlas_auth.nut b/Northstar.Client/mod/scripts/vscripts/ui/atlas_auth.nut new file mode 100644 index 00000000..89b7f719 --- /dev/null +++ b/Northstar.Client/mod/scripts/vscripts/ui/atlas_auth.nut @@ -0,0 +1,56 @@ +global function AtlasAuthDialog + +void function AtlasAuthDialog() +{ + thread AtlasAuthDialog_Threaded() +} + +void function AtlasAuthDialog_Threaded() +{ + // wait at least 1 frame so that the main menu can be loaded first + WaitFrame() + + while ( !NSIsMasterServerAuthenticated() || GetConVarBool( "ns_auth_allow_insecure" ) ) + WaitFrame() + + if ( GetConVarBool( "ns_auth_allow_insecure" ) ) + return + + MasterServerAuthResult res = NSGetMasterServerAuthResult() + + // do nothing on successful authentication + if ( res.success ) + return + + EmitUISound( "blackmarket_purchase_fail" ) + + DialogData dialogData + dialogData.image = $"ui/menu/common/dialog_error" + dialogData.header = Localize( "#AUTHENTICATION_FAILED_HEADER" ) + + // if we got a special error message from Atlas, display it + if ( res.errorMessage != "" ) + dialogData.message = res.errorMessage + else + dialogData.message = Localize( "#AUTHENTICATION_FAILED_BODY" ) + + if ( res.errorCode != "" ) + dialogData.message += format( "\n\n%s", Localize( "#AUTHENTICATION_FAILED_ERROR_CODE", res.errorCode ) ) + + string link = "https://r2northstar.gitbook.io/r2northstar-wiki/installing-northstar/troubleshooting" + // link to generic troubleshooting page if we don't have an error code from Atlas + if ( res.errorCode != "" ) + link = format( "%s#%s", link, res.errorCode ) + + CloseAllDialogs() + AddDialogButton( dialogData, "#OK" ) + AddDialogButton( dialogData, Localize( "#AUTHENTICATION_FAILED_HELP" ), void function() : ( dialogData, link ) + { + // todo: get MS to redirect, so i can use an MS link or something? + LaunchExternalWebBrowser( link, WEBBROWSER_FLAG_FORCEEXTERNAL ) + // keep the dialog open + OpenDialog( dialogData ) + } ) + + OpenDialog( dialogData ) +} |