diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..c0e7798b --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,21 @@ +# Changelog + +## [Unreleased] + +* + +## [1.3.0] - 05-12-2020 + +* Added Edgebox Browser Development Environment Feature Support + * Added tasks for handling browser development environment into TaskFactory + * Added options for handling browser development environment data into OptionsRepository + * Added BrowserDevHelper class for handling browser development environment tasks in a more convenient way + * Added API route to ApiController for handling getBrowserDevStatus, enableBrowserDev, disableBrowserDev, setBrowserDevPassword tasks, and returning the status. + * Added section for handling browser development environment in the Settings page + * Added Javascript to handle browser development environment task buttons and status updates in the settings page section + * Added Browser Development Environment button to EdgeApps detail page when this feature is enabled + +### Missing Past Releases + +Release notes for past versions are not available in this file. Please refer to the [GitHub releases](https://hithub.com/edgebox-iot/api/releases) for more information. Feel free to contribute to this file by adding missing release notes. + diff --git a/src/public/assets/img/changelog-assets/screenshot_2024-12-06_1.jpeg b/src/public/assets/img/changelog-assets/screenshot_2024-12-06_1.jpeg new file mode 100644 index 00000000..653ac3b9 Binary files /dev/null and b/src/public/assets/img/changelog-assets/screenshot_2024-12-06_1.jpeg differ diff --git a/src/public/assets/img/changelog-assets/screenshot_2024-12-06_2.jpeg b/src/public/assets/img/changelog-assets/screenshot_2024-12-06_2.jpeg new file mode 100644 index 00000000..a4b603bb Binary files /dev/null and b/src/public/assets/img/changelog-assets/screenshot_2024-12-06_2.jpeg differ diff --git a/src/public/assets/img/changelog-assets/screenshot_2024-12-06_3.jpeg b/src/public/assets/img/changelog-assets/screenshot_2024-12-06_3.jpeg new file mode 100644 index 00000000..bdb30ec9 Binary files /dev/null and b/src/public/assets/img/changelog-assets/screenshot_2024-12-06_3.jpeg differ diff --git a/src/public/assets/img/edgeapps/hello.png b/src/public/assets/img/edgeapps/hello.png new file mode 100644 index 00000000..e07ed524 Binary files /dev/null and b/src/public/assets/img/edgeapps/hello.png differ diff --git a/src/public/assets/img/edgeapps/paperlessngx.png b/src/public/assets/img/edgeapps/paperlessngx.png new file mode 100644 index 00000000..ca1f7b08 Binary files /dev/null and b/src/public/assets/img/edgeapps/paperlessngx.png differ diff --git a/src/public/assets/img/edgeapps/rocketchat.png b/src/public/assets/img/edgeapps/rocketchat.png new file mode 100644 index 00000000..c2923b57 Binary files /dev/null and b/src/public/assets/img/edgeapps/rocketchat.png differ diff --git a/src/public/assets/img/edgeapps/syncthing.png b/src/public/assets/img/edgeapps/syncthing.png new file mode 100644 index 00000000..9cd398de Binary files /dev/null and b/src/public/assets/img/edgeapps/syncthing.png differ diff --git a/src/public/assets/img/edgeapps/test_banner.jpg b/src/public/assets/img/edgeapps/test_banner.jpg deleted file mode 100644 index d17ffa7e..00000000 Binary files a/src/public/assets/img/edgeapps/test_banner.jpg and /dev/null differ diff --git a/src/src/Attribute/RunMiddleware.php b/src/src/Attribute/RunMiddleware.php index fb02b69f..fb57395f 100644 --- a/src/src/Attribute/RunMiddleware.php +++ b/src/src/Attribute/RunMiddleware.php @@ -5,7 +5,17 @@ #[\Attribute(\Attribute::TARGET_METHOD)] class RunMiddleware { + protected array $args; + public function __construct( - public string $name - ) {} + public string $name, + ...$extras + ) { + $this->extras = $extras; + } + + public function getExtras(): array + { + return $this->extras; + } } \ No newline at end of file diff --git a/src/src/Controller/ApiController.php b/src/src/Controller/ApiController.php index 9d1d5940..974b3fe3 100644 --- a/src/src/Controller/ApiController.php +++ b/src/src/Controller/ApiController.php @@ -8,6 +8,7 @@ use App\Helper\DashboardHelper; use App\Helper\EdgeAppsHelper; use App\Helper\ShellHelper; +use App\Helper\BrowserDevHelper; use App\Helper\TunnelHelper; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; @@ -23,6 +24,7 @@ class ApiController extends AbstractController private DashboardHelper $dashboardHelper; private TunnelHelper $tunnelHelper; private ShellHelper $shellHelper; + private BrowserDevHelper $browserDevHelper; private BackupsHelper $backupsHelper; private EdgeAppsHelper $edgeAppsHelper; private TaskFactory $taskFactory; @@ -32,6 +34,7 @@ public function __construct( DashboardHelper $dashboardHelper, TunnelHelper $tunnelHelper, ShellHelper $shellHelper, + BrowserDevHelper $browserDevHelper, BackupsHelper $backupsHelper, EdgeAppsHelper $edgeAppsHelper, TaskFactory $taskFactory @@ -40,6 +43,7 @@ public function __construct( $this->dashboardHelper = $dashboardHelper; $this->tunnelHelper = $tunnelHelper; $this->shellHelper = $shellHelper; + $this->browserDevHelper = $browserDevHelper; $this->backupsHelper = $backupsHelper; $this->edgeAppsHelper = $edgeAppsHelper; $this->taskFactory = $taskFactory; @@ -131,6 +135,34 @@ public function settingsShell(Request $request): JsonResponse return new JsonResponse($response); } + #[Route('/api/settings/browserdev', name: 'api_settings_browserdev')] + public function settingsBrowserDev(Request $request): JsonResponse + { + if ($request->isMethod('post')) { + $data = json_decode($request->getContent(), true); + $response = [ + 'status' => 'error', + 'message' => 'Invalid operation', + ]; + + if (isset($data['op'])) { + if ('changepw' == $data['op'] && isset($data['password'])) { + $response = $this->browserDevHelper->setBrowserDevPassword($data['password']); + } elseif ('disable' == $data['op']) { + $response = $this->browserDevHelper->disableBrowserDev(); + } elseif ('enable' == $data['op']) { + $response = $this->browserDevHelper->enableBrowserDev(); + } elseif ('status' == $data['op']) { + $response = $this->browserDevHelper->getBrowserDevStatus(); + } + } + } else { + $response = $this->browserDevHelper->getBrowserDevStatus(true); + } + + return new JsonResponse($response); + } + #[Route('/api/backups', name: 'api_backups')] public function backups(Request $request): JsonResponse { diff --git a/src/src/Controller/BackupsController.php b/src/src/Controller/BackupsController.php index 80b454d4..0b2c2734 100644 --- a/src/src/Controller/BackupsController.php +++ b/src/src/Controller/BackupsController.php @@ -28,7 +28,7 @@ public function __construct( #[Route('/backups', name: 'backups')] public function index(): Response { - return $this->render('backups/index.html.twig', [ + return $this->render('pages/backups/index.html.twig', [ 'controller_title' => 'Backups', 'controller_subtitle' => 'Safeguard Data', 'backup_status' => $this->backupsHelper->getBackupsStatus(), diff --git a/src/src/Controller/ChangelogController.php b/src/src/Controller/ChangelogController.php index 0f4f5b89..a6c8dfbc 100644 --- a/src/src/Controller/ChangelogController.php +++ b/src/src/Controller/ChangelogController.php @@ -55,7 +55,7 @@ public function hello(): Response # If LAST_SEEN_CHANGELOG_VERSION is not set, redirect to the changelog page. - return $this->render('changelog/' . $target_version . '.html.twig', [ + return $this->render('pages/changelog/' . $target_version . '.html.twig', [ // 'controller_title' => 'Dashboard', // 'controller_subtitle' => 'Welcome back!', // 'container_system_uptime' => $this->getSystemUptimeContainerVar(), @@ -72,7 +72,7 @@ public function hello(): Response #[Route('/changelog/{version}', name: 'changelog-version')] public function changelog_version(string $version): Response { - return $this->render('changelog/' . $version . '.html.twig', [ + return $this->render('pages/changelog/' . $version . '.html.twig', [ // 'controller_title' => 'Dashboard', // 'controller_subtitle' => 'Welcome back!', // 'container_system_uptime' => $this->getSystemUptimeContainerVar(), diff --git a/src/src/Controller/DocsController.php b/src/src/Controller/DocsController.php index f09cc649..9aa832c9 100644 --- a/src/src/Controller/DocsController.php +++ b/src/src/Controller/DocsController.php @@ -11,7 +11,7 @@ class DocsController extends AbstractController #[Route('/docs', name: 'docs')] public function index(): Response { - return $this->render('docs/index.html.twig', [ + return $this->render('pages/docs/index.html.twig', [ 'page_title' => 'Documentation', 'page_subtitle' => 'Documentation', ]); diff --git a/src/src/Controller/EdgeAppsController.php b/src/src/Controller/EdgeAppsController.php index fa0a9271..834bff41 100644 --- a/src/src/Controller/EdgeAppsController.php +++ b/src/src/Controller/EdgeAppsController.php @@ -9,6 +9,7 @@ use App\Helper\DashboardHelper; use App\Helper\EdgeAppsHelper; use App\Helper\SystemHelper; +use App\Helper\BrowserDevHelper; use App\Repository\OptionRepository; use App\Repository\TaskRepository; use App\Controller\BaseController; @@ -25,6 +26,7 @@ class EdgeAppsController extends BaseController private EntityManagerInterface $entityManager; private EdgeAppsHelper $edgeAppsHelper; private SystemHelper $systemHelper; + private BrowserDevHelper $browserDevHelper; private TaskFactory $taskFactory; protected DashboardHelper $dashboardHelper; @@ -59,6 +61,7 @@ public function __construct( EntityManagerInterface $entityManager, EdgeAppsHelper $edgeAppsHelper, SystemHelper $systemHelper, + BrowserDevHelper $browserDevHelper, TaskFactory $taskFactory, TaskRepository $taskRepository, DashboardHelper $dashboardHelper @@ -67,6 +70,7 @@ public function __construct( $this->entityManager = $entityManager; $this->edgeAppsHelper = $edgeAppsHelper; $this->systemHelper = $systemHelper; + $this->browserDevHelper = $browserDevHelper; $this->taskFactory = $taskFactory; $this->taskRepository = $taskRepository; $this->dashboardHelper = $dashboardHelper; @@ -88,7 +92,7 @@ public function index(): Response $framework_ready = true; } - return $this->render('edgeapps/index.html.twig', [ + return $this->render('pages/edgeapps/index.html.twig', [ 'controller_title' => 'EdgeApps', 'controller_subtitle' => 'Applications control', 'framework_ready' => $framework_ready, @@ -156,7 +160,7 @@ public function details(Request $request, string $edgeapp): Response } } - return $this->render('edgeapps/details.html.twig', [ + return $this->render('pages/edgeapps/details.html.twig', [ 'controller_title' => 'EdgeApps', 'controller_subtitle' => 'Application details', 'release_version' => $this->systemHelper->getReleaseVersion(), @@ -165,6 +169,7 @@ public function details(Request $request, string $edgeapp): Response 'edgeapp' => $edgeapp_config, 'edgeapp_logs' => $logs, 'dashboard_settings' => $this->dashboardHelper->getSettings(), + 'browserdev_status' => $this->browserDevHelper->getBrowserDevStatus(), ]); } @@ -203,7 +208,7 @@ public function action(string $action, string $edgeapp): Response $action_result = 'edgeapp_not_found'; } - return $this->render('edgeapps/action.html.twig', [ + return $this->render('pages/edgeapps/action.html.twig', [ 'controller_title' => 'EdgeApps - '.$controller_title, 'controller_subtitle' => 'Please wait...', 'edgeapp' => $edgeapp, diff --git a/src/src/Controller/HomeController.php b/src/src/Controller/HomeController.php index 926c14e4..1302b131 100644 --- a/src/src/Controller/HomeController.php +++ b/src/src/Controller/HomeController.php @@ -48,7 +48,7 @@ public function __construct( #[Route('/hello', name: 'hello')] public function hello(): Response { - return $this->render('home/hello.html.twig', [ + return $this->render('pages/home/hello.html.twig', [ // 'controller_title' => 'Dashboard', // 'controller_subtitle' => 'Welcome back!', // 'container_system_uptime' => $this->getSystemUptimeContainerVar(), @@ -68,7 +68,7 @@ public function index(): Response $actions_overview = $this->getActionsOverviewContainerVars(); - return $this->render('home/index.html.twig', [ + return $this->render('pages/home/index.html.twig', [ 'controller_title' => 'Dashboard', 'controller_subtitle' => 'Welcome back!', 'container_system_uptime' => $this->getSystemUptimeContainerVar(), @@ -243,6 +243,24 @@ private function getActionsOverviewContainerVars(): array Task::STATUS_FINISHED => 'Stopped interactive shell', Task::STATUS_ERROR => 'Failed to stop interactive shell', ], + 'activate_browserdev' => [ + Task::STATUS_CREATED => 'Waiting to activate Browser Dev Environment', + Task::STATUS_EXECUTING => 'Activating Browser Dev Environment', + Task::STATUS_FINISHED => 'Activated Browser Dev Environment', + Task::STATUS_ERROR => 'Failed to activate Browser Dev Environment', + ], + 'deactivate_browserdev' => [ + Task::STATUS_CREATED => 'Waiting to deactivate Browser Dev Environment', + Task::STATUS_EXECUTING => 'Deactivating Browser Dev Environment', + Task::STATUS_FINISHED => 'Deactivated Browser Dev Environment', + Task::STATUS_ERROR => 'Failed to deactivate Browser Dev Environment', + ], + 'set_browserdev_password' => [ + Task::STATUS_CREATED => 'Waiting to set Browser Dev Environment password', + Task::STATUS_EXECUTING => 'Setting Browser Dev Environment password', + Task::STATUS_FINISHED => 'Set Browser Dev Environment password', + Task::STATUS_ERROR => 'Failed to set Browser Dev Environment password', + ], ]; $unknown_action_descriptions = [ @@ -263,6 +281,8 @@ private function getActionsOverviewContainerVars(): array 'disable_tunnel' => 'scissors', 'enable_public_dashboard' => 'ui-04', 'disable_public_dashboard' => 'ui-04', + 'activate_browserdev' => 'button-play', + 'deactivate_browserdev' => 'button-pause', 'unknown_action' => 'ui-04', ]; diff --git a/src/src/Controller/RegistrationController.php b/src/src/Controller/RegistrationController.php index db0d5657..f9ee70a1 100644 --- a/src/src/Controller/RegistrationController.php +++ b/src/src/Controller/RegistrationController.php @@ -53,7 +53,7 @@ public function register(Request $request, UserPasswordHasherInterface $password ); } - return $this->render('registration/index.html.twig', [ + return $this->render('pages/registration/index.html.twig', [ 'registrationForm' => $form->createView(), ]); } diff --git a/src/src/Controller/SecurityController.php b/src/src/Controller/SecurityController.php index 5c874b41..909c401d 100644 --- a/src/src/Controller/SecurityController.php +++ b/src/src/Controller/SecurityController.php @@ -34,7 +34,7 @@ public function login(AuthenticationUtils $authenticationUtils): Response // last username entered by the user $lastUsername = $authenticationUtils->getLastUsername(); - return $this->render('security/login.html.twig', ['controller_title' => 'Login', 'controller_subtitle' => 'Access the dashboard', 'last_username' => $lastUsername, 'error' => $error]); + return $this->render('pages/security/login.html.twig', ['controller_title' => 'Login', 'controller_subtitle' => 'Access the dashboard', 'last_username' => $lastUsername, 'error' => $error]); } #[Route('/logout', name: 'app_logout')] diff --git a/src/src/Controller/SettingsController.php b/src/src/Controller/SettingsController.php index 16be6159..8ff3b8ad 100644 --- a/src/src/Controller/SettingsController.php +++ b/src/src/Controller/SettingsController.php @@ -11,6 +11,7 @@ use App\Helper\EdgeAppsHelper; use App\Helper\EdgeboxioApiConnector; use App\Helper\ShellHelper; +use App\Helper\BrowserDevHelper; use App\Helper\UpdatesHelper; use App\Helper\SystemHelper; use App\Helper\TunnelHelper; @@ -33,6 +34,7 @@ class SettingsController extends BaseController private EdgeAppsHelper $edgeAppsHelper; private SystemHelper $systemHelper; private ShellHelper $shellHelper; + private BrowserDevHelper $browserDevHelper; private UpdatesHelper $updatesHelper; private EntityManagerInterface $entityManager; private TunnelHelper $tunnelHelper; @@ -64,6 +66,7 @@ public function __construct( EdgeAppsHelper $edgeAppsHelper, SystemHelper $systemhelper, ShellHelper $shellHelper, + BrowserDevHelper $browserDevHelper, UpdatesHelper $updatesHelper, EntityManagerInterface $entityManager, DashboardHelper $dashboardHelper, @@ -76,6 +79,7 @@ public function __construct( $this->edgeAppsHelper = $edgeAppsHelper; $this->systemHelper = $systemhelper; $this->shellHelper = $shellHelper; + $this->browserDevHelper = $browserDevHelper; $this->updatesHelper = $updatesHelper; $this->entityManager = $entityManager; $this->dashboardHelper = $dashboardHelper; @@ -312,7 +316,9 @@ public function index(Request $request): Response $updates_status = $this->updatesHelper->getUpdatesStatus(); - return $this->render('settings/index.html.twig', [ + $browserdev_status = $this->browserDevHelper->getBrowserDevStatus(true); + + return $this->render('pages/settings/index.html.twig', [ 'controller_title' => 'Settings', 'controller_subtitle' => 'Features & Security', 'alert' => $alert, @@ -334,6 +340,7 @@ public function index(Request $request): Response 'dash_internet_url' => $dash_internet_url, 'dashboard_settings' => $this->dashboardHelper->getSettings(), 'updates_status' => $updates_status, + 'browserdev_status' => $browserdev_status, ]); } @@ -378,7 +385,7 @@ public function action(string $action): Response $this->entityManager->flush(); } - return $this->render('settings/action.html.twig', [ + return $this->render('pages/settings/action.html.twig', [ 'controller_title' => 'Settings - '.$controller_title, 'controller_subtitle' => 'Please wait...', 'framework_ready' => $framework_ready, diff --git a/src/src/Controller/StorageController.php b/src/src/Controller/StorageController.php index 75b5e80b..add6990c 100644 --- a/src/src/Controller/StorageController.php +++ b/src/src/Controller/StorageController.php @@ -33,7 +33,7 @@ public function index(): Response $storage_ready = true; } - return $this->render('storage/index.html.twig', [ + return $this->render('pages/storage/index.html.twig', [ 'controller_title' => 'Storage', 'controller_subtitle' => 'Buckets & Drives', 'storage_ready' => $storage_ready, @@ -45,7 +45,7 @@ public function index(): Response #[Route('/storage/device/new', name: 'storage_device_new')] public function storage_device_new(): Response { - return $this->render('storage/device/new.html.twig', [ + return $this->render('pages/storage/device/new.html.twig', [ 'controller_title' => 'Storage', 'controller_subtitle' => 'Add new device', 'dashboard_settings' => $this->dashboardHelper->getSettings(), diff --git a/src/src/EventSubscriber/MiddlewareSubscriber.php b/src/src/EventSubscriber/MiddlewareSubscriber.php index 6e0fd1f2..5829a242 100644 --- a/src/src/EventSubscriber/MiddlewareSubscriber.php +++ b/src/src/EventSubscriber/MiddlewareSubscriber.php @@ -43,17 +43,26 @@ public function onKernelController(ControllerEvent $event): void $run_middleware_instance = $attribute->newInstance(); $middleware = $run_middleware_instance; } - - $methodName = $middleware->name; + + $firstMethodName = $middleware->name; + $otherMethodNames = $middleware->getExtras(); + + $methodNames = [$firstMethodName, ...$otherMethodNames]; $middleware_result = null; - if (method_exists($controller[0], $methodName)) { - $middleware_result = $controller[0]->$methodName(); + foreach ($methodNames as $methodName) { + // If middleware result is not null, stop for loop + // If return of middleware is Response or RedirectResponse, return it + if ($middleware_result && ($middleware_result instanceof Response || $middleware_result instanceof RedirectResponse)) { + break; + } + if (method_exists($controller[0], $methodName)) { + $middleware_result = $controller[0]->$methodName(); + } } - // If return of middleware is Response or RedirectResponse, return it - if ($middleware_result && ($middleware_result instanceof Response || $middleware_result instanceof RedirectResonse)) { + if ($middleware_result) { $event->setController(fn() => $middleware_result); } } diff --git a/src/src/Factory/TaskFactory.php b/src/src/Factory/TaskFactory.php index 774b6110..7739def0 100644 --- a/src/src/Factory/TaskFactory.php +++ b/src/src/Factory/TaskFactory.php @@ -33,6 +33,9 @@ class TaskFactory public const DISABLE_PUBLIC_DASHBOARD = 'disable_public_dashboard'; public const CHECK_UPDATES = 'check_updates'; public const APPLY_UPDATES = 'apply_updates'; + public const ENABLE_BROWSERDEV = 'activate_browserdev'; + public const DISABLE_BROWSERDEV = 'deactivate_browserdev'; + public const SET_BROWSERDEV_PASSWORD = 'set_browserdev_password'; private OptionRepository $optionRepository; private EdgeAppsHelper $edgeAppsHelper; @@ -256,7 +259,7 @@ public function createDisablePublicDashboardTask(): Task return $task; } - public function createCheckUpdatesTask(int $timeout): Task + public function createCheckUpdatesTask(): Task { $task = new Task(); $task->setTask(self::CHECK_UPDATES); @@ -271,4 +274,26 @@ public function createApplyUpdatesTask(): Task return $task; } + + public function createEnableBrowserDevTask(): Task + { + $task = new Task(); + $task->setTask(self::ENABLE_BROWSERDEV); + return $task; + } + + public function createDisableBrowserDevTask(): Task + { + $task = new Task(); + $task->setTask(self::DISABLE_BROWSERDEV); + return $task; + } + + public function createSetBrowserDevPasswordTask(string $password): Task + { + $task = new Task(); + $task->setTask(self::SET_BROWSERDEV_PASSWORD); + $task->setArgs(json_encode(['password' => $password])); + return $task; + } } diff --git a/src/src/Helper/BrowserDevHelper.php b/src/src/Helper/BrowserDevHelper.php new file mode 100644 index 00000000..fdc77dc5 --- /dev/null +++ b/src/src/Helper/BrowserDevHelper.php @@ -0,0 +1,109 @@ +optionRepository = $optionRepository; + $this->entityManager = $entityManager; + $this->taskFactory = $taskFactory; + } + + public function disableBrowserDev(): array + { + $task = $this->taskFactory->createDisableBrowserDevTask(); + $this->entityManager->persist($task); + $this->entityManager->flush(); + + return [ + 'task_id' => $task->getId(), + 'task_status' => $task->getStatus(), + 'task_args' => $task->getArgs(), + ]; + } + + public function enableBrowserDev(): array + { + $task = $this->taskFactory->createEnableBrowserDevTask(); + $this->entityManager->persist($task); + $this->entityManager->flush(); + + return [ + 'task_id' => $task->getId(), + 'task_status' => $task->getStatus(), + 'task_args' => $task->getArgs(), + ]; + } + + public function setBrowserDevPassword(string $password): array + { + $task = $this->taskFactory->createSetBrowserDevPasswordTask($password); + $this->entityManager->persist($task); + $this->entityManager->flush(); + + return [ + 'task_id' => $task->getId(), + 'task_status' => $task->getStatus(), + 'task_args' => $task->getArgs(), + ]; + + } + + public function getBrowserDevPassword(): string + { + return $this->optionRepository->findBrowserDevPassword() ?? ''; + } + public function getBrowserDevUrl(): string + { + return "https://dev." . $this->optionRepository->findDomainName(); + } + + public function getBrowserDevStatus($with_password=false): array + { + $running_result = [ + 'status' => 'not_running', + 'status_message' => 'Browser Dev Environment is not running', + 'url' => $this->getBrowserDevUrl(), + ]; + if ($with_password) { + $password = $this->getBrowserdevPassword(); + $running_result['password'] = $password; + } + + $browser_dev_status_option = $this->optionRepository->findBrowserDevStatus() ?? new Option(); + + if (null === $browser_dev_status_option || 'null' === $browser_dev_status_option || 'not_running' === $browser_dev_status_option) { + return $running_result; + } + + $val = $browser_dev_status_option; + + if ('running' === $val) { + $running_result = [ + 'status' => 'running', + 'status_message' => 'Browser Dev Environment is running', + 'url' => $this->getBrowserDevUrl(), + ]; + if ($with_password) { + $password = $this->getBrowserdevPassword(); + $running_result['password'] = $password; + } + } + + return $running_result; + } +} diff --git a/src/src/Helper/DashboardHelper.php b/src/src/Helper/DashboardHelper.php index 66ed61c3..b6ed0c28 100644 --- a/src/src/Helper/DashboardHelper.php +++ b/src/src/Helper/DashboardHelper.php @@ -36,7 +36,7 @@ public function getOptionValue(string $name): ?string public function getSystemChangelogVersion(): string { - $changelog_files = glob(__DIR__ . '/../../templates/changelog/*.html.twig'); + $changelog_files = glob(__DIR__ . '/../../templates/pages/changelog/*.html.twig'); $changelog_files = array_map('basename', $changelog_files); $changelog_files = array_map(fn($file) => str_replace('.html.twig', '', $file), $changelog_files); $changelog_files = array_map(fn($file) => str_replace('changelog-', '', $file), $changelog_files); @@ -57,12 +57,14 @@ public function getSettings(): array $show_me_when_it_twerks_value = $this->getOptionValue('DASHBOARD_SHOW_ME_WHEN_IT_TWERKS') ?? 'no'; $block_default_apps_public_access_value = $this->getOptionValue('DASHBOARD_BLOCK_DEFAULT_APPS_PUBLIC_ACCESS') ?? 'no'; $show_purpose_label_on_quick_access_icons = $this->getOptionValue('DASHBOARD_SHOW_PURPOSE_LABEL_ON_QUICK_ACCESS_ICONS') ?? 'yes'; + $browser_dev_env_status = $this->getOptionValue('BROWSERDEV_STATUS') ?? 'not_running'; $data = [ 'color_mood' => $color_mood_value, 'sidebar_style' => $sidebar_style_value, 'topbar_style' => $topbar_style_value, 'show_only_installed_apps' => $show_only_installed_apps_value, + 'browser_dev_env_status' => $browser_dev_env_status, 'show_me_when_it_twerks' => $show_me_when_it_twerks_value, 'block_default_apps_public_access' => $block_default_apps_public_access_value, 'show_purpose_label_on_quick_access_icons' => $show_purpose_label_on_quick_access_icons, diff --git a/src/src/Helper/UpdatesHelper.php b/src/src/Helper/UpdatesHelper.php index d5eed06e..7d610bab 100644 --- a/src/src/Helper/UpdatesHelper.php +++ b/src/src/Helper/UpdatesHelper.php @@ -38,7 +38,7 @@ public function checkUpdates(): array public function applyUpdates(): array { - $task = $this->taskFactory->createApplyUpdatesTask($timeout); + $task = $this->taskFactory->createApplyUpdatesTask(); $this->entityManager->persist($task); $this->entityManager->flush(); diff --git a/src/src/Repository/OptionRepository.php b/src/src/Repository/OptionRepository.php index 3b8351c6..64c45257 100644 --- a/src/src/Repository/OptionRepository.php +++ b/src/src/Repository/OptionRepository.php @@ -54,6 +54,17 @@ public function findUpdatesStatus(): ?string return $this->findOption('SYSTEM_UPDATES'); } + public function findBrowserDevStatus(): ?string + { + return $this->findOption('BROWSERDEV_STATUS'); + } + + public function findBrowserDevPassword(): ?string + { + return $this->findOption('BROWSERDEV_PASSWORD'); + + } + private function findOption(string $name) { $option = $this->findOneBy(['name' => $name]); diff --git a/src/templates/base.html.twig b/src/templates/base.html.twig index d2a135f7..da14f75c 100644 --- a/src/templates/base.html.twig +++ b/src/templates/base.html.twig @@ -30,8 +30,7 @@ - - + @@ -887,7 +886,7 @@ buttons[i].classList.add("disabled"); } - // Send API request to /api/settings/tunnel to start setup + // Send API request to /api/settings/shell to start setup fetch('/api/settings/shell', { method: 'POST', headers: { @@ -957,6 +956,189 @@ {% endif %} + {% if browserdev_status is defined and browserdev_status.password is defined %} + + {% endif %} #} + + + +
+
+
+
+
+

