Skip to content

Commit

Permalink
Feature/monorepo (#568)
Browse files Browse the repository at this point in the history
* wip changed security

* wip security

* Fix styling

* added presspanelprovider

* wip security

* added press

* Fix styling

* add preset for pree

* added press

* Fix styling

* Fix styling

* added expiry and trainings

* preset press auth

* changeds command in expiries and trainings

* install both packages

* Fix styling

* Update monorepo-split-packages.yml

---------

Co-authored-by: Kim-the-Diamond <Kim-the-Diamond@users.noreply.github.com>
Co-authored-by: mooxbot <mooxbot@users.noreply.github.com>
  • Loading branch information
3 people committed Jul 24, 2024
1 parent 3993f2b commit 900c582
Show file tree
Hide file tree
Showing 3,155 changed files with 1,366,374 additions and 33 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
75 changes: 69 additions & 6 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,56 @@ APP_NAME=Moox
APP_ENV=local
APP_KEY=base64:1NxfrNErQ0vo1ZnPcLeVhnE7tOZdKlKiFORzPA92krM=
APP_DEBUG=true
APP_TIMEZONE=UTC
APP_URL=https://moox.test

CUSTOM_VIEWS = example

WP_PREFIX="jku8u_"
WP_PATH="/public/wp"
WP_SLUG="/wp"
ADMIN_SLUG="/press"

WP_DEBUG=true
WP_DEBUG_LOG=true
WP_DEBUG_DISPLAY=false

WP_MEMORY_LIMIT=512M

IP_WHITELIST=""
LOCK_WP=true
AUTH_WP=true

REDIRECT_INDEX=false
REDIRECT_TO_WP=false
REDIRECT_LOGIN=true
REDIRECT_LOGOUT=true
REDIRECT_EDITOR=true

FORGOT_PASSWORD=true
REGISTRATION=false
ENABLE_MFA=false

WP_AUTH_KEY="ThisIsASecretKey!DoNotUseItInProduction!ChangeIt!"
WP_SECURE_AUTH_KEY="ThisIsASecretKey!DoNotUseItInProduction!ChangeIt!"
WP_LOGGED_IN_KEY="ThisIsASecretKey!DoNotUseItInProduction!ChangeIt!"
WP_NONCE_KEY="ThisIsASecretKey!DoNotUseItInProduction!ChangeIt!"
WP_AUTH_SALT="ThisIsASecretKey!DoNotUseItInProduction!ChangeIt!"
WP_SECURE_AUTH_SALT="ThisIsASecretKey!DoNotUseItInProduction!ChangeIt!"
WP_LOGGED_IN_SALT="ThisIsASecretKey!DoNotUseItInProduction!ChangeIt!"
WP_NONCE_SALT="ThisIsASecretKey!DoNotUseItInProduction!ChangeIt!"

APP_LOCALE=en
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=en_US

APP_MAINTENANCE_DRIVER=file
APP_MAINTENANCE_STORE=database

BCRYPT_ROUNDS=12

LOG_CHANNEL=stack
LOG_STACK=single
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

Expand All @@ -18,23 +63,33 @@ DB_DATABASE=moox
DB_USERNAME=root
DB_PASSWORD=

BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DISK=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=database
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null

BROADCAST_CONNECTION=log
FILESYSTEM_DISK=local
QUEUE_CONNECTION=database

CACHE_STORE=database
CACHE_PREFIX=

MEMCACHED_HOST=127.0.0.1

REDIS_CLIENT=phpredis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_MAILER=smtp
MAIL_MAILER=log
MAIL_HOST=127.0.0.1
MAIL_PORT=2525
MAIL_FROM_ADDRESS="hello@moox.org"
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"

AWS_ACCESS_KEY_ID=
Expand All @@ -56,3 +111,11 @@ VITE_PUSHER_HOST="${PUSHER_HOST}"
VITE_PUSHER_PORT="${PUSHER_PORT}"
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false

VITE_APP_NAME="${APP_NAME}"
3 changes: 3 additions & 0 deletions .github/workflows/monorepo-split-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ jobs:
- passkey
- notifications
- security
- press
- expiry
- trainings

steps:
- uses: actions/checkout@v4
Expand Down
43 changes: 43 additions & 0 deletions LocalValetDriver.mac.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

use Valet\Drivers\LaravelValetDriver;

class LocalValetDriver extends LaravelValetDriver
{
/**
* Determine if the driver serves the request.
*/
public function serves(string $sitePath, string $siteName, string $uri): bool
{
return true;
}

/**
* Get the fully resolved path to the application's front controller.
*/
public function frontControllerPath(string $sitePath, string $siteName, string $uri): ?string
{
$public = '/public';
$wpslug = '/wp';

if (str_contains($uri, $wpslug.'/') || str_ends_with($uri, $wpslug)) {

if (str_contains($uri, '/wp-admin')) {

if (str_ends_with($uri, '/wp-admin/') || str_ends_with($uri, '/wp-admin') || str_ends_with($uri, '/wp-admin/index.php')) {
return $sitePath.$public.$wpslug.'/wp-admin/index.php';
}

return $sitePath.$public.$uri;
}

if (str_contains($uri, 'wp-login.php')) {
return $sitePath.$public.$wpslug.'/wp-login.php';
}

return $sitePath.$public.$wpslug.'/index.php';
}

return $sitePath.$public.'/index.php';
}
}
48 changes: 48 additions & 0 deletions LocalValetDriver.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

use Valet\Drivers\LaravelValetDriver;

class LocalValetDriver extends LaravelValetDriver
{
/**
* Determine if the driver serves the request.
*/
public function serves(string $sitePath, string $siteName, string $uri): bool
{
return true;
}

/**
* Get the fully resolved path to the application's front controller.
*/
public function frontControllerPath(string $sitePath, string $siteName, string $uri): ?string
{
$public = '/public';
$wpslug = '/wp';

if (str_contains($uri, $wpslug.'/') || str_ends_with($uri, $wpslug)) {

if (str_contains($uri, '/wp-admin')) {

if (str_ends_with($uri, '/wp-admin/') || str_ends_with($uri, '/wp-admin') || str_ends_with($uri, '/wp-admin/index.php')) {
return $this->convertForWindows($sitePath.$public.$wpslug.'/wp-admin/index.php');
}

return $this->convertForWindows($sitePath.$public.$uri);
}

if (str_contains($uri, 'wp-login.php')) {
return $this->convertForWindows($sitePath.$public.$wpslug.'/wp-login.php');
}

return $this->convertForWindows($sitePath.$public.$wpslug.'/index.php');
}

return $this->convertForWindows($sitePath.$public.'/index.php');
}

public function convertForWindows($url)
{
return str_replace('/', '\\', $url);
}
}
48 changes: 48 additions & 0 deletions LocalValetDriver.win.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

use Valet\Drivers\LaravelValetDriver;

class LocalValetDriver extends LaravelValetDriver
{
/**
* Determine if the driver serves the request.
*/
public function serves(string $sitePath, string $siteName, string $uri): bool
{
return true;
}

/**
* Get the fully resolved path to the application's front controller.
*/
public function frontControllerPath(string $sitePath, string $siteName, string $uri): ?string
{
$public = '/public';
$wpslug = '/wp';

if (str_contains($uri, $wpslug.'/') || str_ends_with($uri, $wpslug)) {

if (str_contains($uri, '/wp-admin')) {

if (str_ends_with($uri, '/wp-admin/') || str_ends_with($uri, '/wp-admin') || str_ends_with($uri, '/wp-admin/index.php')) {
return $this->convertForWindows($sitePath.$public.$wpslug.'/wp-admin/index.php');
}

return $this->convertForWindows($sitePath.$public.$uri);
}

if (str_contains($uri, 'wp-login.php')) {
return $this->convertForWindows($sitePath.$public.$wpslug.'/wp-login.php');
}

return $this->convertForWindows($sitePath.$public.$wpslug.'/index.php');
}

return $this->convertForWindows($sitePath.$public.'/index.php');
}

public function convertForWindows($url)
{
return str_replace('/', '\\', $url);
}
}
79 changes: 79 additions & 0 deletions app/Providers/Filament/PressPanelProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?php

namespace App\Providers\Filament;

use Filament\Http\Middleware\Authenticate;
use Filament\Http\Middleware\DisableBladeIconComponents;
use Filament\Http\Middleware\DispatchServingFilamentEvent;
use Filament\Pages;
use Filament\Panel;
use Filament\PanelProvider;
use Filament\Support\Colors\Color;
use Filament\Widgets;
use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse;
use Illuminate\Cookie\Middleware\EncryptCookies;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken;
use Illuminate\Routing\Middleware\SubstituteBindings;
use Illuminate\Session\Middleware\AuthenticateSession;
use Illuminate\Session\Middleware\StartSession;
use Illuminate\View\Middleware\ShareErrorsFromSession;
use Moox\Security\Services\Login;
use Moox\Security\Services\RequestPasswordReset;
use Moox\Security\Services\ResetPassword;

class PressPanelProvider extends PanelProvider
{
public function panel(Panel $panel): Panel
{
return $panel
->id('press')
->path('press')
->authGuard('press')
->passwordReset(RequestPasswordReset::class, ResetPassword::class)
->login(Login::class)
->colors([
'primary' => Color::Amber,
])
->discoverResources(in: app_path('Filament/Press/Resources'), for: 'App\\Filament\\Press\\Resources')
->discoverPages(in: app_path('Filament/Press/Pages'), for: 'App\\Filament\\Press\\Pages')
->pages([
Pages\Dashboard::class,
])
->discoverWidgets(in: app_path('Filament/Press/Widgets'), for: 'App\\Filament\\Press\\Widgets')
->widgets([
Widgets\AccountWidget::class,
Widgets\FilamentInfoWidget::class,
])
->middleware([
EncryptCookies::class,
AddQueuedCookiesToResponse::class,
StartSession::class,
AuthenticateSession::class,
ShareErrorsFromSession::class,
VerifyCsrfToken::class,
SubstituteBindings::class,
DisableBladeIconComponents::class,
DispatchServingFilamentEvent::class,
])
->authMiddleware([
Authenticate::class,
])
->plugins([
\Moox\Press\WpPostPlugin::make(),
\Moox\Press\WpPagePlugin::make(),
\Moox\Press\WpMediaPlugin::make(),
\Moox\Press\WpCategoryPlugin::make(),
\Moox\Press\WpTagPlugin::make(),
\Moox\Press\WpUserPlugin::make(),
\Moox\Press\WpOptionPlugin::make(),

\Moox\Expiry\ExpiryPlugin::make(),

\Moox\Training\TrainingPlugin::make(),
\Moox\Training\TrainingInvitationPlugin::make(),
\Moox\Training\TrainingDatePlugin::make(),
\Moox\Training\TrainingTypePlugin::make(),

]);
}
}
11 changes: 7 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,18 @@
"moox/audit": "*",
"moox/builder": "*",
"moox/jobs": "*",
"moox/login-link": "*",
"moox/notifications": "*",
"moox/page": "*",
"moox/passkey": "*",
"moox/press": "*",
"moox/security": "*",
"moox/sync": "*",
"moox/user": "*",
"moox/expiry": "*",
"moox/trainings": "*",
"moox/user-device": "*",
"moox/login-link": "*",
"moox/user-session": "*",
"moox/passkey": "*",
"moox/notifications": "*",
"moox/security": "*",
"wikimedia/composer-merge-plugin": "^2.1"
},
"require-dev": {
Expand Down
1 change: 1 addition & 0 deletions config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\Filament\AdminPanelProvider::class,
App\Providers\Filament\PressPanelProvider::class,
App\Providers\RouteServiceProvider::class,
],

Expand Down
8 changes: 8 additions & 0 deletions config/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
'driver' => 'session',
'provider' => 'users',
],
'press' => [
'driver' => 'session',
'provider' => 'wpusers',
],
],

/*
Expand All @@ -64,6 +68,10 @@
'driver' => 'eloquent',
'model' => \Moox\User\Models\User::class,
],
'wpusers' => [
'driver' => 'eloquent',
'model' => \Moox\Press\Models\WpUser::class,
],

// 'users' => [
// 'driver' => 'database',
Expand Down
Loading

0 comments on commit 900c582

Please sign in to comment.