This commit is contained in:
Harivansh Rathi 2026-04-01 02:40:21 +00:00
parent c3b5332477
commit c7560e1630
28 changed files with 95 additions and 95 deletions

View file

@ -1,30 +1,30 @@
<?xml version="1.0"?>
<info xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://apps.nextcloud.com/schema/apps/info.xsd">
<id>ainascontrolplane</id>
<id>betternascontrolplane</id>
<name>betterNAS Control Plane</name>
<summary>Thin betterNAS shell app for Nextcloud integration</summary>
<description>Provides betterNAS-branded entry points inside Nextcloud while delegating business logic to the betterNAS control plane.</description>
<version>0.1.0</version>
<licence>AGPL-3.0-or-later</licence>
<author homepage="https://ainas.local">betterNAS</author>
<namespace>AinasControlplane</namespace>
<author homepage="https://betternas.local">betterNAS</author>
<namespace>BetterNasControlplane</namespace>
<category>integration</category>
<dependencies>
<nextcloud min-version="31" max-version="33"/>
</dependencies>
<navigations>
<navigation>
<id>ainascontrolplane</id>
<id>betternascontrolplane</id>
<name>betterNAS</name>
<route>ainascontrolplane.page.index</route>
<route>betternascontrolplane.page.index</route>
<icon>app.svg</icon>
<type>link</type>
</navigation>
</navigations>
<settings>
<admin>OCA\AinasControlplane\Settings\Admin</admin>
<admin-section>OCA\AinasControlplane\Settings\AdminSection</admin-section>
<admin>OCA\BetterNasControlplane\Settings\Admin</admin>
<admin-section>OCA\BetterNasControlplane\Settings\AdminSection</admin-section>
</settings>
</info>

View file

