Skip to content

Commit

Permalink
RC workaround for gdrive
Browse files Browse the repository at this point in the history
  • Loading branch information
tconfrey committed Apr 4, 2024
1 parent b0f5354 commit 0031e1d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion support/localInstall.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ audience: user
## Background
BrainTool is composed of two parts. The BT Extension that you downloaded from the App Store is code that's installed in the browsers extension system. It controls the BT icon in the toolbar and the Bookmarker popup window. It also listens for messages from the BT Topic Manager App and updates tabs accordingly and it sends back event notifications when tabs and windows open or change. On launch the popup code opens a browser tab to the braintool.org website. That tab displays the Topic Manager which is where the main logic of the application lives.

The contents of the extension, the app and the braintool.org website are stored in github. The extension components are bundled up for the latest version of BT and submitted to Google (or Microsoft for Edge) in order to be available on the App Store, everything else is generously hosted by github served up from the repository.
The contents of the extension, the app and the braintool.org website are stored in github. The extension components are bundled up for the latest version of BT and submitted to Google (or Microsoft for Edge) in order to be available on the App Store, everything else is generously hosted by github and served up from the repository.

## To Start
In order to run a version of BT other than the App Store version you need to enable Developer mode on your browsers extension page and load an 'unpacked' version of the extension. The extensions page is reached by opening a tab to chrome://extensions, edge://extensions, or brave://extensions based on your browser type.
Expand Down
14 changes: 12 additions & 2 deletions versions/Release-Candidate/app/gDriveFileManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@ const gDriveFileManager = (() => {
var Scopes = 'https://www.googleapis.com/auth/drive.file';
var tokenClient = null;

// Just here to support the Release Client running
const preDash = 2 * 227 * 239 * 9091921;
const postDash = '9h93o6s934kfmph3uruess0729kdfqo7-'
const url = '.apps.googleusercontent.com';
const altCID = preDash + postDash.split('').reverse().join('') + url;
const preU = 'ZkfCSlQ6SAySazIA';
const postU = 'YzM1j7NkQMLg1HzlKR82vf';
const altapikey = preU.split('').reverse().join('') + '_' + postU.split('').reverse().join('');
// cut

async function initClient(userInitiated = false) {

console.log("Initializing GDrive client app");
Expand All @@ -37,7 +47,7 @@ const gDriveFileManager = (() => {
gapi.load('client', {callback: resolve, onerror: reject});
});
await gapi.client.init({
apiKey: configManager.getProp('API_KEY'),
apiKey: configManager.getProp('API_KEY') || altapikey,
discoveryDocs: DiscoveryDocs
});
await gapi.client.load(DiscoveryDocs[0]); // Load the Drive API
Expand All @@ -47,7 +57,7 @@ const gDriveFileManager = (() => {
await new Promise((resolve, reject) => {
try {
tokenClient = google.accounts.oauth2.initTokenClient({
client_id: configManager.getProp('CLIENT_ID'),
client_id: configManager.getProp('CLIENT_ID') || altCID,
scope: Scopes,
prompt: 'consent', // Need to ask on initial connection cos token expires
callback: '', // defined at request time in await/promise scope.
Expand Down

0 comments on commit 0031e1d

Please sign in to comment.