Customize Whitelabel Storefront
TensorDock offers a "whitelabel" service to select hosts. Organizations can setup storefronts powered by TensorDock's infrastructure, and take a %x commission off sales. Contact us for details.
Last updated
TensorDock offers a "whitelabel" service to select hosts. Organizations can setup storefronts powered by TensorDock's infrastructure, and take a %x commission off sales. Contact us for details.
Last updated
The admin panel is your interface for managing the storefront. TensorDock will take care of web hosting and all else under the hood. You must be the administrator of your organization to access the admin panel. To setup your site, simply save your frontend code, along with a subdomain address. We will go over how to do this in the following sections.
First, you will be greeted by the edit pages section. If you do not have a storefront setup, there will be boilerplate code provided (as seen below). Each page is an HTML document, and we have two stylesheets (Theme, Custom CSS) you can edit. Edits are not live- you must click the "save" button to deploy your code to TensorDock's end. Additionally, the save button will save all the pages & CSS, so it does not matter which tab you're toggled on. You can also upload photos, which will be stored in static/img/.
The next section is domain management. Here, you can set the subdomain and custom domain of your frontend. For example, if you enter the subdomain "test", then anytime another user visits test.tensordock.com they will be served the frontend home page. If they visit test.tensordock.com/login, they will be served the login page of your saved frontend. If you own a custom domain, then you can also insert the domain here.
If its your first time setting up a whitelabel storefront, then after saving the page files and subdomain, you will have a custom storefront ready. All user purchases through your storefront site will earn a x% commission. With a custom domain, you must contact support to finish setting up.
Here, you can view information on registered users of your storefront.
Email: The email the user registered with
Date Created: The timestamp creation of the user
Email Verified: If the user's email is verified
Organization Name: The organization the user is registered under.
Organization Balance: Available funds of an organization
You can delete users (rendered unable to login). However, that will not delete their machines, as they are registered under organizations. Deleting an organization will delete all of its machines and remove their users.
When users create an account on the whitelabel storefront, that account is only valid on your storefront. They cannot login on the TensorDock marketplace.
Here, we will review critical code snippets of the boilerplate frontend, so you can make adjustments easier.
This simply your landing page; nothing to do here
Aside from the standard markup, we have the following code for registration.
Here, we make a POST request to the /api/v0/client/whitelabel/register endpoint. Fields must be in form-data form, and has the fields email (string), password (string), confirm_password (string), organization_name (string), subdomain (string). After a successful request, the user will be generated on our end and a token will be send back in the response with the field token
. This will be stored as a cookie on the client's browser, to be used for authentication later.
Here, we are using the /api/v0/client/whitelabel/login endpoint to simply post the email, password, and subdomain (which is uniquely linked to your storefront). If successful, we will get a token
which will be stored as a cookie to be access later.
Here, we are doing a GET request to /api/vO/client/whitelabel/getUserInfo
to get user information. In order to make authenticated requests, we put in the Authorization header our previous token
. If the token is valid, then our response will have the user's balance, unique identifier, email, organization, organization name, organization type, as well as other users in the same organization. You can then display this information anywhere on the page for the user to view.
On an invalid token, the response will be an error code and we will simply redirect the user to the login screen.
This function is used to open a Stripe deposit funds session. We make a POST request to /createDepositFundsSession/, with the deposit amount in the URI and the user's token in the Authorization header. In our boilerplate code, we have this method binded to a button press. When it has run successfully, it will open a Stripe tab on the user's browser to deposit money.
Here, we do a POST request to the /api/v0/client/whitelabel/token_verify endpoint to verify if the user is logged in. As usual, we put the token in the Authorization header. On an unsuccessful response, we redirect them to login.
Most methods used here (deployServer, updateAvailableLocations, etc) are either using endpoints we covered above, or are using endpoints listed in our docs. If the endpoint is in our docs (start, stop, & delete VM, getting available hostnodes, get list of virtual machines), you can use it as described, but will have to include the token in the Authorization header. Without using the Authorization header, it will be treated as a "normal" TensorDock request as opposed to a whitelabel.