fix patch db types and comment out future domain and proxy features

This commit is contained in:
Matt Hill
2025-02-11 21:17:20 -07:00
parent 7d1096dbd8
commit ce2842d365
12 changed files with 259 additions and 297 deletions

View File

@@ -1,7 +1,4 @@
import {
DomainInfo,
NetworkStrategy,
} from 'src/app/services/patch-db/data-model'
import { DomainInfo } from 'src/app/services/patch-db/data-model'
import { FetchLogsReq, FetchLogsRes } from '@start9labs/shared'
import { Dump } from 'patch-db-client'
import { DataModel } from 'src/app/services/patch-db/data-model'
@@ -184,7 +181,7 @@ export module RR {
// domains
export type ClaimStart9ToReq = { networkStrategy: NetworkStrategy } // net.domain.me.claim
export type ClaimStart9ToReq = { networkInterfaceId: string } // net.domain.me.claim
export type ClaimStart9ToRes = null
export type DeleteStart9ToReq = {} // net.domain.me.delete
@@ -197,7 +194,7 @@ export module RR {
username: string | null
password: string | null
}
networkStrategy: NetworkStrategy
networkInterfaceId: string
} // net.domain.add
export type AddDomainRes = null
@@ -677,10 +674,10 @@ export type ServerNotification<T extends number> = {
export type NotificationData<T> = T extends 0
? null
: T extends 1
? BackupReport
: T extends 2
? string
: any
? BackupReport
: T extends 2
? string
: any
export type BackupReport = {
server: {

View File

@@ -13,7 +13,6 @@ import {
import {
InstallingState,
PackageDataEntry,
Proxy,
StateInfo,
UpdatingState,
} from 'src/app/services/patch-db/data-model'
@@ -574,25 +573,22 @@ export class MockApiService extends ApiService {
async addProxy(params: RR.AddProxyReq): Promise<RR.AddProxyRes> {
await pauseFor(2000)
const type: Proxy['type'] = 'inbound-outbound'
const patch = [
{
op: PatchOp.REPLACE,
path: '/serverInfo/network/proxies',
value: [
{
id: 'abcd-efgh-ijkl-mnop',
op: PatchOp.ADD,
path: `/serverInfo/network/networkInterfaces/wga1`,
value: {
inbound: true,
outbound: true,
ipInfo: {
name: params.name,
createdAt: new Date(),
type,
endpoint: '10.25.2.17',
usedBy: {
domains: [],
services: [],
},
scopeId: 3,
deviceType: 'wireguard',
subnets: [],
wanIp: '1.1.1.1',
ntpServers: [],
},
],
},
},
]
this.mockRevision(patch)
@@ -639,12 +635,10 @@ export class MockApiService extends ApiService {
const patch = [
{
op: PatchOp.REPLACE,
path: '/serverInfo/network/start9ToSubdomain',
path: '/serverInfo/network/start9To',
value: {
value: 'xyz',
createdAt: new Date(),
networkStrategy: params.networkStrategy,
usedBy: [],
subdomain: 'xyz',
networkInterfaceId: params.networkInterfaceId,
},
},
]
@@ -660,7 +654,7 @@ export class MockApiService extends ApiService {
const patch = [
{
op: PatchOp.REPLACE,
path: '/serverInfo/network/start9ToSubdomain',
path: '/serverInfo/network/start9To',
value: null,
},
]
@@ -675,16 +669,13 @@ export class MockApiService extends ApiService {
const patch = [
{
op: PatchOp.REPLACE,
path: '/serverInfo/network/domains',
value: [
{
value: params.hostname,
createdAt: new Date(),
path: `/serverInfo/network/domains`,
value: {
[params.hostname]: {
networkInterfaceId: params.networkInterfaceId,
provider: params.provider.name,
networkStrategy: params.networkStrategy,
usedBy: [],
},
],
},
},
]
this.mockRevision(patch)
@@ -698,7 +689,7 @@ export class MockApiService extends ApiService {
{
op: PatchOp.REPLACE,
path: '/serverInfo/network/domains',
value: [],
value: {},
},
]
this.mockRevision(patch)

View File

@@ -39,37 +39,142 @@ export const mockPatchData: DataModel = {
selected: null,
lastRegion: null,
},
start9ToSubdomain: null,
domains: [],
start9To: null,
domains: {},
wanConfig: {
upnp: true,
forwards: [],
},
proxies: [],
outboundProxy: null,
},
networkInterfaces: {
eth0: {
public: false,
ipInfo: {
scopeId: 1,
deviceType: 'ethernet',
subnets: ['10.0.0.2/24'],
wanIp: null,
ntpServers: [],
host: {
bindings: {
80: {
enabled: true,
net: {
assignedPort: null,
assignedSslPort: 443,
public: false,
},
options: {
preferredExternalPort: 80,
addSsl: {
preferredExternalPort: 443,
alpn: { specified: ['http/1.1', 'h2'] },
},
secure: null,
},
},
},
domains: {},
onions: ['myveryownspecialtoraddress'],
hostnameInfo: {
80: [
{
kind: 'ip',
networkInterfaceId: 'eth0',
public: false,
hostname: {
kind: 'local',
value: 'adjective-noun.local',
port: null,
sslPort: 443,
},
},
{
kind: 'ip',
networkInterfaceId: 'wlan0',
public: false,
hostname: {
kind: 'local',
value: 'adjective-noun.local',
port: null,
sslPort: 443,
},
},
{
kind: 'ip',
networkInterfaceId: 'eth0',
public: false,
hostname: {
kind: 'ipv4',
value: '10.0.0.1',
port: null,
sslPort: 443,
},
},
{
kind: 'ip',
networkInterfaceId: 'wlan0',
public: false,
hostname: {
kind: 'ipv4',
value: '10.0.0.2',
port: null,
sslPort: 443,
},
},
{
kind: 'ip',
networkInterfaceId: 'eth0',
public: false,
hostname: {
kind: 'ipv6',
value: 'fe80::cd00:0000:0cde:1257:0000:211e:72cd',
scopeId: 2,
port: null,
sslPort: 443,
},
},
{
kind: 'ip',
networkInterfaceId: 'wlan0',
public: false,
hostname: {
kind: 'ipv6',
value: 'fe80::cd00:0000:0cde:1257:0000:211e:1234',
scopeId: 3,
port: null,
sslPort: 443,
},
},
{
kind: 'onion',
hostname: {
value: 'myveryownspecialtoraddress.onion',
port: 80,
sslPort: 443,
},
},
],
},
},
wlan0: {
public: false,
ipInfo: {
scopeId: 2,
deviceType: 'wireless',
subnets: [
'10.0.90.12/24',
'fe80::cd00:0000:0cde:1257:0000:211e:72cd/64',
],
wanIp: null,
ntpServers: [],
networkInterfaces: {
eth0: {
inbound: false,
outbound: true,
ipInfo: {
name: 'Wired Connection 1',
scopeId: 1,
deviceType: 'ethernet',
subnets: ['10.0.0.2/24'],
wanIp: null,
ntpServers: [],
},
},
wlan0: {
inbound: false,
outbound: true,
ipInfo: {
name: 'Wireless Connection 1',
scopeId: 2,
deviceType: 'wireless',
subnets: [
'10.0.90.12/24',
'fe80::cd00:0000:0cde:1257:0000:211e:72cd/64',
],
wanIp: null,
ntpServers: [],
},
},
},
},
@@ -78,10 +183,7 @@ export const mockPatchData: DataModel = {
contact: ['mailto:support@start9.com'],
},
},
unreadNotifications: {
count: 4,
recent: Mock.Notifications,
},
unreadNotificationCount: 4,
// password is asdfasdf
passwordHash:
'$argon2d$v=19$m=1024,t=1,p=1$YXNkZmFzZGZhc2RmYXNkZg$Ceev1I901G6UwU+hY0sHrFZ56D+o+LNJ',
@@ -96,108 +198,6 @@ export const mockPatchData: DataModel = {
backupProgress: {},
},
hostname: 'random-words',
host: {
bindings: {
80: {
enabled: true,
net: {
assignedPort: null,
assignedSslPort: 443,
public: false,
},
options: {
preferredExternalPort: 80,
addSsl: {
preferredExternalPort: 443,
alpn: { specified: ['http/1.1', 'h2'] },
},
secure: null,
},
},
},
domains: {},
onions: ['myveryownspecialtoraddress'],
hostnameInfo: {
80: [
{
kind: 'ip',
networkInterfaceId: 'eth0',
public: false,
hostname: {
kind: 'local',
value: 'adjective-noun.local',
port: null,
sslPort: 443,
},
},
{
kind: 'ip',
networkInterfaceId: 'wlan0',
public: false,
hostname: {
kind: 'local',
value: 'adjective-noun.local',
port: null,
sslPort: 443,
},
},
{
kind: 'ip',
networkInterfaceId: 'eth0',
public: false,
hostname: {
kind: 'ipv4',
value: '10.0.0.1',
port: null,
sslPort: 443,
},
},
{
kind: 'ip',
networkInterfaceId: 'wlan0',
public: false,
hostname: {
kind: 'ipv4',
value: '10.0.0.2',
port: null,
sslPort: 443,
},
},
{
kind: 'ip',
networkInterfaceId: 'eth0',
public: false,
hostname: {
kind: 'ipv6',
value: 'fe80::cd00:0000:0cde:1257:0000:211e:72cd',
scopeId: 2,
port: null,
sslPort: 443,
},
},
{
kind: 'ip',
networkInterfaceId: 'wlan0',
public: false,
hostname: {
kind: 'ipv6',
value: 'fe80::cd00:0000:0cde:1257:0000:211e:1234',
scopeId: 3,
port: null,
sslPort: 443,
},
},
{
kind: 'onion',
hostname: {
value: 'myveryownspecialtoraddress.onion',
port: 80,
sslPort: 443,
},
},
],
},
},
pubkey: 'npub1sg6plzptd64u62a878hep2kev88swjh3tw00gjsfl8f237lmu63q0uf63m',
caFingerprint: 'SHA-256: 63 2B 11 99 44 40 17 DF 37 FC C3 DF 0F 3D 15',
ntpSynced: false,