cozy-sharing 25.7.0 → 25.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/components/ShareRestrictionModal/ShareRestrictionModal.js +7 -2
- package/dist/components/SharedDrive/SharedDriveModal.js +12 -8
- package/dist/helpers/link.js +11 -0
- package/package.json +2 -2
- package/src/components/ShareRestrictionModal/ShareRestrictionModal.jsx +3 -2
- package/src/components/SharedDrive/SharedDriveModal.jsx +3 -0
- package/src/helpers/link.js +9 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [25.7.2](https://github.com/cozy/cozy-libs/compare/cozy-sharing@25.7.1...cozy-sharing@25.7.2) (2025-08-19)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- Resolve creating shared drive issue :bug: ([d6574ac](https://github.com/cozy/cozy-libs/commit/d6574ac7c75b4da8da1e67554df175d7031eb5b2))
|
|
11
|
+
|
|
12
|
+
## [25.7.1](https://github.com/cozy/cozy-libs/compare/cozy-sharing@25.7.0...cozy-sharing@25.7.1) (2025-07-30)
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
- Correct link in clipboard when sharing an album ([b56a93c](https://github.com/cozy/cozy-libs/commit/b56a93c43d15a186aa1c26e382d30491b148f255))
|
|
17
|
+
|
|
6
18
|
# [25.7.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@25.6.0...cozy-sharing@25.7.0) (2025-07-16)
|
|
7
19
|
|
|
8
20
|
### Features
|
|
@@ -13,6 +13,7 @@ import { useAlert } from 'cozy-ui/transpiled/react/providers/Alert';
|
|
|
13
13
|
import { useI18n } from 'cozy-ui/transpiled/react/providers/I18n';
|
|
14
14
|
import { ShareRestrictionContentModal } from './ShareRestrictionContentModal';
|
|
15
15
|
import { copyToClipboard, updatePermissions, makeTTL, revokePermissions, createPermissions } from './helpers';
|
|
16
|
+
import { getAppSlugFromDocumentType } from '../../helpers/link';
|
|
16
17
|
import { checkIsPermissionHasExpiresDate, checkIsPermissionHasPassword, checkIsReadOnlyPermissions, getPermissionExpiresDate } from '../../helpers/permissions';
|
|
17
18
|
import { useSharingContext } from '../../hooks/useSharingContext';
|
|
18
19
|
var PASSWORD_MIN_LENGTH = 4;
|
|
@@ -121,7 +122,9 @@ export var ShareRestrictionModal = function ShareRestrictionModal(_ref) {
|
|
|
121
122
|
cozyUrl: client.getStackClient().uri,
|
|
122
123
|
searchParams: [['sharecode', perms.attributes.shortcodes.code]],
|
|
123
124
|
pathname: '/public',
|
|
124
|
-
slug:
|
|
125
|
+
slug: getAppSlugFromDocumentType({
|
|
126
|
+
documentType: documentType
|
|
127
|
+
}),
|
|
125
128
|
subDomainType: client.capabilities.flat_subdomains ? 'flat' : 'nested'
|
|
126
129
|
});
|
|
127
130
|
_context.next = 10;
|
|
@@ -158,7 +161,9 @@ export var ShareRestrictionModal = function ShareRestrictionModal(_ref) {
|
|
|
158
161
|
cozyUrl: client.getStackClient().uri,
|
|
159
162
|
searchParams: [['sharecode', _perms.attributes.shortcodes.code]],
|
|
160
163
|
pathname: '/public',
|
|
161
|
-
slug:
|
|
164
|
+
slug: getAppSlugFromDocumentType({
|
|
165
|
+
documentType: documentType
|
|
166
|
+
}),
|
|
162
167
|
subDomainType: client.capabilities.flat_subdomains ? 'flat' : 'nested'
|
|
163
168
|
});
|
|
164
169
|
_context.next = 21;
|
|
@@ -63,16 +63,20 @@ export var SharedDriveModal = withLocales(function (_ref) {
|
|
|
63
63
|
case 0:
|
|
64
64
|
_context.prev = 0;
|
|
65
65
|
_context.next = 3;
|
|
66
|
+
return client.collection('io.cozy.files').getOrCreateSharedDrivesDirectory();
|
|
67
|
+
|
|
68
|
+
case 3:
|
|
69
|
+
_context.next = 5;
|
|
66
70
|
return client.create('io.cozy.files', {
|
|
67
71
|
name: sharedDriveName,
|
|
68
72
|
dirId: 'io.cozy.files.shared-drives-dir',
|
|
69
73
|
type: 'directory'
|
|
70
74
|
});
|
|
71
75
|
|
|
72
|
-
case
|
|
76
|
+
case 5:
|
|
73
77
|
_yield$client$create2 = _context.sent;
|
|
74
78
|
sharedDriveFolder = _yield$client$create2.data;
|
|
75
|
-
_context.next =
|
|
79
|
+
_context.next = 9;
|
|
76
80
|
return share({
|
|
77
81
|
document: sharedDriveFolder,
|
|
78
82
|
recipients: sharedDriveRecipients.recipients,
|
|
@@ -80,18 +84,18 @@ export var SharedDriveModal = withLocales(function (_ref) {
|
|
|
80
84
|
sharedDrive: true
|
|
81
85
|
});
|
|
82
86
|
|
|
83
|
-
case
|
|
87
|
+
case 9:
|
|
84
88
|
showAlert({
|
|
85
89
|
message: t('SharedDrive.sharedDriveModal.successNotification'),
|
|
86
90
|
severity: 'success',
|
|
87
91
|
variant: 'filled'
|
|
88
92
|
});
|
|
89
93
|
onClose();
|
|
90
|
-
_context.next =
|
|
94
|
+
_context.next = 16;
|
|
91
95
|
break;
|
|
92
96
|
|
|
93
|
-
case
|
|
94
|
-
_context.prev =
|
|
97
|
+
case 13:
|
|
98
|
+
_context.prev = 13;
|
|
95
99
|
_context.t0 = _context["catch"](0);
|
|
96
100
|
showAlert({
|
|
97
101
|
message: t('SharedDrive.sharedDriveModal.errorNotification'),
|
|
@@ -99,11 +103,11 @@ export var SharedDriveModal = withLocales(function (_ref) {
|
|
|
99
103
|
variant: 'filled'
|
|
100
104
|
});
|
|
101
105
|
|
|
102
|
-
case
|
|
106
|
+
case 16:
|
|
103
107
|
case "end":
|
|
104
108
|
return _context.stop();
|
|
105
109
|
}
|
|
106
|
-
}, _callee, null, [[0,
|
|
110
|
+
}, _callee, null, [[0, 13]]);
|
|
107
111
|
}));
|
|
108
112
|
|
|
109
113
|
return function onCreate() {
|
package/dist/helpers/link.js
CHANGED
|
@@ -2,4 +2,15 @@ import { DOCUMENT_TYPE } from './documentType';
|
|
|
2
2
|
export var isOnlyReadOnlyLinkAllowed = function isOnlyReadOnlyLinkAllowed(_ref) {
|
|
3
3
|
var documentType = _ref.documentType;
|
|
4
4
|
return documentType === DOCUMENT_TYPE.ALBUMS;
|
|
5
|
+
};
|
|
6
|
+
export var getAppSlugFromDocumentType = function getAppSlugFromDocumentType(_ref2) {
|
|
7
|
+
var documentType = _ref2.documentType;
|
|
8
|
+
|
|
9
|
+
switch (documentType) {
|
|
10
|
+
case DOCUMENT_TYPE.ALBUMS:
|
|
11
|
+
return 'photos';
|
|
12
|
+
|
|
13
|
+
default:
|
|
14
|
+
return 'drive';
|
|
15
|
+
}
|
|
5
16
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-sharing",
|
|
3
|
-
"version": "25.7.
|
|
3
|
+
"version": "25.7.2",
|
|
4
4
|
"description": "Provides sharing login for React applications.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"author": "Cozy",
|
|
@@ -79,5 +79,5 @@
|
|
|
79
79
|
"sideEffects": [
|
|
80
80
|
"*.css"
|
|
81
81
|
],
|
|
82
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "e65ef0b285982ef58269f766870bcb26fee91ef4"
|
|
83
83
|
}
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
revokePermissions,
|
|
19
19
|
createPermissions
|
|
20
20
|
} from './helpers'
|
|
21
|
+
import { getAppSlugFromDocumentType } from '../../helpers/link'
|
|
21
22
|
import {
|
|
22
23
|
checkIsPermissionHasExpiresDate,
|
|
23
24
|
checkIsPermissionHasPassword,
|
|
@@ -90,7 +91,7 @@ export const ShareRestrictionModal = ({ file, onClose }) => {
|
|
|
90
91
|
cozyUrl: client.getStackClient().uri,
|
|
91
92
|
searchParams: [['sharecode', perms.attributes.shortcodes.code]],
|
|
92
93
|
pathname: '/public',
|
|
93
|
-
slug:
|
|
94
|
+
slug: getAppSlugFromDocumentType({ documentType }),
|
|
94
95
|
subDomainType: client.capabilities.flat_subdomains ? 'flat' : 'nested'
|
|
95
96
|
})
|
|
96
97
|
await copyToClipboard(url, { t, showAlert })
|
|
@@ -112,7 +113,7 @@ export const ShareRestrictionModal = ({ file, onClose }) => {
|
|
|
112
113
|
cozyUrl: client.getStackClient().uri,
|
|
113
114
|
searchParams: [['sharecode', perms.attributes.shortcodes.code]],
|
|
114
115
|
pathname: '/public',
|
|
115
|
-
slug:
|
|
116
|
+
slug: getAppSlugFromDocumentType({ documentType }),
|
|
116
117
|
subDomainType: client.capabilities.flat_subdomains ? 'flat' : 'nested'
|
|
117
118
|
})
|
|
118
119
|
await copyToClipboard(url, { t, showAlert })
|
|
@@ -47,6 +47,9 @@ export const SharedDriveModal = withLocales(({ onClose }) => {
|
|
|
47
47
|
|
|
48
48
|
const onCreate = async () => {
|
|
49
49
|
try {
|
|
50
|
+
await client
|
|
51
|
+
.collection('io.cozy.files')
|
|
52
|
+
.getOrCreateSharedDrivesDirectory()
|
|
50
53
|
const { data: sharedDriveFolder } = await client.create('io.cozy.files', {
|
|
51
54
|
name: sharedDriveName,
|
|
52
55
|
dirId: 'io.cozy.files.shared-drives-dir',
|
package/src/helpers/link.js
CHANGED
|
@@ -2,3 +2,12 @@ import { DOCUMENT_TYPE } from './documentType'
|
|
|
2
2
|
|
|
3
3
|
export const isOnlyReadOnlyLinkAllowed = ({ documentType }) =>
|
|
4
4
|
documentType === DOCUMENT_TYPE.ALBUMS
|
|
5
|
+
|
|
6
|
+
export const getAppSlugFromDocumentType = ({ documentType }) => {
|
|
7
|
+
switch (documentType) {
|
|
8
|
+
case DOCUMENT_TYPE.ALBUMS:
|
|
9
|
+
return 'photos'
|
|
10
|
+
default:
|
|
11
|
+
return 'drive'
|
|
12
|
+
}
|
|
13
|
+
}
|