2021-08-18 10:44:46 +00:00
|
|
|
import 'package:easy_localization/easy_localization.dart';
|
2022-05-30 13:49:42 +00:00
|
|
|
import 'package:flutter/material.dart';
|
2021-08-18 10:44:46 +00:00
|
|
|
import 'package:selfprivacy/ui/components/brand_icons/brand_icons.dart';
|
|
|
|
|
2022-05-26 01:02:06 +00:00
|
|
|
enum LoadingStatus {
|
|
|
|
uninitialized,
|
|
|
|
refreshing,
|
|
|
|
success,
|
|
|
|
error,
|
|
|
|
}
|
|
|
|
|
2021-01-08 12:37:28 +00:00
|
|
|
enum InitializingSteps {
|
2022-02-16 07:28:29 +00:00
|
|
|
setHetznerKey,
|
2021-01-08 12:37:28 +00:00
|
|
|
setCloudFlareKey,
|
|
|
|
setDomainName,
|
|
|
|
setRootUser,
|
|
|
|
createServer,
|
|
|
|
checkCloudFlareDns,
|
|
|
|
startServer,
|
|
|
|
checkSystemDnsAndDkimSet,
|
|
|
|
}
|
2022-05-16 20:30:14 +00:00
|
|
|
|
2022-09-16 08:07:37 +00:00
|
|
|
enum Period {
|
|
|
|
hour,
|
|
|
|
day,
|
|
|
|
month;
|
|
|
|
|
|
|
|
int get stepPeriodInSeconds {
|
|
|
|
switch (this) {
|
|
|
|
case Period.hour:
|
|
|
|
return 18;
|
|
|
|
case Period.day:
|
|
|
|
return 432;
|
|
|
|
case Period.month:
|
|
|
|
return 6480;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-04-10 03:04:23 +00:00
|
|
|
|
2021-08-18 10:44:46 +00:00
|
|
|
enum ServiceTypes {
|
2022-08-29 20:35:06 +00:00
|
|
|
mailserver,
|
|
|
|
bitwarden,
|
|
|
|
jitsi,
|
|
|
|
nextcloud,
|
|
|
|
pleroma,
|
|
|
|
gitea,
|
|
|
|
ocserv,
|
2021-08-18 10:44:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
extension ServiceTypesExt on ServiceTypes {
|
|
|
|
String get title {
|
|
|
|
switch (this) {
|
2022-08-29 20:35:06 +00:00
|
|
|
case ServiceTypes.mailserver:
|
2021-08-18 10:44:46 +00:00
|
|
|
return 'services.mail.title'.tr();
|
2022-08-29 20:35:06 +00:00
|
|
|
case ServiceTypes.bitwarden:
|
2021-08-18 10:44:46 +00:00
|
|
|
return 'services.password_manager.title'.tr();
|
2022-08-29 20:35:06 +00:00
|
|
|
case ServiceTypes.jitsi:
|
2021-08-18 10:44:46 +00:00
|
|
|
return 'services.video.title'.tr();
|
2022-08-29 20:35:06 +00:00
|
|
|
case ServiceTypes.nextcloud:
|
2021-08-18 10:44:46 +00:00
|
|
|
return 'services.cloud.title'.tr();
|
2022-08-29 20:35:06 +00:00
|
|
|
case ServiceTypes.pleroma:
|
2021-08-18 10:44:46 +00:00
|
|
|
return 'services.social_network.title'.tr();
|
2022-08-29 20:35:06 +00:00
|
|
|
case ServiceTypes.gitea:
|
2021-08-18 10:44:46 +00:00
|
|
|
return 'services.git.title'.tr();
|
2022-08-29 20:35:06 +00:00
|
|
|
case ServiceTypes.ocserv:
|
2021-08-29 13:54:28 +00:00
|
|
|
return 'services.vpn.title'.tr();
|
2021-08-18 10:44:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
String get subtitle {
|
|
|
|
switch (this) {
|
2022-08-29 20:35:06 +00:00
|
|
|
case ServiceTypes.mailserver:
|
2021-08-18 10:44:46 +00:00
|
|
|
return 'services.mail.subtitle'.tr();
|
2022-08-29 20:35:06 +00:00
|
|
|
case ServiceTypes.bitwarden:
|
2021-08-18 10:44:46 +00:00
|
|
|
return 'services.password_manager.subtitle'.tr();
|
2022-08-29 20:35:06 +00:00
|
|
|
case ServiceTypes.jitsi:
|
2021-08-18 10:44:46 +00:00
|
|
|
return 'services.video.subtitle'.tr();
|
2022-08-29 20:35:06 +00:00
|
|
|
case ServiceTypes.nextcloud:
|
2021-08-18 10:44:46 +00:00
|
|
|
return 'services.cloud.subtitle'.tr();
|
2022-08-29 20:35:06 +00:00
|
|
|
case ServiceTypes.pleroma:
|
2021-08-18 10:44:46 +00:00
|
|
|
return 'services.social_network.subtitle'.tr();
|
2022-08-29 20:35:06 +00:00
|
|
|
case ServiceTypes.gitea:
|
2021-08-18 10:44:46 +00:00
|
|
|
return 'services.git.subtitle'.tr();
|
2022-08-29 20:35:06 +00:00
|
|
|
case ServiceTypes.ocserv:
|
2021-08-29 13:54:28 +00:00
|
|
|
return 'services.vpn.subtitle'.tr();
|
2021-08-18 10:44:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-23 13:52:12 +00:00
|
|
|
String get loginInfo {
|
|
|
|
switch (this) {
|
2022-08-29 20:35:06 +00:00
|
|
|
case ServiceTypes.mailserver:
|
2021-12-23 13:52:12 +00:00
|
|
|
return 'services.mail.login_info'.tr();
|
2022-08-29 20:35:06 +00:00
|
|
|
case ServiceTypes.bitwarden:
|
2021-12-23 13:52:12 +00:00
|
|
|
return 'services.password_manager.login_info'.tr();
|
2022-08-29 20:35:06 +00:00
|
|
|
case ServiceTypes.jitsi:
|
2021-12-23 13:52:12 +00:00
|
|
|
return 'services.video.login_info'.tr();
|
2022-08-29 20:35:06 +00:00
|
|
|
case ServiceTypes.nextcloud:
|
2021-12-23 13:52:12 +00:00
|
|
|
return 'services.cloud.login_info'.tr();
|
2022-08-29 20:35:06 +00:00
|
|
|
case ServiceTypes.pleroma:
|
2021-12-23 13:52:12 +00:00
|
|
|
return 'services.social_network.login_info'.tr();
|
2022-08-29 20:35:06 +00:00
|
|
|
case ServiceTypes.gitea:
|
2021-12-23 13:52:12 +00:00
|
|
|
return 'services.git.login_info'.tr();
|
2022-08-29 20:35:06 +00:00
|
|
|
case ServiceTypes.ocserv:
|
2021-12-23 13:52:12 +00:00
|
|
|
return '';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
String get subdomain {
|
|
|
|
switch (this) {
|
2022-08-29 20:35:06 +00:00
|
|
|
case ServiceTypes.bitwarden:
|
2021-12-23 13:52:12 +00:00
|
|
|
return 'password';
|
2022-08-29 20:35:06 +00:00
|
|
|
case ServiceTypes.jitsi:
|
2021-12-23 13:52:12 +00:00
|
|
|
return 'meet';
|
2022-08-29 20:35:06 +00:00
|
|
|
case ServiceTypes.nextcloud:
|
2021-12-23 13:52:12 +00:00
|
|
|
return 'cloud';
|
2022-08-29 20:35:06 +00:00
|
|
|
case ServiceTypes.pleroma:
|
2021-12-23 13:52:12 +00:00
|
|
|
return 'social';
|
2022-08-29 20:35:06 +00:00
|
|
|
case ServiceTypes.gitea:
|
2021-12-23 13:52:12 +00:00
|
|
|
return 'git';
|
2022-08-29 20:35:06 +00:00
|
|
|
case ServiceTypes.ocserv:
|
2021-12-23 13:52:12 +00:00
|
|
|
default:
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-18 10:44:46 +00:00
|
|
|
IconData get icon {
|
|
|
|
switch (this) {
|
2022-08-29 20:35:06 +00:00
|
|
|
case ServiceTypes.mailserver:
|
2021-08-18 10:44:46 +00:00
|
|
|
return BrandIcons.envelope;
|
2022-08-29 20:35:06 +00:00
|
|
|
case ServiceTypes.bitwarden:
|
2021-08-18 10:44:46 +00:00
|
|
|
return BrandIcons.key;
|
2022-08-29 20:35:06 +00:00
|
|
|
case ServiceTypes.jitsi:
|
2021-08-18 10:44:46 +00:00
|
|
|
return BrandIcons.webcam;
|
2022-08-29 20:35:06 +00:00
|
|
|
case ServiceTypes.nextcloud:
|
2021-08-18 10:44:46 +00:00
|
|
|
return BrandIcons.upload;
|
2022-08-29 20:35:06 +00:00
|
|
|
case ServiceTypes.pleroma:
|
2021-08-18 10:44:46 +00:00
|
|
|
return BrandIcons.social;
|
2022-08-29 20:35:06 +00:00
|
|
|
case ServiceTypes.gitea:
|
2021-08-18 10:44:46 +00:00
|
|
|
return BrandIcons.git;
|
2022-08-29 20:35:06 +00:00
|
|
|
case ServiceTypes.ocserv:
|
2022-05-30 13:49:42 +00:00
|
|
|
return Icons.vpn_lock_outlined;
|
2021-08-18 10:44:46 +00:00
|
|
|
}
|
|
|
|
}
|
2021-08-29 13:54:28 +00:00
|
|
|
|
2022-05-24 18:55:39 +00:00
|
|
|
String get txt => toString().split('.')[1];
|
2021-08-18 10:44:46 +00:00
|
|
|
}
|