This commit is contained in:
2026-05-06 19:36:53 +03:00
parent 43dd36e20e
commit 8b3a3964a5
10 changed files with 48 additions and 45 deletions
+1
View File
@@ -0,0 +1 @@
LUCENT_AUTH=lucent // or lunar
-4
View File
@@ -39,10 +39,6 @@
dispatch("uploadComplete", data); dispatch("uploadComplete", data);
} }
isLoading = false; isLoading = false;
})
.catch((error) => {
isLoading = false;
console.log(error);
}); });
} }
</script> </script>
+6 -1
View File
@@ -8,8 +8,9 @@
</script> </script>
<div class="top-nav"> <div class="top-nav">
{#if channel.auth == "lucent"}
<a class="top-nav-item" href="{channel.lucentUrl}/members">Members</a> <a class="top-nav-item" href="{channel.lucentUrl}/members">Members</a>
{/if}
{#if channel.commands.length > 0} {#if channel.commands.length > 0}
<Dropdown> <Dropdown>
<div slot="button">Actions</div> <div slot="button">Actions</div>
@@ -27,7 +28,11 @@
<!-- class="form-control" required/>--> <!-- class="form-control" required/>-->
<!-- </form>--> <!-- </form>-->
<!-- </div>--> <!-- </div>-->
{#if channel.auth == "lucent"}
<a href="{channel.lucentUrl}/profile"> <a href="{channel.lucentUrl}/profile">
<Avatar side="28" name={user.name} /> <Avatar side="28" name={user.name} />
</a> </a>
{:else}
<Avatar side="28" name={user.name} />
{/if}
</div> </div>
+6 -24
View File
@@ -1,39 +1,21 @@
<script> <script>
import NavbarMenu from "./NavbarMenu.svelte"; import NavbarMenu from "./NavbarMenu.svelte";
import {getContext} from "svelte"; import { getContext } from "svelte";
export let schema; export let schema;
const channel = getContext("channel"); const channel = getContext("channel");
const readableSchemas = getContext("readableSchemas"); const readableSchemas = getContext("readableSchemas");
const fileSchemas = readableSchemas.filter((sc) => sc.type === "files");
const otherSchemas = readableSchemas.filter((sc) => !sc.isEntry && sc.type === "collection");
</script> </script>
<div class="sidebar-top"> <div class="sidebar-top">
<a class="logo" href="{channel.lucentUrl}">{channel.name}</a> <a class="logo" href={channel.lucentUrl}>{channel.name}</a>
<a class="nav-item" href="{channel.lucentUrl}/profile"> <a class="nav-item" href="{channel.lucentUrl}/profile"> </a>
</a>
</div> </div>
<div class="sidebar"> <div class="sidebar">
<NavbarMenu <NavbarMenu
title="Content" title="Content"
schemas={ readableSchemas.filter((sc) => sc.isEntry)} schemas={readableSchemas.filter((sc) => sc.isEntry)}
schema={schema} {schema}
expanded={true} expanded={true}
/> />
<NavbarMenu
title="Files"
schemas={ fileSchemas}
schema={schema}
/>
<NavbarMenu
title="Other"
schemas={ otherSchemas}
schema={schema}
/>
</div> </div>
+1 -1
View File
@@ -34,7 +34,7 @@
} }
function uploadComplete(e) { function uploadComplete(e) {
records = e.detail; // value = [...value, e.detail];
} }
function openBrowseModal(e) { function openBrowseModal(e) {
+3 -2
View File
@@ -4,7 +4,8 @@ namespace Lucent\Channel;
use Lucent\Channel\Data\UserCommand; use Lucent\Channel\Data\UserCommand;
use Lucent\Primitive\Collection; use Lucent\Primitive\Collection;
use Lucent\Schema\Schema; use Lucent\Data\Schema;
use Lucent\Data\ChannelAuth;
final class Channel final class Channel
{ {
@@ -18,6 +19,7 @@ final class Channel
*/ */
function __construct( function __construct(
public string $name, public string $name,
public ChannelAuth $auth,
public string $url, public string $url,
public string $previewTarget, public string $previewTarget,
public Collection $commands, public Collection $commands,
@@ -27,7 +29,6 @@ final class Channel
) { ) {
$this->lucentUrl = $url . "/lucent"; $this->lucentUrl = $url . "/lucent";
$this->filesUrl = $this->makeFilesUrl(); $this->filesUrl = $this->makeFilesUrl();
$this->previewTargetUrl = $url . "/" . $previewTarget; $this->previewTargetUrl = $url . "/" . $previewTarget;
} }
+5
View File
@@ -3,6 +3,7 @@
namespace Lucent\Channel; namespace Lucent\Channel;
use Lucent\Channel\Data\UserCommand; use Lucent\Channel\Data\UserCommand;
use Lucent\Data\ChannelAuth;
use Lucent\Primitive\Collection; use Lucent\Primitive\Collection;
use Lucent\Data\Schema; use Lucent\Data\Schema;
use Lucent\Schema\SchemaService; use Lucent\Schema\SchemaService;
@@ -34,6 +35,10 @@ final class ChannelService
$channel = new Channel( $channel = new Channel(
name: config("lucent.name") ?? "", name: config("lucent.name") ?? "",
auth: match (config("lucent.auth")) {
"lunar" => ChannelAuth::LUNAR,
default => ChannelAuth::LUCENT,
},
url: rtrim(config("lucent.url") ?? "", "/"), url: rtrim(config("lucent.url") ?? "", "/"),
previewTarget: rtrim(config("lucent.previewTarget") ?? "", "/"), previewTarget: rtrim(config("lucent.previewTarget") ?? "", "/"),
commands: Collection::make($userCommands), commands: Collection::make($userCommands),
+5 -4
View File
@@ -2,10 +2,11 @@
return [ return [
"env" => env("LUCENT_ENV", "production"), "env" => env("LUCENT_ENV", "production"),
"auth" => env("LUCENT_AUTH", "lucent"),
"schemas_path" => env("LUCENT_SCHEMAS_PATH", "resources/lucent/schemas"), "schemas_path" => env("LUCENT_SCHEMAS_PATH", "resources/lucent/schemas"),
"database" => env('LUCENT_DB_CONNECTION', env('DB_CONNECTION', "sqlite")), "database" => env("LUCENT_DB_CONNECTION", env("DB_CONNECTION", "sqlite")),
"name" => env("LUCENT_NAME", "Lucent"), "name" => env("LUCENT_NAME", "Lucent"),
"url" => env("LUCENT_URL", env('APP_URL')), "url" => env("LUCENT_URL", env("APP_URL")),
"previewTarget" => env("LUCENT_PREVIEW_TARGET", "previewTarget"), "previewTarget" => env("LUCENT_PREVIEW_TARGET", "previewTarget"),
/* /*
* Make available laravel artisan commands for admin users * Make available laravel artisan commands for admin users
@@ -44,6 +45,6 @@ return [
\Lucent\Schema\Ui\Rich::class, \Lucent\Schema\Ui\Rich::class,
\Lucent\Schema\Ui\Slug::class, \Lucent\Schema\Ui\Slug::class,
\Lucent\Schema\Ui\Text::class, \Lucent\Schema\Ui\Text::class,
\Lucent\Schema\Ui\Textarea::class \Lucent\Schema\Ui\Textarea::class,
] ],
]; ];
+9
View File
@@ -0,0 +1,9 @@
<?php
namespace Lucent\Data;
enum ChannelAuth: string
{
case LUNAR = "lunar";
case LUCENT = "lucent";
}
+7 -4
View File
@@ -10,16 +10,16 @@ use Intervention\Image\ImageManager;
use Lucent\Account\AuthService; use Lucent\Account\AuthService;
use Lucent\Account\AuthServiceLunar; use Lucent\Account\AuthServiceLunar;
use Lucent\Account\UserRepo; use Lucent\Account\UserRepo;
use Lucent\Account\UserRepoLucent;
use Lucent\Account\UserRepoLunar; use Lucent\Account\UserRepoLunar;
use Lucent\Channel\ChannelService; use Lucent\Channel\ChannelService;
use Lucent\Commands\CompileSchemas; use Lucent\Commands\CompileSchemas;
use Lucent\Commands\GenerateCollectionSchema; use Lucent\Commands\GenerateCollectionSchema;
use Lucent\Commands\GenerateFileSchema;
use Lucent\Commands\LiveLink; use Lucent\Commands\LiveLink;
use Lucent\Commands\RebuildThumbnails; use Lucent\Commands\RebuildThumbnails;
use Lucent\Commands\RemoveOrphanEdges; use Lucent\Commands\RemoveOrphanEdges;
use Lucent\Commands\SetupDatabase; use Lucent\Commands\SetupDatabase;
use Lucent\Commands\UpgradeFiles122; use Lucent\Data\ChannelAuth;
use Lucent\File\FileService; use Lucent\File\FileService;
use Lucent\Query\DatabaseGraph\DatabaseGraph; use Lucent\Query\DatabaseGraph\DatabaseGraph;
use Lucent\Query\DatabaseGraph\PgsqlDatabaseGraph; use Lucent\Query\DatabaseGraph\PgsqlDatabaseGraph;
@@ -43,8 +43,11 @@ class LucentServiceProvider extends ServiceProvider
return new PgsqlDatabaseGraph(); return new PgsqlDatabaseGraph();
}); });
$this->app->bind(UserRepo::class, function () { $this->app->bind(UserRepo::class, function ($app) {
return new UserRepoLunar(); return match ($app->make(ChannelService::class)->channel->auth) {
ChannelAuth::LUNAR => new UserRepoLunar(),
ChannelAuth::LUCENT => new UserRepoLucent(),
};
}); });
$this->app->bind(AuthService::class, function ($app) { $this->app->bind(AuthService::class, function ($app) {