diff --git a/.docker/files/php-school-fpm/Dockerfile b/.docker/files/php-school-fpm/Dockerfile index 14fc3473..b7028137 100644 --- a/.docker/files/php-school-fpm/Dockerfile +++ b/.docker/files/php-school-fpm/Dockerfile @@ -1,4 +1,4 @@ -FROM php:8.1-fpm AS prod +FROM php:8.3-fpm AS prod RUN apt-get -qq update && apt-get install -qqy git zlib1g-dev libzip-dev \ && rm -rf /var/lib/apt/lists/* \ diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 4b80bdea..9329052b 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -12,7 +12,7 @@ jobs: strategy: fail-fast: false matrix: - php: [8.1, 8.2] + php: [8.2, 8.3] name: PHP ${{ matrix.php }} steps: diff --git a/app/config.php b/app/config.php index 2ca4705a..5acae9fa 100644 --- a/app/config.php +++ b/app/config.php @@ -44,6 +44,7 @@ use PhpSchool\Website\Action\Online\ComposerPackageAdd; use PhpSchool\Website\Action\Online\RunExercise; use PhpSchool\Website\Action\Online\VerifyExercise; +use PhpSchool\Website\Action\SlackInvite; use PhpSchool\Website\Action\StudentLogin; use PhpSchool\Website\Action\SubmitWorkshop; use PhpSchool\Website\Action\TrackDownloads; @@ -232,14 +233,21 @@ SubmitWorkshop::class => \DI\factory(function (ContainerInterface $c): SubmitWorkshop { return new SubmitWorkshop( $c->get(FormHandlerFactory::class)->create( - new SubmitWorkshopInputFilter(new Client, $c->get(WorkshopRepository::class)) + new SubmitWorkshopInputFilter(new Client(), $c->get(WorkshopRepository::class)) ), - new WorkshopCreator(new WorkshopComposerJsonInputFilter, $c->get(WorkshopRepository::class)), + new WorkshopCreator(new WorkshopComposerJsonInputFilter(), $c->get(WorkshopRepository::class)), $c->get(EmailNotifier::class), $c->get(LoggerInterface::class) ); }), + SlackInvite::class => function (ContainerInterface $c): SlackInvite { + return new SlackInvite( + $c->get('guzzle'), + $c->get('config')['slackInviteApiToken'] + ); + }, + Github::class => function (ContainerInterface $c): Github { return new Github([ 'clientId' => $c->get('config')['github']['clientId'], @@ -320,6 +328,10 @@ ); }, + 'guzzle' => function (ContainerInterface $c): \GuzzleHttp\Client { + return new \GuzzleHttp\Client(); + }, + 'guzzle.packagist' => function (ContainerInterface $c) { return new \GuzzleHttp\Client(['headers' => ['User-Agent' => 'PHP School: phpschool.team@gmail.com']]); }, @@ -618,7 +630,8 @@ public function parse($markdown): string 'clientSecret' => $_ENV['GITHUB_CLIENT_SECRET'], ], - 'jwtSecret' => $_ENV['JWT_SECRET'] + 'jwtSecret' => $_ENV['JWT_SECRET'], + 'slackInviteApiToken' => $_ENV['SLACK_INVITE_API_TOKEN'], ], //slim settings diff --git a/assets/app.js b/assets/app.js index 6071a9f5..1f1d65c1 100644 --- a/assets/app.js +++ b/assets/app.js @@ -60,7 +60,7 @@ const docRoutes = [].concat( const routes = [ { path: "/", component: Home, meta: { layout: MainLayout } }, - { path: "/online", component: Dashboard, meta: { layout: CompactLayout } }, + { path: "/online/:workshop?", component: Dashboard, meta: { layout: CompactLayout } }, { path: "/online/editor/:workshop/:exercise", component: ExerciseEditor, diff --git a/assets/components/Online/ExerciseVerify.vue b/assets/components/Online/ExerciseVerify.vue index 4ec1976c..394163da 100644 --- a/assets/components/Online/ExerciseVerify.vue +++ b/assets/components/Online/ExerciseVerify.vue @@ -39,8 +39,6 @@ const enableRateLimitError = () => { }; const runSolution = async () => { - currentAction.value = "run"; - if (loadingRun.value) { return; } @@ -81,8 +79,6 @@ const runSolution = async () => { }; const verifySolution = () => { - currentAction.value = "verify"; - if (loadingVerify.value) { return; } @@ -183,16 +179,25 @@ const verifySolution = () => { > -