Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 23 additions & 20 deletions FileUploader/braincloud-fileuploadtest.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
defined" in the browser. Refresh it with: node bccm syncsdk js_fileuploader -->
<script src="client/brainCloudClient.browser.js"></script>

<!-- appId/appSecret/url — generated by `node bccm generate js_fileuploader` from
data/fileuploader_ids_<env>.js and gitignored, so real credentials never land
in this tracked HTML file or the public repo. Missing until you've run
build/run/generate at least once. -->
<script src="ids.js"></script>

<style>
/* brainCloud dark theme — palette mirrors the bcchat example (src/Theme.js). */
:root {
Expand Down Expand Up @@ -219,9 +225,11 @@


function bcInit() {
document.getElementById("appId").value = "20001";
document.getElementById("appSecret").value = "1cecb2f3-5a60-4b00-8c7e-7867c12eea49";
document.getElementById("serverUrl").value = "https://api.internal.braincloudservers.com";
if (typeof FILEUPLOADER_IDS === "undefined") {
document.getElementById("clientState").innerHTML =
"⚠ ids.js not found — run `node bccm build js_fileuploader` (or `generate`) to inject app credentials before opening this page.";
return;
}

document.getElementById("userName").value = "TEST_USER";
document.getElementById("password").value = "TEST_PASSWORD";
Expand All @@ -241,6 +249,8 @@

brainCloud.brainCloudClient.setDebugEnabled(true);

initialize(); // auto-initialize from ids.js — no manual Initialize step

showStep(0); // start the wizard on the first step
}

Expand All @@ -256,9 +266,9 @@
var downloadPath = "downloader/bc/g/";

function getFullPath() {
return document.getElementById("serverUrl").value +
return FILEUPLOADER_IDS.url +
"/downloader/bc/g/" +
document.getElementById("appId").value +
FILEUPLOADER_IDS.appId +
"/u/" +
document.getElementById("profileId").value +
"/f/" +
Expand All @@ -269,8 +279,8 @@


function initialize() {
brainCloud.brainCloudClient.initialize(document.getElementById("appId").value, document.getElementById("appSecret").value, APP_VERSION);
brainCloud.brainCloudClient.setServerUrl(document.getElementById("serverUrl").value);
brainCloud.brainCloudClient.initialize(FILEUPLOADER_IDS.appId, FILEUPLOADER_IDS.appSecret, APP_VERSION);
brainCloud.brainCloudClient.setServerUrl(FILEUPLOADER_IDS.url);
//brainCloud.brainCloudClient.useJQuery(true);
document.getElementById('clientState').innerHTML = "✓ Client Initialized";
bcInitialized = true;
Expand Down Expand Up @@ -365,13 +375,13 @@
xhr.addEventListener("abort", uploadCanceled, false);


brainCloud.file.prepareFileUpload(
brainCloud.file.prepareUserUpload(
document.getElementById("cloudPath").value, document.getElementById("cloudFileName").value, document.getElementById("isShareable").checked, document.getElementById("replaceIfExists").checked, fileSize,
function(result) {
if (result.status == 200) {
var uploadId = result.data.fileDetails.uploadId;

document.getElementById("incomingResponse").innerHTML = "prepareFileUpload: " + JSON.stringify(result, null, 2);
document.getElementById("incomingResponse").innerHTML = "prepareUserUpload: " + JSON.stringify(result, null, 2);



Expand Down Expand Up @@ -485,21 +495,14 @@ <h1>File Tester</h1>
<button type="button" class="bc-step-tab" data-step="2" onclick="showStep(2)">3 &middot; Actions &amp; Response</button>
</div>

<!-- Step 1: Connect (initialize + authenticate) -->
<!-- Step 1: Connect (client auto-initializes from ids.js on load — see bcInit() — so
this step is just the authentication display, no appId/appSecret entry here). -->
<section class="bc-step" data-step="0">
<div class="bc-grid">
<div class="bc-panel">
<h2>Initialize</h2>
<p class="bc-hint">Set up your app information and initialize the client.</p>
<label class="bc-field">App ID <input type="text" id="appId" /></label>
<label class="bc-field">App Secret <input type="text" id="appSecret" /></label>
<label class="bc-field">Server URL <input type="text" id="serverUrl" /></label>
<input type="button" class="bc-primary" onclick="initialize()" value="Initialize" />
<div id="clientState"></div>
</div>
<div class="bc-grid" style="grid-template-columns: 1fr; max-width: 460px;">
<div class="bc-panel">
<h2>Authenticate</h2>
<p class="bc-hint">Set up your user details and authenticate.</p>
<div id="clientState" style="margin-bottom: 10px;"></div>
<label class="bc-field">Username <input type="text" id="userName" /></label>
<label class="bc-field">Password <input type="text" id="password" /></label>
<input type="button" class="bc-primary" onclick="authenticate()" value="Authenticate" />
Expand Down
Loading