domains api + migration

This commit is contained in:
Aiden McClelland
2025-08-06 14:29:35 -06:00
parent ea12251a7e
commit d6dfaf8feb
39 changed files with 496 additions and 87 deletions

View File

@@ -47,10 +47,8 @@ export class DomainService {
readonly data = toSignal(
this.patch.watch$('serverInfo', 'network').pipe(
map(({ networkInterfaces, domains, acme }) => ({
gateways: Object.entries(networkInterfaces).reduce<
Record<string, string>
>(
map(({ gateways, domains, acme }) => ({
gateways: Object.entries(gateways).reduce<Record<string, string>>(
(obj, [id, n]) => ({
...obj,
[id]: n.ipInfo?.name || '',
@@ -64,7 +62,7 @@ export class DomainService {
subdomain: parse(fqdn).subdomain,
gateway: {
id: gateway,
ipInfo: networkInterfaces[gateway]?.ipInfo || null,
ipInfo: gateways[gateway]?.ipInfo || null,
},
authority: {
url: acme,

View File

@@ -84,7 +84,7 @@ export default class GatewaysComponent {
private readonly formDialog = inject(FormDialogService)
readonly gateways$ = inject<PatchDB<DataModel>>(PatchDB)
.watch$('serverInfo', 'network', 'networkInterfaces')
.watch$('serverInfo', 'network', 'gateways')
.pipe(
map(gateways =>
Object.entries(gateways)

View File

@@ -110,7 +110,7 @@ export namespace Mock {
squashfs: {
aarch64: {
publishedAt: '2025-04-21T20:58:48.140749883Z',
url: 'https://alpha-registry-x.start9.com/startos/v0.4.0-alpha.9/startos-0.4.0-alpha.9-33ae46f~dev_aarch64.squashfs',
url: 'https://alpha-registry-x.start9.com/startos/v0.4.0-alpha.10/startos-0.4.0-alpha.10-33ae46f~dev_aarch64.squashfs',
commitment: {
hash: '4elBFVkd/r8hNadKmKtLIs42CoPltMvKe2z3LRqkphk=',
size: 1343500288,
@@ -122,7 +122,7 @@ export namespace Mock {
},
'aarch64-nonfree': {
publishedAt: '2025-04-21T21:07:00.249285116Z',
url: 'https://alpha-registry-x.start9.com/startos/v0.4.0-alpha.9/startos-0.4.0-alpha.9-33ae46f~dev_aarch64-nonfree.squashfs',
url: 'https://alpha-registry-x.start9.com/startos/v0.4.0-alpha.10/startos-0.4.0-alpha.10-33ae46f~dev_aarch64-nonfree.squashfs',
commitment: {
hash: 'MrCEi4jxbmPS7zAiGk/JSKlMsiuKqQy6RbYOxlGHOIQ=',
size: 1653075968,
@@ -134,7 +134,7 @@ export namespace Mock {
},
raspberrypi: {
publishedAt: '2025-04-21T21:16:12.933319237Z',
url: 'https://alpha-registry-x.start9.com/startos/v0.4.0-alpha.9/startos-0.4.0-alpha.9-33ae46f~dev_raspberrypi.squashfs',
url: 'https://alpha-registry-x.start9.com/startos/v0.4.0-alpha.10/startos-0.4.0-alpha.10-33ae46f~dev_raspberrypi.squashfs',
commitment: {
hash: '/XTVQRCqY3RK544PgitlKu7UplXjkmzWoXUh2E4HCw0=',
size: 1490731008,
@@ -146,7 +146,7 @@ export namespace Mock {
},
x86_64: {
publishedAt: '2025-04-21T21:14:20.246908903Z',
url: 'https://alpha-registry-x.start9.com/startos/v0.4.0-alpha.9/startos-0.4.0-alpha.9-33ae46f~dev_x86_64.squashfs',
url: 'https://alpha-registry-x.start9.com/startos/v0.4.0-alpha.10/startos-0.4.0-alpha.10-33ae46f~dev_x86_64.squashfs',
commitment: {
hash: '/6romKTVQGSaOU7FqSZdw0kFyd7P+NBSYNwM3q7Fe44=',
size: 1411657728,
@@ -158,7 +158,7 @@ export namespace Mock {
},
'x86_64-nonfree': {
publishedAt: '2025-04-21T21:15:17.955265284Z',
url: 'https://alpha-registry-x.start9.com/startos/v0.4.0-alpha.9/startos-0.4.0-alpha.9-33ae46f~dev_x86_64-nonfree.squashfs',
url: 'https://alpha-registry-x.start9.com/startos/v0.4.0-alpha.10/startos-0.4.0-alpha.10-33ae46f~dev_x86_64-nonfree.squashfs',
commitment: {
hash: 'HCRq9sr/0t85pMdrEgNBeM4x11zVKHszGnD1GDyZbSE=',
size: 1731035136,

View File

@@ -269,7 +269,7 @@ export namespace RR {
export type UpdateTunnelReq = {
id: string
name: string
} // net.netwok-interface.set-name
} // net.gateway.set-name
export type UpdateTunnelRes = null
export type RemoveTunnelReq = { id: string } // net.tunnel.remove

View File

@@ -351,7 +351,7 @@ export class LiveApiService extends ApiService {
}
async updateTunnel(params: RR.UpdateTunnelReq): Promise<RR.UpdateTunnelRes> {
return this.rpcRequest({ method: 'net.netwok-interface.set-name', params })
return this.rpcRequest({ method: 'net.gateway.set-name', params })
}
async removeTunnel(params: RR.RemoveTunnelReq): Promise<RR.RemoveTunnelRes> {

View File

@@ -553,7 +553,7 @@ export class MockApiService extends ApiService {
const patch: AddOperation<T.NetworkInterfaceInfo>[] = [
{
op: PatchOp.ADD,
path: `/serverInfo/network/networkInterfaces/${id}`,
path: `/serverInfo/network/gateways/${id}`,
value: {
public: params.public,
secure: false,
@@ -579,7 +579,7 @@ export class MockApiService extends ApiService {
const patch: ReplaceOperation<string>[] = [
{
op: PatchOp.REPLACE,
path: `/serverInfo/network/networkInterfaces/${params.id}/label`,
path: `/serverInfo/network/gateways/${params.id}/label`,
value: params.name,
},
]
@@ -593,7 +593,7 @@ export class MockApiService extends ApiService {
const patch: RemoveOperation[] = [
{
op: PatchOp.REMOVE,
path: `/serverInfo/network/networkInterfaces/${params.id}`,
path: `/serverInfo/network/gateways/${params.id}`,
},
]
this.mockRevision(patch)

View File

@@ -145,7 +145,7 @@ export const mockPatchData: DataModel = {
],
},
},
networkInterfaces: {
gateways: {
eth0: {
public: null,
secure: null,

View File

@@ -26,14 +26,14 @@
// ) {}
// async presentModalSetOutboundProxy(current: string | null, pkgId?: string) {
// const networkInterfaces = await firstValueFrom(
// this.patch.watch$('serverInfo', 'network', 'networkInterfaces'),
// const gateways = await firstValueFrom(
// this.patch.watch$('serverInfo', 'network', 'gateways'),
// )
// const config = ISB.InputSpec.of({
// proxyId: ISB.Value.select({
// name: 'Select Proxy',
// default: current || '',
// values: Object.entries(networkInterfaces)
// values: Object.entries(gateways)
// .filter(
// ([_, n]) => n.outbound && n.ipInfo?.deviceType === 'wireguard',
// )