Browse Source

Merge pull request #81 from stakwork/rolez2

Rolez2
push-params
Evan Feenstra 4 years ago
committed by GitHub
parent
commit
c4e017c33a
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      api/builtin/mother.ts
  2. 3
      api/builtin/welcome.ts
  3. 21
      api/controllers/bots.ts
  4. 14
      api/controllers/chatTribes.ts
  5. 2
      api/network/interfaces.ts
  6. 2
      api/network/send.ts
  7. 7
      dist/api/builtin/mother.js
  8. 2
      dist/api/builtin/mother.js.map
  9. 3
      dist/api/builtin/welcome.js
  10. 2
      dist/api/builtin/welcome.js.map
  11. 24
      dist/api/controllers/bots.js
  12. 2
      dist/api/controllers/bots.js.map
  13. 13
      dist/api/controllers/chatTribes.js
  14. 2
      dist/api/controllers/chatTribes.js.map
  15. 2
      dist/api/network/send.js
  16. 2
      dist/api/network/send.js.map
  17. 23
      package-lock.json
  18. 2
      package.json

10
api/builtin/mother.ts

@ -1,7 +1,7 @@
// import * as SphinxBot from '../../../sphinx-bot'
// import * as SphinxBot from '../../../sphinx-bot'
import * as Sphinx from 'sphinx-bot'
import { finalAction } from '../controllers/actions'
import { installBot } from '../controllers/bots'
import { installBotAsTribeAdmin } from '../controllers/bots'
import * as path from 'path'
import * as WelcomeBot from './welcome'
import * as LoopBot from './loop'
@ -39,6 +39,10 @@ export function init() {
if (arr.length < 2) return
if (arr[0] !== '/bot') return
const cmd = arr[1]
const isAdmin = message.member.roles.find(role => role.name === 'Admin')
if(!isAdmin) return
switch (cmd) {
case 'install':
@ -96,7 +100,7 @@ export function init() {
}
})
if (!chat) return
installBot(chat.dataValues, bot)
installBotAsTribeAdmin(chat.dataValues, bot)
} else {
const embed = new Sphinx.MessageEmbed()
.setAuthor('MotherBot')

3
api/builtin/welcome.ts

@ -23,6 +23,9 @@ export function init() {
if (arr[0] !== '/welcome' && !isGroupJoin) return
const cmd = arr[1]
const isAdmin = message.member.roles.find(role => role.name === 'Admin')
if(!isAdmin) return
if (isGroupJoin) {
const chat = await models.Chat.findOne({ where: { uuid: message.channel.id } })
if (!chat) return

21
api/controllers/bots.ts

@ -67,7 +67,7 @@ export const deleteBot = async (req, res) => {
}
}
export async function installBot(chat, bot_json) {
export async function installBotAsTribeAdmin(chat, bot_json) {
const chatId = chat && chat.id
const chat_uuid = chat && chat.uuid
if(!chatId || !chat_uuid) return console.log('no chat id in installBot')
@ -104,7 +104,11 @@ export async function installBot(chat, bot_json) {
type: constants.message_types.bot_install,
bot_uuid: myBot.uuid,
message: {content:'', amount:0},
sender: {pub_key: owner.publicKey, alias: owner.alias},
sender: {
pub_key: owner.publicKey,
alias: owner.alias,
role: constants.chat_roles.owner
},
chat: {uuid:chat_uuid}
}, myBot, SphinxBot.MSG_TYPE.INSTALL)
}
@ -136,10 +140,11 @@ export async function keysendBotCmd(msg, b): Promise<boolean> {
b.botUuid, b.botMakerPubkey, amt,
msg.chat.uuid,
msg.message.content,
(msg.sender && msg.sender.role)
)
}
export async function botKeysend(msg_type, bot_uuid, botmaker_pubkey, amount, chat_uuid:string, content?:string): Promise<boolean> {
export async function botKeysend(msg_type, bot_uuid, botmaker_pubkey, amount, chat_uuid:string, content?:string, sender_role?:number): Promise<boolean> {
const owner = await models.Contact.findOne({ where: { isOwner: true } })
const dest = botmaker_pubkey
const MIN_SATS = 3
@ -150,10 +155,14 @@ export async function botKeysend(msg_type, bot_uuid, botmaker_pubkey, amount, ch
data: <network.Msg>{
type: msg_type,
bot_uuid,
chat: {uuid:chat_uuid},
message: {content: content||'', amount:amt},
sender: {pub_key: owner.publicKey, alias: owner.alias},
chat: {uuid:chat_uuid}
},
sender: {
pub_key: owner.publicKey,
alias: owner.alias,
role: sender_role||constants.chat_roles.reader
}
}
}
try {
await network.signAndSend(opts)

14
api/controllers/chatTribes.ts

@ -130,7 +130,7 @@ export async function receiveMemberRequest(payload) {
let theSender: any = null
const member = chat_members[sender_pub_key]
const senderAlias = sender_alias || (member && member.alias) || 'Unknown'
const sender = await models.Contact.findOne({ where: { publicKey: sender_pub_key } })
if (sender) {
theSender = sender // might already include??
@ -148,13 +148,23 @@ export async function receiveMemberRequest(payload) {
}
if(!theSender) return console.log('no sender') // fail (no contact key?)
await models.ChatMember.upsert({
console.log("UPSERT",{
contactId: theSender.id,
chatId: chat.id,
role: constants.chat_roles.reader,
status: constants.chat_statuses.pending,
lastActive: date,
})
// maybe check here manually????
try{
await models.ChatMember.upsert({
contactId: theSender.id,
chatId: chat.id,
role: constants.chat_roles.reader,
status: constants.chat_statuses.pending,
lastActive: date,
})
} catch(e){}
const msg:{[k:string]:any} = {
chatId: chat.id,

2
api/network/interfaces.ts

@ -11,6 +11,6 @@ export interface Msg {
sender: {
pub_key: string,
alias: string,
role?: number
role: number
}
}

2
api/network/send.ts

@ -57,7 +57,7 @@ export async function sendMessage(params) {
// console.log("SEND.TS isBotMsg")
const isBotMsg = await intercept.isBotMsg(msg, true)
if(isBotMsg===true) {
// return // DO NOT FORWARD TO TRIBE, forwarded to bot instead
// return // DO NOT FORWARD TO TRIBE, forwarded to bot instead?
}
// post last_active to tribes server
tribes.putActivity(chat.uuid, chat.host)

7
dist/api/builtin/mother.js

@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
});
};
Object.defineProperty(exports, "__esModule", { value: true });
// import * as SphinxBot from '../../../sphinx-bot'
// import * as SphinxBot from '../../../sphinx-bot'
const Sphinx = require("sphinx-bot");
const actions_1 = require("../controllers/actions");
const bots_1 = require("../controllers/bots");
@ -45,6 +45,9 @@ function init() {
if (arr[0] !== '/bot')
return;
const cmd = arr[1];
const isAdmin = message.member.roles.find(role => role.name === 'Admin');
if (!isAdmin)
return;
switch (cmd) {
case 'install':
if (arr.length < 3)
@ -104,7 +107,7 @@ function init() {
});
if (!chat)
return;
bots_1.installBot(chat.dataValues, bot);
bots_1.installBotAsTribeAdmin(chat.dataValues, bot);
}
else {
const embed = new Sphinx.MessageEmbed()

2
dist/api/builtin/mother.js.map

File diff suppressed because one or more lines are too long

3
dist/api/builtin/welcome.js

@ -31,6 +31,9 @@ function init() {
if (arr[0] !== '/welcome' && !isGroupJoin)
return;
const cmd = arr[1];
const isAdmin = message.member.roles.find(role => role.name === 'Admin');
if (!isAdmin)
return;
if (isGroupJoin) {
const chat = yield models_1.models.Chat.findOne({ where: { uuid: message.channel.id } });
if (!chat)

2
dist/api/builtin/welcome.js.map

@ -1 +1 @@
{"version":3,"file":"welcome.js","sourceRoot":"","sources":["../../../api/builtin/welcome.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,qCAAoC;AACpC,oDAAoD;AACpD,sCAAkC;AAClC,6BAA4B;AAC5B,MAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAA;AAEjC,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,6BAA6B,CAAC,CAAC,CAAA;AAE9E,IAAI,OAAO,GAAG,KAAK,CAAA;AAEnB,SAAgB,IAAI;IAClB,IAAI,OAAO;QAAE,OAAM;IACnB,OAAO,GAAG,IAAI,CAAA;IAEd,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,CAAA;IAClC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,qBAAW,CAAC,CAAA;IAE9B,MAAM,CAAC,EAAE,CAAC,SAAS,CAAC,OAAO,EAAE,CAAO,OAAuB,EAAE,EAAE;QAC7D,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAA;QACjE,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,OAAO,CAAC,IAAI,CAAC,CAAA;QACzC,MAAM,WAAW,GAAG,OAAO,CAAC,IAAI,KAAK,SAAS,CAAC,aAAa,CAAC,UAAU,CAAA;QACvE,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,WAAW;YAAE,OAAM;QAC1C,IAAI,GAAG,CAAC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(void 0, void 0, void 0, function* ()
res_1.failure(res, e);
}
});
function installBot(chat, bot_json) {
function installBotAsTribeAdmin(chat, bot_json) {
return __awaiter(this, void 0, void 0, function* () {
const chatId = chat && chat.id;
const chat_uuid = chat && chat.uuid;
@ -112,7 +112,11 @@ function installBot(chat, bot_json) {
type: constants.message_types.bot_install,
bot_uuid: myBot.uuid,
message: { content: '', amount: 0 },
sender: { pub_key: owner.publicKey, alias: owner.alias },
sender: {
pub_key: owner.publicKey,
alias: owner.alias,
role: constants.chat_roles.owner
},
chat: { uuid: chat_uuid }
}, myBot, SphinxBot.MSG_TYPE.INSTALL);
}
@ -130,7 +134,7 @@ function installBot(chat, bot_json) {
}
});
}
exports.installBot = installBot;
exports.installBotAsTribeAdmin = installBotAsTribeAdmin;
function keysendBotInstall(b, chat_uuid) {
return __awaiter(this, void 0, void 0, function* () {
return yield botKeysend(constants.message_types.bot_install, b.botUuid, b.botMakerPubkey, b.pricePerUse, chat_uuid);
@ -141,11 +145,11 @@ function keysendBotCmd(msg, b) {
return __awaiter(this, void 0, void 0, function* () {
const amount = msg.message.amount || 0;
const amt = Math.max(amount, b.pricePerUse);
return yield botKeysend(constants.message_types.bot_cmd, b.botUuid, b.botMakerPubkey, amt, msg.chat.uuid, msg.message.content);
return yield botKeysend(constants.message_types.bot_cmd, b.botUuid, b.botMakerPubkey, amt, msg.chat.uuid, msg.message.content, (msg.sender && msg.sender.role));
});
}
exports.keysendBotCmd = keysendBotCmd;
function botKeysend(msg_type, bot_uuid, botmaker_pubkey, amount, chat_uuid, content) {
function botKeysend(msg_type, bot_uuid, botmaker_pubkey, amount, chat_uuid, content, sender_role) {
return __awaiter(this, void 0, void 0, function* () {
const owner = yield models_1.models.Contact.findOne({ where: { isOwner: true } });
const dest = botmaker_pubkey;
@ -157,10 +161,14 @@ function botKeysend(msg_type, bot_uuid, botmaker_pubkey, amount, chat_uuid, cont
data: {
type: msg_type,
bot_uuid,
chat: { uuid: chat_uuid },
message: { content: content || '', amount: amt },
sender: { pub_key: owner.publicKey, alias: owner.alias },
chat: { uuid: chat_uuid }
},
sender: {
pub_key: owner.publicKey,
alias: owner.alias,
role: sender_role || constants.chat_roles.reader
}
}
};
try {
yield network.signAndSend(opts);

2
dist/api/controllers/bots.js.map

File diff suppressed because one or more lines are too long

13
dist/api/controllers/chatTribes.js

@ -150,13 +150,24 @@ function receiveMemberRequest(payload) {
}
if (!theSender)
return console.log('no sender'); // fail (no contact key?)
yield models_1.models.ChatMember.upsert({
console.log("UPSERT", {
contactId: theSender.id,
chatId: chat.id,
role: constants.chat_roles.reader,
status: constants.chat_statuses.pending,
lastActive: date,
});
// maybe check here manually????
try {
yield models_1.models.ChatMember.upsert({
contactId: theSender.id,
chatId: chat.id,
role: constants.chat_roles.reader,
status: constants.chat_statuses.pending,
lastActive: date,
});
}
catch (e) { }
const msg = {
chatId: chat.id,
type: constants.message_types.member_request,

2
dist/api/controllers/chatTribes.js.map

File diff suppressed because one or more lines are too long

2
dist/api/network/send.js

@ -61,7 +61,7 @@ function sendMessage(params) {
// console.log("SEND.TS isBotMsg")
const isBotMsg = yield intercept.isBotMsg(msg, true);
if (isBotMsg === true) {
// return // DO NOT FORWARD TO TRIBE, forwarded to bot instead
// return // DO NOT FORWARD TO TRIBE, forwarded to bot instead?
}
// post last_active to tribes server
tribes.putActivity(chat.uuid, chat.host);

2
dist/api/network/send.js.map

File diff suppressed because one or more lines are too long

23
package-lock.json

@ -1123,9 +1123,9 @@
}
},
"@types/express-serve-static-core": {
"version": "4.17.12",
"resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.12.tgz",
"integrity": "sha512-EaEdY+Dty1jEU7U6J4CUWwxL+hyEGMkO5jan5gplfegUgCUsIUWqXxqw47uGjimeT4Qgkz/XUfwoau08+fgvKA==",
"version": "4.17.13",
"resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.13.tgz",
"integrity": "sha512-RgDi5a4nuzam073lRGKTUIaL3eF2+H7LJvJ8eUnCI0wA6SNjXc44DCmWNiTLs/AZ7QlsFWZiw/gTG3nSQGL0fA==",
"requires": {
"@types/node": "*",
"@types/qs": "*",
@ -3917,9 +3917,9 @@
}
},
"dompurify": {
"version": "2.0.15",
"resolved": "https://registry.npmjs.org/dompurify/-/dompurify-2.0.15.tgz",
"integrity": "sha512-8AnYW8iXOC7xC7K3FBvQ7+GdmtOsgDGZC5dDXaewCC674qcId7G5mhz5VIEnVShJVjQdlcaPjxpaOzaV9JC3Tg=="
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/dompurify/-/dompurify-2.1.0.tgz",
"integrity": "sha512-wKExRhOwUnfm1icoISSXnlmM1P2l07W2tFQqbU+8oySnvy7tHwj2iHJ1kJQi8EfcTlojsHKESOJwCGVJmNUdPQ=="
},
"dont-sniff-mimetype": {
"version": "1.1.0",
@ -11305,9 +11305,9 @@
}
},
"sphinx-bot": {
"version": "0.2.13",
"resolved": "https://registry.npmjs.org/sphinx-bot/-/sphinx-bot-0.2.13.tgz",
"integrity": "sha512-+TRZS4k5vC+0xyaLCWJkXJ2d7y4BncJX2bneJpJN83pvrqq1GH+D4o85BcZTuGM1JKIutUNEm8W26tmgiWOW6g==",
"version": "0.2.18",
"resolved": "https://registry.npmjs.org/sphinx-bot/-/sphinx-bot-0.2.18.tgz",
"integrity": "sha512-BV1nuzjo1X0ZQtMQ3NeANv6zs+lSE4zwkAVxtDVZebs6nZ9GeafKnd1rZB6IrS9UjvOqGitQTYEmrQ3dD018ow==",
"requires": {
"@types/cors": "^2.8.7",
"@types/express": "^4.17.8",
@ -11324,11 +11324,6 @@
"version": "4.0.7",
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz",
"integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw=="
},
"node-fetch": {
"version": "2.6.1",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
"integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw=="
}
}
},

2
package.json

@ -79,7 +79,7 @@
"short-uuid": "^3.1.1",
"sjcl": "^1.0.8",
"socket.io": "^2.3.0",
"sphinx-bot": "^0.2.13",
"sphinx-bot": "^0.2.18",
"tail": "^2.0.3",
"ts-node": "^8.5.4",
"tsc": "^1.20150623.0",

Loading…
Cancel
Save