Move storage location definitions into common location in client.js

This commit is contained in:
Johannes Zellner
2022-09-27 13:31:13 +02:00
parent febb291421
commit 74f769f65d
5 changed files with 176 additions and 359 deletions

View File

@@ -9,125 +9,24 @@
/* global Chart */
/* global Clipboard */
/* global SECRET_PLACEHOLDER */
/* global APP_TYPES */
/* global APP_TYPES, STORAGE_PROVIDER, BACKUP_FORMATS */
/* global REGIONS_S3, REGIONS_WASABI, REGIONS_DIGITALOCEAN, REGIONS_EXOSCALE, REGIONS_SCALEWAY, REGIONS_LINODE, REGIONS_OVH, REGIONS_IONOS, REGIONS_UPCLOUD, REGIONS_VULTR */
angular.module('Application').controller('AppController', ['$scope', '$location', '$translate', '$timeout', '$interval', '$route', '$routeParams', 'Client', function ($scope, $location, $translate, $timeout, $interval, $route, $routeParams, Client) {
// List is from http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region
$scope.s3Regions = [
{ name: 'Asia Pacific (Mumbai)', value: 'ap-south-1' },
{ name: 'Asia Pacific (Osaka-Local)', value: 'ap-northeast-3' },
{ name: 'Asia Pacific (Seoul)', value: 'ap-northeast-2' },
{ name: 'Asia Pacific (Singapore)', value: 'ap-southeast-1' },
{ name: 'Asia Pacific (Sydney)', value: 'ap-southeast-2' },
{ name: 'Asia Pacific (Tokyo)', value: 'ap-northeast-1' },
{ name: 'Canada (Central)', value: 'ca-central-1' },
{ name: 'China (Beijing)', value: 'cn-north-1' },
{ name: 'China (Ningxia)', value: 'cn-northwest-1' },
{ name: 'EU (Frankfurt)', value: 'eu-central-1' },
{ name: 'EU (Ireland)', value: 'eu-west-1' },
{ name: 'EU (London)', value: 'eu-west-2' },
{ name: 'EU (Paris)', value: 'eu-west-3' },
{ name: 'EU (Stockholm)', value: 'eu-north-1' },
{ name: 'South America (São Paulo)', value: 'sa-east-1' },
{ name: 'US East (N. Virginia)', value: 'us-east-1' },
{ name: 'US East (Ohio)', value: 'us-east-2' },
{ name: 'US West (N. California)', value: 'us-west-1' },
{ name: 'US West (Oregon)', value: 'us-west-2' },
];
$scope.s3Regions = REGIONS_S3;
$scope.wasabiRegions = REGIONS_WASABI;
$scope.doSpacesRegions = REGIONS_DIGITALOCEAN;
$scope.exoscaleSosRegions = REGIONS_EXOSCALE;
$scope.scalewayRegions = REGIONS_SCALEWAY;
$scope.linodeRegions = REGIONS_LINODE;
$scope.ovhRegions = REGIONS_OVH;
$scope.ionosRegions = REGIONS_IONOS;
$scope.upcloudRegions = REGIONS_UPCLOUD;
$scope.vultrRegions = REGIONS_VULTR;
$scope.wasabiRegions = [
{ name: 'Amsterdam (EU Central 1)', value: 'https://s3.eu-central-1.wasabisys.com' },
{ name: 'Frankfurt (EU Central 2)', value: 'https://s3.eu-central-2.wasabisys.com' },
{ name: 'London (EU West 1)', value: 'https://s3.eu-west-1.wasabisys.com' },
{ name: 'Oregon (US West 1)', value: 'https://s3.us-west-1.wasabisys.com' },
{ name: 'Osaka (AP Northeast 2)', value: 'https://s3.ap-northeast-2.wasabisys.com' },
{ name: 'Paris (EU West 2)', value: 'https://s3.eu-west-2.wasabisys.com' },
{ name: 'Plano (US Central 1)', value: 'https://s3.us-central-1.wasabisys.com' },
{ name: 'Singapore (AP Southeast 1)', value: 'https://s3.ap-southeast-1.wasabisys.com' },
{ name: 'Sydney (AP Southeast 2)', value: 'https://s3.ap-southeast-2.wasabisys.com' },
{ name: 'Tokyo (AP Northeast 1)', value: 'https://s3.ap-northeast-1.wasabisys.com' },
{ name: 'Toronto (CA Central 1)', value: 'https://s3.ca-central-1.wasabisys.com' },
{ name: 'Virginia (US East 1)', value: 'https://s3.us-east-1.wasabisys.com' },
{ name: 'Virginia (US East 2)', value: 'https://s3.us-east-2.wasabisys.com' }
];
$scope.storageProvider = STORAGE_PROVIDER;
$scope.doSpacesRegions = [
{ name: 'AMS3', value: 'https://ams3.digitaloceanspaces.com' },
{ name: 'FRA1', value: 'https://fra1.digitaloceanspaces.com' },
{ name: 'NYC3', value: 'https://nyc3.digitaloceanspaces.com' },
{ name: 'SFO2', value: 'https://sfo2.digitaloceanspaces.com' },
{ name: 'SFO3', value: 'https://sfo3.digitaloceanspaces.com' },
{ name: 'SGP1', value: 'https://sgp1.digitaloceanspaces.com' }
];
$scope.exoscaleSosRegions = [
{ name: 'AT-VIE-1', value: 'https://sos-at-vie-1.exo.io' },
{ name: 'CH-DK-2', value: 'https://sos-ch-dk-2.exo.io' },
{ name: 'CH-GVA-2', value: 'https://sos-ch-gva-2.exo.io' },
{ name: 'DE-FRA-1', value: 'https://sos-de-fra-1.exo.io' },
];
// https://www.scaleway.com/docs/object-storage-feature/
$scope.scalewayRegions = [
{ name: 'FR-PAR', value: 'https://s3.fr-par.scw.cloud', region: 'fr-par' }, // default
{ name: 'NL-AMS', value: 'https://s3.nl-ams.scw.cloud', region: 'nl-ams' }
];
$scope.linodeRegions = [
{ name: 'Newark', value: 'us-east-1.linodeobjects.com', region: 'us-east-1' }, // default
{ name: 'Frankfurt', value: 'eu-central-1.linodeobjects.com', region: 'us-east-1' },
{ name: 'Singapore', value: 'ap-south-1.linodeobjects.com', region: 'us-east-1' },
];
// note: ovh also has a storage endpoint but that only supports path style access
$scope.ovhRegions = [
{ name: 'Beauharnois (BHS)', value: 'https://s3.bhs.cloud.ovh.net', region: 'bhs' }, // default
{ name: 'Frankfurt (DE)', value: 'https://s3.de.cloud.ovh.net', region: 'de' },
{ name: 'Gravelines (GRA)', value: 'https://s3.gra.cloud.ovh.net', region: 'gra' },
{ name: 'Strasbourg (SBG)', value: 'https://s3.sbg.cloud.ovh.net', region: 'sbg' },
{ name: 'London (UK)', value: 'https://s3.uk.cloud.ovh.net', region: 'uk' },
{ name: 'Sydney (SYD)', value: 'https://s3.syd.cloud.ovh.net', region: 'syd' },
{ name: 'Warsaw (WAW)', value: 'https://s3.waw.cloud.ovh.net', region: 'waw' },
];
// https://devops.ionos.com/api/s3/
$scope.ionosRegions = [
{ name: 'DE', value: 'https://s3-de-central.profitbricks.com', region: 's3-de-central' }, // default
];
$scope.vultrRegions = [
{ name: 'New Jersey', value: 'https://ewr1.vultrobjects.com', region: 'us-east-1' }, // default
];
$scope.storageProvider = [
{ name: 'Amazon S3', value: 's3' },
{ name: 'Backblaze B2 (S3 API)', value: 'backblaze-b2' },
{ name: 'CIFS Mount', value: 'cifs' },
{ name: 'DigitalOcean Spaces', value: 'digitalocean-spaces' },
{ name: 'Exoscale SOS', value: 'exoscale-sos' },
// { name: 'EXT4', value: 'ext4' },
{ name: 'Filesystem', value: 'filesystem' },
// { name: 'Filesystem (Mountpoint)', value: 'mountpoint' },
{ name: 'Google Cloud Storage', value: 'gcs' },
{ name: 'IONOS (Profitbricks)', value: 'ionos-objectstorage' },
{ name: 'Linode Object Storage', value: 'linode-objectstorage' },
{ name: 'Minio', value: 'minio' },
{ name: 'NFS Mount', value: 'nfs' },
{ name: 'OVH Object Storage', value: 'ovh-objectstorage' },
{ name: 'S3 API Compatible (v4)', value: 's3-v4-compat' },
{ name: 'Scaleway Object Storage', value: 'scaleway-objectstorage' },
{ name: 'SSHFS Mount', value: 'sshfs' },
{ name: 'UpCloud Object Storage', value: 'upcloud-objectstorage' },
{ name: 'Vultr Object Storage', value: 'vultr-objectstorage' },
// { name: 'No-op (Only for testing)', value: 'noop' },
{ name: 'Wasabi', value: 'wasabi' }
// { name: 'XFS', value: 'xfs' }
];
$scope.formats = [
{ name: 'Tarball (zipped)', value: 'tgz' },
{ name: 'rsync', value: 'rsync' }
];
$scope.formats = BACKUP_FORMATS;
// Avoid full reload on path change
// https://stackoverflow.com/a/22614334