Skip to content

Commit cd5a40d

Browse files
committed
Merge branch 'release/1.4.0'
# Conflicts: # package.json # yarn.lock
2 parents b2a97d1 + 6374185 commit cd5a40d

File tree

146 files changed

+1874
-2231
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

146 files changed

+1874
-2231
lines changed

.eslintrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
"react/destructuring-assignment": 0,
1818
"react/no-unused-prop-types": 0,
1919
"react/no-array-index-key": 0,
20+
"react/jsx-props-no-spreading": 0,
21+
"react/jsx-fragments": 0,
2022
"import/no-dynamic-require": 0,
2123
"import/extensions": 0,
2224
"no-plusplus": 0,

.rancher-pipeline.yml

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,46 @@ stages:
77
tag: caesarteam/caesar-web-client:${CICD_GIT_BRANCH}
88
pushRemote: true
99
registry: index.docker.io
10+
when:
11+
branch:
12+
include:
13+
- develop
14+
- hotfix/*
15+
- publishImageConfig:
16+
dockerfilePath: ./Dockerfile
17+
buildContext: .
18+
tag: caesarteam/caesar-web-client:${CICD_GIT_TAG}
19+
pushRemote: true
20+
registry: index.docker.io
21+
when:
22+
event:
23+
include:
24+
- tag
1025
- name: Deploy
1126
steps:
1227
- applyYamlConfig:
1328
path: ./deploy/deployment.yaml
14-
branch:
15-
include:
16-
- develop
17-
- master
29+
when:
30+
branch:
31+
include:
32+
- develop
33+
- hotfix/*
34+
- name: Webhook
35+
steps:
36+
- runScriptConfig:
37+
image: caesarteam/alpine-curl
38+
shellScript: 'curl -X POST -H "Content-Type: application/json" --header "Authorization: Basic ${!WEBHOOK_TOKEN}" -d ''{"name": "caesarteam/caesar-web-client","tag": "${!CICD_GIT_TAG}"}'' ${WEBHOOK_URL}'
39+
envFrom:
40+
- sourceName: build-webhook
41+
sourceKey: WEBHOOK_URL
42+
targetKey: WEBHOOK_URL
43+
- sourceName: build-webhook
44+
sourceKey: WEBHOOK_TOKEN
45+
targetKey: WEBHOOK_TOKEN
46+
when:
47+
event:
48+
include:
49+
- tag
1850
notification:
1951
recipients:
2052
- recipient: '#pipeline'

common/actions/node.js

Lines changed: 78 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ export const FETCH_NODES_REQUEST = '@nodes/FETCH_NODES_REQUEST';
22
export const FETCH_NODES_SUCCESS = '@nodes/FETCH_NODES_SUCCESS';
33
export const FETCH_NODES_FAILURE = '@nodes/FETCH_NODES_FAILURE';
44

5-
export const ADD_ITEM = '@nodes/ADD_ITEM';
5+
export const ADD_ITEMS = '@nodes/ADD_ITEMS';
6+
export const FINISH_IS_LOADING = '@nodes/FINISH_IS_LOADING';
67

78
export const SET_WORK_IN_PROGRESS_ITEM = '@nodes/SET_WORK_IN_PROGRESS_ITEM';
89
export const SET_WORK_IN_PROGRESS_ITEM_IDS =
@@ -17,18 +18,28 @@ export const REMOVE_ITEM_REQUEST = '@nodes/REMOVE_ITEM_REQUEST';
1718
export const REMOVE_ITEM_SUCCESS = '@nodes/REMOVE_ITEM_SUCCESS';
1819
export const REMOVE_ITEM_FAILURE = '@nodes/REMOVE_ITEM_FAILURE';
1920

21+
export const REMOVE_ITEMS_BATCH_REQUEST = '@nodes/REMOVE_ITEMS_BATCH_REQUEST';
22+
export const REMOVE_ITEMS_BATCH_SUCCESS = '@nodes/REMOVE_ITEMS_BATCH_SUCCESS';
23+
export const REMOVE_ITEMS_BATCH_FAILURE = '@nodes/REMOVE_ITEMS_BATCH_FAILURE';
24+
2025
export const MOVE_ITEM_REQUEST = '@nodes/MOVE_ITEM_REQUEST';
2126
export const MOVE_ITEM_SUCCESS = '@nodes/MOVE_ITEM_SUCCESS';
2227
export const MOVE_ITEM_FAILURE = '@nodes/MOVE_ITEM_FAILURE';
2328

24-
export const MOVE_ITEMS = '@nodes/MOVE_ITEMS';
25-
export const REMOVE_ITEMS = '@nodes/REMOVE_ITEMS';
29+
export const MOVE_ITEMS_BATCH_REQUEST = '@nodes/MOVE_ITEMS_BATCH_REQUEST';
30+
export const MOVE_ITEMS_BATCH_SUCCESS = '@nodes/MOVE_ITEMS_BATCH_SUCCESS';
31+
export const MOVE_ITEMS_BATCH_FAILURE = '@nodes/MOVE_ITEMS_BATCH_FAILURE';
32+
2633
export const SHARE_ITEMS = '@nodes/SHARE_ITEMS';
2734

2835
export const CREATE_ITEM_REQUEST = '@nodes/CREATE_ITEM_REQUEST';
2936
export const CREATE_ITEM_SUCCESS = '@nodes/CREATE_ITEM_SUCCESS';
3037
export const CREATE_ITEM_FAILURE = '@nodes/CREATE_ITEM_FAILURE';
3138

39+
export const CREATE_ITEMS_BATCH_REQUEST = '@nodes/CREATE_ITEMS_BATCH_REQUEST';
40+
export const CREATE_ITEMS_BATCH_SUCCESS = '@nodes/CREATE_ITEMS_BATCH_SUCCESS';
41+
export const CREATE_ITEMS_BATCH_FAILURE = '@nodes/CREATE_ITEMS_BATCH_FAILURE';
42+
3243
export const EDIT_ITEM_REQUEST = '@nodes/EDIT_ITEM_REQUEST';
3344
export const EDIT_ITEM_SUCCESS = '@nodes/EDIT_ITEM_SUCCESS';
3445
export const EDIT_ITEM_FAILURE = '@nodes/EDIT_ITEM_FAILURE';
@@ -107,8 +118,11 @@ export const SORT_LIST_FAILURE = '@nodes/SORT_LIST_FAILURE';
107118

108119
export const RESET_STORE = '@nodes/RESET_STORE';
109120

110-
export const fetchNodesRequest = () => ({
121+
export const fetchNodesRequest = withItemsDecryption => ({
111122
type: FETCH_NODES_REQUEST,
123+
payload: {
124+
withItemsDecryption,
125+
},
112126
});
113127

114128
export const fetchNodesSuccess = listsById => ({
@@ -122,13 +136,17 @@ export const fetchNodesFailure = () => ({
122136
type: FETCH_NODES_FAILURE,
123137
});
124138

125-
export const addItem = item => ({
126-
type: ADD_ITEM,
139+
export const addItems = items => ({
140+
type: ADD_ITEMS,
127141
payload: {
128-
item,
142+
items,
129143
},
130144
});
131145

146+
export const finishIsLoading = () => ({
147+
type: FINISH_IS_LOADING,
148+
});
149+
132150
export const setWorkInProgressItem = (item, mode) => ({
133151
type: SET_WORK_IN_PROGRESS_ITEM,
134152
payload: {
@@ -155,15 +173,25 @@ export const resetWorkInProgressItemIds = () => ({
155173
type: RESET_WORK_IN_PROGRESS_ITEM_IDS,
156174
});
157175

158-
export const moveItems = listId => ({
159-
type: MOVE_ITEMS,
176+
export const moveItemsBatchRequest = (oldListId, newListId) => ({
177+
type: MOVE_ITEMS_BATCH_REQUEST,
160178
payload: {
161-
listId,
179+
oldListId,
180+
newListId,
162181
},
163182
});
164183

165-
export const removeItems = () => ({
166-
type: REMOVE_ITEMS,
184+
export const moveItemsBatchSuccess = (itemIds, oldListId, newListId) => ({
185+
type: MOVE_ITEMS_BATCH_SUCCESS,
186+
payload: {
187+
itemIds,
188+
oldListId,
189+
newListId,
190+
},
191+
});
192+
193+
export const moveItemsBatchFailure = () => ({
194+
type: MOVE_ITEMS_BATCH_FAILURE,
167195
});
168196

169197
export const shareItems = emails => ({
@@ -193,6 +221,25 @@ export const removeItemFailure = () => ({
193221
type: MOVE_ITEM_FAILURE,
194222
});
195223

224+
export const removeItemsBatchRequest = listId => ({
225+
type: REMOVE_ITEMS_BATCH_REQUEST,
226+
payload: {
227+
listId,
228+
},
229+
});
230+
231+
export const removeItemsBatchSuccess = (itemIds, listId) => ({
232+
type: REMOVE_ITEMS_BATCH_SUCCESS,
233+
payload: {
234+
itemIds,
235+
listId,
236+
},
237+
});
238+
239+
export const removeItemsBatchFailure = () => ({
240+
type: REMOVE_ITEMS_BATCH_FAILURE,
241+
});
242+
196243
export const moveItemRequest = listId => ({
197244
type: MOVE_ITEM_REQUEST,
198245
payload: {
@@ -234,6 +281,25 @@ export const createItemFailure = () => ({
234281
type: CREATE_ITEM_FAILURE,
235282
});
236283

284+
export const createItemsBatchRequest = (listId, items) => ({
285+
type: CREATE_ITEMS_BATCH_REQUEST,
286+
payload: {
287+
listId,
288+
items,
289+
},
290+
});
291+
292+
export const createItemsBatchSuccess = items => ({
293+
type: CREATE_ITEMS_BATCH_SUCCESS,
294+
payload: {
295+
items,
296+
},
297+
});
298+
299+
export const createItemsBatchFailure = () => ({
300+
type: CREATE_ITEMS_BATCH_FAILURE,
301+
});
302+
237303
export const editItemRequest = (item, setSubmitting) => ({
238304
type: EDIT_ITEM_REQUEST,
239305
payload: {

common/api.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,18 @@ export const getUserBootstrap = () => callApi.get('/user/security/bootstrap');
8181

8282
export const postCreateItem = data => callApi.post('/item', data);
8383

84+
export const postCreateItemsBatch = data => callApi.post('/item/batch', data);
85+
8486
export const removeItem = itemId => callApi.delete(`/item/${itemId}`);
8587

88+
export const removeItemsBatch = query => callApi.delete(`/item/batch?${query}`);
89+
8690
export const updateMoveItem = (itemId, data) =>
8791
callApi.patch(`/item/${itemId}/move`, data);
8892

93+
export const updateMoveItemsBatch = (data, listId) =>
94+
callApi.patch(`/item/batch/move/list/${listId}`, data);
95+
8996
export const updateItem = (itemId, data) =>
9097
callApi.patch(`/item/${itemId}`, data);
9198

common/constants.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export const {
1616
export const PORTAL_ID = 'portal';
1717
export const DEFAULT_IDLE_TIMEOUT = 5 * 60 * 1000;
1818
export const MAX_SIZE_RANDOM_BUFFER = 60000;
19+
export const WORKER_DECRYPTION_BUFFER_SIZE = 10;
1920

2021
export const ROOT_TYPE = 'root';
2122
export const INBOX_TYPE = 'inbox';
@@ -62,6 +63,11 @@ export const ITEM_TYPES = {
6263
ITEM_DOCUMENT_TYPE,
6364
};
6465

66+
export const ITEM_ICON_TYPES = {
67+
[ITEM_CREDENTIALS_TYPE]: 'key',
68+
[ITEM_DOCUMENT_TYPE]: 'securenote',
69+
};
70+
6571
export const KEY_CODES = {
6672
BACKSPACE: 8,
6773
TAB: 9,

common/decryption.worker.js

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,44 @@
22
self.window = self;
33

44
const { decryptItem, getPrivateKeyObj } = require('./utils/cipherUtils');
5+
const constants = require('../common/constants');
6+
7+
const { API_URI, WORKER_DECRYPTION_BUFFER_SIZE } = constants;
8+
9+
const postMessage = (event, items) =>
10+
window.postMessage({ event, items }, API_URI);
511

612
window.onmessage = async message => {
713
const {
8-
data: {
9-
event,
10-
data: { listId, items, privateKey, masterPassword },
11-
},
14+
data: { event, data },
1215
} = message;
1316

14-
switch (event) {
15-
case `decryptItems_${listId}`: {
16-
const privateKeyObj = await getPrivateKeyObj(privateKey, masterPassword);
17+
const { events, items, privateKey, masterPassword } = data;
18+
19+
const privateKeyObj = await getPrivateKeyObj(privateKey, masterPassword);
20+
const len = items.length;
21+
22+
let buffer = [];
1723

18-
for (let index = 0; index < items.length; index++) {
19-
const item = items[index];
24+
if (event === events.eventToWorker) {
25+
for (let index = 0; index < len; index++) {
26+
const item = items[index];
27+
const isLast = index === len - 1;
28+
29+
try {
2030
// eslint-disable-next-line
21-
try {
22-
const secret = await decryptItem(item.secret, privateKeyObj);
23-
24-
window.postMessage({
25-
event: `emitDecryptedItem_${listId}`,
26-
item: {
27-
...item,
28-
secret,
29-
},
30-
});
31-
} catch (e) {
32-
console.log(e, item, listId);
31+
const secret = await decryptItem(item.secret, privateKeyObj);
32+
33+
buffer.push({ id: item.id, secret });
34+
35+
if (buffer.length === WORKER_DECRYPTION_BUFFER_SIZE || isLast) {
36+
postMessage(events.eventFromWorker, buffer);
37+
38+
buffer = [];
3339
}
40+
} catch (e) {
41+
console.log(e, item);
3442
}
35-
break;
3643
}
37-
default:
38-
break;
3944
}
4045
};
Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,19 @@ self.window = self;
44
const openpgp = require('openpgp');
55
const constants = require('../common/constants');
66

7-
const { MAX_SIZE_RANDOM_BUFFER } = constants;
7+
const { MAX_SIZE_RANDOM_BUFFER, API_URI } = constants;
88

99
let randomQueue = [];
1010

1111
function randomCallback() {
1212
if (!randomQueue.length) {
13-
window.postMessage({
14-
event: 'request-seed',
15-
amount: MAX_SIZE_RANDOM_BUFFER,
16-
});
13+
window.postMessage(
14+
{
15+
event: 'request-seed',
16+
amount: MAX_SIZE_RANDOM_BUFFER,
17+
},
18+
API_URI,
19+
);
1720
}
1821

1922
return new Promise(resolve => {

0 commit comments

Comments
 (0)