Browse Source

Merge pull request #48 from stakwork/profile-photo

Profile photo
hosting-provider v0.9.14
Evan Feenstra 5 years ago
committed by GitHub
parent
commit
77286d7aaa
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 32
      api/controllers/contacts.ts
  2. 6
      api/helpers.ts
  3. 3
      api/models/ts/contact.ts
  4. 4
      api/network/send.ts
  5. 3
      api/utils/case.ts
  6. 1
      api/utils/lightning.ts
  7. 4
      api/utils/setup.ts
  8. 36
      dist/api/controllers/contacts.js
  9. 2
      dist/api/controllers/contacts.js.map
  10. 8
      dist/api/helpers.js
  11. 2
      dist/api/helpers.js.map
  12. 4
      dist/api/models/ts/contact.js
  13. 2
      dist/api/models/ts/contact.js.map
  14. 3
      dist/api/network/send.js
  15. 2
      dist/api/network/send.js.map
  16. 4
      dist/api/utils/case.js
  17. 2
      dist/api/utils/case.js.map
  18. 1
      dist/api/utils/lightning.js
  19. 2
      dist/api/utils/lightning.js.map
  20. 3
      dist/api/utils/setup.js
  21. 2
      dist/api/utils/setup.js.map

32
api/controllers/contacts.ts

