From e05114d5b18357cd5e21849c1f08fdb01a755645 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 4 Dec 2024 04:23:37 +0000 Subject: [PATCH 1/4] build(deps): Bump the docker group across 2 directories with 2 updates Bumps the docker group with 2 updates in the /packages/dart/sshnoports/tools directory: dart and debian. Bumps the docker group with 2 updates in the /tests/end2end_tests/image directory: dart and debian. Updates `dart` from `09330bd` to `3f3877b` Updates `debian` from `eb37f58` to `4d63ef5` Updates `dart` from `09330bd` to `3f3877b` Updates `debian` from `eb37f58` to `4d63ef5` --- updated-dependencies: - dependency-name: dart dependency-type: direct:production update-type: version-update:semver-patch dependency-group: docker - dependency-name: debian dependency-type: direct:production dependency-group: docker - dependency-name: dart dependency-type: direct:production update-type: version-update:semver-patch dependency-group: docker - dependency-name: debian dependency-type: direct:production dependency-group: docker ... Signed-off-by: dependabot[bot] --- packages/dart/sshnoports/tools/Dockerfile | 4 ++-- packages/dart/sshnoports/tools/Dockerfile.activate | 4 ++-- packages/dart/sshnoports/tools/Dockerfile.sshnpd-slim | 2 +- tests/end2end_tests/image/Dockerfile | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/dart/sshnoports/tools/Dockerfile b/packages/dart/sshnoports/tools/Dockerfile index b7f5b93fa..04b89ecdc 100644 --- a/packages/dart/sshnoports/tools/Dockerfile +++ b/packages/dart/sshnoports/tools/Dockerfile @@ -1,7 +1,7 @@ # Dockerfile # Build image for a containerized instance of sshnpd -FROM dart:3.5.4@sha256:09330bd172355c74cdf60bc2794b0f69489afe0b325510e810090f9195282d2b AS buildimage +FROM dart:3.5.4@sha256:3f3877b9a75a1695dd284151d2dab5787bc6cefd04313b6a8e0bee98230d347b AS buildimage ENV PACKAGEDIR=packages/dart/sshnoports ENV BINARYDIR=/usr/local/at SHELL ["/bin/bash", "-c"] @@ -17,7 +17,7 @@ RUN \ dart compile exe bin/srv.dart -o ${BINARYDIR}/srv # Second stage of build FROM debian-slim -FROM debian:stable-20241202-slim@sha256:eb37f58646a901dc7727cf448cae36daaefaba79de33b5058dab79aa4c04aefb +FROM debian:stable-20241202-slim@sha256:4d63ef53faef7bd35c92fbefb1e9e2e7b6777e3cbec6c34f640e96b925e430eb ENV USER=atsign ENV HOMEDIR=/${USER} ENV BINARYDIR=/usr/local/at diff --git a/packages/dart/sshnoports/tools/Dockerfile.activate b/packages/dart/sshnoports/tools/Dockerfile.activate index 81f3d07fa..976592e1b 100644 --- a/packages/dart/sshnoports/tools/Dockerfile.activate +++ b/packages/dart/sshnoports/tools/Dockerfile.activate @@ -1,6 +1,6 @@ # Dockerfile.activate # Build image for a containerized call of the at_activate binary -FROM dart:3.5.4@sha256:09330bd172355c74cdf60bc2794b0f69489afe0b325510e810090f9195282d2b AS buildimage +FROM dart:3.5.4@sha256:3f3877b9a75a1695dd284151d2dab5787bc6cefd04313b6a8e0bee98230d347b AS buildimage ENV PACKAGEDIR=packages/dart/sshnoports ENV BINARYDIR=/usr/local/at SHELL ["/bin/bash", "-c"] @@ -15,7 +15,7 @@ RUN \ dart compile exe bin/activate_cli.dart -o ${BINARYDIR}/at_activate # Second stage of build FROM debian-slim -FROM debian:stable-20241202-slim@sha256:eb37f58646a901dc7727cf448cae36daaefaba79de33b5058dab79aa4c04aefb +FROM debian:stable-20241202-slim@sha256:4d63ef53faef7bd35c92fbefb1e9e2e7b6777e3cbec6c34f640e96b925e430eb ENV USER=atsign ENV HOMEDIR=/${USER} ENV BINARYDIR=/usr/local/at diff --git a/packages/dart/sshnoports/tools/Dockerfile.sshnpd-slim b/packages/dart/sshnoports/tools/Dockerfile.sshnpd-slim index 9f6d0f9e1..5fcc4e5c2 100644 --- a/packages/dart/sshnoports/tools/Dockerfile.sshnpd-slim +++ b/packages/dart/sshnoports/tools/Dockerfile.sshnpd-slim @@ -9,7 +9,7 @@ # as of 5th Feb 2024 - Will check state as 3.3 Stable is released #FROM dart:beta-sdk AS buildimage -FROM dart:3.5.4@sha256:09330bd172355c74cdf60bc2794b0f69489afe0b325510e810090f9195282d2b AS buildimage +FROM dart:3.5.4@sha256:3f3877b9a75a1695dd284151d2dab5787bc6cefd04313b6a8e0bee98230d347b AS buildimage ENV PACKAGEDIR=packages/dart/sshnoports ENV OPENSSH=tools/static-openssh ENV BINARYDIR=/usr/local/at diff --git a/tests/end2end_tests/image/Dockerfile b/tests/end2end_tests/image/Dockerfile index b7fde199a..83e6f76b5 100644 --- a/tests/end2end_tests/image/Dockerfile +++ b/tests/end2end_tests/image/Dockerfile @@ -1,5 +1,5 @@ # BASE -FROM debian:stable-20241202-slim@sha256:eb37f58646a901dc7727cf448cae36daaefaba79de33b5058dab79aa4c04aefb AS base +FROM debian:stable-20241202-slim@sha256:4d63ef53faef7bd35c92fbefb1e9e2e7b6777e3cbec6c34f640e96b925e430eb AS base ENV USER=atsign ENV HOMEDIR=/${USER} @@ -26,7 +26,7 @@ RUN set -eux ; \ # BRANCH # BUILD BRANCH -FROM dart:3.5.4@sha256:09330bd172355c74cdf60bc2794b0f69489afe0b325510e810090f9195282d2b AS build-branch +FROM dart:3.5.4@sha256:3f3877b9a75a1695dd284151d2dab5787bc6cefd04313b6a8e0bee98230d347b AS build-branch ENV URL=https://github.com/atsign-foundation/noports.git ENV REPO_DIR=/app/repo @@ -65,7 +65,7 @@ ENTRYPOINT cp -r /mount/. ${HOMEDIR} && sudo service ssh start && sh ${HOMEDIR}/ # LOCAL # BUILD LOCAL -FROM dart:3.5.4@sha256:09330bd172355c74cdf60bc2794b0f69489afe0b325510e810090f9195282d2b AS build-local +FROM dart:3.5.4@sha256:3f3877b9a75a1695dd284151d2dab5787bc6cefd04313b6a8e0bee98230d347b AS build-local ENV REPO_DIR=/app/repo ENV PACKAGE_DIR=${REPO_DIR}/packages/dart/sshnoports @@ -101,7 +101,7 @@ ENTRYPOINT cp -r /mount/. ${HOMEDIR} && sudo service ssh start && sh ${HOMEDIR}/ # RELEASE # BUILD RELEASE -FROM debian:stable-20241202-slim@sha256:eb37f58646a901dc7727cf448cae36daaefaba79de33b5058dab79aa4c04aefb AS build-release +FROM debian:stable-20241202-slim@sha256:4d63ef53faef7bd35c92fbefb1e9e2e7b6777e3cbec6c34f640e96b925e430eb AS build-release ARG release From dd84e13abc569855b20a261342e4b7415084f0f2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 4 Dec 2024 04:32:53 +0000 Subject: [PATCH 2/4] build(deps): Bump github/codeql-action in the github-actions group Bumps the github-actions group with 1 update: [github/codeql-action](https://github.com/github/codeql-action). Updates `github/codeql-action` from 3.27.5 to 3.27.6 - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/f09c1c0a94de965c15400f5634aa42fac8fb8f88...aa578102511db1f4524ed59b8cc2bae4f6e88195) --- updated-dependencies: - dependency-name: github/codeql-action dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-actions ... Signed-off-by: dependabot[bot] --- .github/workflows/codeql.yml | 6 +++--- .github/workflows/scorecards.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 68ee484a2..219ea20e1 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -50,7 +50,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5 + uses: github/codeql-action/init@aa578102511db1f4524ed59b8cc2bae4f6e88195 # v3.27.6 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -60,7 +60,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5 + uses: github/codeql-action/autobuild@aa578102511db1f4524ed59b8cc2bae4f6e88195 # v3.27.6 # ℹī¸ Command-line programs to run using the OS shell. # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun @@ -73,6 +73,6 @@ jobs: # ./location_of_script_within_repo/buildscript.sh - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5 + uses: github/codeql-action/analyze@aa578102511db1f4524ed59b8cc2bae4f6e88195 # v3.27.6 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml index d9afeba4a..dd59e3e55 100644 --- a/.github/workflows/scorecards.yml +++ b/.github/workflows/scorecards.yml @@ -67,6 +67,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@f09c1c0a94de965c15400f5634aa42fac8fb8f88 # v3.27.5 + uses: github/codeql-action/upload-sarif@aa578102511db1f4524ed59b8cc2bae4f6e88195 # v3.27.6 with: sarif_file: results.sarif From 64a65abfd31c6bbc9f52bd2b885e5b9d5653f95e Mon Sep 17 00:00:00 2001 From: XavierChanth Date: Tue, 3 Dec 2024 12:20:04 -0500 Subject: [PATCH 3/4] fix: activate without teapot --- .../onboarding/widgets/onboarding_button.dart | 49 ++++++++++++------- 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/packages/dart/npt_flutter/lib/features/onboarding/widgets/onboarding_button.dart b/packages/dart/npt_flutter/lib/features/onboarding/widgets/onboarding_button.dart index efef3d96d..87c48b0e0 100644 --- a/packages/dart/npt_flutter/lib/features/onboarding/widgets/onboarding_button.dart +++ b/packages/dart/npt_flutter/lib/features/onboarding/widgets/onboarding_button.dart @@ -64,7 +64,9 @@ class _OnboardingButtonState extends State { bool shouldOnboard = await selectAtsign(); if (shouldOnboard && context.mounted) { var atsignInformation = context.read().state; - onboard(atsign: atsignInformation.atSign, rootDomain: atsignInformation.rootDomain); + onboard( + atsign: atsignInformation.atSign, + rootDomain: atsignInformation.rootDomain); } }, icon: PhosphorIcon(PhosphorIcons.arrowUpRight()), @@ -73,8 +75,10 @@ class _OnboardingButtonState extends State { ), iconAlignment: IconAlignment.end, ), - _OnboardingButtonStatus.picking => Text(strings.onboardingButtonStatusPicking), - _OnboardingButtonStatus.processingFile => Text(strings.onboardingButtonStatusProcessingFile), + _OnboardingButtonStatus.picking => + Text(strings.onboardingButtonStatusPicking), + _OnboardingButtonStatus.processingFile => + Text(strings.onboardingButtonStatusProcessingFile), }; } @@ -105,8 +109,12 @@ class _OnboardingButtonState extends State { return results ?? false; } - Future onboard({required String atsign, required String rootDomain, bool isFromInitState = false}) async { - var atSigns = await KeyChainManager.getInstance().getAtSignListFromKeychain(); + Future onboard( + {required String atsign, + required String rootDomain, + bool isFromInitState = false}) async { + var atSigns = + await KeyChainManager.getInstance().getAtSignListFromKeychain(); var apiKey = await Constants.appAPIKey; var config = AtOnboardingConfig( atClientPreference: await loadAtClientPreference(rootDomain), @@ -155,7 +163,8 @@ class _OnboardingButtonState extends State { SnackBar( backgroundColor: Colors.red, content: Text( - onboardingResult?.message ?? AppLocalizations.of(context)!.onboardingError, + onboardingResult?.message ?? + AppLocalizations.of(context)!.onboardingError, ), ), ); @@ -165,7 +174,8 @@ class _OnboardingButtonState extends State { } } - Future handleAtsignByStatus(String atsign, NoPortsOnboardingUtil util) async { + Future handleAtsignByStatus( + String atsign, NoPortsOnboardingUtil util) async { AtStatus status; try { @@ -180,6 +190,7 @@ class _OnboardingButtonState extends State { switch (status.status()) { // Automatically start activation with the already entered atSign + case AtSignStatus.unavailable: case AtSignStatus.teapot: final apiKey = await Constants.appAPIKey; @@ -190,9 +201,12 @@ class _OnboardingButtonState extends State { break; } AtOnboardingConstants.setApiKey(apiKey); - AtOnboardingConstants.rootDomain = util.config.atClientPreference.rootDomain; + AtOnboardingConstants.rootDomain = + util.config.atClientPreference.rootDomain; - await AtOnboardingLocalizations.load(LanguageUtil.getLanguageFromLocale(Locale(Platform.localeName)).locale); + await AtOnboardingLocalizations.load( + LanguageUtil.getLanguageFromLocale(Locale(Platform.localeName)) + .locale); if (!mounted) return null; Map apis = { "root.atsign.org": "my.atsign.com", @@ -218,15 +232,17 @@ class _OnboardingButtonState extends State { if (result is AtOnboardingResult) { //Update primary atsign after onboard success - if (result.status == AtOnboardingResultStatus.success && result.atsign != null) { + if (result.status == AtOnboardingResultStatus.success && + result.atsign != null) { var onboardingService = OnboardingService.getInstance(); - bool res = await onboardingService.changePrimaryAtsign(atsign: result.atsign!); + bool res = await onboardingService.changePrimaryAtsign( + atsign: result.atsign!); if (!res) { - result = AtOnboardingResult.error(message: strings.errorSwitchAtSignFailed); + result = AtOnboardingResult.error( + message: strings.errorSwitchAtSignFailed); } } } - // TODO: finalize onboarding case AtSignStatus.activated: // NOTE: for now this is hard coded to do atKey file upload // Later on, we can add the APKAM flow, and will need to make some @@ -237,10 +253,6 @@ class _OnboardingButtonState extends State { result = AtOnboardingResult.error( message: strings.errorAtSignNotExist, ); - case AtSignStatus.unavailable: - result = AtOnboardingResult.error( - message: strings.errorAtServerUnavailable, - ); case null: // This case should never happen, treat it as an error case AtSignStatus.error: result = AtOnboardingResult.error( @@ -250,7 +262,8 @@ class _OnboardingButtonState extends State { return result; } - Future handleFileUploadStatusStream(Stream statusStream, String atsign) async { + Future handleFileUploadStatusStream( + Stream statusStream, String atsign) async { AtOnboardingResult? result; outer: await for (FileUploadStatus status in statusStream) { From d943d654ba9029c613699506750fd409b441fdc8 Mon Sep 17 00:00:00 2001 From: XavierChanth Date: Wed, 4 Dec 2024 17:52:29 -0500 Subject: [PATCH 4/4] chore: set app to regular Window mode when on MacOS --- .../tray_manager/widgets/tray_manager.dart | 24 +++++++++++++++---- packages/dart/npt_flutter/lib/main.dart | 7 ++++-- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/packages/dart/npt_flutter/lib/features/tray_manager/widgets/tray_manager.dart b/packages/dart/npt_flutter/lib/features/tray_manager/widgets/tray_manager.dart index 84b9a9e40..d823d45ab 100644 --- a/packages/dart/npt_flutter/lib/features/tray_manager/widgets/tray_manager.dart +++ b/packages/dart/npt_flutter/lib/features/tray_manager/widgets/tray_manager.dart @@ -1,9 +1,12 @@ +import 'dart:io'; + import 'package:flutter/scheduler.dart'; import 'package:flutter/widgets.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:npt_flutter/app.dart'; import 'package:npt_flutter/features/favorite/favorite.dart'; +import 'package:npt_flutter/features/onboarding/cubit/onboarding_cubit.dart'; import 'package:npt_flutter/features/profile/profile.dart'; import 'package:npt_flutter/features/profile_list/profile_list.dart'; import 'package:npt_flutter/features/settings/settings.dart'; @@ -23,7 +26,8 @@ class TrayManager extends StatefulWidget { State createState() => _TrayManagerState(); } -class _TrayManagerState extends State with TrayListener, WindowListener { +class _TrayManagerState extends State + with TrayListener, WindowListener { /// Must strongly type [context] here or Dart will infer the wrong type for /// the [.read()] extension which causes an error void reloadTray(BuildContext context, Loggable state) async { @@ -36,7 +40,8 @@ class _TrayManagerState extends State with TrayListener, WindowList case ProfilesRunningState _: cubit.reload(profilesRunningState: state); case SettingsLoadedState _: - var localizations = await AppLocalizations.delegate.load(state.settings.language.locale); + var localizations = await AppLocalizations.delegate + .load(state.settings.language.locale); cubit.reload(localizations: localizations); case ProfileState _: cubit.reload(profileState: state); @@ -78,12 +83,14 @@ class _TrayManagerState extends State with TrayListener, WindowList listener: reloadTray, // Only call listener when the language changes in settings listenWhen: (prev, next) { - if (prev is SettingsLoadedState && next is SettingsLoadedState) { + if (prev is SettingsLoadedState && + next is SettingsLoadedState) { return prev.settings.language != next.settings.language; } // This may cause some extra reloading (very occasionally, settings shouldn't change often) // but it should catch all of the edge cases - return prev is SettingsLoadedState || next is SettingsLoadedState; + return prev is SettingsLoadedState || + next is SettingsLoadedState; }), /// Yeah I really hate this... an indefinite list of listeners @@ -114,6 +121,7 @@ class _TrayManagerState extends State with TrayListener, WindowList trayManager.addListener(this); super.initState(); windowManager.setPreventClose(true); + windowManager.setVisibleOnAllWorkspaces(true); var dispatcher = SchedulerBinding.instance.platformDispatcher; // This callback is called every time the brightness changes. @@ -143,6 +151,12 @@ class _TrayManagerState extends State with TrayListener, WindowList @override void onWindowClose() async { - await windowManager.hide(); + var onboardingCubit = App.navState.currentContext?.read(); + if (onboardingCubit?.state.status == OnboardingStatus.onboarded) { + await windowManager.hide(); + } else { + await windowManager.destroy(); + exit(0); + } } } diff --git a/packages/dart/npt_flutter/lib/main.dart b/packages/dart/npt_flutter/lib/main.dart index 9386dd950..daeead29c 100644 --- a/packages/dart/npt_flutter/lib/main.dart +++ b/packages/dart/npt_flutter/lib/main.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:flutter/material.dart'; import 'package:npt_flutter/constants.dart'; import 'package:window_manager/window_manager.dart'; @@ -7,10 +9,11 @@ import 'app.dart'; Future main() async { WidgetsFlutterBinding.ensureInitialized(); - var windowOptions = const WindowOptions( + var windowOptions = WindowOptions( title: "NoPorts Desktop", minimumSize: Constants.kWindowsMinWindowSize, - skipTaskbar: true, + skipTaskbar: Platform.isWindows, + alwaysOnTop: true, ); windowManager.ensureInitialized(); windowManager.waitUntilReadyToShow(windowOptions);