Compare commits

...

55 Commits

Author SHA1 Message Date
Inex Code b29ee2e90e fix: Misleading value of "Do not verify TLS"
continuous-integration/drone/push Build is passing Details
2024-03-01 11:16:53 +02:00
Inex Code 6611093f48 Merge pull request 'fix: Detect the situation when we have faulty link-local IPv6 records' (#473) from inex/fix-linklocal-ipv6 into master
continuous-integration/drone/push Build was killed Details
Reviewed-on: #473
Reviewed-by: NaiJi  <naiji@noreply.git.selfprivacy.org>
2024-03-01 11:14:24 +02:00
Inex Code 643020ebd7 fix: Detect the situation when we have faulty link-local IPv6 records 2024-03-01 11:54:27 +03:00
Inex Code c8577b3bdf fix: When using fallback upgrade, UI showed that upgrade failed
continuous-integration/drone/push Build is passing Details
2024-02-23 20:15:39 +03:00
Inex Code 212c60c613 Merge pull request 'fix: Return the binds migration interface' (#467) from inex/binds-migration into master
continuous-integration/drone/push Build is passing Details
Reviewed-on: #467
2024-02-23 18:51:52 +02:00
Inex Code a9a7b04ad5 fix: Return the binds migration interface
Turns out, there are still servers that didn't perform the binds migration. The can't perform it anymore because email changed the id. I'm getting back the option to perform the binds migration, with some fallback defaults.
2024-02-23 19:50:28 +03:00
Inex Code 490e5f92f3 refactor(ui): Code deduplication in AboutApplicationPage
continuous-integration/drone/push Build is passing Details
2024-02-23 17:56:54 +02:00
Inex Code e36cba045a feat(ui): Select device icon depending on the screen width 2024-02-23 17:56:54 +02:00
Inex Code b4f700d56a feat(ui): Select device icon depending on the platform we are runnning on 2024-02-23 17:56:54 +02:00
Inex Code 9532ddc8af feat(ui): About page now contains links 2024-02-23 17:56:54 +02:00
Inex Code 0d12b1d2d7 Merge pull request 'refactor: Introduce the API connection repository' (#440) from api-connection-refactor into master
continuous-integration/drone/push Build was killed Details
Reviewed-on: #440
Reviewed-by: NaiJi  <naiji@noreply.git.selfprivacy.org>
2024-02-23 16:49:39 +02:00
Inex Code 275e8b1f40 chore: Fixes from review 2024-02-23 17:49:10 +03:00
Inex Code 160e6d3b35 refactor: Remove unused job 2024-02-21 05:00:45 +03:00
Inex Code 7bb96b5ed0 chore: remove prints 2024-02-21 00:45:32 +03:00
Inex Code 43a339af91 refactor: Code deduplication in server data reload 2024-02-20 23:34:45 +03:00
Inex Code caa2fd3b8e refactor: Handle situation when the job has to be removed
Closes #166
2024-02-20 23:17:36 +03:00
Inex Code 4eb8f34e37 Merge remote-tracking branch 'origin/master' into api-connection-refactor 2024-02-20 20:13:19 +03:00
Inex Code 92cf2cde6d refactor: Refactor ServerDetailsCubit to use ApiConnectionRepository 2024-02-20 20:09:14 +03:00
Inex Code 9459191c09 refactor: Remove Job dependency on ClientJobsCubit 2024-02-20 20:04:39 +03:00
Inex Code 16094a3257 refactor: Rework ClientJobs cubit so it doesn't depend on other cubits
Also implemented tracking of the jobs and rebuild status
2024-02-20 19:33:24 +03:00
Inex Code fdb40fccd7 fix: Init ApiConnectionRepository after server access recovery 2024-02-14 15:59:01 +03:00
Inex Code 9a1f47711c chore: Update GraphQL schema with experimental system rebuild tracking 2024-02-12 20:20:30 +03:00
Inex Code 455b1ed7f9 refactor: Replace UsersCubit with UsersBloc 2024-02-09 18:01:05 +03:00
Inex Code e5f00f8770 refactor: Make sure that blocs use sealed classes 2024-02-09 16:54:04 +03:00
Inex Code 710b9b53dd refactor: Replace ApiDevicesCubit with DevicesBloc 2024-02-09 14:07:03 +03:00
Inex Code 27e5abfe4a Merge pull request 'feat: change NavigationDestinationLabelBehavior' (#458) from subtitles_for_menu_options into master
continuous-integration/drone/push Build is passing Details
Reviewed-on: #458
Reviewed-by: Inex Code <inex.code@selfprivacy.org>
2024-02-08 17:18:28 +02:00
def 035fe990d0 Merge branch 'master' into subtitles_for_menu_options 2024-02-08 17:15:21 +02:00
Inex Code 3a525f0d11 refactor: Replace RecoveryKeyCubit with RecoveryKeyBloc 2024-02-08 18:08:29 +03:00
Inex Code 1daf957245 chore: Move ConnectionStatus bloc to bloc folder 2024-02-08 16:58:45 +03:00
Inex Code 0f26683758 Merge pull request 'fix: remove snackbar style notifs' (#457) from remove_snackbar_style_notif into master
continuous-integration/drone/push Build is passing Details
Reviewed-on: #457
Reviewed-by: Inex Code <inex.code@selfprivacy.org>
2024-02-08 14:40:17 +02:00
def 087deede3a Merge branch 'master' into remove_snackbar_style_notif 2024-02-08 14:39:30 +02:00
Inex Code 46910061ed ci: Update Windows build
continuous-integration/drone/push Build was killed Details
2024-02-08 14:30:50 +02:00
aliaksei tratseuski dd81053f42 refactor(UI): Rewrite onboarding page
continuous-integration/drone/push Build was killed Details
rewrote OnboardingPage:
* decomposed into separate widgets
* now content stays centered on wide screens (set so width won't expand further than 480px)
* pageController is now properly disposed
* added some more code changes to
    * main (error widget builder)
    * brand_header (centerTitle instead of empty actions list)
    * console_page (listener callback fix, used gaps instead of SizedBox'es, added keys to list items)
    * service_page (just cleaner build method)
	* removed some dead code

Co-authored-by: Aliaksei Tratseuski <aliaksei.tratseuski@gmail.com>
Reviewed-on: #444
Co-authored-by: aliaksei tratseuski <misterfourtytwo@noreply.git.selfprivacy.org>
Co-committed-by: aliaksei tratseuski <misterfourtytwo@noreply.git.selfprivacy.org>
2024-02-08 13:59:52 +02:00
dettlaff c67661ff65 feat: change NavigationDestinationLabelBehavior 2024-02-08 00:19:27 +04:00
dettlaff ba0e247fba fix: remove SnackBarBehaviov 2024-02-08 00:06:55 +04:00
Inex Code 6914b01d2a refactor: remove ProviderVolumes cubit 2024-02-06 18:21:21 +03:00
Inex Code 3b9d616045 refactor: Introduce VolumesBloc, remove ServerVolumeCubit 2024-02-01 18:30:06 +04:00
Inex Code 3222a9b500 refactor: Init blocs in initState and not in widget build 2024-01-31 18:06:49 +04:00
Inex Code e330f71b63 refactor: Optimistic state update when forgetting a snapshot 2024-01-31 18:06:22 +04:00
Inex Code 1ba8f324fe refactor: Use transformers for blocs 2024-01-31 16:17:27 +04:00
Inex Code 21c0e200a9 fix: Regenerate codegen for updated model name 2024-01-31 16:03:15 +04:00
Inex Code 725c592086 refactor: Fix callbacks returning sets 2024-01-31 15:14:37 +04:00
Inex Code 02870c3149 style: Formatting 2024-01-31 15:05:12 +04:00
Inex Code fe6f900165 refactor: Move event handler registration to the beginning of blocs 2024-01-31 15:04:59 +04:00
Inex Code f46865ca71 style: Apply directives_ordering lint 2024-01-31 14:57:12 +04:00
Inex Code 31c6a18918 Merge remote-tracking branch 'origin/directives_ordering' into api-connection-refactor
# Conflicts:
#	lib/config/bloc_config.dart
#	lib/logic/cubit/app_config_dependent/authentication_dependend_cubit.dart
#	lib/logic/cubit/backups/backups_cubit.dart
#	lib/logic/cubit/dns_records/dns_records_cubit.dart
#	lib/logic/cubit/providers/providers_cubit.dart
#	lib/logic/models/service.dart
#	lib/ui/pages/backups/backup_details.dart
#	lib/ui/pages/backups/change_period_modal.dart
#	lib/ui/pages/backups/change_rotation_quotas_modal.dart
#	lib/ui/pages/backups/copy_encryption_key_modal.dart
#	lib/ui/pages/more/more.dart
#	lib/ui/pages/server_storage/binds_migration/migration_process_page.dart
#	lib/ui/pages/server_storage/server_storage.dart
#	lib/ui/pages/server_storage/storage_card.dart
2024-01-31 14:50:40 +04:00
Inex Code 149969aed8 refactor: Rename ServerVolume model to reflect that it is tied to provider 2024-01-29 20:49:20 +04:00
Inex Code 9bfaf5d381 refactor: Remove usesBinds from ApiServerVolumeCubit 2024-01-29 20:45:49 +04:00
Inex Code bdd00683cd refactor: Optimistic state update when removing all finished jobs 2024-01-29 20:14:12 +04:00
Inex Code 831a0e95eb refactor: Rewrite services cubit to bloc, using ApiRepo streams 2024-01-29 19:58:37 +04:00
Inex Code a5e7725733 refactor: Rewrite backups cubit to bloc, using ApiRepo streams 2024-01-29 17:54:09 +04:00
Inex Code b1be3f24d6 refactor: Rewire cubit from depending on server_installation_cubit to the new connection manager 2024-01-26 18:46:09 +04:00
Inex Code 332e31b655 refactor: Remove binds migration 2024-01-26 14:58:59 +04:00
Inex Code 24e5c8baee refactor: Remove unused providers cubit 2024-01-26 14:49:36 +04:00
Inex Code fa21bdf034 refactor: Remove unused timer singleton 2024-01-26 14:43:44 +04:00
155 changed files with 6806 additions and 2982 deletions

View File

@ -1,6 +1,9 @@
name: Windows Builder
on: tag
on:
push:
tags:
- '*.*.*'
jobs:
build-windows:
@ -14,7 +17,7 @@ jobs:
# Install Flutter
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.3.10'
flutter-version: '3.16.1'
channel: 'stable'
# Build Windows artifact

View File

@ -1,12 +0,0 @@
### Пра нас
Усё больш арганізацый жадаюць валодаць нашымі дадзенымі
Праект дазваляе толькі Вам у поўнай меры распараджацца ўласнымі **дадзенымі** на сваім сэрвэры.
### Наша місія
Лічбавая незалежнасць і прыватнасць, даступныя кожнаму
### Мэта
Распрацаваць праграму, якая дазволіць кожнаму разгарнуць свае прыватныя паслугі для сябе і сваіх суседзяў.

View File

@ -1,12 +0,0 @@
### O nás
More and more corporations want to control our data.
We want to have full control of our **data** on our own.
### Naše poslání
Digitální nezávislost a soukromí dostupné všem
### Cíl
Rozvíjet program, který umožní každému nasadit své soukromé služby pro sebe a své sousedy.

View File

@ -1,12 +0,0 @@
### Über uns
Immer mehr Unternehmen wollen unsere Daten kontrollieren.
Wir wollen selbst die volle Kontrolle über unsere **data** haben.
### Unsere Mission
Digitale Unabhängigkeit und Privatsphäre für alle verfügbar
### Ziel
Das Programm entwickeln, das es jedem ermöglicht, seine privaten Dienste für sich und seine Nachbarn einzusetzen.

View File

@ -1,12 +0,0 @@
### About us
More and more corporations want to control our data.
We want to have full control of our **data** on our own.
### Our mission
Digital independence and privacy, available to everyone
### Target
Develop the program, which will allow everyone to deploy their private services for themselves and their neighbours.

View File

@ -1,12 +0,0 @@
### About us
More and more corporations want to control our data.
We want to have full control of our **data** on our own.
### Our mission
Digital independence and privacy, available to everyone
### Target
Develop the program, which will allow everyone to deploy their private services for themselves and their neighbours.

View File

@ -1,12 +0,0 @@
### About us
More and more corporations want to control our data.
We want to have full control of our **data** on our own.
### Our mission
Digital independence and privacy, available to everyone
### Target
Develop the program, which will allow everyone to deploy their private services for themselves and their neighbours.

View File

@ -1,12 +0,0 @@
### About us
More and more corporations want to control our data.
We want to have full control of our **data** on our own.
### Our mission
Digital independence and privacy, available to everyone
### Target
Develop the program, which will allow everyone to deploy their private services for themselves and their neighbours.

View File

@ -1,12 +0,0 @@
### About us
More and more corporations want to control our data.
We want to have full control of our **data** on our own.
### Our mission
Digital independence and privacy, available to everyone
### Target
Develop the program, which will allow everyone to deploy their private services for themselves and their neighbours.

View File

@ -1,12 +0,0 @@
### About us
More and more corporations want to control our data.
We want to have full control of our **data** on our own.
### Our mission
Digital independence and privacy, available to everyone
### Target
Develop the program, which will allow everyone to deploy their private services for themselves and their neighbours.

View File

@ -1,12 +0,0 @@
### About us
More and more corporations want to control our data.
We want to have full control of our **data** on our own.
### Our mission
Digital independence and privacy, available to everyone
### Target
Develop the program, which will allow everyone to deploy their private services for themselves and their neighbours.

View File

@ -1,12 +0,0 @@
### About us
More and more corporations want to control our data.
We want to have full control of our **data** on our own.
### Misja projektu
Niezależność i prywatność cyfrowa dostępna dla wszystkich
### Cel
Opracuj program, dzięki któremu każdy będzie mógł stworzyć prywatne usługi dla siebie i swoich bliskich.

View File

@ -1,12 +0,0 @@
### О проекте
Всё больше организаций хотят владеть нашими данными
Проект позволяет только Вам в полной мере распоряжаться собственными **данными** на своём сервере.
### Миссия проекта
Цифровая независимость и приватность, доступная каждому
### Цель
Развивать программу, которая позволит каждому создавать приватные сервисы для себя и своих близких.

View File

@ -1,12 +0,0 @@
### O nás
More and more corporations want to control our data.
We want to have full control of our **data** on our own.
### Naše poslanie
Digitálna nezávislosť a súkromie dostupné pre každého
### Cieľ
Vytvorte program, ktorý umožní každému vytvoriť súkromné služby pre seba a svojich blízkych.

View File

@ -1,12 +0,0 @@
### About us
More and more corporations want to control our data.
We want to have full control of our **data** on our own.
### Our mission
Digital independence and privacy, available to everyone
### Target
Develop the program, which will allow everyone to deploy their private services for themselves and their neighbours.

View File

@ -1,12 +0,0 @@
### Про нас
Все більше корпорацій хочуть контролювати свої дані.
Ми хочемо мати повний контроль над нашими.
### Наша місія
Цифрова незалежність і конфіденційність доступні кожному
### Ціль
Розробити програму, яка дозволить кожному розгорнути свої приватні послуги для себе та їх сусідів.

View File

@ -36,29 +36,41 @@
"continue": "Continue",
"alert": "Alert",
"copied_to_clipboard": "Copied to clipboard!",
"please_connect": "Please connect your server, domain and DNS provider to dive in!"
"please_connect": "Please connect your server, domain and DNS provider to dive in!",
"network_error": "Network error"
},
"more_page": {
"configuration_wizard": "Setup wizard",
"about_project": "About us",
"about_application": "About",
"onboarding": "Onboarding",
"create_ssh_key": "Superuser SSH keys",
"console": "Console",
"application_settings": "Application settings"
"create_ssh_key": "Superuser SSH keys"
},
"console_page": {
"title": "Console",
"waiting": "Waiting for initialization…",
"copy": "Copy"
},
"about_us_page": {
"title": "About us"
},
"about_application_page": {
"title": "About",
"application_version_text": "Application version {}",
"api_version_text": "Server API version {}",
"title": "About & support",
"versions": "Versions",
"application_version_text": "Application version",
"api_version_text": "Server API version",
"open_source_licenses": "Open source licenses",
"links": "Links",
"website": "Our website",
"documentation": "Documentation",
"matrix_channel": "Matrix channel",
"telegram_channel": "Telegram channel",
"get_support": "Get support",
"matrix_support_chat": "Matrix support chat",
"telegram_support_chat": "Telegram support chat",
"email_support": "Email support",
"contribute": "Contribute",
"source_code": "Source code",
"bug_report": "Report a bug",
"bug_report_subtitle": "Due to spam, manual account confirmation is required. Contact us in the support chat to activate your account.",
"help_translate": "Help us translate",
"matrix_contributors_chat": "Matrix contributors chat",
"telegram_contributors_chat": "Telegram contributors chat",
"privacy_policy": "Privacy policy"
},
"application_settings": {
@ -305,6 +317,10 @@
"extending_volume_description": "Resizing volume will allow you to store more data on your server without extending the server itself. Volume can only be extended: shrinking is not possible.",
"extending_volume_price_info": "Price includes VAT and is estimated from pricing data provided by your server provider. Server will be rebooted after resizing.",
"extending_volume_error": "Couldn't initialize volume extending.",
"extending_volume_started": "Volume extending started",
"extending_volume_provider_waiting": "Provider volume resized, waiting 10 seconds…",
"extending_volume_server_waiting": "Server volume resized, waiting 20 seconds…",
"extending_volume_rebooting": "Rebooting server…",
"extending_volume_modal_description": "Upgrade to {} for {} plan per month.",
"size": "Size",
"price": "Price",
@ -390,7 +406,8 @@
"could_not_add_ssh_key": "Couldn't add SSH key",
"username_rule": "Username must contain only lowercase latin letters, digits and underscores, should not start with a digit",
"email_login": "Email login",
"no_ssh_notice": "Only email and SSH accounts are created for this user. Single Sign On for all services is coming soon."
"no_ssh_notice": "Only email and SSH accounts are created for this user. Single Sign On for all services is coming soon.",
"user_already_exists": "User with such username already exists"
},
"initializing": {
"server_provider_description": "A place where your data and SelfPrivacy services will reside:",
@ -590,6 +607,8 @@
"service_turn_off": "Turn off",
"service_turn_on": "Turn on",
"job_added": "Job added",
"job_postponed": "Job added, but you will be able to launch it after current jobs are finished",
"job_removed": "Job removed",
"run_jobs": "Run jobs",
"reboot_success": "Server is rebooting",
"reboot_failed": "Couldn't reboot the server. Check the app logs.",
@ -602,7 +621,11 @@
"delete_ssh_key": "Delete SSH key for {}",
"server_jobs": "Jobs on the server",
"reset_user_password": "Reset password of user",
"generic_error": "Couldn't connect to the server!"
"generic_error": "Couldn't connect to the server!",
"rebuild_system": "Rebuild system",
"start_server_upgrade": "Start the server upgrade",
"change_auto_upgrade_settings": "Change auto-upgrade settings",
"change_server_timezone": "Change server timezone"
},
"validations": {
"required": "Required",
@ -634,4 +657,4 @@
"reset_onboarding_description": "Reset onboarding switch to show onboarding screen again",
"cubit_statuses": "Cubit loading statuses"
}
}
}

View File

@ -1,43 +1,64 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:selfprivacy/logic/bloc/backups/backups_bloc.dart';
import 'package:selfprivacy/logic/bloc/connection_status/connection_status_bloc.dart';
import 'package:selfprivacy/logic/bloc/devices/devices_bloc.dart';
import 'package:selfprivacy/logic/bloc/recovery_key/recovery_key_bloc.dart';
import 'package:selfprivacy/logic/bloc/server_jobs/server_jobs_bloc.dart';
import 'package:selfprivacy/logic/bloc/services/services_bloc.dart';
import 'package:selfprivacy/logic/bloc/users/users_bloc.dart';
import 'package:selfprivacy/logic/bloc/volumes/volumes_bloc.dart';
import 'package:selfprivacy/logic/cubit/app_settings/app_settings_cubit.dart';
import 'package:selfprivacy/logic/cubit/backups/backups_cubit.dart';
import 'package:selfprivacy/logic/cubit/client_jobs/client_jobs_cubit.dart';
import 'package:selfprivacy/logic/cubit/devices/devices_cubit.dart';
import 'package:selfprivacy/logic/cubit/dns_records/dns_records_cubit.dart';
import 'package:selfprivacy/logic/cubit/provider_volumes/provider_volume_cubit.dart';
import 'package:selfprivacy/logic/cubit/providers/providers_cubit.dart';
import 'package:selfprivacy/logic/cubit/recovery_key/recovery_key_cubit.dart';
import 'package:selfprivacy/logic/cubit/server_detailed_info/server_detailed_info_cubit.dart';
import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart';
import 'package:selfprivacy/logic/cubit/server_jobs/server_jobs_cubit.dart';
import 'package:selfprivacy/logic/cubit/server_volumes/server_volume_cubit.dart';
import 'package:selfprivacy/logic/cubit/services/services_cubit.dart';
import 'package:selfprivacy/logic/cubit/support_system/support_system_cubit.dart';
import 'package:selfprivacy/logic/cubit/users/users_cubit.dart';
class BlocAndProviderConfig extends StatelessWidget {
class BlocAndProviderConfig extends StatefulWidget {
const BlocAndProviderConfig({super.key, this.child});
final Widget? child;
@override
BlocAndProviderConfigState createState() => BlocAndProviderConfigState();
}
class BlocAndProviderConfigState extends State<BlocAndProviderConfig> {
late final ServerInstallationCubit serverInstallationCubit;
late final SupportSystemCubit supportSystemCubit;
late final UsersBloc usersBloc;
late final ServicesBloc servicesBloc;
late final BackupsBloc backupsBloc;
late final DnsRecordsCubit dnsRecordsCubit;
late final RecoveryKeyBloc recoveryKeyBloc;
late final DevicesBloc devicesBloc;
late final ServerJobsBloc serverJobsBloc;
late final ConnectionStatusBloc connectionStatusBloc;
late final ServerDetailsCubit serverDetailsCubit;
late final VolumesBloc volumesBloc;
@override
void initState() {
super.initState();
serverInstallationCubit = ServerInstallationCubit()..load();
supportSystemCubit = SupportSystemCubit();
usersBloc = UsersBloc();
servicesBloc = ServicesBloc();
backupsBloc = BackupsBloc();
dnsRecordsCubit = DnsRecordsCubit();
recoveryKeyBloc = RecoveryKeyBloc();
devicesBloc = DevicesBloc();
serverJobsBloc = ServerJobsBloc();
connectionStatusBloc = ConnectionStatusBloc();
serverDetailsCubit = ServerDetailsCubit();
volumesBloc = VolumesBloc();
}
@override
Widget build(final BuildContext context) {
const isDark = false;
const isAutoDark = true;
final serverInstallationCubit = ServerInstallationCubit()..load();
final supportSystemCubit = SupportSystemCubit();
final usersCubit = UsersCubit(serverInstallationCubit);
final servicesCubit = ServicesCubit(serverInstallationCubit);
final backupsCubit = BackupsCubit(serverInstallationCubit);
final dnsRecordsCubit = DnsRecordsCubit(serverInstallationCubit);
final recoveryKeyCubit = RecoveryKeyCubit(serverInstallationCubit);
final apiDevicesCubit = ApiDevicesCubit(serverInstallationCubit);
final apiVolumesCubit = ApiProviderVolumeCubit(serverInstallationCubit);
final apiServerVolumesCubit =
ApiServerVolumeCubit(serverInstallationCubit, apiVolumesCubit);
final serverJobsCubit = ServerJobsCubit(serverInstallationCubit);
final serverDetailsCubit = ServerDetailsCubit(serverInstallationCubit);
return MultiProvider(
providers: [
@ -56,49 +77,37 @@ class BlocAndProviderConfig extends StatelessWidget {
lazy: false,
),
BlocProvider(
create: (final _) => ProvidersCubit(),
),
BlocProvider(
create: (final _) => usersCubit..load(),
create: (final _) => usersBloc,
lazy: false,
),
BlocProvider(
create: (final _) => servicesCubit..load(),
lazy: false,
create: (final _) => servicesBloc,
),
BlocProvider(
create: (final _) => backupsCubit..load(),
lazy: false,
create: (final _) => backupsBloc,
),
BlocProvider(
create: (final _) => dnsRecordsCubit..load(),
create: (final _) => dnsRecordsCubit,
),
BlocProvider(
create: (final _) => recoveryKeyCubit..load(),
create: (final _) => recoveryKeyBloc,
),
BlocProvider(
create: (final _) => apiDevicesCubit..load(),
create: (final _) => devicesBloc,
),
BlocProvider(
create: (final _) => apiVolumesCubit..load(),
create: (final _) => serverJobsBloc,
),
BlocProvider(create: (final _) => connectionStatusBloc),
BlocProvider(
create: (final _) => apiServerVolumesCubit..load(),
create: (final _) => serverDetailsCubit,
),
BlocProvider(create: (final _) => volumesBloc),
BlocProvider(
create: (final _) => serverJobsCubit..load(),
),
BlocProvider(
create: (final _) => serverDetailsCubit..load(),
),
BlocProvider(
create: (final _) => JobsCubit(
usersCubit: usersCubit,
servicesCubit: servicesCubit,
),
create: (final _) => JobsCubit(),
),
],
child: child,
child: widget.child,
);
}
}

View File

@ -1,13 +1,13 @@
import 'package:get_it/get_it.dart';
import 'package:selfprivacy/logic/get_it/api_config.dart';
import 'package:selfprivacy/logic/get_it/api_connection_repository.dart';
import 'package:selfprivacy/logic/get_it/console.dart';
import 'package:selfprivacy/logic/get_it/navigation.dart';
import 'package:selfprivacy/logic/get_it/timer.dart';
export 'package:selfprivacy/logic/get_it/api_config.dart';
export 'package:selfprivacy/logic/get_it/api_connection_repository.dart';
export 'package:selfprivacy/logic/get_it/console.dart';
export 'package:selfprivacy/logic/get_it/navigation.dart';
export 'package:selfprivacy/logic/get_it/timer.dart';
final GetIt getIt = GetIt.instance;
@ -15,8 +15,11 @@ Future<void> getItSetup() async {
getIt.registerSingleton<NavigationService>(NavigationService());
getIt.registerSingleton<ConsoleModel>(ConsoleModel());
getIt.registerSingleton<TimerModel>(TimerModel());
getIt.registerSingleton<ApiConfigModel>(ApiConfigModel()..init());
getIt.registerSingleton<ApiConnectionRepository>(
ApiConnectionRepository()..init(),
);
await getIt.allReady();
}

View File

@ -20,7 +20,7 @@ class HiveConfig {
Hive.registerAdapter(ServerDomainAdapter());
Hive.registerAdapter(BackupsCredentialAdapter());
Hive.registerAdapter(BackblazeBucketAdapter());
Hive.registerAdapter(ServerVolumeAdapter());
Hive.registerAdapter(ServerProviderVolumeAdapter());
Hive.registerAdapter(UserTypeAdapter());
Hive.registerAdapter(DnsProviderTypeAdapter());
Hive.registerAdapter(ServerProviderTypeAdapter());

View File

@ -1 +0,0 @@

View File

@ -17,10 +17,6 @@ class StrayDeerPainter extends CustomPainter {
final Color deerSkin =
const Color(0xffe0ac9c).harmonizeWith(colorScheme.primary);
print('deerSkin: $deerSkin');
print('colorScheme.primary: ${colorScheme.primary}');
print('colorPalette.tertiary.get(10): ${colorPalette.tertiary.get(50)}');
final Path path0 = Path();
path0.moveTo(size.width * 0.6099773, size.height * 0.6719577);
path0.lineTo(size.width * 0.6088435, size.height * 0.6719577);

View File

@ -150,9 +150,9 @@ type DnsRecord {
recordType: String!
name: String!
content: String!
displayName: String!
ttl: Int!
priority: Int
displayName: String!
}
type GenericBackupConfigReturn implements MutationReturnInterface {
@ -272,6 +272,19 @@ enum RestoreStrategy {
DOWNLOAD_VERIFY_OVERWRITE
}
input SSHSettingsInput {
enable: Boolean!
passwordAuthentication: Boolean!
}
type SSHSettingsMutationReturn implements MutationReturnInterface {
success: Boolean!
message: String!
code: Int!
enable: Boolean!
passwordAuthentication: Boolean!
}
enum ServerProvider {
HETZNER
DIGITALOCEAN
@ -424,9 +437,10 @@ type SystemInfo {
type SystemMutations {
changeTimezone(timezone: String!): TimezoneMutationReturn!
changeAutoUpgradeSettings(settings: AutoUpgradeSettingsInput!): AutoUpgradeSettingsMutationReturn!
runSystemRebuild: GenericMutationReturn!
changeSshSettings(settings: SSHSettingsInput!): SSHSettingsMutationReturn!
runSystemRebuild: GenericJobMutationReturn!
runSystemRollback: GenericMutationReturn!
runSystemUpgrade: GenericMutationReturn!
runSystemUpgrade: GenericJobMutationReturn!
rebootSystem: GenericMutationReturn!
pullRepositoryChanges: GenericMutationReturn!
}

View File

@ -982,6 +982,135 @@ class _CopyWithStubImpl$Input$RecoveryKeyLimitsInput<TRes>
_res;
}
class Input$SSHSettingsInput {
factory Input$SSHSettingsInput({
required bool enable,
required bool passwordAuthentication,
}) =>
Input$SSHSettingsInput._({
r'enable': enable,
r'passwordAuthentication': passwordAuthentication,
});
Input$SSHSettingsInput._(this._$data);
factory Input$SSHSettingsInput.fromJson(Map<String, dynamic> data) {
final result$data = <String, dynamic>{};
final l$enable = data['enable'];
result$data['enable'] = (l$enable as bool);
final l$passwordAuthentication = data['passwordAuthentication'];
result$data['passwordAuthentication'] = (l$passwordAuthentication as bool);
return Input$SSHSettingsInput._(result$data);
}
Map<String, dynamic> _$data;
bool get enable => (_$data['enable'] as bool);
bool get passwordAuthentication => (_$data['passwordAuthentication'] as bool);
Map<String, dynamic> toJson() {
final result$data = <String, dynamic>{};
final l$enable = enable;
result$data['enable'] = l$enable;
final l$passwordAuthentication = passwordAuthentication;
result$data['passwordAuthentication'] = l$passwordAuthentication;
return result$data;
}
CopyWith$Input$SSHSettingsInput<Input$SSHSettingsInput> get copyWith =>
CopyWith$Input$SSHSettingsInput(
this,
(i) => i,
);
@override
bool operator ==(Object other) {
if (identical(this, other)) {
return true;
}
if (!(other is Input$SSHSettingsInput) ||
runtimeType != other.runtimeType) {
return false;
}
final l$enable = enable;
final lOther$enable = other.enable;
if (l$enable != lOther$enable) {
return false;
}
final l$passwordAuthentication = passwordAuthentication;
final lOther$passwordAuthentication = other.passwordAuthentication;
if (l$passwordAuthentication != lOther$passwordAuthentication) {
return false;
}
return true;
}
@override
int get hashCode {
final l$enable = enable;
final l$passwordAuthentication = passwordAuthentication;
return Object.hashAll([
l$enable,
l$passwordAuthentication,
]);
}
}
abstract class CopyWith$Input$SSHSettingsInput<TRes> {
factory CopyWith$Input$SSHSettingsInput(
Input$SSHSettingsInput instance,
TRes Function(Input$SSHSettingsInput) then,
) = _CopyWithImpl$Input$SSHSettingsInput;
factory CopyWith$Input$SSHSettingsInput.stub(TRes res) =
_CopyWithStubImpl$Input$SSHSettingsInput;
TRes call({
bool? enable,
bool? passwordAuthentication,
});
}
class _CopyWithImpl$Input$SSHSettingsInput<TRes>
implements CopyWith$Input$SSHSettingsInput<TRes> {
_CopyWithImpl$Input$SSHSettingsInput(
this._instance,
this._then,
);
final Input$SSHSettingsInput _instance;
final TRes Function(Input$SSHSettingsInput) _then;
static const _undefined = <dynamic, dynamic>{};
TRes call({
Object? enable = _undefined,
Object? passwordAuthentication = _undefined,
}) =>
_then(Input$SSHSettingsInput._({
..._instance._$data,
if (enable != _undefined && enable != null) 'enable': (enable as bool),
if (passwordAuthentication != _undefined &&
passwordAuthentication != null)
'passwordAuthentication': (passwordAuthentication as bool),
}));
}
class _CopyWithStubImpl$Input$SSHSettingsInput<TRes>
implements CopyWith$Input$SSHSettingsInput<TRes> {
_CopyWithStubImpl$Input$SSHSettingsInput(this._res);
TRes _res;
call({
bool? enable,
bool? passwordAuthentication,
}) =>
_res;
}
class Input$SshMutationInput {
factory Input$SshMutationInput({
required String username,
@ -1928,6 +2057,7 @@ const possibleTypesMap = <String, Set<String>>{
'GenericBackupConfigReturn',
'GenericJobMutationReturn',
'GenericMutationReturn',
'SSHSettingsMutationReturn',
'ServiceJobMutationReturn',
'ServiceMutationReturn',
'TimezoneMutationReturn',

View File

@ -42,6 +42,17 @@ mutation RemoveJob($jobId: String!) {
}
mutation RunSystemRebuild {
system {
runSystemRebuild {
...basicMutationReturnFields
job {
...basicApiJobsFields
}
}
}
}
mutation RunSystemRebuildFallback {
system {
runSystemRebuild {
...basicMutationReturnFields
@ -58,6 +69,17 @@ mutation RunSystemRollback {
}
mutation RunSystemUpgrade {
system {
runSystemUpgrade {
...basicMutationReturnFields
job {
...basicApiJobsFields
}
}
}
}
mutation RunSystemUpgradeFallback {
system {
runSystemUpgrade {
...basicMutationReturnFields

File diff suppressed because it is too large Load Diff

View File

@ -29,7 +29,11 @@ mixin ServerActionsApi on GraphQLApiMap {
print(response.exception.toString());
}
if (response.parsedData!.system.rebootSystem.success) {
time = DateTime.now().toUtc();
return GenericResult(
data: time,
success: true,
message: response.parsedData!.system.rebootSystem.message,
);
}
} catch (e) {
print(e);
@ -50,23 +54,94 @@ mixin ServerActionsApi on GraphQLApiMap {
}
}
Future<bool> upgrade() async {
Future<GenericResult<ServerJob?>> upgrade() async {
try {
final GraphQLClient client = await getClient();
return _commonBoolRequest(
() async => client.mutate$RunSystemUpgrade(),
);
final result = await client.mutate$RunSystemUpgrade();
if (result.hasException) {
final fallbackResult = await client.mutate$RunSystemUpgradeFallback();
if (fallbackResult.parsedData!.system.runSystemUpgrade.success) {
return GenericResult(
success: true,
data: null,
message: fallbackResult.parsedData!.system.runSystemUpgrade.message,
);
} else {
return GenericResult(
success: false,
message: fallbackResult.parsedData!.system.runSystemUpgrade.message,
data: null,
);
}
} else if (result.parsedData!.system.runSystemUpgrade.success &&
result.parsedData!.system.runSystemUpgrade.job != null) {
return GenericResult(
success: true,
data: ServerJob.fromGraphQL(
result.parsedData!.system.runSystemUpgrade.job!,
),
message: result.parsedData!.system.runSystemUpgrade.message,
);
} else {
return GenericResult(
success: false,
message: result.parsedData!.system.runSystemUpgrade.message,
data: null,
);
}
} catch (e) {
return false;
return GenericResult(
success: false,
message: e.toString(),
data: null,
);
}
}
Future<void> apply() async {
Future<GenericResult<ServerJob?>> apply() async {
try {
final GraphQLClient client = await getClient();
await client.mutate$RunSystemRebuild();
final result = await client.mutate$RunSystemRebuild();
if (result.hasException) {
final fallbackResult = await client.mutate$RunSystemRebuildFallback();
if (fallbackResult.parsedData!.system.runSystemRebuild.success) {
return GenericResult(
success: true,
data: null,
message: fallbackResult.parsedData!.system.runSystemRebuild.message,
);
} else {
return GenericResult(
success: false,
message: fallbackResult.parsedData!.system.runSystemRebuild.message,
data: null,
);
}
} else {
if (result.parsedData!.system.runSystemRebuild.success &&
result.parsedData!.system.runSystemRebuild.job != null) {
return GenericResult(
success: true,
data: ServerJob.fromGraphQL(
result.parsedData!.system.runSystemRebuild.job!,
),
message: result.parsedData!.system.runSystemRebuild.message,
);
} else {
return GenericResult(
success: false,
message: result.parsedData!.system.runSystemRebuild.message,
data: null,
);
}
}
} catch (e) {
print(e);
return GenericResult(
success: false,
message: e.toString(),
data: null,
);
}
}
}

View File

@ -132,24 +132,55 @@ class ServerApi extends GraphQLApiMap
return usesBinds;
}
Future<void> switchService(final String uid, final bool needTurnOn) async {
Future<GenericResult> switchService(
final String uid,
final bool needTurnOn,
) async {
try {
final GraphQLClient client = await getClient();
if (needTurnOn) {
final variables = Variables$Mutation$EnableService(serviceId: uid);
final mutation = Options$Mutation$EnableService(variables: variables);
await client.mutate$EnableService(mutation);
final result = await client.mutate$EnableService(mutation);
if (result.hasException) {
return GenericResult(
success: false,
message: result.exception.toString(),
data: null,
);
}
return GenericResult(
success: result.parsedData?.services.enableService.success ?? false,
message: result.parsedData?.services.enableService.message,
data: null,
);
} else {
final variables = Variables$Mutation$DisableService(serviceId: uid);
final mutation = Options$Mutation$DisableService(variables: variables);
await client.mutate$DisableService(mutation);
final result = await client.mutate$DisableService(mutation);
if (result.hasException) {
return GenericResult(
success: false,
message: result.exception.toString(),
data: null,
);
}
return GenericResult(
success: result.parsedData?.services.disableService.success ?? false,
message: result.parsedData?.services.disableService.message,
data: null,
);
}
} catch (e) {
print(e);
return GenericResult(
success: false,
message: e.toString(),
data: null,
);
}
}
Future<void> setAutoUpgradeSettings(
Future<GenericResult<AutoUpgradeSettings?>> setAutoUpgradeSettings(
final AutoUpgradeSettings settings,
) async {
try {
@ -164,13 +195,38 @@ class ServerApi extends GraphQLApiMap
final mutation = Options$Mutation$ChangeAutoUpgradeSettings(
variables: variables,
);
await client.mutate$ChangeAutoUpgradeSettings(mutation);
final result = await client.mutate$ChangeAutoUpgradeSettings(mutation);
if (result.hasException) {
return GenericResult<AutoUpgradeSettings?>(
success: false,
message: result.exception.toString(),
data: null,
);
}
return GenericResult<AutoUpgradeSettings?>(
success: result.parsedData?.system.changeAutoUpgradeSettings.success ??
false,
message: result.parsedData?.system.changeAutoUpgradeSettings.message,
data: result.parsedData == null
? null
: AutoUpgradeSettings(
allowReboot: result
.parsedData!.system.changeAutoUpgradeSettings.allowReboot,
enable: result.parsedData!.system.changeAutoUpgradeSettings
.enableAutoUpgrade,
),
);
} catch (e) {
print(e);
return GenericResult<AutoUpgradeSettings?>(
success: false,
message: e.toString(),
data: null,
);
}
}
Future<void> setTimezone(final String timezone) async {
Future<GenericResult<String?>> setTimezone(final String timezone) async {
try {
final GraphQLClient client = await getClient();
final variables = Variables$Mutation$ChangeTimezone(
@ -179,9 +235,26 @@ class ServerApi extends GraphQLApiMap
final mutation = Options$Mutation$ChangeTimezone(
variables: variables,
);
await client.mutate$ChangeTimezone(mutation);
final result = await client.mutate$ChangeTimezone(mutation);
if (result.hasException) {
return GenericResult<String>(
success: false,
message: result.exception.toString(),
data: '',
);
}
return GenericResult<String?>(
success: result.parsedData?.system.changeTimezone.success ?? false,
message: result.parsedData?.system.changeTimezone.message,
data: result.parsedData?.system.changeTimezone.timezone,
);
} catch (e) {
print(e);
return GenericResult<String?>(
success: false,
message: e.toString(),
data: '',
);
}
}

View File

@ -11,6 +11,7 @@ mixin VolumeApi on GraphQLApiMap {
if (response.hasException) {
print(response.exception.toString());
}
// TODO: Rewrite to use fromGraphQL
volumes = response.data!['storage']['volumes']
.map<ServerDiskVolume>((final e) => ServerDiskVolume.fromJson(e))
.toList();
@ -59,17 +60,18 @@ mixin VolumeApi on GraphQLApiMap {
Future<GenericResult<String?>> migrateToBinds(
final Map<String, String> serviceToDisk,
final String fallbackDrive,
) async {
GenericResult<String?>? mutation;
try {
final GraphQLClient client = await getClient();
final input = Input$MigrateToBindsInput(
bitwardenBlockDevice: serviceToDisk['bitwarden']!,
emailBlockDevice: serviceToDisk['mailserver']!,
giteaBlockDevice: serviceToDisk['gitea']!,
nextcloudBlockDevice: serviceToDisk['nextcloud']!,
pleromaBlockDevice: serviceToDisk['pleroma']!,
bitwardenBlockDevice: serviceToDisk['bitwarden'] ?? fallbackDrive,
emailBlockDevice: serviceToDisk['email'] ?? fallbackDrive,
giteaBlockDevice: serviceToDisk['gitea'] ?? fallbackDrive,
nextcloudBlockDevice: serviceToDisk['nextcloud'] ?? fallbackDrive,
pleromaBlockDevice: serviceToDisk['pleroma'] ?? fallbackDrive,
);
final variables = Variables$Mutation$MigrateToBinds(input: input);
final migrateMutation =

View File

@ -0,0 +1,408 @@
import 'dart:async';
import 'package:bloc_concurrency/bloc_concurrency.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:equatable/equatable.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:selfprivacy/config/get_it_config.dart';
import 'package:selfprivacy/logic/api_maps/rest_maps/backblaze.dart';
import 'package:selfprivacy/logic/models/backup.dart';
import 'package:selfprivacy/logic/models/hive/backblaze_bucket.dart';
import 'package:selfprivacy/logic/models/hive/backups_credential.dart';
import 'package:selfprivacy/logic/models/initialize_repository_input.dart';
import 'package:selfprivacy/logic/models/json/server_job.dart';
import 'package:selfprivacy/logic/models/service.dart';
part 'backups_event.dart';
part 'backups_state.dart';
class BackupsBloc extends Bloc<BackupsEvent, BackupsState> {
BackupsBloc() : super(BackupsInitial()) {
on<BackupsServerLoaded>(
_loadState,
transformer: droppable(),
);
on<BackupsServerReset>(
_resetState,
transformer: droppable(),
);
on<BackupsStateChanged>(
_updateState,
transformer: droppable(),
);
on<InitializeBackupsRepository>(
_initializeRepository,
transformer: droppable(),
);
on<ForceSnapshotListUpdate>(
_forceSnapshotListUpdate,
transformer: droppable(),
);
on<CreateBackups>(
_createBackups,
transformer: sequential(),
);
on<RestoreBackup>(
_restoreBackup,
transformer: sequential(),
);
on<SetAutobackupPeriod>(
_setAutobackupPeriod,
transformer: restartable(),
);
on<SetAutobackupQuotas>(
_setAutobackupQuotas,
transformer: restartable(),
);
on<ForgetSnapshot>(
_forgetSnapshot,
transformer: sequential(),
);
final connectionRepository = getIt<ApiConnectionRepository>();
_apiStatusSubscription = connectionRepository.connectionStatusStream
.listen((final ConnectionStatus connectionStatus) {
switch (connectionStatus) {
case ConnectionStatus.nonexistent:
add(const BackupsServerReset());
isLoaded = false;
break;
case ConnectionStatus.connected:
if (!isLoaded) {
add(const BackupsServerLoaded());
isLoaded = true;
}
break;
default:
break;
}
});
_apiDataSubscription = connectionRepository.dataStream.listen(
(final ApiData apiData) {
if (apiData.backups.data == null || apiData.backupConfig.data == null) {
add(const BackupsServerReset());
isLoaded = false;
} else {
add(
BackupsStateChanged(
apiData.backups.data!,
apiData.backupConfig.data,
),
);
isLoaded = true;
}
},
);
if (connectionRepository.connectionStatus == ConnectionStatus.connected) {
add(const BackupsServerLoaded());
isLoaded = true;
}
}
final BackblazeApi backblaze = BackblazeApi();