mirror of
https://github.com/pockethost/pockethost.git
synced 2025-06-11 16:46:40 +00:00
redo pockethost package entry point
This commit is contained in:
parent
3facc2c3f3
commit
c205de9bbd
@ -35,6 +35,7 @@
|
||||
"mothership",
|
||||
"multitenancy",
|
||||
"multitenant",
|
||||
"neverending",
|
||||
"noaxis",
|
||||
"nofile",
|
||||
"nohup",
|
||||
|
@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { userSubscriptionType } from '$util/stores'
|
||||
import { PLAN_NAMES, SubscriptionType } from 'pockethost'
|
||||
import { PLAN_NAMES, SubscriptionType } from 'pockethost/common'
|
||||
import { userStore } from '$util/stores'
|
||||
import { onMount } from 'svelte'
|
||||
import FlounderCard from './FlounderCard.svelte'
|
||||
|
@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { PLAN_NAMES, SubscriptionType } from 'pockethost'
|
||||
import { PLAN_NAMES, SubscriptionType } from 'pockethost/common'
|
||||
import { stats, userStore } from '$util/stores'
|
||||
import PricingCard from '$src/routes/(static)/pricing/PricingCard.svelte'
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
import { globalInstancesStore, userSubscriptionType } from '$util/stores'
|
||||
import { values } from '@s-libs/micro-dash'
|
||||
import InstanceList from './InstanceList.svelte'
|
||||
import { SubscriptionType } from 'pockethost'
|
||||
import { SubscriptionType } from 'pockethost/common'
|
||||
import { faPlus } from '@fortawesome/free-solid-svg-icons'
|
||||
import Fa from 'svelte-fa'
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
import { globalInstancesStore } from '$util/stores'
|
||||
import { faCircleInfo } from '@fortawesome/free-solid-svg-icons'
|
||||
import { values } from '@s-libs/micro-dash'
|
||||
import { type InstanceId } from 'pockethost'
|
||||
import { type InstanceId } from 'pockethost/common'
|
||||
import Fa from 'svelte-fa'
|
||||
|
||||
const { updateInstance } = client()
|
||||
@ -26,7 +26,7 @@
|
||||
{#each values($globalInstancesStore).sort( (a, b) => a.subdomain.localeCompare(b.subdomain), ) as instance, index}
|
||||
<button
|
||||
class={`card min-w-80 lg:max-w-80 flex-1 m-4 transition hover:bg-base-300 ${instance.maintenance ? 'bg-base-200' : 'bg-neutral'}`}
|
||||
on:click={_=>goto(`/instances/${instance.id}`)}
|
||||
on:click={(_) => goto(`/instances/${instance.id}`)}
|
||||
>
|
||||
<div class="card-body w-full">
|
||||
<div class="card-title">
|
||||
@ -38,7 +38,7 @@
|
||||
? 'bg-red-500 hover:bg-red-500'
|
||||
: 'toggle-success'}"
|
||||
checked={!instance.maintenance}
|
||||
on:click={e=>e.stopPropagation()}
|
||||
on:click={(e) => e.stopPropagation()}
|
||||
on:change={handleMaintenanceChange(instance.id)}
|
||||
/>
|
||||
</div>
|
||||
|
@ -4,7 +4,7 @@
|
||||
import { client } from '$src/pocketbase-client'
|
||||
import { instance } from '../store'
|
||||
import { reduce } from '@s-libs/micro-dash'
|
||||
import { logger, type UpdateInstancePayload } from 'pockethost'
|
||||
import { logger, type UpdateInstancePayload } from 'pockethost/common'
|
||||
import Fa from 'svelte-fa'
|
||||
import { faTrash } from '@fortawesome/free-solid-svg-icons'
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import PricingCard from '$src/routes/(static)/pricing/PricingCard.svelte'
|
||||
import { PLAN_NAMES, SubscriptionType } from 'pockethost'
|
||||
import { PLAN_NAMES, SubscriptionType } from 'pockethost/common'
|
||||
import PricingTable from './PricingTable.svelte'
|
||||
import { userStore } from '$util/stores'
|
||||
import FlounderCard from '$src/routes/(app)/account/FlounderCard.svelte'
|
||||
|
@ -1 +0,0 @@
|
||||
export * from './src/common'
|
@ -1,2 +0,0 @@
|
||||
export * from './src/common'
|
||||
export * from './src/core'
|
@ -6,8 +6,14 @@
|
||||
"url": "https://github.com/benallfree"
|
||||
},
|
||||
"license": "MIT",
|
||||
"main": "./common.ts",
|
||||
"module": "./common.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"import": "./src/index.ts"
|
||||
},
|
||||
"./common": {
|
||||
"import": "./src/common/index.ts"
|
||||
}
|
||||
},
|
||||
"type": "module",
|
||||
"bin": {
|
||||
"pockethost": "src/cli/index.ts"
|
||||
|
@ -1,14 +1,14 @@
|
||||
import Dockerode from 'dockerode'
|
||||
import { ErrorRequestHandler } from 'express'
|
||||
import { logger } from '../../../../../common'
|
||||
import {
|
||||
MOTHERSHIP_ADMIN_PASSWORD,
|
||||
MOTHERSHIP_ADMIN_USERNAME,
|
||||
MOTHERSHIP_URL,
|
||||
discordAlert,
|
||||
logger,
|
||||
neverendingPromise,
|
||||
tryFetch,
|
||||
} from '../../../../../core'
|
||||
} from '../../../../..'
|
||||
import {
|
||||
DOCKER_INSTANCE_IMAGE_NAME,
|
||||
MothershipAdminClientService,
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Command } from 'commander'
|
||||
import { logger } from '../../../../../../common'
|
||||
import { logger } from '../../../../../common'
|
||||
import { daemon } from './daemon'
|
||||
|
||||
type Options = {
|
||||
|
@ -4,6 +4,7 @@ import { spawn } from 'child_process'
|
||||
import { Mode, constants, createReadStream, createWriteStream } from 'fs'
|
||||
import { FileStat, FileSystem, FtpConnection } from 'ftp-srv'
|
||||
import { dirname, isAbsolute, join, normalize, resolve, sep } from 'path'
|
||||
import { DATA_ROOT } from '../../../../..'
|
||||
import {
|
||||
InstanceFields,
|
||||
Logger,
|
||||
@ -11,7 +12,6 @@ import {
|
||||
assert,
|
||||
seqid,
|
||||
} from '../../../../../common'
|
||||
import { DATA_ROOT } from '../../../../../core'
|
||||
import {
|
||||
InstanceLogWriter,
|
||||
InstanceLogWriterApi,
|
||||
|
@ -1,11 +1,5 @@
|
||||
import { readFileSync } from 'fs'
|
||||
import { FtpSrv } from 'ftp-srv'
|
||||
import {
|
||||
PocketBase,
|
||||
logger,
|
||||
mergeConfig,
|
||||
mkSingleton,
|
||||
} from '../../../../../common'
|
||||
import {
|
||||
MOTHERSHIP_URL,
|
||||
PH_FTP_PASV_IP,
|
||||
@ -15,7 +9,13 @@ import {
|
||||
SSL_CERT,
|
||||
SSL_KEY,
|
||||
asyncExitHook,
|
||||
} from '../../../../../core'
|
||||
} from '../../../../..'
|
||||
import {
|
||||
PocketBase,
|
||||
logger,
|
||||
mergeConfig,
|
||||
mkSingleton,
|
||||
} from '../../../../../common'
|
||||
import { PhFs } from './PhFs'
|
||||
|
||||
export type FtpConfig = { mothershipUrl: string }
|
||||
|
@ -1,9 +1,5 @@
|
||||
import { MOTHERSHIP_URL, neverendingPromise, tryFetch } from '../../../../..'
|
||||
import { logger } from '../../../../../common'
|
||||
import {
|
||||
MOTHERSHIP_URL,
|
||||
neverendingPromise,
|
||||
tryFetch,
|
||||
} from '../../../../../core'
|
||||
import { ftpService } from '../FtpService'
|
||||
|
||||
export async function ftp() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Command } from 'commander'
|
||||
import { logger } from '../../../../../../common'
|
||||
import { logger } from '../../../../../common'
|
||||
import { ftp } from './ftp'
|
||||
|
||||
type Options = {
|
||||
|
@ -7,7 +7,6 @@ import fs from 'fs'
|
||||
import http from 'http'
|
||||
import { createProxyMiddleware } from 'http-proxy-middleware'
|
||||
import https from 'https'
|
||||
import { logger } from '../../../../../common/Logger'
|
||||
import {
|
||||
APEX_DOMAIN,
|
||||
DAEMON_PORT,
|
||||
@ -18,7 +17,8 @@ import {
|
||||
neverendingPromise,
|
||||
SSL_CERT,
|
||||
SSL_KEY,
|
||||
} from '../../../../../core'
|
||||
} from '../../../../..'
|
||||
import { logger } from '../../../../../common/Logger'
|
||||
import { createIpWhitelistMiddleware } from './cidr'
|
||||
import { createVhostProxyMiddleware } from './createVhostProxyMiddleware'
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Command } from 'commander'
|
||||
import { logger } from '../../../../common'
|
||||
import { logger } from '../../../common'
|
||||
import { ServeCommand } from './ServeCommand'
|
||||
|
||||
type Options = {
|
||||
|
@ -9,7 +9,7 @@ import {
|
||||
LoggerService,
|
||||
MOTHERSHIP_PORT,
|
||||
stringify,
|
||||
} from '../../../../core'
|
||||
} from '../../..'
|
||||
|
||||
export const checkHealth = async () => {
|
||||
const { cpu, drive } = osu
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { execSync } from 'child_process'
|
||||
import { globSync } from 'glob'
|
||||
import { DATA_ROOT } from '../../../../core'
|
||||
import { logger } from '../../../common/Logger'
|
||||
import { DATA_ROOT, logger } from '../../..'
|
||||
|
||||
export const compact = async () => {
|
||||
const { info, error } = logger()
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Command } from 'commander'
|
||||
import { logger } from '../../../../core'
|
||||
import { logger } from '../../..'
|
||||
|
||||
type Options = {
|
||||
debug: boolean
|
||||
|
@ -5,7 +5,7 @@ import {
|
||||
MOTHERSHIP_DATA_ROOT,
|
||||
MOTHERSHIP_MIGRATIONS_DIR,
|
||||
MOTHERSHIP_SEMVER,
|
||||
} from '../../../../../core'
|
||||
} from '../../../..'
|
||||
import { GobotService } from '../../../../services/GobotService'
|
||||
|
||||
export async function schema() {
|
||||
|
@ -15,7 +15,7 @@ import {
|
||||
TEST_EMAIL,
|
||||
_MOTHERSHIP_APP_ROOT,
|
||||
mkContainerHomePath,
|
||||
} from '../../../../../core'
|
||||
} from '../../../..'
|
||||
import { GobotService } from '../../../../services/GobotService'
|
||||
|
||||
export type MothershipConfig = {}
|
||||
|
@ -5,7 +5,7 @@ import {
|
||||
MOTHERSHIP_HOOKS_DIR,
|
||||
PH_ALLOWED_POCKETBASE_SEMVER,
|
||||
stringify,
|
||||
} from '../../../../../core'
|
||||
} from '../../../..'
|
||||
import { GobotService } from '../../../../services/GobotService'
|
||||
|
||||
function compareSemVer(a: string, b: string): number {
|
||||
|
@ -2,14 +2,14 @@ import { map } from '@s-libs/micro-dash'
|
||||
import Database from 'better-sqlite3'
|
||||
import Bottleneck from 'bottleneck'
|
||||
import { Command, InvalidArgumentError } from 'commander'
|
||||
import { PocketBase, UserFields, logger } from '../../../common'
|
||||
import {
|
||||
MOTHERSHIP_ADMIN_PASSWORD,
|
||||
MOTHERSHIP_ADMIN_USERNAME,
|
||||
MOTHERSHIP_DATA_DB,
|
||||
MOTHERSHIP_URL,
|
||||
TEST_EMAIL,
|
||||
} from '../../../core'
|
||||
} from '../../..'
|
||||
import { PocketBase, UserFields, logger } from '../../../common'
|
||||
|
||||
const TBL_SENT_MESSAGES = `sent_messages`
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Command } from 'commander'
|
||||
import { neverendingPromise } from '../../..'
|
||||
import { logger } from '../../../common'
|
||||
import { neverendingPromise } from '../../../core'
|
||||
import { daemon } from '../EdgeCommand/DaemonCommand/ServeCommand/daemon'
|
||||
import { firewall } from '../FirewallCommand/ServeCommand/firewall/server'
|
||||
import { mothership } from '../MothershipCommand/ServeCommand/mothership'
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
import { program } from 'commander'
|
||||
import EventSource from 'eventsource'
|
||||
import { LogLevelName, gracefulExit, logger } from '../../core'
|
||||
import { LogLevelName, gracefulExit, logger } from '..'
|
||||
import { version } from '../../package.json'
|
||||
import { EdgeCommand } from './commands/EdgeCommand'
|
||||
import { FirewallCommand } from './commands/FirewallCommand'
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { WinstonLoggerService } from '..'
|
||||
import { version } from '../../package.json'
|
||||
import { ioc } from '../common'
|
||||
import { RegisterEnvSettingsService } from '../constants'
|
||||
import { WinstonLoggerService } from '../core/winston'
|
||||
import { GobotService } from '../services/GobotService'
|
||||
|
||||
export const initIoc = async () => {
|
||||
|
@ -12,15 +12,13 @@ import {
|
||||
SettingsHandlerFactory,
|
||||
SettingsService,
|
||||
ioc,
|
||||
} from '../core'
|
||||
import {
|
||||
mkBoolean,
|
||||
mkCsvString,
|
||||
mkNumber,
|
||||
mkPath,
|
||||
mkString,
|
||||
} from './core/Settings'
|
||||
import { settings } from './core/ioc'
|
||||
settings,
|
||||
} from '.'
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url))
|
||||
|
||||
|
@ -5,7 +5,9 @@ export * from './discordAlert'
|
||||
export * from './env'
|
||||
export * from './exit'
|
||||
export * from './internal'
|
||||
export * from './ioc'
|
||||
export * from './process'
|
||||
export * from './Settings'
|
||||
export * from './smartFetch'
|
||||
export * from './tryFetch'
|
||||
export * from './winston'
|
||||
|
@ -1 +1,2 @@
|
||||
export * from './common'
|
||||
export * from './core'
|
||||
|
@ -5,7 +5,7 @@ import {
|
||||
LoggerService,
|
||||
mkInstanceDataPath,
|
||||
stringify,
|
||||
} from '../../../core'
|
||||
} from '../..'
|
||||
|
||||
type UnsubFunc = () => void
|
||||
|
||||
|
@ -23,7 +23,7 @@ import {
|
||||
now,
|
||||
stringify,
|
||||
tryFetch,
|
||||
} from '../../../core'
|
||||
} from '../..'
|
||||
import {
|
||||
InstanceLogWriter,
|
||||
MothershipAdminClientService,
|
||||
|
@ -8,7 +8,7 @@ import {
|
||||
PocketBase,
|
||||
UserFields,
|
||||
UserId,
|
||||
} from '../../../core'
|
||||
} from '../..'
|
||||
|
||||
export const mkInstanceCache = (client: PocketBase) => {
|
||||
const { dbg } = LoggerService().create(`InstanceCache`)
|
||||
|
@ -6,7 +6,7 @@ import {
|
||||
InstanceId,
|
||||
InstanceStatus,
|
||||
WithUser,
|
||||
} from '../../../core'
|
||||
} from '../..'
|
||||
|
||||
export type InstanceApi = ReturnType<typeof createInstanceMixin>
|
||||
|
||||
|
@ -9,7 +9,7 @@ import {
|
||||
RestMethods,
|
||||
createRestHelper,
|
||||
stringify,
|
||||
} from '../../../core'
|
||||
} from '../..'
|
||||
import { createInstanceMixin } from './InstanceMIxin'
|
||||
|
||||
export type PocketbaseClientApi = ReturnType<typeof createAdminPbClient>
|
||||
|
@ -7,7 +7,7 @@ import {
|
||||
PocketBase,
|
||||
mergeConfig,
|
||||
mkSingleton,
|
||||
} from '../../../core'
|
||||
} from '../..'
|
||||
import { createAdminPbClient } from './createAdminPbClient'
|
||||
|
||||
export type ClientServiceConfig = {
|
||||
|
@ -15,7 +15,7 @@ import {
|
||||
mkInstanceDataPath,
|
||||
mkInternalUrl,
|
||||
mkSingleton,
|
||||
} from '../../../core'
|
||||
} from '../..'
|
||||
import { GobotService } from '../GobotService'
|
||||
import { InstanceLogWriter } from '../InstanceLoggerService'
|
||||
|
||||
|
@ -11,7 +11,7 @@ import {
|
||||
asyncExitHook,
|
||||
mkSingleton,
|
||||
seqid,
|
||||
} from '../../core'
|
||||
} from '..'
|
||||
|
||||
export type ProxyServiceApi = AsyncReturnType<typeof proxyService>
|
||||
|
||||
|
@ -7,7 +7,7 @@ import {
|
||||
PocketBase,
|
||||
SingletonBaseConfig,
|
||||
stringify,
|
||||
} from '../../core'
|
||||
} from '..'
|
||||
import { InstanceLogReader } from './InstanceLoggerService'
|
||||
import { proxyService } from './ProxyService'
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user