+ Improvements and Fixes +

+

+ for a better experience 🎉 +

+

+

+ Version 1.3 is a big internal update, and we cleaned a lot of ground on capabilities, stability and details! +

Launching future updates is going to be easier and faster, and we're excited to focus our efforts across the next minor verions towards cleaning and make Edgebox even more practical, secure, and robust. Here's what we've done so far:

+
+
+ 🏗️ Creating new apps from templates: +
    +
  • + we start our journey through the devyoelopment environment with much improved tooling to run and work with Edgebox in a development setting.
    You can now scaffold a new Edgeapp from a set of templates, using the browser dev environment tasks existing when you open in the apps path (/home/system/components/apps/). For this release there is only a "hello" template, but we're working on more. +
  • +
+ 👀 A bunch of new development tasks to help you with your development: +
    +
  • + Edgeapps can now have a tasks file that can help you easily run them and modify them in the Browser Development Environment!, using Cmd/Crtl+Shift+P and selecting the "Run Task" command to choose waht task to run. +
  • +
  • + The same tasks system exists across all internal edgebox core modules, so its easier than ever to contribute back to the project. +
  • +
  • + Future minor updates will continue introducing new tasks and ways to facilitate developing things using Edgebox. +
  • +
+ + {#
+
+
+ team-2 + team-2 + team-2 +
+
+
#} + + 🪲 We also fixed some things to simplify Edgebox: +
    +
  • + We improved the experience of the advanced settings section collapsible cards to open when tapping on either the title or the explanatory subtitle. +
  • +
  • + We've fixed some issues we've found with the system control service when developing the browser dev environment. +
  • +
  • + We've made several improvements to the Edgeapps framework around postinstall scripts and app file structure to support the bootstrap tool and have a better overall experience of developing and running Edgeapps. +
  • +
  • + We've updated the updater module to better detect the current version and available new versions. This module now supports finding when you are running a development version of a module, and detect + update to pre-releases and beta versions. +
  • +
+

+
+
+
+
+
+ +
+
+
+
+
+
+ +
+ +
+
+ + + + +
+
+
+
+ +
+
+ + + + + {% endblock content %} diff --git a/src/templates/docs/index.html.twig b/src/templates/pages/docs/index.html.twig similarity index 100% rename from src/templates/docs/index.html.twig rename to src/templates/pages/docs/index.html.twig diff --git a/src/templates/edgeapps/action.html.twig b/src/templates/pages/edgeapps/action.html.twig similarity index 96% rename from src/templates/edgeapps/action.html.twig rename to src/templates/pages/edgeapps/action.html.twig index 58fa81ef..f5d4e2a7 100644 --- a/src/templates/edgeapps/action.html.twig +++ b/src/templates/pages/edgeapps/action.html.twig @@ -33,25 +33,26 @@

{% if action == "remove" %} -

Removing {{edgeapp}}

This can take a minute...

+

Removing {{edgeapp}}

{% endif %} {% if action == "install" %} -

Installing {{edgeapp}}

This can take a minute...

+

Installing {{edgeapp}}

{% endif %} {% if action == "stop" %} -

Stopping {{edgeapp}}

This can take a minute...

+

Stopping {{edgeapp}}

{% endif %} {% if action == "start" %} -

Starting {{edgeapp}}

This can take a minute...

+

Starting {{edgeapp}}

{% endif %} {% if action == "enable_online" %} -

Enabling online access to {{edgeapp}}

This can take a minute...

+

Enabling online access to {{edgeapp}}

{% endif %} {% if action == "disable_online" %} -

Disabling online access to {{edgeapp}}

This can take a minute...

+

Disabling online access to {{edgeapp}}

{% endif %} +

This will take a couple of minutes...

-

You will be automatically redirected once this task finishes 😉

+

You can continue using your Edgebox while this happens 😉