diff --git a/front/js/svelte/Account.svelte b/front/js/svelte/Account.svelte
index c2a0ffd..71938b1 100644
--- a/front/js/svelte/Account.svelte
+++ b/front/js/svelte/Account.svelte
@@ -3,6 +3,7 @@
import Login from "./account/Login.svelte";
import Verify from "./account/Verify.svelte";
import Profile from "./account/Profile.svelte";
+ import SetupIndex from "./setup/Index.svelte";
import {setContext} from "svelte";
const components = {
@@ -10,6 +11,7 @@
login: Login,
verify: Verify,
profile: Profile,
+ setup: SetupIndex,
};
export let title;
diff --git a/front/js/svelte/setup/Index.svelte b/front/js/svelte/setup/Index.svelte
new file mode 100644
index 0000000..bf5d226
--- /dev/null
+++ b/front/js/svelte/setup/Index.svelte
@@ -0,0 +1,12 @@
+
+
+
+{#each steps as step}
+
+{/each}
+
\ No newline at end of file
diff --git a/front/js/svelte/setup/Step.svelte b/front/js/svelte/setup/Step.svelte
new file mode 100644
index 0000000..955fb7e
--- /dev/null
+++ b/front/js/svelte/setup/Step.svelte
@@ -0,0 +1,67 @@
+
+
+
+
+
+ {#if step.status === "success"}
+
+ {:else}
+
+ {/if}
+
+
+
{step.name}
+
+ Instuctions
+ {step.instructions}
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Channel/Channel.php b/src/Channel/Channel.php
index b269be0..7d51eb0 100644
--- a/src/Channel/Channel.php
+++ b/src/Channel/Channel.php
@@ -37,6 +37,7 @@ final class Channel
return match (config("filesystems.disks.lucent.driver")) {
"s3" => config("filesystems.disks.lucent.endpoint") . "/" . config("filesystems.disks.lucent.bucket"),
"local" => $this->url . "/storage" . config("filesystems.disks.lucent.endpoint"),
+ default => ""
};
}
diff --git a/src/Http/Controller/SetupController.php b/src/Http/Controller/SetupController.php
new file mode 100644
index 0000000..839e86f
--- /dev/null
+++ b/src/Http/Controller/SetupController.php
@@ -0,0 +1,78 @@
+accountService->countUsers() > 0) {
+ return redirect($this->channelService->channel->lucentUrl . "/login");
+ }
+
+ $steps = array_reduce([
+ new ComposerStep,
+ new LucentConfigStep,
+ ],fn(array $carry, IStep $setupStep)=> array_merge($carry,[$setupStep()]) ,[]);
+
+ return $this->svelte->render(
+ layout: "account",
+ view: "setup",
+ title: "Setup Lucent",
+ data: [
+ "steps" => $steps
+ ]
+
+ );
+ }
+
+
+ public function postRegister(Request $request): Response
+ {
+
+ if ($this->accountService->countUsers() > 0) {
+ abort(400);
+ }
+
+ try {
+ $this->authService->registerAdmin(
+ name: $request->input("name"),
+ email: $request->input("email"),
+ );
+ } catch (LucentException $th) {
+ return fail($th);
+ }
+
+ return ok();
+ }
+
+}
diff --git a/src/Http/web.php b/src/Http/web.php
index ca9be22..51635b9 100644
--- a/src/Http/web.php
+++ b/src/Http/web.php
@@ -10,6 +10,7 @@ use Lucent\Http\Controller\HomeController;
use Lucent\Http\Controller\MemberController;
use Lucent\Http\Controller\RecordController;
use Lucent\Http\Controller\RevisionController;
+use Lucent\Http\Controller\SetupController;
Route::group([
@@ -19,6 +20,7 @@ Route::group([
Route::middleware(['lucent.guest'])->group(function () {
Route::get('/', [AuthController::class, 'login']);
+ Route::get('/setup', [SetupController::class, 'setup']);
Route::get('/register', [AuthController::class, 'register']);
Route::post('/register', [AuthController::class, 'postRegister']);
Route::get('/login', [AuthController::class, 'login']);
diff --git a/src/LucentServiceProvider.php b/src/LucentServiceProvider.php
index 510bbff..51399b2 100644
--- a/src/LucentServiceProvider.php
+++ b/src/LucentServiceProvider.php
@@ -85,9 +85,10 @@ class LucentServiceProvider extends ServiceProvider
$this->publishes([
__DIR__ . '/Config/main.php' => config_path('lucent.php'),
- ]);
+ ],"lucent-config");
$this->publishes([
+ __DIR__ . '/Config/main.php' => config_path('lucent.php'),
__DIR__ . '/../front/dist' => public_path('vendor/lucent/dist'),
__DIR__ . '/../front/public' => public_path('vendor/lucent/public'),
], 'lucent');
diff --git a/src/Setup/Data/SetupStep.php b/src/Setup/Data/SetupStep.php
new file mode 100644
index 0000000..d836a99
--- /dev/null
+++ b/src/Setup/Data/SetupStep.php
@@ -0,0 +1,24 @@
+ SetupStep::makeSuccess($name, $instructions),
+ false => SetupStep::makeFail($name, $instructions),
+ };
+ }
+}
\ No newline at end of file
diff --git a/src/Setup/Step/IStep.php b/src/Setup/Step/IStep.php
new file mode 100644
index 0000000..f8f7432
--- /dev/null
+++ b/src/Setup/Step/IStep.php
@@ -0,0 +1,11 @@
+ SetupStep::makeSuccess($name, $instructions),
+ false => SetupStep::makeFail($name, $instructions),
+ };
+ }
+}
\ No newline at end of file