new topic filter of contacts based on seal setting

This commit is contained in:
Roland Osborne 2022-12-09 11:18:25 -08:00
parent 5f4b04adc6
commit 8f2df02fbe
11 changed files with 7328 additions and 7422 deletions

View File

@ -4314,6 +4314,8 @@ components:
type: string
node:
type: string
seal:
type: string
Connect:
type: object

View File

@ -42,6 +42,7 @@ func GetProfileMessage(w http.ResponseWriter, r *http.Request) {
Image: detail.Image,
Version: APPVersion,
Node: getStrConfigValue(CNFDomain, ""),
Seal: detail.SealPublic,
}
msg, res := WriteDataMessage(detail.PrivateKey, detail.PublicKey, detail.KeyType,
APPSignPKCS1V15, account.GUID, APPMsgIdentity, &identity)

View File

@ -61,6 +61,7 @@ func SetCardProfile(w http.ResponseWriter, r *http.Request) {
card.Version = identity.Version
card.Node = identity.Node
card.ProfileRevision = identity.Revision
card.Seal = identity.Seal;
err = store.DB.Transaction(func(tx *gorm.DB) error {

View File

@ -322,6 +322,8 @@ type Identity struct {
Version string `json:"version"`
Node string `json:"node"`
Seal string `json:"seal"`
}
//IDList general list of ids

View File

@ -102,7 +102,7 @@ export function useAccountAccess() {
// generate rsa key for sealing channel, delay for activity indicator
await new Promise(r => setTimeout(r, 1000));
const crypto = new JSEncrypt({ default_key_size: 2048 });
const key = crypto.getKey();
crypto.getKey();
// encrypt private key
const iv = CryptoJS.lib.WordArray.random(128 / 8);

View File

@ -25,7 +25,7 @@ export function useSelectItem(item, selected, markup) {
updateState({ className: 'passive', markup: item.id === markup });
}
// eslint-disable-next-line
}, [selected]);
}, [selected, item]);
useEffect(() => {
updateState({ logo: card.actions.getImageUrl(item.id) });

View File

@ -1,4 +1,4 @@
import { Modal, Input, List, Button } from 'antd';
import { Modal, Input, List, Button, Switch } from 'antd';
import { ChannelsWrapper, AddFooter } from './Channels.styled';
import { CommentOutlined, SearchOutlined } from '@ant-design/icons';
import { useChannels } from './useChannels.hook';
@ -25,6 +25,10 @@ export function Channels({ open, active }) {
const addFooter = (
<AddFooter>
<div class="seal">
<Switch checked={state.seal} onChange={actions.setSeal} size="small" />
<span class="sealText">Sealed Channel</span>
</div>
<Button key="back" onClick={actions.clearShowAdd}>Cancel</Button>
<Button key="save" type="primary" loading={state.busy} onClick={addChannel}>Save</Button>
</AddFooter>

View File

@ -91,7 +91,18 @@ export const AddFooter = styled.div`
width: 100%;
display: flex;
flex-direction: row;
justify-content: flex-end;
justify-content: center;
align-items: center;
.seal {
display: flex;
flex-grow: 1;
flex-direction: row;
align-items: center;
.sealText {
padding-left: 8px;
}
}
`

View File

@ -19,7 +19,7 @@ export function AddChannel({ state, actions }) {
select={actions.onMember}
selected={state.members}
emptyMessage={'No Connected Contacts'}
filter={(card) => card?.data?.cardDetail?.status === 'connected'}
filter={actions.cardFilter}
unknown={0}
/>
</div>

View File

@ -16,6 +16,7 @@ export function useChannels() {
busy: false,
members: new Set(),
subject: null,
seal: false,
});
const card = useContext(CardContext);
@ -49,11 +50,26 @@ export function useChannels() {
}
return added.id;
},
setSeal: (seal) => {
if (seal) {
let cards = Array.from(state.members.values());
let members = new Set(state.members);
cards.forEach(id => {
if (!(card.state.cards.get(id)?.data?.cardProfile?.seal)) {
members.delete(id);
}
});
updateState({ seal: true, members });
}
else {
updateState({ seal: false });
}
},
onFilter: (value) => {
setFilter(value.toUpperCase());
},
setShowAdd: () => {
updateState({ showAdd: true });
updateState({ showAdd: true, seal: false });
},
clearShowAdd: () => {
updateState({ showAdd: false, members: new Set(), subject: null });
@ -71,6 +87,12 @@ export function useChannels() {
setSubject: (subject) => {
updateState({ subject });
},
cardFilter: (card) => {
if (state.seal) {
return card?.data?.cardDetail?.status === 'connected' && card?.data?.cardProfile?.seal;
}
return card?.data?.cardDetail?.status === 'connected';
},
};
const setUpdated = (chan) => {

File diff suppressed because it is too large Load Diff