Browse Source

Merge pull request #37 from stakwork/edit-tribes

Edit tribes
feature/dockerfile-arm v0.9.4
Evan Feenstra 5 years ago
committed by GitHub
parent
commit
e71cc55748
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 92
      api/controllers/chats.ts
  2. 1
      api/controllers/index.ts
  3. 36
      api/utils/logger.ts
  4. 162
      api/utils/tribes.ts
  5. 74
      dist/api/controllers/chats.js
  6. 2
      dist/api/controllers/chats.js.map
  7. 1
      dist/api/controllers/index.js
  8. 2
      dist/api/controllers/index.js.map
  9. 2
      dist/api/utils/logger.js.map
  10. 57
      dist/api/utils/tribes.js
  11. 2
      dist/api/utils/tribes.js.map

92
api/controllers/chats.ts

@ -37,6 +37,60 @@ async function mute(req, res) {
success(res, jsonUtils.chatToJson(chat))
}
async function editTribe(req, res) {
const {
name,
is_listed,
price_per_message,
price_to_join,
img,
description,
tags,
} = req.body
const { id } = req.params
if(!id) return failure(res, 'group id is required')
const chat = await models.Chat.findOne({where:{id}})
if(!chat) {
return failure(res, 'cant find chat')
}
const owner = await models.Contact.findOne({ where: { isOwner: true } })
let okToUpdate = true
if(is_listed) {
try{
await tribes.edit({
uuid: chat.uuid,
name: name,
host: chat.host,
price_per_message: price_per_message||0,
price_to_join: price_to_join||0,
description,
tags,
img,
owner_alias: owner.alias,
})
} catch(e) {
okToUpdate = false
}
}
if(okToUpdate) {
await chat.update({
photoUrl: img||'',
name: name,
pricePerMessage: price_per_message||0,
priceToJoin: price_to_join||0
})
success(res, jsonUtils.chatToJson(chat))
} else {
failure(res, 'failed to update tribe')
}
}
// just add self here if tribes
// or can u add contacts as members?
async function createGroupChat(req, res) {
@ -67,18 +121,26 @@ async function createGroupChat(req, res) {
})
let chatParams:any = null
let okToCreate = true
if(is_tribe){
chatParams = await createTribeChatParams(owner, contact_ids, name, img, price_per_message, price_to_join)
if(is_listed && chatParams.uuid){
// publish to tribe server
tribes.declare({
...chatParams,
pricePerMessage: price_per_message||0,
priceToJoin: price_to_join||0,
description, tags, img,
ownerPubkey: owner.publicKey,
ownerAlias: owner.alias,
})
try {
await tribes.declare({
uuid: chatParams.uuid,
name: chatParams.name,
host: chatParams.host,
group_key: chatParams.groupKey,
price_per_message: price_per_message||0,
price_to_join: price_to_join||0,
description, tags, img,
owner_pubkey: owner.publicKey,
owner_alias: owner.alias,
})
} catch(e) {
okToCreate = false
}
}
// make me owner when i create
members[owner.publicKey].role = constants.chat_roles.owner
@ -86,6 +148,10 @@ async function createGroupChat(req, res) {
chatParams = createGroupChatParams(owner, contact_ids, members, name)
}
if(!okToCreate) {
return failure(res, 'could not create tribe')
}
network.sendMessage({
chat: { ...chatParams, members },
sender: owner,
@ -344,6 +410,12 @@ async function receiveGroupJoin(payload) {
if (sender) {
theSender = sender // might already include??
if(!contactIds.includes(sender.id)) contactIds.push(sender.id)
// update sender contacT_key in case they reset?
if(member && member.key) {
if(sender.contactKey!==member.key) {
await sender.update({contactKey:member.key})
}
}
} else {
if(member && member.key) {
const createdContact = await models.Contact.create({
@ -536,9 +608,9 @@ async function createTribeChatParams(owner, contactIds, name, img, price_per_mes
uuid: groupUUID,
ownerPubkey: owner.publicKey,
contactIds: JSON.stringify(theContactIds),
photoUrl: img||'',
createdAt: date,
updatedAt: date,
photoUrl: img||'',
name: name,
type: constants.chat_types.tribe,
groupKey: keys.public,
@ -553,7 +625,7 @@ export {
getChats, mute, addGroupMembers,
receiveGroupCreateOrInvite, createGroupChat,
deleteChat, receiveGroupLeave, receiveGroupJoin,
joinTribe,
joinTribe, editTribe,
}

1
api/controllers/index.ts

@ -35,6 +35,7 @@ async function set(app) {
app.delete('/chat/:id', controllers.chats.deleteChat)
app.put('/chat/:id', controllers.chats.addGroupMembers)
app.post('/tribe', controllers.chats.joinTribe)
app.put('/group/:id', controllers.chats.editTribe)
app.post('/contacts/tokens', controllers.contacts.generateToken)

36
api/utils/logger.ts

@ -5,24 +5,24 @@ import * as moment from 'moment'
const tsFormat = (ts) => moment(ts).format('YYYY-MM-DD HH:mm:ss').trim();
const logger = expressWinston.logger({
transports: [
new winston.transports.Console()
],
format: winston.format.combine(
winston.format.timestamp(),
winston.format.colorize(),
winston.format.printf(info=>{
return `-> ${tsFormat(info.timestamp)}: ${info.message}`
})
),
meta: false, // optional: control whether you want to log the meta data about the request (default to true)
// msg: "HTTP {{req.method}} {{req.url}}", // optional: customize the default logging message. E.g. "{{res.statusCode}} {{req.method}} {{res.responseTime}}ms {{req.url}}"
expressFormat: true, // Use the default Express/morgan request formatting. Enabling this will override any msg if true. Will only output colors with colorize set to true
colorize: true, // Color the text and status code, using the Express/morgan color palette (text: gray, status: default green, 3XX cyan, 4XX yellow, 5XX red).
ignoreRoute: function (req, res) {
if(req.path.startsWith('/json')) return true // debugger
return false;
} // optional: allows to skip some log messages based on request and/or response
transports: [
new winston.transports.Console()
],
format: winston.format.combine(
winston.format.timestamp(),
winston.format.colorize(),
winston.format.printf(info=>{
return `-> ${tsFormat(info.timestamp)}: ${info.message}`
})
),
meta: false, // optional: control whether you want to log the meta data about the request (default to true)
// msg: "HTTP {{req.method}} {{req.url}}", // optional: customize the default logging message. E.g. "{{res.statusCode}} {{req.method}} {{res.responseTime}}ms {{req.url}}"
expressFormat: true, // Use the default Express/morgan request formatting. Enabling this will override any msg if true. Will only output colors with colorize set to true
colorize: true, // Color the text and status code, using the Express/morgan color palette (text: gray, status: default green, 3XX cyan, 4XX yellow, 5XX red).
ignoreRoute: function (req, res) {
if(req.path.startsWith('/json')) return true // debugger
return false;
} // optional: allows to skip some log messages based on request and/or response
})
export default logger

162
api/utils/tribes.ts

@ -7,95 +7,119 @@ import * as mqtt from 'mqtt'
import * as fetch from 'node-fetch'
const env = process.env.NODE_ENV || 'development'
const config = require(path.join(__dirname,'../../config/app.json'))[env]
const config = require(path.join(__dirname, '../../config/app.json'))[env]
let client:any
let client: any
export async function connect(onMessage) {
try{
const info = await LND.getInfo()
try {
const info = await LND.getInfo()
async function reconnect(){
client = null
const pwd = await genSignedTimestamp()
console.log('[tribes] try to connect:',`tls://${config.tribes_host}:8883`)
client = mqtt.connect(`tls://${config.tribes_host}:8883`,{
username:info.identity_pubkey,
password:pwd,
reconnectPeriod:0, // dont auto reconnect
})
client.on('connect', function () {
console.log("[tribes] connected!")
client.subscribe(`${info.identity_pubkey}/#`)
})
client.on('close', function (e) {
setTimeout(()=> reconnect(), 2000)
})
client.on('error', function (e) {
console.log('[tribes] error: ',e.message||e)
})
client.on('message', function(topic, message) {
if(onMessage) onMessage(topic, message)
})
}
reconnect()
} catch(e){
console.log("TRIBES ERROR",e)
async function reconnect() {
client = null
const pwd = await genSignedTimestamp()
console.log('[tribes] try to connect:', `tls://${config.tribes_host}:8883`)
client = mqtt.connect(`tls://${config.tribes_host}:8883`, {
username: info.identity_pubkey,
password: pwd,
reconnectPeriod: 0, // dont auto reconnect
})
client.on('connect', function () {
console.log("[tribes] connected!")
client.subscribe(`${info.identity_pubkey}/#`)
})
client.on('close', function (e) {
setTimeout(() => reconnect(), 2000)
})
client.on('error', function (e) {
console.log('[tribes] error: ', e.message || e)
})
client.on('message', function (topic, message) {
if (onMessage) onMessage(topic, message)
})
}
reconnect()
} catch (e) {
console.log("TRIBES ERROR", e)
}
}
export function subscribe(topic){
if(client) client.subscribe(topic)
export function subscribe(topic) {
if (client) client.subscribe(topic)
}
export function publish(topic,msg){
if(client) client.publish(topic,msg)
export function publish(topic, msg) {
if (client) client.publish(topic, msg)
}
export async function declare({uuid,name,description,tags,img,groupKey,host,pricePerMessage,priceToJoin,ownerAlias,ownerPubkey}) {
const r = await fetch('https://' + host + '/tribes', {
method: 'POST' ,
body: JSON.stringify({
uuid, groupKey,
name, description, tags, img:img||'',
pricePerMessage:pricePerMessage||0,
priceToJoin:priceToJoin||0,
ownerAlias, ownerPubkey,
export async function declare({ uuid, name, description, tags, img, group_key, host, price_per_message, price_to_join, owner_alias, owner_pubkey }) {
try {
await fetch('https://' + host + '/tribes', {
method: 'POST',
body: JSON.stringify({
uuid, group_key,
name, description, tags, img: img || '',
price_per_message: price_per_message || 0,
price_to_join: price_to_join || 0,
owner_alias, owner_pubkey,
}),
headers: { 'Content-Type': 'application/json' }
})
// const j = await r.json()
} catch (e) {
console.log('[tribes] unauthorized to declare')
throw e
}
}
}),
headers: { 'Content-Type': 'application/json' }
export async function edit({ uuid, host, name, description, tags, img, price_per_message, price_to_join, owner_alias }) {
try {
const token = await genSignedTimestamp()
await fetch('https://' + host + '/tribe?token=' + token, {
method: 'PUT',
body: JSON.stringify({
uuid,
name, description, tags, img: img || '',
price_per_message: price_per_message || 0,
price_to_join: price_to_join || 0,
owner_alias,
}),
headers: { 'Content-Type': 'application/json' }
})
const j = await r.json()
console.log(j)
// const j = await r.json()
} catch(e) {
console.log('[tribes] unauthorized to edit')
throw e
}
}
export async function genSignedTimestamp(){
const now = moment().unix()
const tsBytes = Buffer.from(now.toString(16), 'hex')
const sig = await LND.signBuffer(tsBytes)
const sigBytes = zbase32.decode(sig)
const totalLength = tsBytes.length + sigBytes.length
const buf = Buffer.concat([tsBytes, sigBytes], totalLength)
return urlBase64(buf)
export async function genSignedTimestamp() {
const now = moment().unix()
const tsBytes = Buffer.from(now.toString(16), 'hex')
const sig = await LND.signBuffer(tsBytes)
const sigBytes = zbase32.decode(sig)
const totalLength = tsBytes.length + sigBytes.length
const buf = Buffer.concat([tsBytes, sigBytes], totalLength)
return urlBase64(buf)
}
export async function verifySignedTimestamp(stsBase64){
const stsBuf = Buffer.from(stsBase64, 'base64')
const sig = stsBuf.subarray(4,92)
const sigZbase32 = zbase32.encode(sig)
const r = await LND.verifyBytes(stsBuf.subarray(0,4), sigZbase32) // sig needs to be zbase32 :(
if (r.valid) {
return r.pubkey
} else {
return false
}
export async function verifySignedTimestamp(stsBase64) {
const stsBuf = Buffer.from(stsBase64, 'base64')
const sig = stsBuf.subarray(4, 92)
const sigZbase32 = zbase32.encode(sig)
const r = await LND.verifyBytes(stsBuf.subarray(0, 4), sigZbase32) // sig needs to be zbase32 :(
if (r.valid) {
return r.pubkey
} else {
return false
}
}
export function getHost() {
return config.tribes_host || ''
return config.tribes_host || ''
}
function urlBase64(buf){
return buf.toString('base64').replace(/\//g, '_').replace(/\+/g, '-')
function urlBase64(buf) {
return buf.toString('base64').replace(/\//g, '_').replace(/\+/g, '-')
}

74
dist/api/controllers/chats.js

@ -45,6 +45,51 @@ function mute(req, res) {
});
}
exports.mute = mute;
function editTribe(req, res) {
return __awaiter(this, void 0, void 0, function* () {
const { name, is_listed, price_per_message, price_to_join, img, description, tags, } = req.body;
const { id } = req.params;
if (!id)
return res_1.failure(res, 'group id is required');
const chat = yield models_1.models.Chat.findOne({ where: { id } });
if (!chat) {
return res_1.failure(res, 'cant find chat');
}
const owner = yield models_1.models.Contact.findOne({ where: { isOwner: true } });
let okToUpdate = true;
if (is_listed) {
try {
yield tribes.edit({
uuid: chat.uuid,
name: name,
host: chat.host,
price_per_message: price_per_message || 0,
price_to_join: price_to_join || 0,
description,
tags,
img,
owner_alias: owner.alias,
});
}
catch (e) {
okToUpdate = false;
}
}
if (okToUpdate) {
yield chat.update({
photoUrl: img || '',
name: name,
pricePerMessage: price_per_message || 0,
priceToJoin: price_to_join || 0
});
res_1.success(res, jsonUtils.chatToJson(chat));
}
else {
res_1.failure(res, 'failed to update tribe');
}
});
}
exports.editTribe = editTribe;
// just add self here if tribes
// or can u add contacts as members?
function createGroupChat(req, res) {
@ -64,11 +109,27 @@ function createGroupChat(req, res) {
};
}));
let chatParams = null;
let okToCreate = true;
if (is_tribe) {
chatParams = yield createTribeChatParams(owner, contact_ids, name, img, price_per_message, price_to_join);
if (is_listed && chatParams.uuid) {
// publish to tribe server
tribes.declare(Object.assign(Object.assign({}, chatParams), { pricePerMessage: price_per_message || 0, priceToJoin: price_to_join || 0, description, tags, img, ownerPubkey: owner.publicKey, ownerAlias: owner.alias }));
try {
yield tribes.declare({
uuid: chatParams.uuid,
name: chatParams.name,
host: chatParams.host,
group_key: chatParams.groupKey,
price_per_message: price_per_message || 0,
price_to_join: price_to_join || 0,
description, tags, img,
owner_pubkey: owner.publicKey,
owner_alias: owner.alias,
});
}
catch (e) {
okToCreate = false;
}
}
// make me owner when i create
members[owner.publicKey].role = constants.chat_roles.owner;
@ -76,6 +137,9 @@ function createGroupChat(req, res) {
else {
chatParams = createGroupChatParams(owner, contact_ids, members, name);
}
if (!okToCreate) {
return res_1.failure(res, 'could not create tribe');
}
network.sendMessage({
chat: Object.assign(Object.assign({}, chatParams), { members }),
sender: owner,
@ -322,6 +386,12 @@ function receiveGroupJoin(payload) {
theSender = sender; // might already include??
if (!contactIds.includes(sender.id))
contactIds.push(sender.id);
// update sender contacT_key in case they reset?
if (member && member.key) {
if (sender.contactKey !== member.key) {
yield sender.update({ contactKey: member.key });
}
}
}
else {
if (member && member.key) {
@ -502,9 +572,9 @@ function createTribeChatParams(owner, contactIds, name, img, price_per_message,
uuid: groupUUID,
ownerPubkey: owner.publicKey,
contactIds: JSON.stringify(theContactIds),
photoUrl: img || '',
createdAt: date,
updatedAt: date,
photoUrl: img || '',
name: name,
type: constants.chat_types.tribe,
groupKey: keys.public,

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

File diff suppressed because one or more lines are too long

1
dist/api/controllers/index.js

@ -44,6 +44,7 @@ function set(app) {
app.delete('/chat/:id', controllers.chats.deleteChat);
app.put('/chat/:id', controllers.chats.addGroupMembers);
app.post('/tribe', controllers.chats.joinTribe);
app.put('/group/:id', controllers.chats.editTribe);
app.post('/contacts/tokens', controllers.contacts.generateToken);
app.post('/upload', controllers.uploads.avatarUpload.single('file'), controllers.uploads.uploadFile);
app.post('/invites', controllers.invites.createInvite);

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

File diff suppressed because one or more lines are too long

2
dist/api/utils/logger.js.map

@ -1 +1 @@
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../api/utils/logger.ts"],"names":[],"mappings":";;AAAA,kDAAiD;AACjD,mCAAkC;AAClC,iCAAgC;AAEhC,MAAM,QAAQ,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,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1B,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,EAC1B,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,EACzB,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAA,EAAE;QAC1B,OAAO,MAAM,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC,OAAO,EAAE,CAAA;IAC5D,CAAC,CAAC,CACH;IACD,IAAI,EAAE,KAAK;IACX,0KAA0K;IAC1K,aAAa,EAAE,IAAI;IACnB,QAAQ,EAAE,IAAI;IACd,WAAW,EAAE,UAAU,GAAG,EAAE,GAAG;QAC7B,IAAG,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;YAAE,OAAO,IAAI,CAAA,CAAC,WAAW;QACxD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,8EAA8E;CACjF,CAAC,CAAA;AAEF,kBAAe,MAAM,CAAA"}

57
dist/api/utils/tribes.js

@ -66,24 +66,53 @@ function publish(topic, msg) {
client.publish(topic, msg);
}
exports.publish = publish;
function declare({ uuid, name, description, tags, img, groupKey, host, pricePerMessage, priceToJoin, ownerAlias, ownerPubkey }) {
function declare({ uuid, name, description, tags, img, group_key, host, price_per_message, price_to_join, owner_alias, owner_pubkey }) {
return __awaiter(this, void 0, void 0, function* () {
const r = yield fetch('https://' + host + '/tribes', {
method: 'POST',
body: JSON.stringify({
uuid, groupKey,
name, description, tags, img: img || '',
pricePerMessage: pricePerMessage || 0,
priceToJoin: priceToJoin || 0,
ownerAlias, ownerPubkey,
}),
headers: { 'Content-Type': 'application/json' }
});
const j = yield r.json();
console.log(j);
try {
yield fetch('https://' + host + '/tribes', {
method: 'POST',
body: JSON.stringify({
uuid, group_key,
name, description, tags, img: img || '',
price_per_message: price_per_message || 0,
price_to_join: price_to_join || 0,
owner_alias, owner_pubkey,
}),
headers: { 'Content-Type': 'application/json' }
});
// const j = await r.json()
}
catch (e) {
console.log('[tribes] unauthorized to declare');
throw e;
}
});
}
exports.declare = declare;
function edit({ uuid, host, name, description, tags, img, price_per_message, price_to_join, owner_alias }) {
return __awaiter(this, void 0, void 0, function* () {
try {
const token = yield genSignedTimestamp();
yield fetch('https://' + host + '/tribe?token=' + token, {
method: 'PUT',
body: JSON.stringify({
uuid,
name, description, tags, img: img || '',
price_per_message: price_per_message || 0,
price_to_join: price_to_join || 0,
owner_alias,
}),
headers: { 'Content-Type': 'application/json' }
});
// const j = await r.json()
}
catch (e) {
console.log('[tribes] unauthorized to edit');
throw e;
}
});
}
exports.edit = edit;
function genSignedTimestamp() {
return __awaiter(this, void 0, void 0, function* () {
const now = moment().unix();

2
dist/api/utils/tribes.js.map

@ -1 +1 @@
{"version":3,"file":"tribes.js","sourceRoot":"","sources":["../../../api/utils/tribes.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,iCAAgC;AAChC,qCAAoC;AACpC,mCAAkC;AAClC,6BAA4B;AAC5B,6BAA4B;AAC5B,oCAAmC;AAEnC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,aAAa,CAAA;AACjD,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAC,uBAAuB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;AAEzE,IAAI,MAAU,CAAA;AAEd,SAAsB,OAAO,CAAC,SAAS;;QACnC,IAAG;YACC,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,OAAO,EAAE,CAAA;YAEhC,SAAe,SAAS;;oBACpB,MAAM,GAAG,IAAI,CAAA;oBACb,MAAM,GAAG,GAAG,MAAM,kBAAkB,EAAE,CAAA;oBACtC,OAAO,CAAC,GAAG,CAAC,0BAA0B,EAAC,SAAS,MAAM,CAAC,WAAW,OAAO,CAAC,CAAA;oBAC1E,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,MAAM,CAAC,WAAW,OAAO,EAAC;wBACrD,QAAQ,EAAC,IAAI,CAAC,eAAe;w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