Download wp-calypso/client/document/support-user.jsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.32 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/document/support-user.jsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/document/support-user.jsx
-
curl -L -o support-user.jsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/document/support-user.jsx
1.32 kB
| function supportUserFn( { user, token, path, authorized } ) { | |
| const url = window.location.toString(); | |
| if ( url.indexOf( '?' ) > 0 ) { | |
| const cleanUrl = url.substring( 0, url.indexOf( '?' ) ); | |
| window.history.replaceState( {}, document.title, cleanUrl ); | |
| } | |
| if ( authorized ) { | |
| window.sessionStorage.setItem( 'boot_support_user', window.JSON.stringify( { user, token } ) ); | |
| } | |
| // Only redirect to same-domain | |
| const redirectUrl = new URL( url ); | |
| redirectUrl.pathname = path ? decodeURIComponent( path ) : '/'; | |
| redirectUrl.search = ''; | |
| window.location.replace( redirectUrl.href ); | |
| } | |
| function SupportUser( { supportUser, supportToken, supportPath, authorized = false } ) { | |
| return ( | |
| <html lang="en"> | |
| <body> | |
| { /* eslint-disable react/no-danger */ } | |
| <script | |
| dangerouslySetInnerHTML={ { | |
| __html: ` | |
| const supportUserFn = ${ supportUserFn.toString() }; | |
| supportUserFn( { | |
| user: ${ supportUser && `"${ encodeURIComponent( supportUser ) }"` }, | |
| token: ${ supportToken && `"${ encodeURIComponent( supportToken ) }"` }, | |
| path: ${ supportPath && `"${ encodeURIComponent( supportPath ) }"` }, | |
| authorized: ${ authorized } | |
| } ); | |
| `, | |
| } } | |
| /> | |
| ); | |
| } | |
| export default SupportUser; | |