mirror of
https://github.com/balzack/databag.git
synced 2025-02-12 03:29:16 +00:00
new topic filter of contacts based on seal setting
This commit is contained in:
parent
5f4b04adc6
commit
8f2df02fbe
@ -4314,6 +4314,8 @@ components:
|
|||||||
type: string
|
type: string
|
||||||
node:
|
node:
|
||||||
type: string
|
type: string
|
||||||
|
seal:
|
||||||
|
type: string
|
||||||
|
|
||||||
Connect:
|
Connect:
|
||||||
type: object
|
type: object
|
||||||
|
@ -42,6 +42,7 @@ func GetProfileMessage(w http.ResponseWriter, r *http.Request) {
|
|||||||
Image: detail.Image,
|
Image: detail.Image,
|
||||||
Version: APPVersion,
|
Version: APPVersion,
|
||||||
Node: getStrConfigValue(CNFDomain, ""),
|
Node: getStrConfigValue(CNFDomain, ""),
|
||||||
|
Seal: detail.SealPublic,
|
||||||
}
|
}
|
||||||
msg, res := WriteDataMessage(detail.PrivateKey, detail.PublicKey, detail.KeyType,
|
msg, res := WriteDataMessage(detail.PrivateKey, detail.PublicKey, detail.KeyType,
|
||||||
APPSignPKCS1V15, account.GUID, APPMsgIdentity, &identity)
|
APPSignPKCS1V15, account.GUID, APPMsgIdentity, &identity)
|
||||||
|
@ -61,6 +61,7 @@ func SetCardProfile(w http.ResponseWriter, r *http.Request) {
|
|||||||
card.Version = identity.Version
|
card.Version = identity.Version
|
||||||
card.Node = identity.Node
|
card.Node = identity.Node
|
||||||
card.ProfileRevision = identity.Revision
|
card.ProfileRevision = identity.Revision
|
||||||
|
card.Seal = identity.Seal;
|
||||||
|
|
||||||
err = store.DB.Transaction(func(tx *gorm.DB) error {
|
err = store.DB.Transaction(func(tx *gorm.DB) error {
|
||||||
|
|
||||||
|
@ -322,6 +322,8 @@ type Identity struct {
|
|||||||
Version string `json:"version"`
|
Version string `json:"version"`
|
||||||
|
|
||||||
Node string `json:"node"`
|
Node string `json:"node"`
|
||||||
|
|
||||||
|
Seal string `json:"seal"`
|
||||||
}
|
}
|
||||||
|
|
||||||
//IDList general list of ids
|
//IDList general list of ids
|
||||||
|
@ -102,7 +102,7 @@ export function useAccountAccess() {
|
|||||||
// generate rsa key for sealing channel, delay for activity indicator
|
// generate rsa key for sealing channel, delay for activity indicator
|
||||||
await new Promise(r => setTimeout(r, 1000));
|
await new Promise(r => setTimeout(r, 1000));
|
||||||
const crypto = new JSEncrypt({ default_key_size: 2048 });
|
const crypto = new JSEncrypt({ default_key_size: 2048 });
|
||||||
const key = crypto.getKey();
|
crypto.getKey();
|
||||||
|
|
||||||
// encrypt private key
|
// encrypt private key
|
||||||
const iv = CryptoJS.lib.WordArray.random(128 / 8);
|
const iv = CryptoJS.lib.WordArray.random(128 / 8);
|
||||||
|
@ -25,7 +25,7 @@ export function useSelectItem(item, selected, markup) {
|
|||||||
updateState({ className: 'passive', markup: item.id === markup });
|
updateState({ className: 'passive', markup: item.id === markup });
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
}, [selected]);
|
}, [selected, item]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
updateState({ logo: card.actions.getImageUrl(item.id) });
|
updateState({ logo: card.actions.getImageUrl(item.id) });
|
||||||
|
@ -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 { ChannelsWrapper, AddFooter } from './Channels.styled';
|
||||||
import { CommentOutlined, SearchOutlined } from '@ant-design/icons';
|
import { CommentOutlined, SearchOutlined } from '@ant-design/icons';
|
||||||
import { useChannels } from './useChannels.hook';
|
import { useChannels } from './useChannels.hook';
|
||||||
@ -25,6 +25,10 @@ export function Channels({ open, active }) {
|
|||||||
|
|
||||||
const addFooter = (
|
const addFooter = (
|
||||||
<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="back" onClick={actions.clearShowAdd}>Cancel</Button>
|
||||||
<Button key="save" type="primary" loading={state.busy} onClick={addChannel}>Save</Button>
|
<Button key="save" type="primary" loading={state.busy} onClick={addChannel}>Save</Button>
|
||||||
</AddFooter>
|
</AddFooter>
|
||||||
|
@ -91,7 +91,18 @@ export const AddFooter = styled.div`
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
justify-content: flex-end;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
|
.seal {
|
||||||
|
display: flex;
|
||||||
|
flex-grow: 1;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
.sealText {
|
||||||
|
padding-left: 8px;
|
||||||
|
}
|
||||||
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ export function AddChannel({ state, actions }) {
|
|||||||
select={actions.onMember}
|
select={actions.onMember}
|
||||||
selected={state.members}
|
selected={state.members}
|
||||||
emptyMessage={'No Connected Contacts'}
|
emptyMessage={'No Connected Contacts'}
|
||||||
filter={(card) => card?.data?.cardDetail?.status === 'connected'}
|
filter={actions.cardFilter}
|
||||||
unknown={0}
|
unknown={0}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -16,6 +16,7 @@ export function useChannels() {
|
|||||||
busy: false,
|
busy: false,
|
||||||
members: new Set(),
|
members: new Set(),
|
||||||
subject: null,
|
subject: null,
|
||||||
|
seal: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
const card = useContext(CardContext);
|
const card = useContext(CardContext);
|
||||||
@ -49,11 +50,26 @@ export function useChannels() {
|
|||||||
}
|
}
|
||||||
return added.id;
|
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) => {
|
onFilter: (value) => {
|
||||||
setFilter(value.toUpperCase());
|
setFilter(value.toUpperCase());
|
||||||
},
|
},
|
||||||
setShowAdd: () => {
|
setShowAdd: () => {
|
||||||
updateState({ showAdd: true });
|
updateState({ showAdd: true, seal: false });
|
||||||
},
|
},
|
||||||
clearShowAdd: () => {
|
clearShowAdd: () => {
|
||||||
updateState({ showAdd: false, members: new Set(), subject: null });
|
updateState({ showAdd: false, members: new Set(), subject: null });
|
||||||
@ -71,6 +87,12 @@ export function useChannels() {
|
|||||||
setSubject: (subject) => {
|
setSubject: (subject) => {
|
||||||
updateState({ 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) => {
|
const setUpdated = (chan) => {
|
||||||
|
14693
net/web/yarn.lock
14693
net/web/yarn.lock
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user