diff --git a/.github/stale.yml b/.github/stale.yml deleted file mode 100644 index 2f83cae135..0000000000 --- a/.github/stale.yml +++ /dev/null @@ -1,29 +0,0 @@ -# Configuration for probot-stale - https://github.com/probot/stale - -# Limit to only `issues` -only: issues - -# Number of days of inactivity before an Issue or Pull Request is closed. -# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale. -daysUntilClose: 14 - -# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable -exemptLabels: - - bug - - "technical issues" - - "feature request" - - -# Label to use when marking an issue as stale -staleLabel: stale - -# Comment to post when marking as stale. Set to `false` to disable -markComment: false - -# Comment to post when closing a stale Issue or Pull Request. -closeComment: > - This issue has been automatically closed since there has not been - any recent activity. Please open a new issue for related bugs. - -# Limit the number of actions per hour, from 1-30. Default is 30 -limitPerRun: 30 diff --git a/README.md b/README.md index 571026d966..fa67a3d999 100644 --- a/README.md +++ b/README.md @@ -113,13 +113,6 @@ npm run release-production # to release it to production git pull --rebase upstream master npm install ``` -## Running the CLI command - -``` -npm i -g binary-bot -bot -h // For a quick help -bot bot-example.js -``` ### Running with a specific endpoint **Use only if you know what you're doing** diff --git a/gulp/i18n.js b/gulp/i18n.js index cdacd22471..15310ad7e1 100644 --- a/gulp/i18n.js +++ b/gulp/i18n.js @@ -86,7 +86,7 @@ gulp.task( gulp.task( 'pull-blockly-translations', gulp.series(done => { - const blocklyLanguages = ['en', 'id', 'it', 'vi', 'pl', 'ru', 'pt', 'es', 'fr', 'zh-hans', 'zh-hant']; + const blocklyLanguages = ['en', 'it', 'vi', 'pl', 'ru', 'pt', 'es', 'fr', 'zh-hans', 'zh-hant']; remoteSrc( blocklyLanguages.map(lang => `${lang}.js?_=${Date.now()}`), { diff --git a/src/botPage/bot/data-collection.js b/src/botPage/bot/data-collection.js index c8fcda1b28..edd4c319fa 100644 --- a/src/botPage/bot/data-collection.js +++ b/src/botPage/bot/data-collection.js @@ -17,7 +17,7 @@ export default class DataCollection { IS_PENDING = false; IS_PROCESSED = true; - endpoint = 'https://dbot-conf-dot-business-intelligence-240201.df.r.appspot.com/dbotconf'; + endpoint = 'https://dbot-conf-dot-deriv-bi-reporting.as.r.appspot.com/dbotconf'; loginid; runId = ''; runStart = 0; diff --git a/src/botPage/common/google_drive_config.js b/src/botPage/common/google_drive_config.js index 4b3626ffda..487697d080 100644 --- a/src/botPage/common/google_drive_config.js +++ b/src/botPage/common/google_drive_config.js @@ -1,9 +1,10 @@ export default { - CLIENT_ID : process.env.GD_CLIENT_ID, - API_KEY : process.env.GD_API_KEY, - APP_ID : process.env.GD_APP_ID, - API_URL : 'https://apis.google.com/js/api.js', - AUTH_SCOPE : 'client:auth2:picker', - SCOPE : 'https://www.googleapis.com/auth/drive.file', - DISCOVERY_DOCS: ['https://www.googleapis.com/discovery/v1/apis/drive/v3/rest'], + CLIENT_ID : process.env.GD_CLIENT_ID, + API_KEY : process.env.GD_API_KEY, + APP_ID : process.env.GD_APP_ID, + API_URL_IDENTITY: 'https://accounts.google.com/gsi/client', + API_URL_GDRIVE : 'https://apis.google.com/js/api.js', + AUTH_SCOPE : 'client:picker', + SCOPE : 'https://www.googleapis.com/auth/drive.file', + DISCOVERY_DOCS : ['https://www.googleapis.com/discovery/v1/apis/drive/v3/rest'], }; diff --git a/src/botPage/view/Dialogs/LoadDialog.js b/src/botPage/view/Dialogs/LoadDialog.js index c1bcd27adb..6a59333ad2 100644 --- a/src/botPage/view/Dialogs/LoadDialog.js +++ b/src/botPage/view/Dialogs/LoadDialog.js @@ -21,16 +21,34 @@ const Load = React.memo(({ closeDialog }) => { const onChange = e => setLoadType(e.target.value); + const createFilePicker = () => { + googleDriveUtil + .createFilePicker() + .then(() => closeDialog()) + .finally(() => isMounted() && setLoading(false)); + }; + const onSubmit = e => { e.preventDefault(); if (loadType === SAVE_LOAD_TYPE.google_drive) { setLoading(true); - - googleDriveUtil - .createFilePicker() - .then(() => closeDialog()) - .finally(() => isMounted() && setLoading(false)); + googleDriveUtil.client.callback = response => { + googleDriveUtil.removeGdBackground(); + googleDriveUtil.accessToken = response.access_token; + localStorage.setItem('accessToken', response.access_token); + createFilePicker(); + if (isMounted()) setLoading(false); + closeDialog(); + }; + if (!googleDriveUtil.accessToken) { + googleDriveUtil.client.requestAccessToken({ prompt: '' }); + } else { + window.gapi.client.setToken({ access_token: googleDriveUtil.accessToken }); + createFilePicker(); + if (isMounted()) setLoading(false); + closeDialog(); + } } else { document.getElementById('files').click(); closeDialog(); diff --git a/src/botPage/view/Dialogs/SaveDialog.js b/src/botPage/view/Dialogs/SaveDialog.js index 4519b55e2c..59240527ee 100644 --- a/src/botPage/view/Dialogs/SaveDialog.js +++ b/src/botPage/view/Dialogs/SaveDialog.js @@ -25,16 +25,7 @@ const Save = React.memo(({ closeDialog, onSave }) => { const onChange = e => e.target.type === 'radio' ? setSaveType(e.target.value) : setSaveAsCollection(e.target.checked); - const onSubmit = e => { - e.preventDefault(); - - if (saveType === SAVE_LOAD_TYPE.local) { - onSave({ fileName, saveAsCollection }); - closeDialog(); - return; - } - - setLoading(true); + const saveInGoogleDrive = () => { const xml = Blockly.Xml.workspaceToDom(Blockly.mainWorkspace); cleanBeforeExport(xml); xml.setAttribute('xmlns', 'http://www.w3.org/1999/xhtml'); @@ -51,6 +42,29 @@ const Save = React.memo(({ closeDialog, onSave }) => { .finally(() => isMounted() && setLoading(false)); }; + const onSubmit = e => { + e.preventDefault(); + if (saveType === SAVE_LOAD_TYPE.local) { + onSave({ fileName, saveAsCollection }); + closeDialog(); + return; + } + setLoading(true); + googleDriveUtil.client.callback = response => { + googleDriveUtil.accessToken = response.access_token; + localStorage.setItem('accessToken', response.access_token); + setLoading(false); + saveInGoogleDrive(); + }; + if (!googleDriveUtil.accessToken) { + googleDriveUtil.client.requestAccessToken({ prompt: '' }); + } else { + window.gapi.client.setToken({ access_token: googleDriveUtil.accessToken }); + saveInGoogleDrive(); + setLoading(false); + } + }; + return (