Browse Source

private tribes'

push-params
Evan Feenstra 5 years ago
parent
commit
09d85b4c9a
  1. 6
      api/controllers/chatTribes.ts
  2. 4
      api/controllers/chats.ts
  3. 6
      api/models/ts/chat.ts
  4. 3
      api/models/ts/chatMember.ts
  5. 43
      api/utils/setup.ts
  6. 6
      api/utils/tribes.ts
  7. 4
      config/constants.json
  8. 7
      dist/api/controllers/chatTribes.js
  9. 2
      dist/api/controllers/chatTribes.js.map
  10. 5
      dist/api/controllers/chats.js
  11. 2
      dist/api/controllers/chats.js.map
  12. 8
      dist/api/models/ts/chat.js
  13. 2
      dist/api/models/ts/chat.js.map
  14. 4
      dist/api/models/ts/chatMember.js
  15. 2
      dist/api/models/ts/chatMember.js.map
  16. 40
      dist/api/utils/setup.js
  17. 2
      dist/api/utils/setup.js.map
  18. 6
      dist/api/utils/tribes.js
  19. 2
      dist/api/utils/tribes.js.map
  20. 4
      dist/config/constants.json

6
api/controllers/chatTribes.ts

@ -104,6 +104,7 @@ export async function editTribe(req, res) {
img,
description,
tags,
unlisted,
} = req.body
const { id } = req.params
@ -131,6 +132,7 @@ export async function editTribe(req, res) {
tags,
img,
owner_alias: owner.alias,
unlisted,
})
} catch(e) {
okToUpdate = false
@ -145,6 +147,7 @@ export async function editTribe(req, res) {
priceToJoin: price_to_join||0,
escrowAmount: escrow_amount||0,
escrowMillis: escrow_millis||0,
unlisted: unlisted||false,
})
success(res, jsonUtils.chatToJson(chat))
} else {
@ -206,7 +209,7 @@ export async function replayChatHistory(chat, contact) {
})
}
export async function createTribeChatParams(owner, contactIds, name, img, price_per_message, price_to_join, escrow_amount, escrow_millis): Promise<{[k:string]:any}> {
export async function createTribeChatParams(owner, contactIds, name, img, price_per_message, price_to_join, escrow_amount, escrow_millis, unlisted): Promise<{[k:string]:any}> {
let date = new Date()
date.setMilliseconds(0)
if (!(owner && contactIds && Array.isArray(contactIds))) {
@ -233,6 +236,7 @@ export async function createTribeChatParams(owner, contactIds, name, img, price_
priceToJoin: price_to_join||0,
escrowMillis: escrow_millis||0,
escrowAmount: escrow_amount||0,
unlisted: unlisted||false,
}
}

4
api/controllers/chats.ts

@ -145,6 +145,7 @@ export async function createGroupChat(req, res) {
img,
description,
tags,
unlisted,
} = req.body
const contact_ids = req.body.contact_ids||[]
@ -165,7 +166,7 @@ export 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, escrow_amount, escrow_millis)
chatParams = await createTribeChatParams(owner, contact_ids, name, img, price_per_message, price_to_join, escrow_amount, escrow_millis, unlisted)
if(is_listed && chatParams.uuid){
// publish to tribe server
try {
@ -181,6 +182,7 @@ export async function createGroupChat(req, res) {
description, tags, img,
owner_pubkey: owner.publicKey,
owner_alias: owner.alias,
unlisted: unlisted||false,
})
} catch(e) {
okToCreate = false

6
api/models/ts/chat.ts

@ -66,6 +66,12 @@ export default class Chat extends Model<Chat> {
@Column(DataType.BIGINT)
escrowMillis: number
@Column
unlisted: boolean // dont show on tribes list
@Column
private: boolean // joining requires approval of admin
@Column
ownerPubkey: string

3
api/models/ts/chatMember.ts

@ -21,4 +21,7 @@ export default class ChatMember extends Model<ChatMember> {
@Column
lastActive: Date
@Column
approved: boolean
}

43
api/utils/setup.ts

@ -6,7 +6,7 @@ import * as publicIp from 'public-ip'
import password from '../utils/password'
import {checkTag, checkCommitHash} from '../utils/gitinfo'
const USER_VERSION = 5
const USER_VERSION = 6
const setupDatabase = async () => {
console.log('=> [db] starting setup...')
@ -31,6 +31,10 @@ async function setVersion(){
}
async function migrate(){
addTableColumn('sphinx_chats', 'private', 'BOOLEAN')
addTableColumn('sphinx_chats', 'unlisted', 'BOOLEAN')
addTableColumn('sphinx_chat_members', 'approved', 'BOOLEAN')
addTableColumn('sphinx_chats', 'seen', 'BOOLEAN')
try{
@ -41,30 +45,21 @@ async function migrate(){
addTableColumn('sphinx_contacts', 'notification_sound')
try{
await sequelize.query(`
CREATE TABLE sphinx_timers (
id BIGINT,
chat_id BIGINT,
receiver BIGINT,
millis BIGINT,
msg_id BIGINT,
amount DECIMAL
)`)
} catch(e){}
addTableColumn('sphinx_chats', 'escrow_amount', 'BIGINT')
addTableColumn('sphinx_chats', 'escrow_millis', 'BIGINT')
// try{
// await sequelize.query(`
// CREATE TABLE sphinx_timers (
// id BIGINT,
// chat_id BIGINT,
// receiver BIGINT,
// millis BIGINT,
// msg_id BIGINT,
// amount DECIMAL
// )`)
// } catch(e){}
// addTableColumn('sphinx_chats', 'escrow_amount', 'BIGINT')
// addTableColumn('sphinx_chats', 'escrow_millis', 'BIGINT')
addTableColumn('sphinx_contacts', 'private_photo', 'BOOLEAN')
// addTableColumn('sphinx_media_keys', 'media_type')
// addTableColumn('sphinx_media_keys', 'original_muid')
// addTableColumn('sphinx_messages', 'original_muid')
// addTableColumn('sphinx_messages', 'uuid')
// addTableColumn('sphinx_messages', 'reply_uuid')
// addTableColumn('sphinx_media_keys', 'sender', 'BIGINT')
// addTableColumn('sphinx_contacts', 'private_photo', 'BOOLEAN')
}
async function addTableColumn(table:string, column:string, type='TEXT') {

6
api/utils/tribes.ts

@ -72,7 +72,7 @@ export function publish(topic, msg, cb) {
})
}
export async function declare({ uuid, name, description, tags, img, group_key, host, price_per_message, price_to_join, owner_alias, owner_pubkey, escrow_amount, escrow_millis }) {
export async function declare({ uuid, name, description, tags, img, group_key, host, price_per_message, price_to_join, owner_alias, owner_pubkey, escrow_amount, escrow_millis, unlisted }) {
try {
await fetch('https://' + host + '/tribes', {
method: 'POST',
@ -84,6 +84,7 @@ export async function declare({ uuid, name, description, tags, img, group_key, h
owner_alias, owner_pubkey,
escrow_amount: escrow_amount || 0,
escrow_millis: escrow_millis || 0,
unlisted: unlisted||false,
}),
headers: { 'Content-Type': 'application/json' }
})
@ -94,7 +95,7 @@ export async function declare({ uuid, name, description, tags, img, group_key, h
}
}
export async function edit({ uuid, host, name, description, tags, img, price_per_message, price_to_join, owner_alias, escrow_amount, escrow_millis }) {
export async function edit({ uuid, host, name, description, tags, img, price_per_message, price_to_join, owner_alias, escrow_amount, escrow_millis, unlisted }) {
try {
const token = await genSignedTimestamp()
await fetch('https://' + host + '/tribe?token=' + token, {
@ -107,6 +108,7 @@ export async function edit({ uuid, host, name, description, tags, img, price_per
escrow_amount: escrow_amount || 0,
escrow_millis: escrow_millis || 0,
owner_alias,
unlisted: unlisted||false,
}),
headers: { 'Content-Type': 'application/json' }
})

4
config/constants.json

@ -39,7 +39,9 @@
"group_leave": 15,
"group_kick": 16,
"delete": 17,
"repayment": 18
"repayment": 18,
"member_approve": 19,
"member_reject": 20
},
"payment_errors": {
"timeout": "Timed Out",

7
dist/api/controllers/chatTribes.js

@ -100,7 +100,7 @@ function joinTribe(req, res) {
exports.joinTribe = joinTribe;
function editTribe(req, res) {
return __awaiter(this, void 0, void 0, function* () {
const { name, is_listed, price_per_message, price_to_join, escrow_amount, escrow_millis, img, description, tags, } = req.body;
const { name, is_listed, price_per_message, price_to_join, escrow_amount, escrow_millis, img, description, tags, unlisted, } = req.body;
const { id } = req.params;
if (!id)
return res_1.failure(res, 'group id is required');
@ -124,6 +124,7 @@ function editTribe(req, res) {
tags,
img,
owner_alias: owner.alias,
unlisted,
});
}
catch (e) {
@ -138,6 +139,7 @@ function editTribe(req, res) {
priceToJoin: price_to_join || 0,
escrowAmount: escrow_amount || 0,
escrowMillis: escrow_millis || 0,
unlisted: unlisted || false,
});
res_1.success(res, jsonUtils.chatToJson(chat));
}
@ -197,7 +199,7 @@ function replayChatHistory(chat, contact) {
});
}
exports.replayChatHistory = replayChatHistory;
function createTribeChatParams(owner, contactIds, name, img, price_per_message, price_to_join, escrow_amount, escrow_millis) {
function createTribeChatParams(owner, contactIds, name, img, price_per_message, price_to_join, escrow_amount, escrow_millis, unlisted) {
return __awaiter(this, void 0, void 0, function* () {
let date = new Date();
date.setMilliseconds(0);
@ -224,6 +226,7 @@ function createTribeChatParams(owner, contactIds, name, img, price_per_message,
priceToJoin: price_to_join || 0,
escrowMillis: escrow_millis || 0,
escrowAmount: escrow_amount || 0,
unlisted: unlisted || false,
};
});
}

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

File diff suppressed because one or more lines are too long

5
dist/api/controllers/chats.js

@ -144,7 +144,7 @@ exports.mute = mute;
// or can u add contacts as members?
function createGroupChat(req, res) {
return __awaiter(this, void 0, void 0, function* () {
const { name, is_tribe, is_listed, price_per_message, price_to_join, escrow_amount, escrow_millis, img, description, tags, } = req.body;
const { name, is_tribe, is_listed, price_per_message, price_to_join, escrow_amount, escrow_millis, img, description, tags, unlisted, } = req.body;
const contact_ids = req.body.contact_ids || [];
const members = {}; //{pubkey:{key,alias}, ...}
const owner = yield models_1.models.Contact.findOne({ where: { isOwner: true } });
@ -161,7 +161,7 @@ function createGroupChat(req, res) {
let chatParams = null;
let okToCreate = true;
if (is_tribe) {
chatParams = yield chatTribes_1.createTribeChatParams(owner, contact_ids, name, img, price_per_message, price_to_join, escrow_amount, escrow_millis);
chatParams = yield chatTribes_1.createTribeChatParams(owner, contact_ids, name, img, price_per_message, price_to_join, escrow_amount, escrow_millis, unlisted);
if (is_listed && chatParams.uuid) {
// publish to tribe server
try {
@ -177,6 +177,7 @@ function createGroupChat(req, res) {
description, tags, img,
owner_pubkey: owner.publicKey,
owner_alias: owner.alias,
unlisted: unlisted || false,
});
}
catch (e) {

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

File diff suppressed because one or more lines are too long

8
dist/api/models/ts/chat.js

@ -93,6 +93,14 @@ __decorate([
sequelize_typescript_1.Column(sequelize_typescript_1.DataType.BIGINT),
__metadata("design:type", Number)
], Chat.prototype, "escrowMillis", void 0);
__decorate([
sequelize_typescript_1.Column,
__metadata("design:type", Boolean)
], Chat.prototype, "unlisted", void 0);
__decorate([
sequelize_typescript_1.Column,
__metadata("design:type", Boolean)
], Chat.prototype, "private", void 0);
__decorate([
sequelize_typescript_1.Column,
__metadata("design:type", String)

2
dist/api/models/ts/chat.js.map

@ -1 +1 @@
{"version":3,"file":"chat.js","sourceRoot":"","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YAAY,EAAE,KAAK;QACnB,SAAS,EAAE,KAAK;KACjB,CAAC;;kCACW;AA/EM,IAAI;IADxB,4BAAK,CAAC,EAAC,SAAS,EAAE,cAAc,EAAE,WAAW,EAAE,IAAI,EAAC,CAAC;GACjC,IAAI,CAiFxB;kBAjFoB,IAAI"}

4
dist/api/models/ts/chatMember.js

@ -36,6 +36,10 @@ __decorate([
sequelize_typescript_1.Column,
__metadata("design:type", Date)
], ChatMember.prototype, "lastActive", void 0);
__decorate([
sequelize_typescript_1.Column,
__metadata("design:type", Boolean)
], ChatMember.prototype, "approved", void 0);
ChatMember = __decorate([
sequelize_typescript_1.Table({ tableName: 'sphinx_chat_members', underscored: true })
], ChatMember);

2
dist/api/models/ts/chatMember.js.map

@ -1 +1 @@
{"version":3,"file":"chatMember.js","sourceRoot":"","sources":["../../../../api/models/ts/chatMember.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAA4D;AAG5D,IAAqB,UAAU,GAA/B,MAAqB,UAAW,SAAQ,4BAAiB;CAoBxD,CAAA;AAjBC;IADC,6BAAM;;0CACO;AAGd;IADC,6BAAM;;6CACU;AAGjB;IADC,6BAAM;;wCACK;AAGZ;IADC,6BAAM;;8CACW;AAGlB;IADC,6BAAM;;iDACc;AAGrB;IADC,6BAAM;8BACK,IAAI;8CAAA;AAlBG,UAAU;IAD9B,4BAAK,CAAC,EAAC,SAAS,EAAE,qBAAqB,EAAE,WAAW,EAAE,IAAI,EAAC,CAAC;GACxC,UAAU,CAoB9B;kBApBoB,UAAU"}
{"version":3,"file":"chatMember.js","sourceRoot":"","sources":["../../../../api/models/ts/chatMember.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAA4D;AAG5D,IAAqB,UAAU,GAA/B,MAAqB,UAAW,SAAQ,4BAAiB;CAuBxD,CAAA;AApBC;IADC,6BAAM;;0CACO;AAGd;IADC,6BAAM;;6CACU;AAGjB;IADC,6BAAM;;wCACK;AAGZ;IADC,6BAAM;;8CACW;AAGlB;IADC,6BAAM;;iDACc;AAGrB;IADC,6BAAM;8BACK,IAAI;8CAAA;AAGhB;IADC,6BAAM;;4CACU;AArBE,UAAU;IAD9B,4BAAK,CAAC,EAAC,SAAS,EAAE,qBAAqB,EAAE,WAAW,EAAE,IAAI,EAAC,CAAC;GACxC,UAAU,CAuB9B;kBAvBoB,UAAU"}

40
dist/api/utils/setup.js

@ -16,7 +16,7 @@ const QRCode = require("qrcode");
const publicIp = require("public-ip");
const password_1 = require("../utils/password");
const gitinfo_1 = require("../utils/gitinfo");
const USER_VERSION = 5;
const USER_VERSION = 6;
const setupDatabase = () => __awaiter(void 0, void 0, void 0, function* () {
console.log('=> [db] starting setup...');
yield setVersion();
@ -44,6 +44,9 @@ function setVersion() {
}
function migrate() {
return __awaiter(this, void 0, void 0, function* () {
addTableColumn('sphinx_chats', 'private', 'BOOLEAN');
addTableColumn('sphinx_chats', 'unlisted', 'BOOLEAN');
addTableColumn('sphinx_chat_members', 'approved', 'BOOLEAN');
addTableColumn('sphinx_chats', 'seen', 'BOOLEAN');
try {
yield models_1.sequelize.query(`CREATE INDEX idx_messages_sender ON sphinx_messages (sender);`);
@ -52,27 +55,20 @@ function migrate() {
console.log(e);
}
addTableColumn('sphinx_contacts', 'notification_sound');
try {
yield models_1.sequelize.query(`
CREATE TABLE sphinx_timers (
id BIGINT,
chat_id BIGINT,
receiver BIGINT,
millis BIGINT,
msg_id BIGINT,
amount DECIMAL
)`);
}
catch (e) { }
addTableColumn('sphinx_chats', 'escrow_amount', 'BIGINT');
addTableColumn('sphinx_chats', 'escrow_millis', 'BIGINT');
addTableColumn('sphinx_contacts', 'private_photo', 'BOOLEAN');
// addTableColumn('sphinx_media_keys', 'media_type')
// addTableColumn('sphinx_media_keys', 'original_muid')
// addTableColumn('sphinx_messages', 'original_muid')
// addTableColumn('sphinx_messages', 'uuid')
// addTableColumn('sphinx_messages', 'reply_uuid')
// addTableColumn('sphinx_media_keys', 'sender', 'BIGINT')
// try{
// await sequelize.query(`
// CREATE TABLE sphinx_timers (
// id BIGINT,
// chat_id BIGINT,
// receiver BIGINT,
// millis BIGINT,
// msg_id BIGINT,
// amount DECIMAL
// )`)
// } catch(e){}
// addTableColumn('sphinx_chats', 'escrow_amount', 'BIGINT')
// addTableColumn('sphinx_chats', 'escrow_millis', 'BIGINT')
// addTableColumn('sphinx_contacts', 'private_photo', 'BOOLEAN')
});
}
function addTableColumn(table, column, type = 'TEXT') {

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

@ -1 +1 @@
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../../api/utils/setup.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,2CAA2C;AAC3C,sCAA2C;AAC3C,iDAAoC;AACpC,iCAAgC;AAChC,sCAAqC;AACrC,gDAAwC;AACxC,8CAA0D;AAE1D,MAAM,YAAY,GAAG,CAAC,CAAA;AAEtB,MAAM,aAAa,GAAG,GAAS,EAAE;IAC/B,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAA;IACxC,MAAM,UAAU,EAAE,CAAA;IAClB,IAAI;QACF,MAAM,kBAAS,CAAC,IAAI,EAAE,CAAA;QACtB,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAA;KACpC;IAAC,OAAM,CAAC,EAAE;QACT,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAC,CAAC,CAAC,CAAA;KAChC;IACD,MAAM,OAAO,EAAE,CAAA;IACf,iBAAiB,EAAE,CAAA;IACnB,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAA;AACnC,CAAC,CAAA,CAAA;AAqGQ,sCAAa;AAnGtB,SAAe,UAAU;;QACvB,IAAI;YACF,MAAM,kBAAS,CAAC,KAAK,CAAC,yBAAyB,YAAY,EAAE,CAAC,CAAA;SAC/D;QAAC,OAAM,CAAC,EAAE;YACT,OAAO,CAAC,GAAG,CAAC,sBAAsB,EAAC,CAAC,CAAC,CAAA;SACtC;IACH,CAAC;CAAA;AAED,SAAe,OAAO;;QACpB,c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C,MAAM,GAAG,GAAG,MAAM,kBAAQ,EAAE,CAAA;QAC5B,OAAO,CAAC,GAAG,CAAC,qBAAqB,GAAG,aAAa,UAAU,EAAE,CAAC,CAAA;IAChE,CAAC;CAAA;AAED,SAAe,OAAO;;QACpB,MAAM,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAA;QAC9B,IAAI,SAAS,CAAA;QACb,IAAG,CAAC,EAAE,EAAE;YACN,IAAI;gBACF,SAAS,GAAG,MAAM,QAAQ,CAAC,EAAE,EAAE,CAAA;aAChC;YAAC,OAAM,CAAC,EAAC,GAAE;SACb;aAAM;YACL,SAAS,GAAG,EAAE,CAAA;SACf;QACD,IAAG,CAAC,SAAS,EAAE;YACb,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAA;YACvC,OAAM;SACP;QACD,IAAI,KAAK,GAAG,SAAS,CAAA;QACrB,qDAAqD;QAErD,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,KAAK,KAAK,kBAAQ,IAAE,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;QAC3E,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAA;QAC1C,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QAChB,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAC,EAAC,IAAI,EAAC,UAAU,EAAC,EAAE,UAAU,GAAG,EAAE,GAAG;YACvD,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QAClB,CAAC,CAAC,CAAA;IACJ,CAAC;CAAA"}

6
dist/api/utils/tribes.js

@ -89,7 +89,7 @@ function publish(topic, msg, cb) {
});
}
exports.publish = publish;
function declare({ uuid, name, description, tags, img, group_key, host, price_per_message, price_to_join, owner_alias, owner_pubkey, escrow_amount, escrow_millis }) {
function declare({ uuid, name, description, tags, img, group_key, host, price_per_message, price_to_join, owner_alias, owner_pubkey, escrow_amount, escrow_millis, unlisted }) {
return __awaiter(this, void 0, void 0, function* () {
try {
yield fetch('https://' + host + '/tribes', {
@ -102,6 +102,7 @@ function declare({ uuid, name, description, tags, img, group_key, host, price_pe
owner_alias, owner_pubkey,
escrow_amount: escrow_amount || 0,
escrow_millis: escrow_millis || 0,
unlisted: unlisted || false,
}),
headers: { 'Content-Type': 'application/json' }
});
@ -114,7 +115,7 @@ function declare({ uuid, name, description, tags, img, group_key, host, price_pe
});
}
exports.declare = declare;
function edit({ uuid, host, name, description, tags, img, price_per_message, price_to_join, owner_alias, escrow_amount, escrow_millis }) {
function edit({ uuid, host, name, description, tags, img, price_per_message, price_to_join, owner_alias, escrow_amount, escrow_millis, unlisted }) {
return __awaiter(this, void 0, void 0, function* () {
try {
const token = yield genSignedTimestamp();
@ -128,6 +129,7 @@ function edit({ uuid, host, name, description, tags, img, price_per_message, pri
escrow_amount: escrow_amount || 0,
escrow_millis: escrow_millis || 0,
owner_alias,
unlisted: unlisted || false,
}),
headers: { 'Content-Type': 'application/json' }
});

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

File diff suppressed because one or more lines are too long

4
dist/config/constants.json

@ -39,7 +39,9 @@
"group_leave": 15,
"group_kick": 16,
"delete": 17,
"repayment": 18
"repayment": 18,
"member_approve": 19,
"member_reject": 20
},
"payment_errors": {
"timeout": "Timed Out",

Loading…
Cancel
Save