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63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
import { translate } from 'i18n-calypso';

enum InfoTypes {
	Text = 'Text',
	Link = 'Link',
	UnorderedList = 'UnorderedList',
	OrderedList = 'OrderedList',
	Line = 'Line',
}

export interface Text {
	type: InfoTypes.Text;
	text: string;
}

export interface Link {
	type: InfoTypes.Link;
	text: string;
	link: string;
}

export interface UnorderedList {
	type: InfoTypes.UnorderedList;
	items: string[];
}

export interface OrderedList {
	type: InfoTypes.OrderedList;
	items: string[];
}

export interface Line {
	type: InfoTypes.Line;
}

export type Info = Text | Link | UnorderedList | OrderedList | Line;

export type InfoSplit = {
	ftp: Info[];
	sftp: Info[];
};

export const infoIsSplit = ( info: InfoSplit | Info[] ): info is InfoSplit =>
	!! ( info as InfoSplit ).ftp && !! ( info as InfoSplit ).sftp;

export const infoIsText = ( info: Info ): info is Text => info.type === InfoTypes.Text;
export const infoIsLink = ( info: Info ): info is Link => info.type === InfoTypes.Link;
export const infoIsUnorderedList = ( info: Info ): info is UnorderedList =>
	info.type === InfoTypes.UnorderedList;
export const infoIsOrderedList = ( info: Info ): info is OrderedList =>
	info.type === InfoTypes.OrderedList;
export const infoIsLine = ( info: Info ): info is Line => info.type === InfoTypes.Line;

export interface Host {
	id: string;
	name: string;
	supportLink?: string;
	credentialLinks?: {
		ftp?: string;
		sftp?: string;
	};
	defaultPort?: {
		ftp?: number;
		sftp?: number;
	};
	inline?: {
		protocol?: InfoSplit | Info[];
		host?: InfoSplit | Info[];
		port?: InfoSplit | Info[];
		path?: InfoSplit | Info[];
		user?: InfoSplit | Info[];
		pass?: InfoSplit | Info[];
		kpri?: InfoSplit | Info[];
		mode?: InfoSplit | Info[];
	};
}

