Chore/unexport api ts (#2585)

* don't export api params

* import from SDK instead of BE

---------

Co-authored-by: Aiden McClelland <me@drbonez.dev>
This commit is contained in:
Matt Hill
2024-04-01 14:47:03 -06:00
committed by GitHub
parent f021ad9b0a
commit 71b83245b4
105 changed files with 88 additions and 464 deletions

View File

@@ -1,13 +1,8 @@
import { DOCUMENT } from '@angular/common'
import { Inject, Injectable } from '@angular/core'
import { WorkspaceConfig } from '@start9labs/shared'
import { types } from '@start9labs/start-sdk'
import { PackageDataEntry } from 'src/app/services/patch-db/data-model'
import { PackageState } from '../../../../../../core/startos/bindings/PackageState'
import { MainStatus } from '../../../../../../core/startos/bindings/MainStatus'
import { ExportedOnionHostname } from '../../../../../../core/startos/bindings/ExportedOnionHostname'
import { ExportedIpHostname } from '../../../../../../core/startos/bindings/ExportedIpHostname'
import { ExportedHostnameInfo } from '../../../../../../core/startos/bindings/ExportedHostnameInfo'
import { T } from '@start9labs/start-sdk'
import { PackageDataEntry } from './patch-db/data-model'
const {
gitHash,
@@ -55,8 +50,8 @@ export class ConfigService {
}
isLaunchable(
state: PackageState['state'],
status: MainStatus['status'],
state: T.PackageState['state'],
status: T.MainStatus['status'],
): boolean {
return state === 'installed' && status === 'running'
}
@@ -76,13 +71,13 @@ export class ConfigService {
if (host.kind === 'multi') {
const onionHostname = host.hostnames.find(h => h.kind === 'onion')
?.hostname as ExportedOnionHostname
?.hostname as T.ExportedOnionHostname
if (this.isTor() && onionHostname) {
url.hostname = onionHostname.value
} else {
const ipHostname = host.hostnames.find(h => h.kind === 'ip')
?.hostname as ExportedIpHostname
?.hostname as T.ExportedIpHostname
if (!ipHostname) return ''
@@ -91,16 +86,16 @@ export class ConfigService {
}
} else {
throw new Error('unimplemented')
const hostname = {} as ExportedHostnameInfo // host.hostname
// const hostname = {} as T.ExportedHostnameInfo // host.hostname
if (!hostname) return ''
// if (!hostname) return ''
if (this.isTor() && hostname.kind === 'onion') {
url.hostname = (hostname.hostname as ExportedOnionHostname).value
} else {
url.hostname = this.hostname
url.port = String(hostname.hostname.sslPort || hostname.hostname.port)
}
// if (this.isTor() && hostname.kind === 'onion') {
// url.hostname = (hostname.hostname as T.ExportedOnionHostname).value
// } else {
// url.hostname = this.hostname
// url.port = String(hostname.hostname.sslPort || hostname.hostname.port)
// }
}
return url.href