using local google drive app on localhost

This commit is contained in:
antelle 2017-12-17 18:06:18 +01:00
parent 60494d2f33
commit 9931c746f3
1 changed files with 8 additions and 2 deletions

View File

@ -1,7 +1,10 @@
const StorageBase = require('./storage-base');
const Locale = require('../util/locale');
const GDriveClientId = '847548101761-koqkji474gp3i2gn3k5omipbfju7pbt1.apps.googleusercontent.com';
const GDriveClientId = {
Local: '783608538594-36tkdh8iscrq8t8dq87gghubnhivhjp5.apps.googleusercontent.com',
Production: '847548101761-koqkji474gp3i2gn3k5omipbfju7pbt1.apps.googleusercontent.com'
};
const NewFileIdPrefix = 'NewFile:';
const StorageGDrive = StorageBase.extend({
@ -200,7 +203,10 @@ const StorageGDrive = StorageBase.extend({
},
_getOAuthConfig: function() {
const clientId = this.appSettings.get('gdriveClientId') || GDriveClientId;
let clientId = this.appSettings.get('gdriveClientId');
if (!clientId) {
clientId = location.origin.indexOf('localhost') >= 0 ? GDriveClientId.Local : GDriveClientId.Production;
}
return {
scope: 'https://www.googleapis.com/auth/drive',
url: 'https://accounts.google.com/o/oauth2/v2/auth',