expect(map['Username']).to.equal(activeUser.user.username);
expect(map['Port']).to.equal(port);
expect(map['Hostname']).to.equal(host);
+ expect(map['Path']).to.equal(`/c=${testCollection.uuid}`);
});
})
.then(() => cy.task('clearDownload', { filename }));
import { ServiceRepository } from "~/services/services";
import { dialogActions } from '~/store/dialog/dialog-actions';
import { getNewExtraToken } from "../auth/auth-action";
+import { CollectionResource } from "~/models/collection";
export const COLLECTION_WEBDAV_S3_DIALOG_NAME = 'collectionWebdavS3Dialog';
localCluster: string;
username: string;
activeTab: number;
- collectionName?: string;
+ collectionName: string;
setActiveTab: (event: any, tabNr: number) => void;
}
localCluster: getState().auth.localCluster,
username: getState().auth.user!.username,
activeTab: activeTab || 0,
- collectionName: (getState().collectionPanel.item || {} as any).name,
+ collectionName: (getState().resources[uuid] as CollectionResource).name,
setActiveTab: (event: any, tabNr: number) => dispatch<any>(openWebDavS3InfoDialog(uuid, tabNr)),
uuid
}
);
}
+const isValidIpAddress = (ipAddress: string): Boolean => {
+ console.log(ipAddress);
+ if (/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(ipAddress)) {
+ return true;
+ }
+
+ return false;
+};
+
const mountainduckTemplate = ({
uuid,
username,
cyberDavStr,
collectionsUrl
-}: any) => `<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
- <dict>
- <key>Protocol</key>
- <string>davs</string>
- <key>Provider</key>
- <string>iterate GmbH</string>
- <key>UUID</key>
- <string>${uuid}</string>
- <key>Hostname</key>
- <string>${collectionsUrl.replace('https://', ``).replace('*', uuid).split(':')[0]}</string>
- <key>Port</key>
- <string>${(cyberDavStr.split(':')[2] || '443').split('/')[0]}</string>
- <key>Username</key>
- <string>${username}</string>
- <key>Labels</key>
- <array>
- </array>
- </dict>
-</plist>
-`.split(/\r?\n/).join('\n');
+}: any) => {
+
+ return `<?xml version="1.0" encoding="UTF-8"?>
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+ <plist version="1.0">
+ <dict>
+ <key>Protocol</key>
+ <string>davs</string>
+ <key>Provider</key>
+ <string>iterate GmbH</string>
+ <key>UUID</key>
+ <string>${uuid}</string>
+ <key>Hostname</key>
+ <string>${collectionsUrl.replace('https://', ``).replace('*', uuid).split(':')[0]}</string>
+ <key>Port</key>
+ <string>${(cyberDavStr.split(':')[2] || '443').split('/')[0]}</string>
+ <key>Username</key>
+ <string>${username}</string>${isValidIpAddress(collectionsUrl.replace('https://', ``).split(':')[0])?
+ `
+ <key>Path</key>
+ <string>/c=${uuid}</string>` : ''}
+ <key>Labels</key>
+ <array>
+ </array>
+ </dict>
+ </plist>`.split(/\r?\n/).join('\n');
+};
const downloadMountainduckFileHandler = (filename: string, text: string) => {
const element = document.createElement('a');
color='primary'
size='small'>
<DownloadIcon />
- Download config
+ Download Cyber/Mountain Duck bookmark
</Button>
<h3>Gnome</h3>