export const topHosts: Host[] = [
	{
		id: 'amazon',
		name: 'Amazon / AWS',
		// supportLink: '',
		credentialLinks: {
			sftp: 'https://docs.aws.amazon.com/transfer/latest/userguide/create-server-sftp.html ',
		},
	},
	{
		id: 'bluehost',
		name: 'Bluehost',
		inline: {
			protocol: {
				ftp: [
					{
						type: InfoTypes.UnorderedList,
						items: [
							translate(
								'FTP (File Transfer Protocol): the original standard for transferring files between servers.'
							),
							translate(
								'SFTP (Secure File Transfer Protocol): is like FTP, but adds a layer of security (SSH encryption).'
							),
							translate(
								'SFTP/SSH is the preferred method to choose. Both methods are supported by Bluehost.'
							),
						],
					},

					{
						type: InfoTypes.Line,
					},
					{
						type: InfoTypes.Link,
						text: translate( 'Read more' ),
						link: 'https://my.bluehost.com/cgi/help/ftpaccounts',
					},
				],
				sftp: [
					{
						type: InfoTypes.UnorderedList,
						items: [
							translate(
								'FTP (File Transfer Protocol): the original standard for transferring files between servers.'
							),
							translate(
								'SFTP (Secure File Transfer Protocol): is like FTP, but adds a layer of security (SSH encryption).'
							),
							translate(
								'SFTP/SSH is the preferred method to choose. Both methods are supported by Bluehost.'
							),
						],
					},

					{
						type: InfoTypes.Line,
					},
					{
						type: InfoTypes.Link,
						text: translate( 'Read more' ),
						link: 'https://www.bluehost.com/help/article/ssh-access',
					},
				],
			},
			host: [
				{
					type: InfoTypes.Text,
					text: translate(
						'Your Domain Name or server IP address. Both are available from the Bluehost cPanel.'
					),
				},
				{
					type: InfoTypes.Line,
				},
				{
					type: InfoTypes.Link,
					text: translate( 'Visit my Bluehost cPanel' ),
					link: 'https://my.bluehost.com/cgi-bin/cplogin',
				},
			],
			port: {
				ftp: [
					{
						type: InfoTypes.Text,
						text: translate( 'Enter port 21 for Bluehost’s FTP service.' ),
					},
				],
				sftp: [
					{
						type: InfoTypes.Text,
						text: translate(
							'Port 2222 would be used for Bluehost shared and reseller accounts. 22 is the default for Bluehost dedicated & VPS accounts.'
						),
					},
				],
			},
			user: {
				ftp: [
					{
						type: InfoTypes.OrderedList,
						items: [
							translate( 'Login to your Bluehost cPanel' ),
							translate( 'Click the "Advanced" tab towards the left side of the account.' ),
							translate(
								'Choose FTP from the sub-menu, or click the FTP Accounts icon from the Files section.'
							),
							translate( 'Create a new FTP account' ),
						],
					},
					{
						type: InfoTypes.Text,
						text: translate(
							'Your Bluehost username will end with your domain (e.g. test@example.com).'
						),
					},
					{
						type: InfoTypes.Line,
					},
					{
						type: InfoTypes.Link,
						text: translate( 'Visit my Bluehost cPanel' ),
						link: 'https://my.bluehost.com/cgi-bin/cplogin',
					},
				],
				sftp: [
					{
						type: InfoTypes.Text,
						text: translate( 'For Bluehost VPS and dedicated servers, the login will be `root`.' ),
					},
					{
						type: InfoTypes.Text,
						text: translate(
							'If you enable shell access for individual cPanels, the SSH username and password would be the same as the cPanel username and password for those accounts.'
						),
					},
				],
			},
			pass: {
				ftp: [
					{
						type: InfoTypes.OrderedList,
						items: [
							translate( 'Login to your Bluehost cPanel' ),
							translate( 'Click the "Advanced" tab towards the left side of the account.' ),
							translate(
								'Choose FTP from the sub-menu, or click the FTP Accounts icon from the Files section.'
							),
							translate( 'Create a new FTP account' ),
						],
					},
					{
						type: InfoTypes.Text,
						text: translate( 'Your Bluehost FTP password is chosen by you using the tools above.' ),
					},
					{
						type: InfoTypes.Line,
					},
					{
						type: InfoTypes.Link,
						text: translate( 'Visit my Bluehost cPanel' ),
						link: 'https://my.bluehost.com/cgi-bin/cplogin',
					},
				],
				sftp: [
					{
						type: InfoTypes.Text,
						text: translate(
							'If you enable shell access for individual cPanels, the SSH username and password would be the same as the cPanel username and password for those accounts.'
						),
					},
					{
						type: InfoTypes.Line,
					},
					{
						type: InfoTypes.Link,
						text: translate( 'Visit my Bluehost cPanel' ),
						link: 'https://my.bluehost.com/cgi-bin/cplogin',
					},
				],
			},
			mode: [
				{
					type: InfoTypes.Text,
					text: translate(
						'The majority of Bluehost accounts require private key authentication. Bluehost VPS and Dedicated Servers also allow for username and password authentication as secondary option.'
					),
				},
				{
					type: InfoTypes.Line,
				},
				{
					type: InfoTypes.Link,
					text: translate( 'Read more' ),
					link: 'https://www.bluehost.com/help/article/ssh-access',
				},
			],
			kpri: [
				{
					type: InfoTypes.OrderedList,
					items: [
						translate( 'Login to your Bluehost cPanel' ),
						translate( 'Click the "Advanced" tab towards the left side of the account.' ),
						translate( 'Click the Shell Access icon under the Security section.' ),
						translate( 'Click the Manage SSH Keys button' ),
						translate( 'Choose generate a new key and complete the form' ),
					],
				},
				{
					type: InfoTypes.Line,
				},
				{
					type: InfoTypes.Link,
					text: translate( 'Visit my Bluehost cPanel' ),
					link: 'https://my.bluehost.com/cgi-bin/cplogin',
				},
			],
		},
	},
	{
		id: 'dreamhost',
		name: 'Dreamhost',
		supportLink: 'https://www.dreamhost.com/support/',
		credentialLinks: {
			ftp: 'https://help.dreamhost.com/hc/en-us/articles/115000675027-FTP-overview-and-credentials',
			sftp: 'https://help.dreamhost.com/hc/en-us/articles/216385837-Enabling-Shell-access',
		},
	},
	{
		id: 'godaddy',
		name: 'GoDaddy',
		supportLink: 'https://www.godaddy.com/help',
		credentialLinks: {
			sftp: 'https://www.godaddy.com/help/enable-ssh-4942',
		},
	},
	{
		id: 'hostgator',
		name: 'HostGator',
		supportLink: 'https://www.hostgator.com/help',
		credentialLinks: {
			ftp: 'https://www.hostgator.com/help/article/ftp-getting-started',
			sftp: 'https://www.hostgator.com/help/article/how-do-i-start-using-ssl-with-ftp',
		},
	},
	{
		id: 'siteground',
		name: 'Siteground',
		supportLink: 'https://www.siteground.com/kb/category/website/',
		credentialLinks: {
			ftp: 'https://www.siteground.com/kb/establish-ftp-connection-hosting-account/',
		},
	},
	{
		id: 'pressable',
		name: 'Pressable',
		supportLink: 'https://pressable.com/knowledgebase/connect-to-ssh-on-pressable/',
	},
];