@ -194,19 +194,14 @@ const receiveConfirmContactKey = async (payload) => {
const sender_pub_key = dat.sender.pub_key
const sender_contact_key = dat.sender.contact_key
const sender_alias = dat.sender.alias || 'Unknown'
const sender_photo_url = dat.sender.photoUrl
if(sender_photo_url){
// download and store photo locally
}
const sender_photo_url = dat.sender.photo_url
const sender = await models.Contact.findOne({ where: { publicKey: sender_pub_key, status: constants.contact_statuses.confirmed }})
if (sender_contact_key && sender) {
if(!sender.alias || sender.alias==='Unknown') {
sender.update({ contactKey: sender_contact_key, alias: sender_alias })
} else {
sender.update({ contactKey: sender_contact_key })
}
const objToUpdate:{[k:string]:any} = {contactKey: sender_contact_key}
if(sender_alias) objToUpdate.alias = sender_alias
if(sender_photo_url) objToUpdate.photoUrl = sender_photo_url
await sender.update(objToUpdate)
socket.sendJson({
type: 'contact',
@ -222,21 +217,16 @@ const receiveContactKey = async (payload) => {
const sender_pub_key = dat.sender.pub_key
const sender_contact_key = dat.sender.contact_key
const sender_alias = dat.sender.alias || 'Unknown'
const sender_photo_url = dat.sender.photoUrl
if(sender_photo_url){
// download and store photo locally
}
const sender_photo_url = dat.sender.photo_url
const owner = await models.Contact.findOne({ where: { isOwner: true }})
const sender = await models.Contact.findOne({ where: { publicKey: sender_pub_key, status: constants.contact_statuses.confirmed }})
if (sender_contact_key && sender) {
if(!sender.alias || sender.alias==='Unknown') {
sender.update({ contactKey: sender_contact_key, alias: sender_alias })
} else {
sender.update({ contactKey: sender_contact_key })
}
const objToUpdate:{[k:string]:any} = {contactKey: sender_contact_key}
if(sender_alias) objToUpdate.alias = sender_alias
if(sender_photo_url) objToUpdate.photoUrl = sender_photo_url
await sender.update(objToUpdate)
socket.sendJson({
type: 'contact',
@ -252,7 +242,7 @@ const receiveContactKey = async (payload) => {
}
const extractAttrs = body => {
let fields_to_update = ["public_key", "node_alias", "alias", "photo_url", "device_id", "status", "contact_key", "from_group"]
let fields_to_update = ["public_key", "node_alias", "alias", "photo_url", "device_id", "status", "contact_key", "from_group", "private_photo"]
let attrs = {}
Object.keys(body).forEach(key => {
if (fields_to_update.includes(key)) {

6
api/helpers.ts

@ -135,6 +135,7 @@ async function parseReceiveParams(payload) {
const dat = payload.content || payload
const sender_pub_key = dat.sender.pub_key
const sender_alias = dat.sender.alias
const sender_photo_url = dat.sender.photo_url
const chat_uuid = dat.chat.uuid
const chat_type = dat.chat.type
const chat_members: { [k: string]: any } = dat.chat.members || {}
@ -176,7 +177,7 @@ async function parseReceiveParams(payload) {
}
chat = await models.Chat.findOne({ where: { uuid: chat_uuid } })
}
return { owner, sender, chat, sender_pub_key, sender_alias, isTribeOwner, chat_uuid, amount, content, mediaToken, mediaKey, mediaType, originalMuid, chat_type, msg_id, chat_members, chat_name, chat_host, chat_key, remote_content, msg_uuid, date_string, reply_uuid, skip_payment_processing, purchaser_id }
return { owner, sender, chat, sender_pub_key, sender_alias, isTribeOwner, chat_uuid, amount, content, mediaToken, mediaKey, mediaType, originalMuid, chat_type, msg_id, chat_members, chat_name, chat_host, chat_key, remote_content, msg_uuid, date_string, reply_uuid, skip_payment_processing, purchaser_id, sender_photo_url }
}
export {
@ -196,13 +197,14 @@ async function asyncForEach(array, callback) {
}
function newkeyexchangemsg(type, sender){
const includePhotoUrl = sender && sender.photoUrl && !sender.privatePhoto
return {
type: type,
sender: {
// pub_key: sender.publicKey,
contact_key: sender.contactKey,
...sender.alias && {alias: sender.alias},
// ...sender.photoUrl && {photoUrl: sender.photoUrl}
...includePhotoUrl && {photo_url: sender.photoUrl}
}
}
}

3
api/models/ts/contact.ts

@ -23,6 +23,9 @@ export default class Contact extends Model<Contact> {
@Column
photoUrl: string
@Column
privatePhoto: boolean
@Column
isOwner: boolean

4
api/network/send.ts

@ -117,6 +117,7 @@ export function signAndSend(opts, pubkey, mqttTopic?:string){
export function newmsg(type, chat, sender, message){
const includeGroupKey = type===constants.message_types.group_create || type===constants.message_types.group_invite
const includeAlias = sender && sender.alias && chat.type===constants.chat_types.tribe
const includePhotoUrl = sender && sender.photoUrl && !sender.privatePhoto
return {
type: type,
chat: {
@ -129,8 +130,9 @@ export function newmsg(type, chat, sender, message){
},
message: message,
sender: {
...includeAlias && {alias: sender.alias},
pub_key: sender.publicKey,
...includeAlias && {alias: sender.alias},
...includePhotoUrl && {photo_url: sender.photoUrl},
// ...sender.contactKey && {contact_key: sender.contactKey}
}
}

3
api/utils/case.ts

@ -1,6 +1,7 @@
import * as changeCase from "change-case";
const dateKeys = ['date','createdAt','updatedAt','created_at','updated_at']
const boolKeys = ['fromGroup','isOwner','deleted']
function toSnake(obj) {
const ret: {[k: string]: any} = {}
@ -9,6 +10,8 @@ function toSnake(obj) {
const v: any = value
const d = new Date(v)
ret[changeCase.snakeCase(key)] = d.toISOString()
} else if(boolKeys.includes(key)) {
ret[changeCase.snakeCase(key)] = (!value||value==='0')?0:1
} else {
ret[changeCase.snakeCase(key)] = value
}

1
api/utils/lightning.ts

@ -122,7 +122,6 @@ const keysend = (opts) => {
const call = lightning.sendPayment()
call.on('data', function(payment) {
if(payment.payment_error){
console.log('=> payment.error',payment)
reject(payment.payment_error)
} else {
resolve(payment)

4
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 = 2
const USER_VERSION = 3
const setupDatabase = async () => {
console.log('=> [db] starting setup...')
@ -31,6 +31,8 @@ async function setVersion(){
}
async function migrate(){
addTableColumn('sphinx_contacts', 'private_photo', 'BOOLEAN')
addTableColumn('sphinx_media_keys', 'media_type')
addTableColumn('sphinx_media_keys', 'original_muid')
addTableColumn('sphinx_messages', 'original_muid')

36
dist/api/controllers/contacts.js

@ -178,18 +178,15 @@ const receiveConfirmContactKey = (payload) => __awaiter(void 0, void 0, void 0,
const sender_pub_key = dat.sender.pub_key;
const sender_contact_key = dat.sender.contact_key;
const sender_alias = dat.sender.alias || 'Unknown';
const sender_photo_url = dat.sender.photoUrl;
if (sender_photo_url) {
// download and store photo locally
}
const sender_photo_url = dat.sender.photo_url;
const sender = yield models_1.models.Contact.findOne({ where: { publicKey: sender_pub_key, status: constants.contact_statuses.confirmed } });
if (sender_contact_key && sender) {
if (!sender.alias || sender.alias === 'Unknown') {
sender.update({ contactKey: sender_contact_key, alias: sender_alias });
}
else {
sender.update({ contactKey: sender_contact_key });
}
const objToUpdate = { contactKey: sender_contact_key };
if (sender_alias)
objToUpdate.alias = sender_alias;
if (sender_photo_url)
objToUpdate.photoUrl = sender_photo_url;
yield sender.update(objToUpdate);
socket.sendJson({
type: 'contact',
response: jsonUtils.contactToJson(sender)
@ -203,19 +200,16 @@ const receiveContactKey = (payload) => __awaiter(void 0, void 0, void 0, functio
const sender_pub_key = dat.sender.pub_key;
const sender_contact_key = dat.sender.contact_key;
const sender_alias = dat.sender.alias || 'Unknown';
const sender_photo_url = dat.sender.photoUrl;
if (sender_photo_url) {
// download and store photo locally
}
const sender_photo_url = dat.sender.photo_url;
const owner = yield models_1.models.Contact.findOne({ where: { isOwner: true } });
const sender = yield models_1.models.Contact.findOne({ where: { publicKey: sender_pub_key, status: constants.contact_statuses.confirmed } });
if (sender_contact_key && sender) {
if (!sender.alias || sender.alias === 'Unknown') {
sender.update({ contactKey: sender_contact_key, alias: sender_alias });
}
else {
sender.update({ contactKey: sender_contact_key });
}
const objToUpdate = { contactKey: sender_contact_key };
if (sender_alias)
objToUpdate.alias = sender_alias;
if (sender_photo_url)
objToUpdate.photoUrl = sender_photo_url;
yield sender.update(objToUpdate);
socket.sendJson({
type: 'contact',
response: jsonUtils.contactToJson(sender)
@ -229,7 +223,7 @@ const receiveContactKey = (payload) => __awaiter(void 0, void 0, void 0, functio
});
exports.receiveContactKey = receiveContactKey;
const extractAttrs = body => {
let fields_to_update = ["public_key", "node_alias", "alias", "photo_url", "device_id", "status", "contact_key", "from_group"];
let fields_to_update = ["public_key", "node_alias", "alias", "photo_url", "device_id", "status", "contact_key", "from_group", "private_photo"];
let attrs = {};
Object.keys(body).forEach(key => {
if (fields_to_update.includes(key)) {

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

File diff suppressed because one or more lines are too long

8
dist/api/helpers.js

@ -151,6 +151,7 @@ function parseReceiveParams(payload) {
const dat = payload.content || payload;
const sender_pub_key = dat.sender.pub_key;
const sender_alias = dat.sender.alias;
const sender_photo_url = dat.sender.photo_url;
const chat_uuid = dat.chat.uuid;
const chat_type = dat.chat.type;
const chat_members = dat.chat.members || {};
@ -190,7 +191,7 @@ function parseReceiveParams(payload) {
}
chat = yield models_1.models.Chat.findOne({ where: { uuid: chat_uuid } });
}
return { owner, sender, chat, sender_pub_key, sender_alias, isTribeOwner, chat_uuid, amount, content, mediaToken, mediaKey, mediaType, originalMuid, chat_type, msg_id, chat_members, chat_name, chat_host, chat_key, remote_content, msg_uuid, date_string, reply_uuid, skip_payment_processing, purchaser_id };
return { owner, sender, chat, sender_pub_key, sender_alias, isTribeOwner, chat_uuid, amount, content, mediaToken, mediaKey, mediaType, originalMuid, chat_type, msg_id, chat_members, chat_name, chat_host, chat_key, remote_content, msg_uuid, date_string, reply_uuid, skip_payment_processing, purchaser_id, sender_photo_url };
});
}
exports.parseReceiveParams = parseReceiveParams;
@ -202,11 +203,12 @@ function asyncForEach(array, callback) {
});
}
function newkeyexchangemsg(type, sender) {
const includePhotoUrl = sender && sender.photoUrl && !sender.privatePhoto;
return {
type: type,
sender: Object.assign({
sender: Object.assign(Object.assign({
// pub_key: sender.publicKey,
contact_key: sender.contactKey }, sender.alias && { alias: sender.alias })
contact_key: sender.contactKey }, sender.alias && { alias: sender.alias }), includePhotoUrl && { photo_url: sender.photoUrl })
};
}
//# sourceMappingURL=helpers.js.map

2
dist/api/helpers.js.map

File diff suppressed because one or more lines are too long

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

@ -37,6 +37,10 @@ __decorate([
sequelize_typescript_1.Column,
__metadata("design:type", String)
], Contact.prototype, "photoUrl", void 0);
__decorate([
sequelize_typescript_1.Column,
__metadata("design:type", Boolean)
], Contact.prototype, "privatePhoto", void 0);
__decorate([
sequelize_typescript_1.Column,
__metadata("design:type", Boolean)

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

@ -1 +1 @@
{"version":3,"file":"contact.js","sourceRoot":"","sources":["../../../../api/models/ts/contact.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAsE;AAGtE,IAAqB,OAAO,GAA5B,MAAqB,OAAQ,SAAQ,4BAAc;CAwDlD,CAAA;AAhDC;IANC,6BAAM,CAAC;QACN,IAAI,EAAE,+BAAQ,CAAC,MAAM;QACrB,UAAU,EAAE,IAAI;QAChB,MAAM,EAAE,IAAI;QACZ,aAAa,EAAE,IAAI;KACpB,CAAC;;mCACQ;AAGV;IADC,6BAAM;;0CACU;AAGjB;IADC,6BAAM;;0CACU;AAGjB;IADC,6BAAM;;sCACM;AAGb;IADC,6BAAM;;yCACS;AAGhB;IADC,6BAAM;;wCACS;AAOhB;IALC,6BAAM,CAAC;QACN,IAAI,EAAE,+BAAQ,CAAC,OAAO;QACtB,YAAY,EAAE,KAAK;QACnB,SAAS,EAAE,KAAK;KACjB,CAAC;;wCACc;AAGhB;IADC,6BAAM;;0CACU;AAGjB;IADC,6BAAM,CAAC,+BAAQ,CAAC,MAAM,CAAC;;yCACR;AAGhB;IADC,6BAAM,CAAC,+BAAQ,CAAC,MAAM,CAAC;;uCACV;AAGd;IADC,6BAAM,CAAC,+BAAQ,CAAC,IAAI,CAAC;;2CACJ;AAGlB;IADC,6BAAM;;yCACS;AAGhB;IADC,6BAAM;8BACI,IAAI;0CAAA;AAGf;IADC,6BAAM;8BACI,IAAI;0CAAA;AAGf;IADC,6BAAM;;0CACW;AAtDC,OAAO;IAD3B,4BAAK,CAAC,EAAC,SAAS,EAAE,iBAAiB,EAAE,WAAW,EAAE,IAAI,EAAC,CAAC;GACpC,OAAO,CAwD3B;kBAxDoB,OAAO"}
{"version":3,"file":"contact.js","sourceRoot":"","sources":["../../../../api/models/ts/contact.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,+DAAsE;AAGtE,IAAqB,OAAO,GAA5B,MAAqB,OAAQ,SAAQ,4BAAc;CA2DlD,CAAA;AAnDC;IANC,6BAAM,CAAC;QACN,IAAI,EAAE,+BAAQ,CAAC,MAAM;QACrB,UAAU,EAAE,IAAI;QAChB,MAAM,EAAE,IAAI;QACZ,aAAa,EAAE,IAAI;KACpB,CAAC;;mCACQ;AAGV;IADC,6BAAM;;0CACU;AAGjB;IADC,6BAAM;;0CACU;AAGjB;IADC,6BAAM;;sCACM;AAGb;IADC,6BAAM;;yCACS;AAGhB;IADC,6BAAM;;6CACc;AAGrB;IADC,6BAAM;;wCACS;AAOhB;IALC,6BAAM,CAAC;QACN,IAAI,EAAE,+BAAQ,CAAC,OAAO;QACtB,YAAY,EAAE,KAAK;QACnB,SAAS,EAAE,KAAK;KACjB,CAAC;;wCACc;AAGhB;IADC,6BAAM;;0CACU;AAGjB;IADC,6BAAM,CAAC,+BAAQ,CAAC,MAAM,CAAC;;yCACR;AAGhB;IADC,6BAAM,CAAC,+BAAQ,CAAC,MAAM,CAAC;;uCACV;AAGd;IADC,6BAAM,CAAC,+BAAQ,CAAC,IAAI,CAAC;;2CACJ;AAGlB;IADC,6BAAM;;yCACS;AAGhB;IADC,6BAAM;8BACI,IAAI;0CAAA;AAGf;IADC,6BAAM;8BACI,IAAI;0CAAA;AAGf;IADC,6BAAM;;0CACW;AAzDC,OAAO;IAD3B,4BAAK,CAAC,EAAC,SAAS,EAAE,iBAAiB,EAAE,WAAW,EAAE,IAAI,EAAC,CAAC;GACpC,OAAO,CA2D3B;kBA3DoB,OAAO"}

3
dist/api/network/send.js

@ -127,11 +127,12 @@ exports.signAndSend = signAndSend;
function newmsg(type, chat, sender, message) {
const includeGroupKey = type === constants.message_types.group_create || type === constants.message_types.group_invite;
const includeAlias = sender && sender.alias && chat.type === constants.chat_types.tribe;
const includePhotoUrl = sender && sender.photoUrl && !sender.privatePhoto;
return {
type: type,
chat: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ uuid: chat.uuid }, chat.name && { name: chat.name }), (chat.type || chat.type === 0) && { type: chat.type }), chat.members && { members: chat.members }), (includeGroupKey && chat.groupKey) && { groupKey: chat.groupKey }), (includeGroupKey && chat.host) && { host: chat.host }),
message: message,
sender: Object.assign(Object.assign({}, includeAlias && { alias: sender.alias }), { pub_key: sender.publicKey })
sender: Object.assign(Object.assign({ pub_key: sender.publicKey }, includeAlias && { alias: sender.alias }), includePhotoUrl && { photo_url: sender.photoUrl })
};
}
exports.newmsg = newmsg;

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

File diff suppressed because one or more lines are too long

4
dist/api/utils/case.js

@ -2,6 +2,7 @@
Object.defineProperty(exports, "__esModule", { value: true });
const changeCase = require("change-case");
const dateKeys = ['date', 'createdAt', 'updatedAt', 'created_at', 'updated_at'];
const boolKeys = ['fromGroup', 'isOwner', 'deleted'];
function toSnake(obj) {
const ret = {};
for (let [key, value] of Object.entries(obj)) {
@ -10,6 +11,9 @@ function toSnake(obj) {
const d = new Date(v);
ret[changeCase.snakeCase(key)] = d.toISOString();
}
else if (boolKeys.includes(key)) {
ret[changeCase.snakeCase(key)] = (!value || value === '0') ? 0 : 1;
}
else {
ret[changeCase.snakeCase(key)] = value;
}

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

@ -1 +1 @@
{"version":3,"file":"case.js","sourceRoot":"","sources":["../../../api/utils/case.ts"],"names":[],"mappings":";;AAAA,0CAA0C;AAE1C,MAAM,QAAQ,GAAG,CAAC,MAAM,EAAC,WAAW,EAAC,WAAW,EAAC,YAAY,EAAC,YAAY,CAAC,CAAA;AAE3E,SAAS,OAAO,CAAC,GAAG;IAChB,MAAM,GAAG,GAAuB,EAAE,CAAA;IAClC,KAAK,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;QAC1C,IAAG,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,KAAK,EAAC;YAC/B,MAAM,CAAC,GAAQ,KAAK,CAAA;YACpB,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,CAAA;YACrB,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,CAAA;SACnD;aAAM;YACH,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAA;SACzC;KACJ;IACD,OAAO,GAAG,CAAA;AACd,CAAC;AAUO,0BAAO;AARf,SAAS,OAAO,CAAC,GAAG;IAChB,MAAM,GAAG,GAAuB,EAAE,CAAA;IAClC,KAAK,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;QAC1C,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAA;KACzC;IACD,OAAO,GAAG,CAAA;AACd,CAAC;AAEgB,0BAA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1C,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAA;KACzC;IACD,OAAO,GAAG,CAAA;AACd,CAAC;AAEgB,0BAAO"}

1
dist/api/utils/lightning.js

@ -133,7 +133,6 @@ const keysend = (opts) => {
const call = lightning.sendPayment();
call.on('data', function (payment) {
if (payment.payment_error) {
console.log('=> payment.error', payment);
reject(payment.payment_error);
}
else {

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

File diff suppressed because one or more lines are too long

3
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 = 2;
const USER_VERSION = 3;
const setupDatabase = () => __awaiter(void 0, void 0, void 0, function* () {
console.log('=> [db] starting setup...');
yield setVersion();
@ -44,6 +44,7 @@ function setVersion() {
}
function migrate() {
return __awaiter(this, void 0, void 0, function* () {
addTableColumn('sphinx_contacts', 'private_photo', 'BOOLEAN');
addTableColumn('sphinx_media_keys', 'media_type');
addTableColumn('sphinx_media_keys', 'original_muid');
addTableColumn('sphinx_messages', 'original_muid');

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,OA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