Skip to content

Commit

Permalink
boy this expanded beyond what I expected.... Add Protonmail client, a…
Browse files Browse the repository at this point in the history
…nd a matrix server client to pull in messages
  • Loading branch information
austinkregel committed Dec 3, 2023
1 parent 1d3d1d4 commit 6bcbd5d
Show file tree
Hide file tree
Showing 235 changed files with 26,102 additions and 1,041 deletions.
42 changes: 42 additions & 0 deletions app/Console/Commands/MakeUser.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

namespace App\Console\Commands;

use App\Models\Team;
use App\Models\User;
use Illuminate\Console\Command;

class MakeUser extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'make:user';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description';

/**
* Execute the console command.
*/
public function handle()
{
$user = User::create([
'name' => $this->ask('What is your name?'),
'email' => $this->ask('What is your email address?'),
'password' => bcrypt($this->ask('What password would you like to use?')),
]);

$user->ownedTeams()->create([
'name' => config('app.name'),
'personal_team' => true,
'settings' => [],
]);
}
}
2 changes: 1 addition & 1 deletion app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ protected function schedule(Schedule $schedule): void
$schedule->job(FetchResourcesFromCredentials::class)->everyOddHour();
$schedule->job(FetchCloudflareAnalytics::class)->everyFourHours();

$schedule->command('operations:queue')->everyFiveMinutes();
// $schedule->command('operations:queue')->everyFiveMinutes();
}

/**
Expand Down
36 changes: 36 additions & 0 deletions app/Events/Admin/Composer/ActionFailed.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

namespace App\Events\Admin\Composer;

use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;

class ActionFailed
{
use Dispatchable, InteractsWithSockets, SerializesModels;

/**
* Create a new event instance.
*/
public function __construct()
{
//
}

/**
* Get the channels the event should broadcast on.
*
* @return array<int, \Illuminate\Broadcasting\Channel>
*/
public function broadcastOn(): array
{
return [
new PrivateChannel('channel-name'),
];
}
}
36 changes: 36 additions & 0 deletions app/Events/Admin/Composer/ActionFinished.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

namespace App\Events\Admin\Composer;

use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;

class ActionFinished
{
use Dispatchable, InteractsWithSockets, SerializesModels;

/**
* Create a new event instance.
*/
public function __construct()
{
//
}

/**
* Get the channels the event should broadcast on.
*
* @return array<int, \Illuminate\Broadcasting\Channel>
*/
public function broadcastOn(): array
{
return [
new PrivateChannel('channel-name'),
];
}
}
36 changes: 36 additions & 0 deletions app/Events/Admin/Composer/ActionLoggedToConsole.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

namespace App\Events\Admin\Composer;

use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;

class ActionLoggedToConsole
{
use Dispatchable, InteractsWithSockets, SerializesModels;

/**
* Create a new event instance.
*/
public function __construct()
{
//
}

/**
* Get the channels the event should broadcast on.
*
* @return array<int, \Illuminate\Broadcasting\Channel>
*/
public function broadcastOn(): array
{
return [
new PrivateChannel('channel-name'),
];
}
}
36 changes: 36 additions & 0 deletions app/Events/SubscribeToJobEvent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

namespace App\Events;

use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;

class SubscribeToJobEvent
{
use Dispatchable, InteractsWithSockets, SerializesModels;

/**
* Create a new event instance.
*/
public function __construct()
{
//
}

/**
* Get the channels the event should broadcast on.
*
* @return array<int, \Illuminate\Broadcasting\Channel>
*/
public function broadcastOn(): array
{
return [
new PrivateChannel('channel-name'),
];
}
}
10 changes: 10 additions & 0 deletions app/Http/Controllers/AccountController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class AccountController extends Controller
{
//
}
82 changes: 82 additions & 0 deletions app/Http/Controllers/AdminController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<?php

namespace App\Http\Controllers;

use App\Http\Controllers\Controller;
use App\Providers\EventServiceProvider;
use App\Services\Code;
use App\Services\ImapService;
use App\Services\Programming\LaravelProgrammingStyle;
use Illuminate\Support\Arr;
use Illuminate\Support\Collection;
use Inertia\Inertia;

class AdminController extends Controller
{
public function __invoke()
{
$installedNotInstalled = json_decode(file_get_contents(storage_path('provider-information.json')), true);

/** @var Collection $serviceWithOauthish */
$serviceWithOauthish = collect(config('services'));
$serviceWithOauthish = $serviceWithOauthish->filter(function ($service, $key) {
return !empty($service['client_id'])
&& !empty($service['client_secret'])
&& !empty($service['redirect']);
})->reduce(function ($result, $config, $service) use ($installedNotInstalled) {

try {
$installedServiceThatMatchesInstalledDriver = array_values(array_filter($installedNotInstalled['installed'], fn($value) => in_array($service, $value['drivers'] ?? [])));
$driver = Arr::first($installedServiceThatMatchesInstalledDriver) ?? [];
foreach ($driver['drivers'] ?? [] as $eventListener => $driverName) {
$foundListener = Code::with(LaravelProgrammingStyle::class)
->for(EventServiceProvider::class)
->propertyContainsValue('listen', $eventListener);

if ($foundListener) {
return array_merge($result, [
'enabled' => array_merge($result['enabled'] ?? [], [
$service => $config,
]),
]);
}

return array_merge($result, [
'disabled' => array_merge($result['disabled'] ?? [], [
$service => $config,
]),
]);
}
} catch (\Throwable $e) {
return array_merge($result, [
'disabled' => array_merge($result['disabled'] ?? [], [
$service => $config,
]),
]);
}

return array_merge($result, [
'disabled' => array_merge($result['disabled'] ?? [], [
$service => $config,
]),
]);
}, [
'enabled' => [],
'disabled' => [],
]);

return Inertia::render('Admin/Index', array_merge($installedNotInstalled, $serviceWithOauthish));
}

public function email()
{
$imapService = new ImapService();

dd($imapService->findAllFromDate(now()->subDay()));

return Inertia::render('Admin/Emails', [

'mail' => ''
]);
}
}
10 changes: 10 additions & 0 deletions app/Http/Controllers/BudgetController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class BudgetController extends Controller
{
//
}
10 changes: 10 additions & 0 deletions app/Http/Controllers/ConditionController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class ConditionController extends Controller
{
//
}
Loading

0 comments on commit 6bcbd5d

Please sign in to comment.