export const otherHosts: Host[] = [
	{
		id: 'generic',
		name: 'Other',
		supportLink: 'https://jetpack.com/support/activating-jetpack-backups/',
	},
	{
		id: 'land1',
		name: '1&1',
	},
	{
		id: 'digitalocean',
		name: 'DigitalOcean',
	},

	{
		id: 'flywheel',
		name: 'Flywheel',
	},
	{
		id: 'hostinger',
		name: 'Hostinger',
	},
	{
		id: 'hostmonster',
		name: 'HostMonster',
	},
	{
		id: 'inmotion',
		name: 'InMotion Hosting',
	},
	{
		id: 'ipage',
		name: 'iPage',
	},
	{
		id: 'justhost',
		name: 'Just Host',
	},
	{
		id: 'kinsta',
		name: 'Kinsta',
	},
	{
		id: 'liquidweb',
		name: 'Liquid Web',
	},
	{
		id: 'mediatemple',
		name: 'Media Temple',
	},
	{
		id: 'namecheap',
		name: 'Namecheap',
	},
	{
		id: 'ovh',
		name: 'OVH',
	},
	{
		id: 'pagely',
		name: 'Pagely',
	},
	{
		id: 'pressable',
		name: 'Pressable',
	},
	{
		id: 'wpengine',
		name: 'WPEngine',
	},
	{
		id: 'jurassic_ninja',
		name: 'Jurassic Ninja',
	},
];

export const getProviderNameFromId = ( searchId?: string ): string | null => {
	for ( const host of topHosts ) {
		if ( host.id === searchId ) {
			return host.name;
		}
	}
	for ( const host of otherHosts ) {
		if ( host.id === searchId ) {
			return host.name;
		}
	}
	return null;
};

export const getHostInfoFromId = ( searchId?: string ): Host | null => {
	for ( const host of topHosts ) {
		if ( host.id === searchId ) {
			return host;
		}
	}
	for ( const host of otherHosts ) {
		if ( host.id === searchId ) {
			return host;
		}
	}
	return null;
};