Skip to content

TagSpaces is an offline, open source, document manager with tagging support

fix: refactoring location to support only one path, adding methods for history manipulations

Ilian Sapundshiev5fdcae1938d2
diff --git a/app/components/DirectoryTreeView.tsx b/app/components/DirectoryTreeView.tsx
index 8f5a8ef82..d8d992e7a 100644
--- a/app/components/DirectoryTreeView.tsx
+++ b/app/components/DirectoryTreeView.tsx
@@ -57,7 +57,7 @@ const DirectoryTreeView = forwardRef((props: Props, ref) => {
PlatformIO.enableObjectStoreSupport(location)
.then(() => {
loadSubDirectories(location, 1);
- props.loadDirectoryContent(location.paths[0]);
+ props.loadDirectoryContent(location.path || location.paths[0]);
})
.catch(error => {
console.log('enableObjectStoreSupport', error);
@@ -65,7 +65,7 @@ const DirectoryTreeView = forwardRef((props: Props, ref) => {
} else if (location.type === locationType.TYPE_LOCAL) {
PlatformIO.disableObjectStoreSupport();
loadSubDirectories(location, 1);
- props.loadDirectoryContent(location.paths[0]);
+ props.loadDirectoryContent(location.path || location.paths[0]);
}
}
},
diff --git a/app/components/LocationManager.tsx b/app/components/LocationManager.tsx
index 8c8aa3483..d78ee1930 100644
--- a/app/components/LocationManager.tsx
+++ b/app/components/LocationManager.tsx
@@ -199,7 +199,7 @@ class LocationManager extends React.Component<Props, State> {
uuid: uuidv1(),
type: locationType.TYPE_LOCAL,
name: key, // TODO use i18n
- paths: [devicePaths[key]],
+ path: devicePaths[key],
isDefault: AppConfig.isWeb && devicePaths[key] === '/files/', // Used for the web ts demo
isReadOnly: false,
persistIndex: false
@@ -246,7 +246,7 @@ class LocationManager extends React.Component<Props, State> {
PlatformIO.enableObjectStoreSupport(selectedLocation)
.then(() => {
createDirectoryIndex(
- selectedLocation.paths[0],
+ selectedLocation.path || selectedLocation.paths[0],
selectedLocation.fullTextIndex,
isCurrentLocation
);
@@ -258,7 +258,7 @@ class LocationManager extends React.Component<Props, State> {
} else if (selectedLocation.type === locationType.TYPE_LOCAL) {
PlatformIO.disableObjectStoreSupport();
createDirectoryIndex(
- selectedLocation.paths[0],
+ selectedLocation.path || selectedLocation.paths[0],
selectedLocation.fullTextIndex,
isCurrentLocation
);
@@ -281,7 +281,9 @@ class LocationManager extends React.Component<Props, State> {
showInFileManager = () => {
this.handleRequestCloseContextMenus();
- this.props.openDirectory(this.state.selectedLocation.paths[0]);
+ this.props.openDirectory(
+ this.state.selectedLocation.path || this.state.selectedLocation.pathS[0]
+ );
};
closeLocation = () => {
@@ -382,7 +384,7 @@ class LocationManager extends React.Component<Props, State> {
handleLocationClick = (location: Location) => {
this.directoryTreeRef[location.uuid].changeLocation(location);
if (location.uuid === this.props.currentLocationId) {
- this.props.loadDirectoryContent(location.paths[0]);
+ this.props.loadDirectoryContent(location.path || location.paths[0]);
} else {
// this.directoryTreeRef[location.uuid].loadSubDir(location, 1);
this.props.setSelectedEntries([]);
@@ -510,10 +512,9 @@ class LocationManager extends React.Component<Props, State> {
}
title={
location.isDefault
- ? i18n.t('core: thisIsStartupLocation') +
- ' : ' +
+ ? i18n.t('core: thisIsStartupLocation') + ' : ' + location.path ||
location.paths[0]
- : location.paths[0]
+ : location.path || location.paths[0]
}
button
onClick={() => this.handleLocationClick(location)}
@@ -551,7 +552,7 @@ class LocationManager extends React.Component<Props, State> {
<TargetMoveFileBox
accepts={[DragItemTypes.FILE]}
onDrop={this.handleFileMoveDrop}
- path={location.paths[0]}
+ path={location.path || location.paths[0]}
location={location}
>
<div style={{ maxWidth: 250 }}>
diff --git a/app/components/dialogs/CreateLocationDialog.tsx b/app/components/dialogs/CreateLocationDialog.tsx
index bca5b5fa5..a6ca58279 100644
--- a/app/components/dialogs/CreateLocationDialog.tsx
+++ b/app/components/dialogs/CreateLocationDialog.tsx
@@ -198,7 +198,7 @@ class CreateLocationDialog extends React.Component<Props, State> {
uuid: uuidv1(),
type: locationType.TYPE_LOCAL,
name: this.state.name,
- paths: [this.state.path],
+ path: this.state.path,
isDefault: this.state.isDefault,
isReadOnly: this.state.isReadOnly,
persistIndex: this.state.persistIndex,
@@ -210,7 +210,7 @@ class CreateLocationDialog extends React.Component<Props, State> {
uuid: uuidv1(),
type: locationType.TYPE_CLOUD,
name: this.state.storeName,
- paths: [this.state.storePath],
+ path: this.state.storePath,
endpointURL: this.state.endpointURL,
accessKeyId: this.state.accessKeyId,
secretAccessKey: this.state.secretAccessKey,
diff --git a/app/components/dialogs/EditLocationDialog.tsx b/app/components/dialogs/EditLocationDialog.tsx
index db37ac774..b6200a529 100644
--- a/app/components/dialogs/EditLocationDialog.tsx
+++ b/app/components/dialogs/EditLocationDialog.tsx
@@ -54,8 +54,10 @@ interface Props {
interface State {
errorTextPath: boolean;
errorTextName: boolean;
+ errorTextId: boolean;
disableConfirmButton: boolean;
cloudErrorTextName: boolean;
+ cloudErrorId: boolean;
cloudErrorBucketName: boolean;
cloudErrorRegion: boolean;
cloudErrorAccessKey: boolean;
@@ -91,7 +93,7 @@ class EditLocationDialog extends React.Component<Props, State> {
storeName: dir
? extractDirectoryName(dir, PlatformIO.getDirSeparator())
: props.location.name,
- storePath: dir || props.location.paths[0]
+ storePath: dir || props.location.path || props.location.paths[0]
};
} else {
properties = {
@@ -99,7 +101,7 @@ class EditLocationDialog extends React.Component<Props, State> {
name: dir
? extractDirectoryName(dir, PlatformIO.getDirSeparator())
: props.location.name,
- path: dir || props.location.paths[0]
+ path: dir || props.location.path || props.location.paths[0]
};
}
this.state = {
@@ -122,12 +124,14 @@ class EditLocationDialog extends React.Component<Props, State> {
this.state = {
errorTextPath: false,
errorTextName: false,
+ errorTextId: false,
disableConfirmButton: true,
cloudErrorTextName: false,
cloudErrorBucketName: false,
cloudErrorRegion: false,
cloudErrorAccessKey: false,
cloudErrorSecretAccessKey: false,
+ cloudErrorId: false,
uuid: '',
newuuid: '',
name: '',
@@ -181,6 +185,7 @@ class EditLocationDialog extends React.Component<Props, State> {
let cloudErrorTextName = false;
let cloudErrorAccessKey = false;
let cloudErrorSecretAccessKey = false;
+ let cloudErrorId = false;
let disableConfirmButton = false;
if (!this.state.storeName || this.state.storeName.length === 0) {
cloudErrorTextName = true;
@@ -192,6 +197,11 @@ class EditLocationDialog extends React.Component<Props, State> {
disableConfirmButton = true;
}
+ if (!this.state.uuid || this.state.uuid.length === 0) {
+ cloudErrorId = true;
+ disableConfirmButton = true;
+ }
+
if (
!this.state.secretAccessKey ||
this.state.secretAccessKey.length === 0
@@ -205,11 +215,13 @@ class EditLocationDialog extends React.Component<Props, State> {
cloudErrorTextName,
cloudErrorAccessKey,
cloudErrorSecretAccessKey,
+ cloudErrorId,
disableConfirmButton
});
} else {
let errorTextName = false;
let errorTextPath = false;
+ let errorTextId = false;
let disableConfirmButton = false;
if (!this.state.name || this.state.name.length === 0) {
errorTextName = true;
@@ -219,7 +231,16 @@ class EditLocationDialog extends React.Component<Props, State> {
errorTextPath = true; // make in optional in cloud mode
disableConfirmButton = true;
}
- this.setState({ errorTextName, errorTextPath, disableConfirmButton });
+ if (!this.state.newuuid || this.state.newuuid.length === 0) {
+ errorTextId = true;
+ disableConfirmButton = true;
+ }
+ this.setState({
+ errorTextName,
+ errorTextPath,
+ errorTextId,
+ disableConfirmButton
+ });
}
}
@@ -252,7 +273,7 @@ class EditLocationDialog extends React.Component<Props, State> {
newuuid: this.state.newuuid,
type: locationType.TYPE_LOCAL,
name: this.state.name,
- paths: [this.state.path],
+ path: this.state.path,
isDefault: this.state.isDefault,
isReadOnly: this.state.isReadOnly,
persistIndex: this.state.persistIndex,
@@ -265,7 +286,7 @@ class EditLocationDialog extends React.Component<Props, State> {
newuuid: this.state.newuuid,
type: locationType.TYPE_CLOUD,
name: this.state.storeName,
- paths: [this.state.storePath],
+ path: this.state.storePath,
endpointURL: this.state.endpointURL,
accessKeyId: this.state.accessKeyId,
secretAccessKey: this.state.secretAccessKey,
diff --git a/app/components/dialogs/LocalForm.tsx b/app/components/dialogs/LocalForm.tsx
index 8407c63b4..49a4bf53e 100644
--- a/app/components/dialogs/LocalForm.tsx
+++ b/app/components/dialogs/LocalForm.tsx
@@ -109,18 +109,26 @@ class LocalForm extends React.Component<Props> {
<FormHelperText>{i18n.t('core:invalidPath')}</FormHelperText>
)}
</FormControl>
- <FormControl fullWidth={true}>
- <InputLabel htmlFor="newuuid">{i18n.t('core:uuid')}</InputLabel>
- <Input
- margin="dense"
- name="newuuid"
- fullWidth={true}
- data-tid="newuuid"
- placeholder="Advanced setting"
- onChange={handleInputChange}
- value={state.newuuid}
- />
- </FormControl>
+ {state.newuuid && (
+ <FormControl fullWidth={true}>
+ <InputLabel htmlFor="newuuid">
+ {i18n.t('core:locationId')}
+ </InputLabel>
+ <Input
+ required
+ margin="dense"
+ name="newuuid"
+ fullWidth={true}
+ data-tid="newuuid"
+ placeholder="Location ID"
+ onChange={handleInputChange}
+ value={state.newuuid}
+ />
+ {state.errorTextId && (
+ <FormHelperText>{i18n.t('core:invalidId')}</FormHelperText>
+ )}
+ </FormControl>
+ )}
</div>
);
}
diff --git a/app/components/dialogs/ObjectStoreForm.tsx b/app/components/dialogs/ObjectStoreForm.tsx
index 61b6bd70b..c53ffc78f 100644
--- a/app/components/dialogs/ObjectStoreForm.tsx
+++ b/app/components/dialogs/ObjectStoreForm.tsx
@@ -303,22 +303,29 @@ class ObjectStoreForm extends React.Component<Props, State> {
onChange={handleInputChange}
value={state.endpointURL}
/>
+ {state.cloudErrorId && (
+ <FormHelperText>{i18n.t('core:missingId')}</FormHelperText>
+ )}
</FormControl>
</Grid>
- <Grid item xs={12}>
- <FormControl fullWidth={true}>
- <InputLabel htmlFor="newuuid">{i18n.t('core:uuid')}</InputLabel>
- <Input
- margin="dense"
- name="newuuid"
- fullWidth={true}
- data-tid="newuuid"
- placeholder="Advanced setting"
- onChange={handleInputChange}
- value={state.newuuid}
- />
- </FormControl>
- </Grid>
+ {state.newuuid && (
+ <Grid item xs={12}>
+ <FormControl fullWidth={true}>
+ <InputLabel htmlFor="newuuid">
+ {i18n.t('core:locationId')}
+ </InputLabel>
+ <Input
+ margin="dense"
+ name="newuuid"
+ fullWidth={true}
+ data-tid="newuuid"
+ placeholder="Advanced setting"
+ onChange={handleInputChange}
+ value={state.newuuid}
+ />
+ </FormControl>
+ </Grid>
+ )}
</Grid>
);
}
diff --git a/app/locales/en/core.json b/app/locales/en/core.json
index c0225ef49..74cf85d91 100644
--- a/app/locales/en/core.json
+++ b/app/locales/en/core.json
@@ -465,6 +465,7 @@
"noFileButFoldersFound": "Some folders found! Turn on the folder visibility from the perspective's toolbar to view them.",
"selectTags": "Select tags",
"location": "Location",
+ "locationId": "Location ID",
"folder": "Folder",
"globalSearch": "Global",
"objectStorage": "Object Storage (Amazon S3, Minio)",
diff --git a/app/reducers/app.ts b/app/reducers/app.ts
index 66f750500..134293988 100644
--- a/app/reducers/app.ts
+++ b/app/reducers/app.ts
@@ -615,7 +615,7 @@ export default (state: any = initialState, action: any) => {
};
} */
case types.CLOSE_ALL_FILES: {
- window.history.pushState('', document.title, window.location.pathname);
+ clearURLParam('tsepath');
return {
...state,
openedFiles: [],
@@ -952,7 +952,13 @@ export const actions = {
directoryPath: string,
directoryContent: Array<Object>,
directoryMeta?: FileSystemEntryMeta
- ) => (dispatch: (actions: Object) => void) => {
+ ) => (dispatch: (actions: Object) => void, getState: () => any) => {
+ const currentLocation: Location = getLocation(
+ getState(),
+ getState().app.currentLocationId
+ );
+ updateHistory(currentLocation, directoryPath);
+
dispatch(actions.hideNotifications());
dispatch(
actions.loadDirectorySuccessInt(
@@ -1326,7 +1332,9 @@ export const actions = {
);
dispatch(actions.setReadOnlyMode(location.isReadOnly || false));
dispatch(actions.changeLocation(location));
- dispatch(actions.loadDirectoryContent(location.paths[0]));
+ dispatch(
+ actions.loadDirectoryContent(location.path || location.paths[0])
+ );
return true;
})
.catch(() => {
@@ -1343,9 +1351,15 @@ export const actions = {
PlatformIO.disableObjectStoreSupport();
dispatch(actions.setReadOnlyMode(location.isReadOnly || false));
dispatch(actions.changeLocation(location));
- dispatch(actions.loadDirectoryContent(location.paths[0]));
+ dispatch(
+ actions.loadDirectoryContent(location.path || location.paths[0])
+ );
if (Pro && Pro.Watcher && location.watchForChanges) {
- Pro.Watcher.watchFolder(location.paths[0], dispatch, actions);
+ Pro.Watcher.watchFolder(
+ location.path || location.paths[0],
+ dispatch,
+ actions
+ );
}
}
},
@@ -1366,6 +1380,7 @@ export const actions = {
Pro.Watcher.stopWatching();
}
}
+ clearAllURLParams();
return true;
});
}
@@ -1463,12 +1478,6 @@ export const actions = {
dispatch: (actions: Object) => void,
getState: () => any
) => {
- const currentLocation: Location = getLocation(
- getState(),
- getState().app.currentLocationId
- );
- // const isCloudLocation = currentLocation.type === locationType.TYPE_CLOUD;
-
let entryForOpening: OpenedEntry;
const { openedFiles } = getState().app;
/**
@@ -1513,18 +1522,12 @@ export const actions = {
if (fsEntry.isNewFile) {
entryForOpening.editMode = true;
}
- const localePar = getURLParameter(fsEntry.path);
- let startPar = '?open=' + encodeURIComponent(fsEntry.path);
-
- if (currentLocation && currentLocation.uuid) {
- startPar += '&lid=' + currentLocation.uuid;
- }
-
- if (localePar && localePar.length > 1) {
- startPar += '&locale=' + localePar;
- }
-
- window.history.pushState('', document.title, startPar);
+ const currentLocation: Location = getLocation(
+ getState(),
+ getState().app.currentLocationId
+ );
+ const { currentDirectoryPath } = getState().app;
+ updateHistory(currentLocation, currentDirectoryPath, fsEntry.path);
dispatch(actions.addToEntryContainer(entryForOpening));
},
@@ -1767,9 +1770,104 @@ export const actions = {
openFileNatively: (selectedFile: string) => () => {
PlatformIO.openFile(selectedFile);
},
- openLink: (url: string) => (dispatch: (actions: Object) => void) => {
- const decodedURI = decodeURIComponent(url);
- if (
+ openLink: (url: string) => (
+ dispatch: (actions: Object) => void,
+ getState: () => any
+ ) => {
+ const decodedURI = decodeURI(url);
+ // if openfile and location.id open location.path + relative entry.path
+ const lid = getURLParameter('tslid', url);
+ const dPath = getURLParameter('tsdpath', url);
+ const ePath = getURLParameter('tsepath', url);
+ const cmdOpen = getURLParameter('cmdopen', url);
+ if (cmdOpen && cmdOpen.length > 0) {
+ const entryPath = decodeURIComponent(cmdOpen);
+ getAllPropertiesPromise(entryPath)
+ .then((fsEntry: FileSystemEntry) => {
+ if (fsEntry.isFile) {
+ dispatch(actions.openFsEntry(fsEntry));
+ } else {
+ dispatch(actions.loadDirectoryContent(fsEntry.path));
+ }
+ return true;
+ })
+ .catch(() =>
+ dispatch(
+ actions.showNotification(
+ i18n.t('missing file or folder'),
+ 'warning',
+ true
+ )
+ )
+ );
+ } else if (lid && lid.length > 0) {
+ const locationId = decodeURIComponent(lid);
+ const directoryPath = decodeURIComponent(dPath);
+ const entryPath = decodeURIComponent(ePath);
+ const targetLocation: Location = getLocation(getState(), locationId);
+ if (targetLocation) {
+ dispatch(actions.openLocation(targetLocation));
+ const isCloudLocation = targetLocation.type === locationType.TYPE_CLOUD;
+
+ setTimeout(() => {
+ if (isCloudLocation) {
+ if (directoryPath) {
+ const dirFullPath = directoryPath;
+ dispatch(actions.loadDirectoryContent(dirFullPath));
+ }
+
+ if (entryPath) {
+ getAllPropertiesPromise(entryPath)
+ .then((fsEntry: FileSystemEntry) => {
+ if (fsEntry) {
+ dispatch(actions.openFsEntry(fsEntry));
+ }
+ return true;
+ })
+ .catch(() =>
+ dispatch(
+ actions.showNotification(
+ i18n.t('missing file or folder'),
+ 'warning',
+ true
+ )
+ )
+ );
+ }
+ } else {
+ let locationPath = '';
+ if (targetLocation && targetLocation.path) {
+ locationPath = targetLocation.path;
+ }
+ if (directoryPath) {
+ const dirFullPath = locationPath + '/' + directoryPath;
+ dispatch(actions.loadDirectoryContent(dirFullPath));
+ }
+
+ if (entryPath) {
+ const entryFullPath = locationPath + '/' + entryPath; // TODO dir sep
+ getAllPropertiesPromise(entryFullPath)
+ .then((fsEntry: FileSystemEntry) => {
+ if (fsEntry) {
+ dispatch(actions.openFsEntry(fsEntry));
+ }
+ return true;
+ })
+ .catch(() =>
+ dispatch(
+ actions.showNotification(
+ i18n.t('missing file or folder'),
+ 'warning',
+ true
+ )
+ )
+ );
+ }
+ }
+ }, 2000);
+ }
+ } else if (
+ // External URL case
decodedURI.startsWith('http://') ||
decodedURI.startsWith('https://') ||
decodedURI.startsWith('file://')
@@ -1799,6 +1897,61 @@ export const actions = {
}
};
+function clearAllURLParams() {
+ window.history.pushState('', document.title, window.location.pathname);
+ console.log(window.location.href);
+}
+
+function clearURLParam(paramName) {
+ const url = new URL(window.location.href);
+ const params = new URLSearchParams(url.search);
+
+ // Delete the foo parameter.
+ params.delete(paramName);
+ window.history.pushState(
+ '',
+ document.title,
+ window.location.pathname + '?' + params
+ );
+ console.log(window.location.href);
+}
+
+/*
+ cmdopen - open file or folder as cmd parameter
+ tslid - location id
+ tsdpath - folder path
+ tsepath - entry path
+ tspersp - folder perspective
+*/
+function updateHistory(
+ currentLocation: Location,
+ currentDirectory: string,
+ entryPath?: string
+) {
+ // const isCloudLocation = currentLocation.type === locationType.TYPE_CLOUD;
+ let urlParams = '?';
+
+ if (currentLocation && currentLocation.uuid) {
+ urlParams += 'tslid=' + encodeURIComponent(currentLocation.uuid);
+ }
+
+ if (currentDirectory && currentDirectory.length > 0) {
+ urlParams += '&tsdpath=' + encodeURIComponent(currentDirectory);
+ }
+
+ if (entryPath && entryPath.length > 0) {
+ urlParams += '&tsepath=' + encodeURIComponent(entryPath);
+ }
+
+ const localePar = getURLParameter('locale');
+ if (localePar && localePar.length > 1) {
+ urlParams += '&locale=' + localePar;
+ }
+
+ window.history.pushState('', document.title, urlParams);
+ console.log(window.location.href);
+}
+
function prepareDirectoryContent(
dirEntries,
directoryPath,
@@ -2022,12 +2175,17 @@ export const getCurrentLocationPath = (state: any) => {
state.app.currentLocationId &&
location.uuid === state.app.currentLocationId
) {
- if (AppConfig.isElectron && location.paths[0].startsWith('./')) {
+ const locationPath = location.path || location.paths[0];
+ if (
+ AppConfig.isElectron &&
+ locationPath &&
+ locationPath.startsWith('./')
+ ) {
// TODO test relative path (Directory Back) with other platforms
// relative paths
- return pathLib.resolve(location.paths[0]);
+ return pathLib.resolve(locationPath);
}
- return location.paths[0];
+ return locationPath;
}
}
}
diff --git a/app/reducers/location-index.ts b/app/reducers/location-index.ts
index c2889317e..635ed87fb 100644
--- a/app/reducers/location-index.ts
+++ b/app/reducers/location-index.ts
@@ -216,7 +216,7 @@ export const actions = {
const allLocations = getLocations(state);
const locationPaths = [];
allLocations.forEach(location => {
- locationPaths.push(location.paths[0]);
+ locationPaths.push(location.path || location.paths[0]);
});
const result = locationPaths.reduce(
(accumulatorPromise, nextPath) =>
@@ -323,7 +323,7 @@ export const actions = {
searchQuery.forceIndexing ||
indexAge > AppConfig.maxIndexAge
) {
- const currentPath = currentLocation.paths[0];
+ const currentPath = currentLocation.path || currentLocation.paths[0];
console.log('Start creating index for : ' + currentPath);
if (currentLocation.persistIndex && Pro && Pro.Indexer.loadIndex) {
GlobalSearch.index = await Pro.Indexer.loadIndex(
@@ -415,7 +415,7 @@ export const actions = {
Promise.resolve();
return true;
}
- const nextPath = location.paths[0];
+ const nextPath = location.path || location.paths[0];
let directoryIndex = [];
let hasIndex = false;
const isCloudLocation = location.type === locationType.TYPE_CLOUD;
diff --git a/app/reducers/locations.ts b/app/reducers/locations.ts
index 86f9c3ad2..175ffe60d 100644
--- a/app/reducers/locations.ts
+++ b/app/reducers/locations.ts
@@ -43,7 +43,7 @@ export type Location = {
secretAccessKey?: string;
bucketName?: string;
region?: string;
- paths: Array<string>;
+ paths?: Array<string>; // deprecated
path?: string;
endpointURL?: string;
children?: Array<any>;
diff --git a/scripts/extconfig.js b/scripts/extconfig.js
index da49f04dc..fce94d537 100644
--- a/scripts/extconfig.js
+++ b/scripts/extconfig.js
@@ -12,7 +12,7 @@ window.ExtLocations = [
uuid: '30565f09-c7fd-2333-fc67-a75db27rt5ba', // an inique id of the location
type: '0', // 1 defines the locations a cloud based
name: 'supported-filestypes', // the name of the location
- paths: ['./testdata-tmp/file-structure/supported-filestypes'], // the path to sub folder in the location
+ path: './testdata-tmp/file-structure/supported-filestypes', // the path to sub folder in the location
// accessKeyId: 'your_access_key', // the access key of the user
// secretAccessKey: 'your_secret_key', // the secret case of the user
// bucketName: 'demo-bucket', // the name of the S3 bucket