Browse Source

fixes #596

tags/v0.1.11
Big Bad Waffle 6 years ago
parent
commit
1242a9e11d
4 changed files with 51 additions and 4 deletions
  1. +0
    -2
      .gitignore
  2. +18
    -0
      src/server/security/creds.js
  3. +10
    -2
      src/server/security/sheets.js
  4. +23
    -0
      src/server/security/sheetsConfig.js

+ 0
- 2
.gitignore View File

@@ -3,6 +3,4 @@ storage.db
*.sublime-project
*.sublime-workspace
*.css
creds.js
sheetsConfig.js
!helpers/item-tooltip/styles.css

+ 18
- 0
src/server/security/creds.js View File

@@ -0,0 +1,18 @@
define([

], function (

) {
return {
type: 'service_account',
project_id: '',
private_key_id: '',
private_key: '',
client_email: '',
client_id: '',
auth_uri: 'https://accounts.google.com/o/oauth2/auth',
token_uri: 'https://accounts.google.com/o/oauth2/token',
auth_provider_x509_cert_url: 'https://www.googleapis.com/oauth2/v1/certs',
client_x509_cert_url: ''
};
});

+ 10
- 2
src/server/security/sheets.js View File

@@ -14,6 +14,12 @@ define([
records: null,

init: function () {
if (sheetsConfig.roles) {
this.update = function () {};
this.onGetRows(null, sheetsConfig.roles);
return;
}

this.doc = new googleSheets(sheetsConfig.sheetId);
this.doc.useServiceAccountAuth(creds, this.onAuth.bind(this));
},
@@ -54,8 +60,10 @@ define([
o.messagePrefix = o.messageprefix;
delete o.messageprefix;

o.items = JSON.parse(o.items || "[]");
o.skins = JSON.parse(o.skins || "[]");
if (typeof (o.items) == 'string')
o.items = JSON.parse(o.items || "[]");
if (typeof (o.skins) == 'string')
o.skins = JSON.parse(o.skins || "[]");

return o;
});


+ 23
- 0
src/server/security/sheetsConfig.js View File

@@ -0,0 +1,23 @@
define([

], function (

) {
return {
sheetId: '',

roles: [{
username: 'admin',
level: 10,
messagestyle: 'color-blueA',
messageprefix: '(dev) ',
skins: ['*'],
items: [{
type: 'key',
name: 'Key to the world',
sprite: [2, 0],
keyId: 'world'
}]
}]
};
});

Loading…
Cancel
Save