Merge branch 'master' of github.com:benallfree/pockethost

This commit is contained in:
Ben Allfree 2024-06-06 01:49:42 +00:00
commit e67a1261f7
515 changed files with 3479 additions and 2049 deletions

8
.changeset/README.md Normal file
View File

@ -0,0 +1,8 @@
# Changesets
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)

11
.changeset/config.json Normal file
View File

@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.0.1/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "master",
"updateInternalDependencies": "patch",
"ignore": []
}

View File

@ -9,6 +9,10 @@ on:
description: 'Force deploy specific project'
required: false
default: ''
# https://github.com/pockethost/pockethost/actions/workflows/publish.yaml
env:
PUBLIC_APEX_DOMAIN: ${{ vars.PUBLIC_APEX_DOMAIN }}
jobs:
publish:
@ -23,6 +27,8 @@ jobs:
- name: pnpm
uses: pnpm/action-setup@v3.0.0
with:
version: 9.1.3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
@ -35,8 +41,6 @@ jobs:
pnpm i
pnpm lint
pnpm build-frontends
ls
ls dist
- name: Expose git commit data
uses: rlespinasse/git-commit-data-action@v1.5.0
@ -53,7 +57,9 @@ jobs:
uses: tj-actions/changed-files@v40.1.0
with:
files: |
frontends/dashboard/**
packages/dashboard/**
.github/workflows/**
packages/common/**
- name: DASHBOARD - Publish to Cloudflare Pages
uses: cloudflare/pages-action@v1.5.0
@ -97,7 +103,9 @@ jobs:
uses: tj-actions/changed-files@v40.1.0
with:
files: |
frontends/lander/**
packages/lander/**
.github/workflows/**
packages/common/**
- name: LANDER - Publish to Cloudflare Pages
uses: cloudflare/pages-action@v1.5.0
@ -140,7 +148,9 @@ jobs:
uses: tj-actions/changed-files@v40.1.0
with:
files: |
frontends/superadmin/**
packages/superadmin/**
.github/workflows/**
packages/common/**
- name: SUPERADMIN - Publish to Cloudflare Pages
uses: cloudflare/pages-action@v1.5.0

3
.gitignore vendored
View File

@ -13,4 +13,5 @@ pocketbase
live-data
dist
.pockethost
.scripts
*.tgz

5
.husky/commit-msg Normal file
View File

@ -0,0 +1,5 @@
branch="$(git rev-parse --abbrev-ref HEAD)"
if [ "$branch" = "master" ]; then
npx --no -- commitlint --edit $1
fi

0
.husky/pre-commit Normal file
View File

6
.husky/pre-push Normal file
View File

@ -0,0 +1,6 @@
branch="$(git rev-parse --abbrev-ref HEAD)"
if [ "$branch" = "master" ]; then
pnpm check:types
pnpm build-frontends
fi

3
.npmrc Normal file
View File

@ -0,0 +1,3 @@
public-hoist-pattern[]=eslint
public-hoist-pattern[]=prettier
public-hoist-pattern[]=@pockethost/plugin-*

View File

@ -9,6 +9,6 @@ build
_site
forks
src/mothership-app/migrations
src/mothership-app/pb_hooks/types/types.d.ts
src/instance-app/types/types.d.ts
packages/pockethost/src/mothership-app/migrations
packages/pockethost/src/mothership-app/pb_hooks/types/types.d.ts
packages/pockethost/src/instance-app/types/types.d.ts

View File

@ -1,56 +0,0 @@
import { Command, program } from 'commander'
import { BuildOptions, build, context } from 'esbuild'
import { nodeExternalsPlugin } from 'esbuild-node-externals'
import ncp from 'ncp'
export const main = async () => {
program.name('buildtool').description('CLI build and watch ')
const args: BuildOptions = {
entryPoints: ['src/cli/index.ts'],
bundle: true,
format: 'esm',
platform: 'node',
outfile: 'dist/index.mjs',
plugins: [nodeExternalsPlugin()],
}
program.addCommand(
new Command(`build`).description(`Build CLI`).action(async () => {
console.log(`Building CLI`)
await build(args)
console.log(`Building mothership app`)
await new Promise<void>((resolve) => {
ncp(`src/mothership-app`, './dist/mothership-app', (e) => {
if (e) {
console.error(e)
}
resolve()
})
})
console.log(`Building instance app`)
await new Promise<void>((resolve) => {
ncp(`src/instance-app`, './dist/instance-app', (e) => {
if (e) {
console.error(e)
}
resolve()
})
})
}),
)
program.addCommand(
new Command(`watch`).description(`Watch CLI`).action(async () => {
console.log(`Watching`)
const ctx = await context(args)
await ctx.watch()
}),
)
await program.parseAsync()
}
main()

20
commitlint.config.cjs Normal file
View File

@ -0,0 +1,20 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'scope-enum': [
2,
'always',
[
'root',
'dashboard',
'lander',
'superadmin',
'pockethost',
'common',
'ga',
'plugin-console-logger',
],
],
'scope-empty': [2, 'never'],
},
}

View File

@ -14,7 +14,6 @@
"dockerode",
"esbuild",
"eventsource",
"frontends",
"fullchain",
"getenv",
"gobot",

View File

@ -1,5 +1,5 @@
{
"name": "pockethost",
"name": "pockethost-root",
"version": "0.11.0",
"author": {
"name": "Ben Allfree",
@ -12,27 +12,29 @@
},
"scripts": {
"check:types": "concurrently 'pnpm:check:types:*'",
"check:types:dashboard": "cd frontends/dashboard && pnpm check:types",
"check:types:pockethost": "tsc --noEmit --skipLibCheck",
"check:types:dashboard": "cd packages/dashboard && pnpm check:types",
"check:types:superadmin": "cd packages/superadmin && pnpm check:types",
"check:types:pockethost": "cd packages/pockethost && pnpm check:types",
"check:types:common": "cd packages/common && pnpm check:types",
"lint": "prettier -c \"./**/*.{ts,js,cjs,svelte,json}\"",
"lint:fix": "prettier -w \"./**/*.{ts,js,cjs,svelte,json}\"",
"build": "concurrently 'pnpm:build:*'",
"buildtool": "tsx buildtool/index.ts",
"build-frontends": "concurrently 'pnpm:build:frontend:*'",
"build:frontend:dashboard": "cd frontends/dashboard && pnpm build",
"build:docker": "cd src/services/PocketBaseService && docker build . -t pockethost-instance:1.0.0 -t pockethost-instance:latest",
"build:frontend:lander": "cd frontends/lander && pnpm build",
"build:frontend:superadmin": "cd frontends/superadmin && pnpm build",
"dev:cli": "NODE_ENV=development tsx src/cli/index.ts",
"dev:lander": "cd frontends/lander && pnpm start",
"dev:dashboard": "cd frontends/dashboard && pnpm dev",
"dev:superadmin": "cd frontends/superadmin && pnpm dev",
"prod:cli": "tsx ./src/cli/index.ts",
"build:frontend:dashboard": "cd packages/dashboard && pnpm build",
"build:docker": "cd pockethost-instance && pnpm build",
"build:frontend:lander": "cd packages/lander && pnpm build",
"build:frontend:superadmin": "cd packages/superadmin && pnpm build",
"dev:cli": "NODE_ENV=development cd packages/pockethost && pnpm dev",
"dev:lander": "cd packages/lander && pnpm start",
"dev:dashboard": "cd packages/dashboard && pnpm dev",
"dev:superadmin": "cd packages/superadmin && pnpm dev",
"prod:cli": "tsx ./packages/pockethost/src/cli/index.ts",
"plop": "plop --no-progress",
"nofile": "cat /proc/sys/fs/file-nr",
"mail": "tsx ./src/cli/sendmail.ts",
"mail": "tsx ./packages/pockethost/src/cli/sendmail.ts",
"gobot:download": "gobot download pocketbase",
"gobot:download:all": "gobot download pocketbase --g-use-version='*'"
"gobot:download:all": "gobot download pocketbase --g-use-version='*'",
"prepare": "husky"
},
"prettier": {
"semi": false,
@ -46,55 +48,12 @@
]
},
"type": "module",
"dependencies": {
"@s-libs/micro-dash": "^16.1.0",
"devDependencies": {
"@changesets/cli": "^2.27.5",
"@types/node-os-utils": "^1.3.4",
"@types/winston-syslog": "^2.4.3",
"ajv": "^8.12.0",
"boolean": "^3.2.0",
"bottleneck": "^2.19.5",
"chalk": "^5.3.0",
"commander": "^11.1.0",
"cors": "^2.8.5",
"decompress": "^4.2.1",
"decompress-unzip": "https://github.com/pockethost/decompress-unzip.git#6ef397b9a2df11d39c7b26ce779e123833844751",
"devcert": "^1.2.2",
"dockerode": "^3.3.5",
"dotenv": "^16.3.1",
"event-source-polyfill": "^1.0.31",
"eventsource": "^2.0.2",
"exit-hook": "^4.0.0",
"express": "^4.18.2",
"express-async-errors": "^3.1.1",
"express-sslify": "^1.2.0",
"find-up": "^6.3.0",
"ftp-srv": "github:pockethost/ftp-srv#0fc708bae0d5d7a55ce948767f082d6fcfb2af59",
"get-port": "^6.1.2",
"glob": "^10.3.10",
"gobot": "1.0.0-alpha.40",
"gobot-pocketbase": "0.22.8-alpha.22",
"http-proxy": "^1.18.1",
"http-proxy-middleware": "^2.0.6",
"ip-cidr": "^3.1.0",
"json-stringify-safe": "^5.0.1",
"knex": "^2.5.1",
"memorystream": "^0.3.1",
"nanoid": "^5.0.2",
"node-fetch": "^3.3.2",
"node-os-utils": "^1.3.7",
"pocketbase": "^0.20.1",
"rimraf": "^5.0.5",
"semver": "^7.5.4",
"sqlite3": "^5.1.6",
"syslog-parse": "^2.0.0",
"tail": "^2.2.6",
"tmp": "^0.2.1",
"url-pattern": "^1.0.3",
"vhost": "^3.0.2",
"winston": "^3.11.0",
"winston-syslog": "^2.7.0"
},
"devDependencies": {
"@commitlint/cli": "^19.3.0",
"@commitlint/config-conventional": "^19.2.2",
"@swc/cli": "^0.1.62",
"@swc/core": "^1.3.95",
"@types/bootstrap": "^5.2.8",
@ -130,6 +89,7 @@
"esbuild-node-externals": "^1.13.0",
"express": "^4.18.2",
"http-proxy-middleware": "^2.0.6",
"husky": "^9.0.11",
"inquirer": "^9.2.15",
"ip-cidr": "^3.1.0",
"js-yaml": "^4.1.0",

View File

@ -0,0 +1,26 @@
{
"name": "@pockethost/common",
"version": "1.0.0",
"description": "",
"main": "src/index.ts",
"module": "src/index.ts",
"type": "module",
"scripts": {
"check:types": "tsc --noEmit "
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@s-libs/micro-dash": "^16.1.0",
"ajv": "^8.12.0",
"bottleneck": "^2.19.5",
"chalk": "^5.3.0",
"json-stringify-safe": "^5.0.1",
"nanoid": "^5.0.2",
"pocketbase": "^0.21.3"
},
"devDependencies": {
"@types/json-stringify-safe": "^5.0.2"
}
}

View File

@ -2,8 +2,9 @@
import chalk from 'chalk'
import stringify from 'json-stringify-safe'
import { mergeConfig } from '../util/mergeConfig'
import { mergeConfig } from '../../pockethost/src/util/mergeConfig'
import { mkSingleton } from './mkSingleton'
import { PocketHostAction, action } from './plugin'
export type Config = {
level: LogLevelName
@ -44,16 +45,6 @@ export const LEVEL_NAMES = [
LogLevelName.Abort,
]
export const LogLevelConsoleMap = {
[LogLevelName.Trace]: console.trace,
[LogLevelName.Raw]: console.log,
[LogLevelName.Debug]: console.debug,
[LogLevelName.Info]: console.info,
[LogLevelName.Warn]: console.warn,
[LogLevelName.Error]: console.error,
[LogLevelName.Abort]: console.error,
} as const
export const LogLevels = {
[LogLevelName.Trace]: 0,
[LogLevelName.Raw]: 1,
@ -85,32 +76,7 @@ export const createLogger = (config: Partial<Config>) => {
.join(' ')
const _log = (levelIn: LogLevelName, ...args: any[]) => {
if (isLevelGte(levelIn, _config.level)) {
const pfx = args.shift()
while (args.length > 0) {
let arg = args.shift()
const t = typeof arg
if (arg instanceof Error) {
args.unshift(...[arg.name, arg.message.toString()])
if (isLevelLte(levelIn, LogLevelName.Debug) && arg.stack) {
args.unshift(...arg.stack.split(/\n/))
}
continue
}
if (t === 'string' && !!arg.match(/\n/)) {
args.unshift(...arg.split(/\n/))
continue
}
if (t === 'object') {
args.unshift(...stringify(arg, null, 2).split(/\n/))
continue
}
if (t === 'function') {
arg = `<<function ${stringify(arg.toString())}>>`
}
LogLevelConsoleMap[levelIn](...[pfx, arg])
}
}
action(PocketHostAction.Log, _config.level, levelIn, args)
}
const raw = (...args: any[]) => {

View File

@ -1,7 +1,7 @@
import { LoggerService } from '$shared'
import { uniqueId } from '@s-libs/micro-dash'
import Bottleneck from 'bottleneck'
import { SetReturnType } from 'type-fest'
import { LoggerService } from './Logger'
const limiters: { [lane: string]: Bottleneck } = {}
export const serialAsyncExecutionGuard = <
@ -37,6 +37,7 @@ export const singletonAsyncExecutionGuard = <
const wrapper = (...args: Parameters<T>) => {
const { dbg } = LoggerService().create(`singletonAsyncExecutionGuard`)
const key = keyFactory(...args)
//@ts-ignore
if (singletons[key]) {
return singletons[key] as unknown as ReturnType<T>
}

View File

@ -7,5 +7,8 @@ export * from './events'
export * from './ioc'
export * from './mkSingleton'
export * from './newId'
export * from './plugin'
export * from './pocketbase'
export * from './pocketbase-client-helpers'
export * from './schema'
export * from './stringify'

View File

@ -1,4 +1,4 @@
import { customAlphabet } from 'nanoid'
const nanoid = customAlphabet('abcdefghijklmnopqrstuvwxyz')
export const newId = () => nanoid(15)
export const newId = (length = 15) => nanoid(length)

View File

@ -0,0 +1,124 @@
import { isString } from '@s-libs/micro-dash'
import { Request } from 'express'
import { LogLevelName } from './Logger'
import { InstanceFields } from './schema'
export enum PocketHostAction {
Request = 'request',
BeforeDaemonStart = 'before_daemon_start',
Log = 'log',
InstanceApiTimeout = 'instance_api_timeout',
UpdateInstance = 'update_instance',
}
export enum PocketHostFilter {
ExtraBinds = 'extra_binds',
}
export type PocketHostPlugin = (api: PocketHostPluginApi) => Promise<void>
const filters: { [key in PocketHostFilter]: FilterHandler[] } = {
[PocketHostFilter.ExtraBinds]: [],
}
const actions: {
[key in PocketHostAction]: ActionHandler[]
} = {
[PocketHostAction.Request]: [],
[PocketHostAction.BeforeDaemonStart]: [],
[PocketHostAction.Log]: [],
[PocketHostAction.InstanceApiTimeout]: [],
[PocketHostAction.UpdateInstance]: [],
}
export type FilterHandler = (carry: any) => any
export type ActionHandler = (...args: any[]) => void
export async function registerFilter(
filter: PocketHostFilter.ExtraBinds,
handler: (carry: string[]) => string[],
) {
filters[filter].push(handler)
}
export async function registerAction(
action: PocketHostAction.BeforeDaemonStart,
handler: (req: Request) => void,
): Promise<void>
export async function registerAction(
action: PocketHostAction.Request,
handler: (req: Request) => void,
): Promise<void>
export async function registerAction(
action: PocketHostAction.Log,
handler: (
currentLevel: LogLevelName,
level: LogLevelName,
args: any[],
) => void,
): Promise<void>
export async function registerAction(
action: PocketHostAction.InstanceApiTimeout,
handler: (instance: InstanceFields) => void,
): Promise<void>
export async function registerAction(
action: PocketHostAction.UpdateInstance,
handler: (id: string, fields: InstanceFields) => void,
): Promise<void>
export async function registerAction(
action: PocketHostAction,
handler: ActionHandler,
): Promise<void> {
actions[action].push(handler)
}
export async function filter(
filter: PocketHostFilter.ExtraBinds,
initial: string[],
) {
return filters[filter].reduce((carry, handler) => handler(carry), initial)
}
export async function action(
action: PocketHostAction.Request,
req: Request,
): Promise<void>
export async function action(
action: PocketHostAction.BeforeDaemonStart,
): Promise<void>
export async function action(
action: PocketHostAction.Log,
currentLevel: LogLevelName,
levelIn: LogLevelName,
...rest: any[]
): Promise<void>
export async function action(
action: PocketHostAction.InstanceApiTimeout,
instance: InstanceFields,
): Promise<void>
export async function action(
action: PocketHostAction.UpdateInstance,
id: string,
fields: Partial<InstanceFields>,
): Promise<void>
export async function action(action: PocketHostAction, ...args: any[]) {
await Promise.all(actions[action].map((handler) => handler(...args)))
}
export type PocketHostPluginApi = {
registerAction: typeof registerAction
}
export const loadPlugins = async (plugins: (string | PocketHostPlugin)[]) => {
await Promise.all(
plugins.map(async (pluginPathOrModule) => {
const plugin = await (async () => {
if (!isString(pluginPathOrModule)) return pluginPathOrModule
const plugin = await import(pluginPathOrModule)
return plugin.default
})()
await plugin({ registerAction })
}),
)
return plugins
}

View File

@ -1,12 +1,12 @@
import Ajv, { JSONSchemaType } from 'ajv'
import type pocketbaseEs from 'pocketbase'
import { ClientResponseError } from 'pocketbase'
import type { JsonObject } from 'type-fest'
import { PocketBase } from '..'
import { LoggerService } from '../Logger'
import { RestCommands, RestMethods } from '../schema'
export type RestHelperConfig = {
client: pocketbaseEs
client: PocketBase
}
export type RestHelper = ReturnType<typeof createRestHelper>

View File

@ -0,0 +1,14 @@
import PocketBase, {
BaseAuthStore,
ClientResponseError,
type AuthModel,
type UnsubscribeFunc,
} from 'pocketbase'
export {
AuthModel,
BaseAuthStore,
ClientResponseError,
PocketBase,
UnsubscribeFunc,
}

View File

@ -0,0 +1,3 @@
import stringify from 'json-stringify-safe'
export { stringify }

View File

@ -0,0 +1,109 @@
{
"compilerOptions": {
/* Visit https://aka.ms/tsconfig to read more about this file */
/* Projects */
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
/* Language and Environment */
"target": "es2016" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
// "jsx": "preserve", /* Specify what JSX code is generated. */
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
/* Modules */
"module": "commonjs" /* Specify what module code is generated. */,
// "rootDir": "./", /* Specify the root folder within your source files. */
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
// "resolveJsonModule": true, /* Enable importing .json files. */
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
/* JavaScript Support */
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
/* Emit */
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
// "outDir": "./", /* Specify an output folder for all emitted files. */
// "removeComments": true, /* Disable emitting comments. */
// "noEmit": true, /* Disable emitting files from a compilation. */
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
// "newLine": "crlf", /* Set the newline character for emitting files. */
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
/* Interop Constraints */
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
// "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
/* Type Checking */
"strict": true /* Enable all strict type-checking options. */,
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
/* Completeness */
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
}
}

View File

@ -6,7 +6,7 @@ Description about PocketHost goes here!
## Developing Locally
To run this project, navigate to the `/frontends/dashboard` folder and run `pnpm dev`.
To run this project, navigate to the `/packages/dashboard` folder and run `pnpm dev`.
It will start up the server here: [http://127.0.0.1:5173/](http://127.0.0.1:5173/) and now you're ready to code!

View File

@ -14,6 +14,7 @@
"type": "module",
"devDependencies": {
"@microsoft/fetch-event-source": "https://github.com/pockethost/fetch-event-source.git#ebe3b7122647b48b93fd11effbbfb915d98956b0",
"@pockethost/common": "workspace:../common",
"@s-libs/micro-dash": "^16.1.0",
"@sveltejs/adapter-static": "^2.0.3",
"@sveltejs/kit": "^1.25.2",
@ -30,7 +31,6 @@
"daisyui": "^4.4.23",
"date-fns": "^2.30.0",
"highlight.js": "^11.8.0",
"pocketbase": "^0.19.0",
"sass": "^1.68.0",
"svelte": "^4.2.1",
"svelte-chartjs": "3.1.2",
@ -39,5 +39,8 @@
"svelte-preprocess": "^5.0.4",
"tailwindcss": "^3.3.3",
"vite": "^4.4.9"
},
"dependencies": {
"@pockethost/plugin-console-logger": "link:../plugin-console-logger"
}
}

View File

@ -1,6 +1,6 @@
<!doctype html>
<!--suppress ALL -->
<html lang="en" data-theme="dark" class='h-full'>
<html lang="en" data-theme="dark" class="h-full">
<head>
<meta charset="utf-8" />
<title>PocketHost</title>
@ -19,7 +19,7 @@
%sveltekit.head%
</head>
<body class='h-full'>
<body class="h-full">
<div>%sveltekit.body%</div>
</body>
</html>

View File

@ -1,5 +1,5 @@
<script lang="ts">
import { InstanceStatus } from '$shared'
import { InstanceStatus } from '@pockethost/common'
import { onMount } from 'svelte'
export let status: InstanceStatus = InstanceStatus.Idle

View File

@ -1,6 +1,6 @@
<script lang="ts">
import { PLAN_NAMES, SubscriptionType } from '$shared'
import { isUserFounder, userSubscriptionType } from '$util/stores'
import { PLAN_NAMES, SubscriptionType } from '@pockethost/common'
isUserFounder

View File

@ -1,4 +1,4 @@
import { assertTruthy } from '$shared'
import { assertTruthy } from '@pockethost/common'
export const html = () => {
const htmlElement = document.querySelector('html')

View File

@ -1,12 +1,13 @@
<script lang="ts">
import { page } from '$app/stores'
import type { MouseEventHandler } from 'svelte/elements'
export let url: string = ''
export let icon: string = ''
export let brandIcon: boolean = false
export let iconSmall: boolean = false
export let external: boolean = false
export let handleClick: Function = () => {}
export let handleClick: MouseEventHandler<HTMLElement> = () => {}
let activeLink = $page.url.pathname === url
$: activeLink = $page.url.pathname.includes(url)

View File

@ -3,9 +3,9 @@
import FeatureName from '$components/tables/pricing-table/FeatureName.svelte'
import FeatureSupportBlock from '$components/tables/pricing-table/FeatureSupportBlock.svelte'
import MobileTable from '$components/tables/pricing-table/MobileTable.svelte'
import { PLAN_NAMES, SubscriptionType } from '$shared'
import { DISCORD_URL, DOCS_URL } from '$src/env'
import { userSubscriptionType, isUserFounder } from '$util/stores'
import { isUserFounder, userSubscriptionType } from '$util/stores'
import { PLAN_NAMES, SubscriptionType } from '@pockethost/common'
type ItemValue = '1' | 'Unlimited' | 'YesBlock' | 'NoBlock'

View File

@ -1,4 +1,4 @@
import { InstanceFields } from '$shared'
import { InstanceFields } from '@pockethost/common'
import { boolean } from 'boolean'
/**
@ -7,17 +7,17 @@ import { boolean } from 'boolean'
* will prevail.
*/
// The apex domain of this whole operation.
export const PUBLIC_APEX_DOMAIN =
import.meta.env.PUBLIC_APEX_DOMAIN || `pockethost.lvh.me`
// The domain name where this dashboard lives
export const PUBLIC_APP_URL =
import.meta.env.PUBLIC_APP_URL || 'https://app.pockethost.io'
// The apex domain of this whole operation. Also known as the "app" or "dashboard"
export const PUBLIC_APEX_DOMAIN =
import.meta.env.PUBLIC_APEX_DOMAIN || `pockethost.io`
import.meta.env.PUBLIC_APP_URL || `https://app.${PUBLIC_APEX_DOMAIN}`
// The domain name of the lander/marketing site
export const PUBLIC_BLOG_URL =
import.meta.env.PUBLIC_BLOG_URL || 'https://pockethost.io'
import.meta.env.PUBLIC_BLOG_URL || `https://${PUBLIC_APEX_DOMAIN}`
// The protocol to use, almost always will be https
export const PUBLIC_HTTP_PROTOCOL =
@ -26,7 +26,7 @@ export const PUBLIC_HTTP_PROTOCOL =
// The complete URL to the mothership
export const PUBLIC_MOTHERSHIP_URL =
import.meta.env.PUBLIC_MOTHERSHIP_URL ||
`https://pockethost-central.pockethost.io`
`https://pockethost-central.${PUBLIC_APEX_DOMAIN}`
// Whether we are in debugging mode - default TRUE
export const PUBLIC_DEBUG = boolean(import.meta.env.PUBLIC_DEBUG || 'true')

View File

@ -1,8 +1,15 @@
import { INSTANCE_URL } from '$src/env'
import { createGenericSyncEvent } from '$util/events'
import { fetchEventSource } from '@microsoft/fetch-event-source'
import {
AuthModel,
BaseAuthStore,
ClientResponseError,
CreateInstancePayloadSchema,
DeleteInstancePayload,
DeleteInstancePayloadSchema,
DeleteInstanceResult,
PocketBase,
RestCommands,
RestMethods,
UpdateInstancePayload,
@ -15,16 +22,8 @@ import {
type InstanceFields,
type InstanceId,
type InstanceLogFields,
} from '$shared'
import { INSTANCE_URL } from '$src/env'
import { createGenericSyncEvent } from '$util/events'
import { fetchEventSource } from '@microsoft/fetch-event-source'
} from '@pockethost/common'
import { keys, map } from '@s-libs/micro-dash'
import PocketBase, {
BaseAuthStore,
ClientResponseError,
type AuthModel,
} from 'pocketbase'
export type AuthToken = string
export type AuthStoreProps = {

View File

@ -1,7 +1,6 @@
<script lang="ts">
import AuthStateGuard from '$components/helpers/AuthStateGuard.svelte'
import PricingTable from '$components/tables/pricing-table/PricingTable.svelte'
import { PLAN_NAMES, SubscriptionType } from '$shared'
import { client } from '$src/pocketbase-client'
import FAQSection from '$src/routes/account/FAQSection.svelte'
import PricingCard from '$src/routes/account/PricingCard.svelte'
@ -11,6 +10,7 @@
userStore,
userSubscriptionType,
} from '$util/stores'
import { PLAN_NAMES, SubscriptionType } from '@pockethost/common'
import { onMount } from 'svelte'
import { writable } from 'svelte/store'

View File

Before

Width:  |  Height:  |  Size: 364 B

After

Width:  |  Height:  |  Size: 364 B

Some files were not shown because too many files have changed in this diff Show More