@ -1,10 +1,10 @@
{
"name": "ainas/ainascontrolplane",
"name": "betternas/betternascontrolplane",
"description": "betterNAS Nextcloud shell app",
"license": "AGPL-3.0-or-later",
"autoload": {
"psr-4": {
"OCA\\AinasControlplane\\": "lib/"
"OCA\\BetterNasControlplane\\": "lib/"
}
},
"require": {

View file

@ -1,10 +1,10 @@
.ainas-shell {
.betternas-shell {
max-width: 1100px;
margin: 0 auto;
padding: 32px;
}
.ainas-shell__hero {
.betternas-shell__hero {
margin-bottom: 28px;
padding: 28px;
border-radius: 24px;
@ -12,7 +12,7 @@
color: #f6fafc;
}
.ainas-shell__eyebrow {
.betternas-shell__eyebrow {
margin: 0 0 12px;
font-size: 12px;
letter-spacing: 0.12em;
@ -20,26 +20,26 @@
opacity: 0.8;
}
.ainas-shell__title {
.betternas-shell__title {
margin: 0 0 12px;
font-size: 32px;
line-height: 1.1;
}
.ainas-shell__copy {
.betternas-shell__copy {
margin: 0;
max-width: 70ch;
font-size: 15px;
line-height: 1.6;
}
.ainas-shell__grid {
.betternas-shell__grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
gap: 20px;
}
.ainas-shell__card {
.betternas-shell__card {
padding: 24px;
border: 1px solid rgba(16, 33, 45, 0.12);
border-radius: 20px;
@ -47,38 +47,38 @@
box-shadow: 0 20px 40px rgba(16, 33, 45, 0.06);
}
.ainas-shell__card h2 {
.betternas-shell__card h2 {
margin-top: 0;
}
.ainas-shell__card dl {
.betternas-shell__card dl {
display: grid;
grid-template-columns: minmax(120px, 160px) 1fr;
gap: 8px 16px;
margin: 0;
}
.ainas-shell__card dt {
.betternas-shell__card dt {
font-weight: 600;
}
.ainas-shell__card dd {
.betternas-shell__card dd {
margin: 0;
}
.ainas-shell__card code {
.betternas-shell__card code {
display: inline-block;
padding: 4px 8px;
border-radius: 999px;
background: #eef4f7;
}
.ainas-shell__card ul {
.betternas-shell__card ul {
margin: 0;
padding-left: 20px;
}
.ainas-shell__error {
.betternas-shell__error {
margin-top: 16px;
color: #b42318;
}

View file

Before

Width:  |  Height:  |  Size: 292 B

After

Width:  |  Height:  |  Size: 292 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 292 B

After

Width:  |  Height:  |  Size: 292 B

Before After
Before After

View file

@ -2,7 +2,7 @@
declare(strict_types=1);
namespace OCA\AinasControlplane\AppInfo;
namespace OCA\BetterNasControlplane\AppInfo;
use OCP\AppFramework\App;
use OCP\AppFramework\Bootstrap\IBootContext;
@ -10,7 +10,7 @@ use OCP\AppFramework\Bootstrap\IBootstrap;
use OCP\AppFramework\Bootstrap\IRegistrationContext;
class Application extends App implements IBootstrap {
public const APP_ID = 'ainascontrolplane';
public const APP_ID = 'betternascontrolplane';
public function __construct() {
parent::__construct(self::APP_ID);

View file

@ -2,10 +2,10 @@
declare(strict_types=1);
namespace OCA\AinasControlplane\Controller;
namespace OCA\BetterNasControlplane\Controller;
use OCA\AinasControlplane\AppInfo\Application;
use OCA\AinasControlplane\Service\ControlPlaneClient;
use OCA\BetterNasControlplane\AppInfo\Application;
use OCA\BetterNasControlplane\Service\ControlPlaneClient;
use OCP\AppFramework\Http\Attribute\ApiRoute;
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
use OCP\AppFramework\Http\DataResponse;

View file

@ -2,11 +2,11 @@
declare(strict_types=1);
namespace OCA\AinasControlplane\Controller;
namespace OCA\BetterNasControlplane\Controller;
use OCA\AinasControlplane\AppInfo\Application;
use OCA\AinasControlplane\Service\ControlPlaneClient;
use OCA\AinasControlplane\Service\ControlPlaneConfig;
use OCA\BetterNasControlplane\AppInfo\Application;
use OCA\BetterNasControlplane\Service\ControlPlaneClient;
use OCA\BetterNasControlplane\Service\ControlPlaneConfig;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\Attribute\FrontpageRoute;
use OCP\AppFramework\Http\Attribute\NoAdminRequired;

View file

@ -2,7 +2,7 @@
declare(strict_types=1);
namespace OCA\AinasControlplane\Service;
namespace OCA\BetterNasControlplane\Service;
use OCP\Http\Client\IClientService;
use OCP\Http\Client\IResponse;

View file

@ -2,9 +2,9 @@
declare(strict_types=1);
namespace OCA\AinasControlplane\Service;
namespace OCA\BetterNasControlplane\Service;
use OCA\AinasControlplane\AppInfo\Application;
use OCA\BetterNasControlplane\AppInfo\Application;
use OCP\IAppConfig;
class ControlPlaneConfig {
@ -14,7 +14,7 @@ class ControlPlaneConfig {
}
public function getBaseUrl(): string {
$environmentUrl = getenv('AINAS_CONTROL_PLANE_URL');
$environmentUrl = getenv('BETTERNAS_CONTROL_PLANE_URL');
if (is_string($environmentUrl) && $environmentUrl !== '') {
return rtrim($environmentUrl, '/');
}

View file

@ -2,11 +2,11 @@
declare(strict_types=1);
namespace OCA\AinasControlplane\Settings;
namespace OCA\BetterNasControlplane\Settings;
use OCA\AinasControlplane\AppInfo\Application;
use OCA\AinasControlplane\Service\ControlPlaneClient;
use OCA\AinasControlplane\Service\ControlPlaneConfig;
use OCA\BetterNasControlplane\AppInfo\Application;
use OCA\BetterNasControlplane\Service\ControlPlaneClient;
use OCA\BetterNasControlplane\Service\ControlPlaneConfig;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\Settings\ISettings;

View file

@ -2,9 +2,9 @@
declare(strict_types=1);
namespace OCA\AinasControlplane\Settings;
namespace OCA\BetterNasControlplane\Settings;
use OCA\AinasControlplane\AppInfo\Application;
use OCA\BetterNasControlplane\AppInfo\Application;
use OCP\IL10N;
use OCP\IURLGenerator;
use OCP\Settings\IIconSection;

View file

@ -2,27 +2,27 @@
declare(strict_types=1);
use OCA\AinasControlplane\AppInfo\Application;
use OCA\BetterNasControlplane\AppInfo\Application;
use OCP\Util;
Util::addStyle(Application::APP_ID, 'ainascontrolplane');
Util::addStyle(Application::APP_ID, 'betternascontrolplane');
$snapshot = $_['snapshot'];
$reachable = !empty($snapshot['available']) ? 'yes' : 'no';
$version = $snapshot['version']['version'] ?? 'unreachable';
?>
<div class="ainas-shell ainas-shell--admin">
<div class="ainas-shell__hero">
<p class="ainas-shell__eyebrow">Admin settings</p>
<h1 class="ainas-shell__title">betterNAS control-plane wiring</h1>
<p class="ainas-shell__copy">
The local scaffold wires this app to the control plane through the <code>AINAS_CONTROL_PLANE_URL</code> environment variable in the Nextcloud container.
<div class="betternas-shell betternas-shell--admin">
<div class="betternas-shell__hero">
<p class="betternas-shell__eyebrow">Admin settings</p>
<h1 class="betternas-shell__title">betterNAS control-plane wiring</h1>
<p class="betternas-shell__copy">
The local scaffold wires this app to the control plane through the <code>BETTERNAS_CONTROL_PLANE_URL</code> environment variable in the Nextcloud container.
</p>
</div>
<div class="ainas-shell__grid">
<section class="ainas-shell__card">
<div class="betternas-shell__grid">
<section class="betternas-shell__card">
<h2>Current wiring</h2>
<dl>
<dt>Control-plane URL</dt>
@ -34,7 +34,7 @@ $version = $snapshot['version']['version'] ?? 'unreachable';
</dl>
</section>
<section class="ainas-shell__card">
<section class="betternas-shell__card">
<h2>Next step</h2>
<p>Keep storage policy, sharing logic, and orchestration in the control-plane service. This page should remain a thin integration surface.</p>
</section>

View file

@ -2,10 +2,10 @@
declare(strict_types=1);
use OCA\AinasControlplane\AppInfo\Application;
use OCA\BetterNasControlplane\AppInfo\Application;
use OCP\Util;
Util::addStyle(Application::APP_ID, 'ainascontrolplane');
Util::addStyle(Application::APP_ID, 'betternascontrolplane');
$snapshot = $_['snapshot'];
$version = $snapshot['version']['version'] ?? 'unreachable';
@ -13,17 +13,17 @@ $status = !empty($snapshot['available']) ? 'Connected' : 'Unavailable';
$error = $snapshot['error'] ?? null;
?>
<div class="ainas-shell">
<div class="ainas-shell__hero">
<p class="ainas-shell__eyebrow">betterNAS inside Nextcloud</p>
<h1 class="ainas-shell__title"><?php p($_['appName']); ?></h1>
<p class="ainas-shell__copy">
<div class="betternas-shell">
<div class="betternas-shell__hero">
<p class="betternas-shell__eyebrow">betterNAS inside Nextcloud</p>
<h1 class="betternas-shell__title"><?php p($_['appName']); ?></h1>
<p class="betternas-shell__copy">
This shell app stays intentionally thin. It exposes betterNAS entry points inside Nextcloud and delegates business logic to the external control-plane service.
</p>
</div>
<div class="ainas-shell__grid">
<section class="ainas-shell__card">
<div class="betternas-shell__grid">
<section class="betternas-shell__card">
<h2>Control plane</h2>
<dl>
<dt>Configured URL</dt>
@ -34,11 +34,11 @@ $error = $snapshot['error'] ?? null;
<dd><?php p($version); ?></dd>
</dl>
<?php if ($error !== null): ?>
<p class="ainas-shell__error"><?php p($error); ?></p>
<p class="betternas-shell__error"><?php p($error); ?></p>
<?php endif; ?>
</section>
<section class="ainas-shell__card">
<section class="betternas-shell__card">
<h2>Boundary</h2>
<ul>
<li>Nextcloud provides file and client primitives.</li>

View file

@ -30,7 +30,7 @@ services:
dockerfile: exapps/control-plane/Dockerfile
environment:
PORT: 3000
AINAS_VERSION: local-dev
BETTERNAS_VERSION: local-dev
NEXTCLOUD_BASE_URL: http://nextcloud
ports:
- "3001:3000"
@ -61,7 +61,7 @@ services:
REDIS_HOST: redis
NEXTCLOUD_ADMIN_USER: admin
NEXTCLOUD_ADMIN_PASSWORD: admin
AINAS_CONTROL_PLANE_URL: http://control-plane:3000
BETTERNAS_CONTROL_PLANE_URL: http://control-plane:3000
ports:
- "8080:80"
volumes:

View file

@ -6,7 +6,7 @@ betterNAS treats Nextcloud as an upstream backend, not as the place where better
That leads to three explicit boundaries:
1. `apps/ainas-controlplane/` is a thin shell inside Nextcloud.
1. `apps/betternascontrolplane/` is a thin shell inside Nextcloud.
2. `exapps/control-plane/` owns betterNAS business logic and internal APIs.
3. `packages/contracts/` defines the interface between the shell app and the control plane.

View file

@ -1,5 +1,5 @@
{
"name": "@ainas/control-plane",
"name": "@betternas/control-plane",
"version": "0.1.0",
"private": true,
"type": "module",
@ -11,7 +11,7 @@
"typecheck": "tsc --noEmit -p tsconfig.json"
},
"dependencies": {
"@ainas/contracts": "file:../../packages/contracts"
"@betternas/contracts": "file:../../packages/contracts"
},
"devDependencies": {
"@types/node": "^22.18.6",

View file

@ -1,4 +1,4 @@
import type { NextcloudBackendStatus } from "@ainas/contracts";
import type { NextcloudBackendStatus } from "@betternas/contracts";
export class NextcloudBackendAdapter {
constructor(private readonly baseUrl: string) {}

View file

@ -3,7 +3,7 @@ import {
CONTROL_PLANE_ROUTES,
type ControlPlaneHealthResponse,
type ControlPlaneVersionResponse
} from "@ainas/contracts";
} from "@betternas/contracts";
import type { ControlPlaneConfig } from "./config.js";
import { NextcloudBackendAdapter } from "./adapters/nextcloud-backend.js";

View file

@ -14,7 +14,7 @@ export function loadConfig(env: NodeJS.ProcessEnv = process.env): ControlPlaneCo
return {
port,
version: env.AINAS_VERSION ?? "0.1.0-dev",
version: env.BETTERNAS_VERSION ?? "0.1.0-dev",
nextcloudBaseUrl: normalizeBaseUrl(env.NEXTCLOUD_BASE_URL ?? "http://nextcloud")
};
}

View file

@ -17,7 +17,7 @@ docker/
nextcloud/
CADDY/
apps/
ainas-controlplane/ #generate from nextcloud tempalte
betternascontrolplane/ #generate from nextcloud tempalte
exapps/
sharing-service/ #golang/python
policy-service/

14
package-lock.json generated
View file

@ -1,20 +1,20 @@
{
"name": "ainas",
"name": "betternas",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "ainas",
"name": "betternas",
"workspaces": [
"packages/*",
"exapps/*"
]
},
"exapps/control-plane": {
"name": "@ainas/control-plane",
"name": "@betternas/control-plane",
"version": "0.1.0",
"dependencies": {
"@ainas/contracts": "file:../../packages/contracts"
"@betternas/contracts": "file:../../packages/contracts"
},
"devDependencies": {
"@types/node": "^22.18.6",
@ -22,11 +22,11 @@
"typescript": "^5.9.3"
}
},
"node_modules/@ainas/contracts": {
"node_modules/@betternas/contracts": {
"resolved": "packages/contracts",
"link": true
},
"node_modules/@ainas/control-plane": {
"node_modules/@betternas/control-plane": {
"resolved": "exapps/control-plane",
"link": true
},
@ -604,7 +604,7 @@
"license": "MIT"
},
"packages/contracts": {
"name": "@ainas/contracts",
"name": "@betternas/contracts",
"version": "0.1.0"
}
}

View file

@ -1,5 +1,5 @@
{
"name": "ainas",
"name": "betternas",
"private": true,
"packageManager": "npm@10.9.7",
"workspaces": [
@ -7,9 +7,9 @@
"exapps/*"
],
"scripts": {
"build": "npm run build --workspace @ainas/contracts && npm run build --workspace @ainas/control-plane",
"typecheck": "npm run typecheck --workspace @ainas/contracts && npm run typecheck --workspace @ainas/control-plane",
"dev:control-plane": "npm run dev --workspace @ainas/control-plane"
"build": "npm run build --workspace @betternas/contracts && npm run build --workspace @betternas/control-plane",
"typecheck": "npm run typecheck --workspace @betternas/contracts && npm run typecheck --workspace @betternas/control-plane",
"dev:control-plane": "npm run dev --workspace @betternas/control-plane"
}
}

View file

@ -1,5 +1,5 @@
{
"name": "@ainas/contracts",
"name": "@betternas/contracts",
"version": "0.1.0",
"private": true,
"type": "module",

View file

@ -1,6 +1,6 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://ainas.local/schemas/control-plane-health.schema.json",
"$id": "https://betternas.local/schemas/control-plane-health.schema.json",
"type": "object",
"additionalProperties": false,
"required": [

View file

@ -1,6 +1,6 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://ainas.local/schemas/control-plane-version.schema.json",
"$id": "https://betternas.local/schemas/control-plane-version.schema.json",
"type": "object",
"additionalProperties": false,
"required": [

View file

@ -1,9 +1,9 @@
betterNAS repo
│ apps/ainas-controlplane
│ apps/betternascontrolplane
│ PHP Nextcloud app
│ - nav entry: "betterNAS"
│ - page route: /index.php/apps/ainascontrolplane/
│ - OCS route: /ocs/v2.php/apps/ainascontrolplane/api/status
│ - page route: /index.php/apps/betternascontrolplane/
│ - OCS route: /ocs/v2.php/apps/betternascontrolplane/api/status
│ - job today: call control-plane and render a thin shell
│ exapps/control-plane

View file

@ -4,7 +4,7 @@ set -euo pipefail
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
compose_file="$repo_root/docker/compose.dev.yml"
app_source_dir="$repo_root/apps/ainas-controlplane"
app_source_dir="$repo_root/apps/betternascontrolplane"
nextcloud_occ() {
docker compose -f "$compose_file" exec -T --user www-data --workdir /var/www/html nextcloud php occ "$@"
@ -17,13 +17,13 @@ nextcloud_is_installed() {
docker compose -f "$compose_file" up -d --build
docker compose -f "$compose_file" exec -T --user root nextcloud sh -lc '
mkdir -p /var/www/html/custom_apps/ainascontrolplane
mkdir -p /var/www/html/custom_apps/betternascontrolplane
chown -R www-data:www-data /var/www/html/custom_apps
'
docker compose -f "$compose_file" cp "$app_source_dir/." nextcloud:/var/www/html/custom_apps/ainascontrolplane
docker compose -f "$compose_file" cp "$app_source_dir/." nextcloud:/var/www/html/custom_apps/betternascontrolplane
docker compose -f "$compose_file" exec -T --user root nextcloud sh -lc '
chown -R www-data:www-data /var/www/html/custom_apps/ainascontrolplane
chown -R www-data:www-data /var/www/html/custom_apps/betternascontrolplane
'
echo "Waiting for Nextcloud command interface..."
@ -60,7 +60,7 @@ if ! nextcloud_is_installed; then
fi
fi
nextcloud_occ app:enable --force ainascontrolplane >/dev/null
nextcloud_occ app:enable --force betternascontrolplane >/dev/null
echo "Nextcloud: http://localhost:8080"
echo "betterNAS control plane: http://localhost:3001"