@camstack/addon-admin-ui 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/index-DjELGD4R.css +1 -0
- package/dist/assets/index-w55PwKyu.js +598 -0
- package/{index.html → dist/index.html} +3 -1
- package/dist/server/addon.d.ts +11 -0
- package/dist/server/addon.js +50 -0
- package/dist/server/addon.js.map +1 -0
- package/package.json +5 -1
- package/src/App.tsx +0 -71
- package/src/components/addons/AddonCard.tsx +0 -339
- package/src/components/addons/AddonUploadZone.tsx +0 -307
- package/src/components/addons/CapabilityBadge.tsx +0 -55
- package/src/components/addons/CapabilityMap.tsx +0 -133
- package/src/components/addons/UpdatesList.tsx +0 -119
- package/src/components/agents/AgentCard.tsx +0 -281
- package/src/components/agents/AgentLogs.tsx +0 -231
- package/src/components/agents/ProcessList.tsx +0 -127
- package/src/components/agents/ProcessTree.tsx +0 -369
- package/src/components/agents/TaskList.tsx +0 -68
- package/src/components/cameras/CameraCard.tsx +0 -60
- package/src/components/cameras/LiveEventsPanel.tsx +0 -91
- package/src/components/cameras/ProviderSection.tsx +0 -50
- package/src/components/cameras/StreamArea.tsx +0 -107
- package/src/components/cameras/tabs/AddonsTab.tsx +0 -113
- package/src/components/cameras/tabs/CameraEventsTab.tsx +0 -129
- package/src/components/cameras/tabs/PipelineTab.tsx +0 -118
- package/src/components/cameras/tabs/StreamsTab.tsx +0 -114
- package/src/components/dashboard/BlockPicker.tsx +0 -54
- package/src/components/dashboard/BlockWrapper.tsx +0 -97
- package/src/components/dashboard/DashboardGrid.tsx +0 -160
- package/src/components/dashboard/block-registry.ts +0 -15
- package/src/components/dashboard/blocks/PipelineStagesBlock.tsx +0 -39
- package/src/components/dashboard/blocks/StorageBlock.tsx +0 -66
- package/src/components/dashboard/blocks/SystemStatusBlock.tsx +0 -67
- package/src/components/dashboard/blocks/index.ts +0 -32
- package/src/components/device/DeviceHeader.tsx +0 -116
- package/src/components/device/FloatingPanel.tsx +0 -132
- package/src/components/device/FloatingPanelManager.tsx +0 -167
- package/src/components/device/PanelContent.tsx +0 -196
- package/src/components/device/QuickConfigWizard.tsx +0 -507
- package/src/components/device/tabs/DetectionConfigTab.tsx +0 -96
- package/src/components/device/tabs/EventsTab.tsx +0 -19
- package/src/components/device/tabs/LogsTab.tsx +0 -22
- package/src/components/device/tabs/OverviewTab.tsx +0 -104
- package/src/components/device/tabs/ProviderSettingsTab.tsx +0 -34
- package/src/components/device/tabs/RecordingTab.tsx +0 -47
- package/src/components/device/tabs/ReplTab.tsx +0 -153
- package/src/components/device/tabs/TrackTrailTab.tsx +0 -49
- package/src/components/device/tabs/ZonesTab.tsx +0 -98
- package/src/components/device/zone-editor/ZoneCanvas.tsx +0 -354
- package/src/components/device/zone-editor/ZoneForm.tsx +0 -128
- package/src/components/device/zone-editor/ZoneList.tsx +0 -150
- package/src/components/form-builder/FormBuilder.tsx +0 -135
- package/src/components/form-builder/FormField.tsx +0 -732
- package/src/components/form-builder/ModelSelector.tsx +0 -239
- package/src/components/integrations/AddDeviceDialog.tsx +0 -205
- package/src/components/integrations/CompactDeviceCard.tsx +0 -35
- package/src/components/integrations/DeviceCard.tsx +0 -29
- package/src/components/integrations/DeviceDiscoveryStep.tsx +0 -105
- package/src/components/integrations/DeviceGrid.tsx +0 -79
- package/src/components/integrations/DeviceGroupHeader.tsx +0 -17
- package/src/components/integrations/DiscoveredDeviceCard.tsx +0 -26
- package/src/components/integrations/IntegrationCard.tsx +0 -40
- package/src/components/integrations/IntegrationWizard.tsx +0 -171
- package/src/components/integrations/ProviderConfigForm.tsx +0 -89
- package/src/components/integrations/ProviderPicker.tsx +0 -91
- package/src/components/integrations/SnapshotPopover.tsx +0 -68
- package/src/components/metrics/AgentLoad.tsx +0 -113
- package/src/components/metrics/IntegrationUsage.tsx +0 -90
- package/src/components/metrics/PipelineStatus.tsx +0 -105
- package/src/components/metrics/ProcessResources.tsx +0 -139
- package/src/components/pipeline/PhaseSettings.tsx +0 -131
- package/src/components/shared/CapabilityBadges.tsx +0 -30
- package/src/components/shared/ProviderIcon.tsx +0 -42
- package/src/components/shared/StatusBadge.tsx +0 -23
- package/src/components/shared/WebRtcPlayer.tsx +0 -211
- package/src/components/timeline/EventMarker.tsx +0 -32
- package/src/components/timeline/TimelineBar.tsx +0 -131
- package/src/components/ui/ConfirmDialog.tsx +0 -115
- package/src/components/ui/ToastContainer.tsx +0 -92
- package/src/contexts/auth-context.tsx +0 -91
- package/src/hooks/useBackendClient.ts +0 -6
- package/src/hooks/useTheme.ts +0 -1
- package/src/i18n/en.json +0 -164
- package/src/i18n/index.ts +0 -29
- package/src/i18n/it.json +0 -164
- package/src/index.css +0 -63
- package/src/layouts/AddonPageLoader.tsx +0 -120
- package/src/layouts/AppLayout.tsx +0 -238
- package/src/layouts/ProtectedRoute.tsx +0 -25
- package/src/lib/addon-page-context.ts +0 -29
- package/src/lib/backend.ts +0 -16
- package/src/main.tsx +0 -21
- package/src/pages/AccessDenied.tsx +0 -22
- package/src/pages/Cameras.tsx +0 -127
- package/src/pages/Dashboard.tsx +0 -6
- package/src/pages/DeviceDetail.tsx +0 -175
- package/src/pages/IntegrationDetail.tsx +0 -224
- package/src/pages/Integrations.tsx +0 -330
- package/src/pages/Login.tsx +0 -106
- package/src/pages/Metrics.tsx +0 -18
- package/src/pages/PipelineConfig.tsx +0 -282
- package/src/pages/Showroom.tsx +0 -351
- package/src/pages/Timeline.tsx +0 -269
- package/src/pages/system/Addons.tsx +0 -525
- package/src/pages/system/Agents.tsx +0 -362
- package/src/pages/system/Logs.tsx +0 -131
- package/src/pages/system/Models.tsx +0 -102
- package/src/pages/system/Processes.tsx +0 -129
- package/src/pages/system/Repl.tsx +0 -148
- package/src/pages/system/Settings.tsx +0 -168
- package/src/pages/system/Users.tsx +0 -174
- package/src/server/addon.ts +0 -54
- package/src/types/config-ui.ts +0 -210
- package/src/types/dashboard.ts +0 -39
- package/tsconfig.json +0 -29
- package/tsconfig.server.json +0 -16
- package/tsup.config.ts +0 -20
- package/vite.config.ts +0 -68
- /package/{public → dist}/brand/logo-dark.svg +0 -0
- /package/{public → dist}/brand/logo-horizontal-dark.svg +0 -0
- /package/{public → dist}/brand/logo-horizontal-light.svg +0 -0
- /package/{public → dist}/brand/logo-light.svg +0 -0
- /package/{public → dist}/brand/logo-wide-dark.svg +0 -0
- /package/{public → dist}/brand/logo-wide-light.svg +0 -0
- /package/{public → dist}/favicon.svg +0 -0
- /package/{public → dist}/vendor/react-jsx-runtime.mjs +0 -0
- /package/{public → dist}/vendor/react.mjs +0 -0
package/src/types/config-ui.ts
DELETED
|
@@ -1,210 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Configuration UI Schema — declarative form definition for any element.
|
|
3
|
-
*
|
|
4
|
-
* Copied from backend/src/interfaces/config-ui.ts (types only, no runtime code).
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
// --- Schema Definition ---
|
|
8
|
-
|
|
9
|
-
export interface ConfigUISchema {
|
|
10
|
-
sections: ConfigSection[]
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface ConfigSection {
|
|
14
|
-
id: string
|
|
15
|
-
title: string
|
|
16
|
-
description?: string
|
|
17
|
-
style?: 'card' | 'accordion' // default: 'card'
|
|
18
|
-
defaultCollapsed?: boolean // for accordion, default: false
|
|
19
|
-
columns?: 1 | 2 | 3 | 4 // responsive grid columns, default: 2
|
|
20
|
-
fields: ConfigField[]
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// --- Field Types ---
|
|
24
|
-
|
|
25
|
-
export type ConfigField =
|
|
26
|
-
| ConfigTextField
|
|
27
|
-
| ConfigNumberField
|
|
28
|
-
| ConfigBooleanField
|
|
29
|
-
| ConfigSelectField
|
|
30
|
-
| ConfigMultiSelectField
|
|
31
|
-
| ConfigColorField
|
|
32
|
-
| ConfigPasswordField
|
|
33
|
-
| ConfigTextAreaField
|
|
34
|
-
| ConfigSliderField
|
|
35
|
-
| ConfigTagsField
|
|
36
|
-
| ConfigGroupField
|
|
37
|
-
| ConfigSeparatorField
|
|
38
|
-
| ConfigInfoField
|
|
39
|
-
| ConfigModelSelectorField
|
|
40
|
-
|
|
41
|
-
export interface ConfigFieldBase {
|
|
42
|
-
key: string // maps to config path: 'mqtt.brokerUrl'
|
|
43
|
-
label: string
|
|
44
|
-
description?: string
|
|
45
|
-
required?: boolean
|
|
46
|
-
disabled?: boolean
|
|
47
|
-
placeholder?: string
|
|
48
|
-
span?: 1 | 2 | 3 | 4 // grid column span, default: 1
|
|
49
|
-
showWhen?: ConfigCondition // conditional visibility
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export interface ConfigCondition {
|
|
53
|
-
field: string // another field's key
|
|
54
|
-
equals?: unknown
|
|
55
|
-
notEquals?: unknown
|
|
56
|
-
in?: unknown[]
|
|
57
|
-
notIn?: unknown[]
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export interface ConfigTextField extends ConfigFieldBase {
|
|
61
|
-
type: 'text'
|
|
62
|
-
maxLength?: number
|
|
63
|
-
pattern?: string // regex validation
|
|
64
|
-
inputType?: 'text' | 'url' | 'email'
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export interface ConfigNumberField extends ConfigFieldBase {
|
|
68
|
-
type: 'number'
|
|
69
|
-
min?: number
|
|
70
|
-
max?: number
|
|
71
|
-
step?: number
|
|
72
|
-
unit?: string // display suffix: 'ms', '%', 'px', 's'
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export interface ConfigBooleanField extends ConfigFieldBase {
|
|
76
|
-
type: 'boolean'
|
|
77
|
-
style?: 'switch' | 'checkbox' // default: switch
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export interface ConfigSelectField extends ConfigFieldBase {
|
|
81
|
-
type: 'select'
|
|
82
|
-
options: ConfigOption[]
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export interface ConfigMultiSelectField extends ConfigFieldBase {
|
|
86
|
-
type: 'multiselect'
|
|
87
|
-
options: ConfigOption[]
|
|
88
|
-
maxItems?: number
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export interface ConfigColorField extends ConfigFieldBase {
|
|
92
|
-
type: 'color'
|
|
93
|
-
presets?: string[]
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
export interface ConfigPasswordField extends ConfigFieldBase {
|
|
97
|
-
type: 'password'
|
|
98
|
-
showToggle?: boolean // show/hide toggle, default: true
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export interface ConfigTextAreaField extends ConfigFieldBase {
|
|
102
|
-
type: 'textarea'
|
|
103
|
-
rows?: number
|
|
104
|
-
maxLength?: number
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export interface ConfigSliderField extends ConfigFieldBase {
|
|
108
|
-
type: 'slider'
|
|
109
|
-
min: number
|
|
110
|
-
max: number
|
|
111
|
-
step?: number
|
|
112
|
-
showValue?: boolean // default: true
|
|
113
|
-
unit?: string
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
export interface ConfigTagsField extends ConfigFieldBase {
|
|
117
|
-
type: 'tags'
|
|
118
|
-
suggestions?: string[] // autocomplete suggestions
|
|
119
|
-
maxTags?: number
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
export interface ConfigGroupField extends ConfigFieldBase {
|
|
123
|
-
type: 'group'
|
|
124
|
-
fields: ConfigField[]
|
|
125
|
-
style?: 'card' | 'inline' | 'accordion'
|
|
126
|
-
defaultCollapsed?: boolean
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/** Visual separator between fields */
|
|
130
|
-
export interface ConfigSeparatorField {
|
|
131
|
-
type: 'separator'
|
|
132
|
-
key: string
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
/** Read-only informational text */
|
|
136
|
-
export interface ConfigInfoField {
|
|
137
|
-
type: 'info'
|
|
138
|
-
key: string
|
|
139
|
-
label: string
|
|
140
|
-
content: string // markdown or plain text
|
|
141
|
-
variant?: 'info' | 'warning' | 'success' | 'danger'
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
export interface ConfigOption {
|
|
145
|
-
value: string
|
|
146
|
-
label: string
|
|
147
|
-
description?: string
|
|
148
|
-
icon?: string
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
// --- Model Selector Field ---
|
|
152
|
-
|
|
153
|
-
/** Lightweight model format entry sent inside catalog entries */
|
|
154
|
-
export interface ModelFormatEntry {
|
|
155
|
-
readonly url: string
|
|
156
|
-
readonly sizeMB: number
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
/** Label definition sent inside catalog entries */
|
|
160
|
-
export interface LabelDefinition {
|
|
161
|
-
readonly id: string
|
|
162
|
-
readonly name: string
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
export type ModelFormat = 'onnx' | 'coreml' | 'openvino' | 'tflite' | 'pt'
|
|
166
|
-
export type ModelOutputFormat = 'yolo' | 'ssd' | 'embedding' | 'classification' | 'ocr'
|
|
167
|
-
|
|
168
|
-
/** A single model entry from the addon's catalog */
|
|
169
|
-
export interface ModelCatalogEntry {
|
|
170
|
-
readonly id: string
|
|
171
|
-
readonly name: string
|
|
172
|
-
readonly description: string
|
|
173
|
-
readonly formats: Partial<Readonly<Record<ModelFormat, ModelFormatEntry>>>
|
|
174
|
-
readonly inputSize: { readonly width: number; readonly height: number }
|
|
175
|
-
readonly labels: readonly LabelDefinition[]
|
|
176
|
-
readonly inputLayout?: 'nchw' | 'nhwc'
|
|
177
|
-
readonly inputNormalization?: 'zero-one' | 'imagenet' | 'none'
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* Specialized field for selecting ML models.
|
|
182
|
-
* Renders a catalog selector with optional custom path input.
|
|
183
|
-
*/
|
|
184
|
-
export interface ConfigModelSelectorField extends ConfigFieldBase {
|
|
185
|
-
type: 'model-selector'
|
|
186
|
-
/** Filter models by type (detection, face-detection, embedding, plate-detection, ocr, audio-classification) */
|
|
187
|
-
modelType?: string
|
|
188
|
-
/** Allow user to enter a custom local path or URL (default: true) */
|
|
189
|
-
allowCustomPath?: boolean
|
|
190
|
-
/** Allow file upload via UI (default: true) */
|
|
191
|
-
allowUpload?: boolean
|
|
192
|
-
/** Accepted file extensions for upload (default: ['.onnx']) */
|
|
193
|
-
acceptExtensions?: string[]
|
|
194
|
-
/** URL to model conversion documentation/guide */
|
|
195
|
-
conversionGuideUrl?: string
|
|
196
|
-
/** Brief text explaining what models are compatible */
|
|
197
|
-
compatibilityNote?: string
|
|
198
|
-
/** Inline catalog entries from the addon */
|
|
199
|
-
catalog?: readonly ModelCatalogEntry[]
|
|
200
|
-
/** Whether to allow custom model import (default: false) */
|
|
201
|
-
allowCustom?: boolean
|
|
202
|
-
/** Whether model format conversion is available */
|
|
203
|
-
allowConversion?: boolean
|
|
204
|
-
/** Accepted model formats */
|
|
205
|
-
acceptFormats?: readonly ModelFormat[]
|
|
206
|
-
/** Required metadata keys for custom models */
|
|
207
|
-
requiredMetadata?: readonly string[]
|
|
208
|
-
/** Hint about the expected output format */
|
|
209
|
-
outputFormatHint?: ModelOutputFormat
|
|
210
|
-
}
|
package/src/types/dashboard.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { LucideIcon } from 'lucide-react'
|
|
2
|
-
import type { ComponentType } from 'react'
|
|
3
|
-
|
|
4
|
-
export interface BlockProps {
|
|
5
|
-
config: Record<string, unknown>
|
|
6
|
-
size: { w: number; h: number }
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export interface BlockConfigField {
|
|
10
|
-
key: string
|
|
11
|
-
label: string
|
|
12
|
-
type: 'text' | 'number' | 'select' | 'boolean'
|
|
13
|
-
options?: { label: string; value: string }[]
|
|
14
|
-
defaultValue?: unknown
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface DashboardBlock {
|
|
18
|
-
id: string
|
|
19
|
-
name: string
|
|
20
|
-
icon: LucideIcon
|
|
21
|
-
defaultSize: { w: number; h: number }
|
|
22
|
-
minSize?: { w: number; h: number }
|
|
23
|
-
component: ComponentType<BlockProps>
|
|
24
|
-
configSchema?: BlockConfigField[]
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface DashboardLayoutItem {
|
|
28
|
-
i: string // block instance id (e.g., 'system-status-1')
|
|
29
|
-
blockId: string // registry block id (e.g., 'system-status')
|
|
30
|
-
x: number
|
|
31
|
-
y: number
|
|
32
|
-
w: number
|
|
33
|
-
h: number
|
|
34
|
-
config: Record<string, unknown>
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export interface DashboardState {
|
|
38
|
-
items: DashboardLayoutItem[]
|
|
39
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2022",
|
|
4
|
-
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
5
|
-
"module": "ESNext",
|
|
6
|
-
"moduleResolution": "bundler",
|
|
7
|
-
"jsx": "react-jsx",
|
|
8
|
-
"strict": true,
|
|
9
|
-
"esModuleInterop": true,
|
|
10
|
-
"skipLibCheck": true,
|
|
11
|
-
"forceConsistentCasingInFileNames": true,
|
|
12
|
-
"resolveJsonModule": true,
|
|
13
|
-
"isolatedModules": true,
|
|
14
|
-
"noEmit": true,
|
|
15
|
-
"experimentalDecorators": true,
|
|
16
|
-
"emitDecoratorMetadata": true,
|
|
17
|
-
"noUncheckedIndexedAccess": false,
|
|
18
|
-
"paths": {
|
|
19
|
-
"@camstack/sdk": ["../sdk/src/index.ts"],
|
|
20
|
-
"@camstack/sdk/*": ["../sdk/src/*"],
|
|
21
|
-
"@camstack/ui": ["../ui-library/src/index.ts"],
|
|
22
|
-
"@camstack/ui/*": ["../ui-library/src/*"],
|
|
23
|
-
"@camstack/ui-library": ["../ui-library/src/index.ts"],
|
|
24
|
-
"@camstack/ui-library/*": ["../ui-library/src/*"]
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
"include": ["src"],
|
|
28
|
-
"exclude": ["src/server"]
|
|
29
|
-
}
|
package/tsconfig.server.json
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2022",
|
|
4
|
-
"lib": ["ES2022"],
|
|
5
|
-
"module": "ESNext",
|
|
6
|
-
"moduleResolution": "bundler",
|
|
7
|
-
"strict": true,
|
|
8
|
-
"esModuleInterop": true,
|
|
9
|
-
"skipLibCheck": true,
|
|
10
|
-
"forceConsistentCasingInFileNames": true,
|
|
11
|
-
"resolveJsonModule": true,
|
|
12
|
-
"isolatedModules": true,
|
|
13
|
-
"noEmit": true
|
|
14
|
-
},
|
|
15
|
-
"include": ["src/server"]
|
|
16
|
-
}
|
package/tsup.config.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from 'tsup'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Builds only the server-side addon entry point.
|
|
5
|
-
* The Vite React app is built separately via `vite build`.
|
|
6
|
-
*/
|
|
7
|
-
export default defineConfig({
|
|
8
|
-
entry: ['src/server/addon.ts'],
|
|
9
|
-
format: ['esm'],
|
|
10
|
-
target: 'es2022',
|
|
11
|
-
outDir: 'dist/server',
|
|
12
|
-
clean: false, // Don't clean — Vite output lives in dist/ too
|
|
13
|
-
sourcemap: true,
|
|
14
|
-
dts: {
|
|
15
|
-
compilerOptions: {
|
|
16
|
-
paths: {},
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
splitting: false,
|
|
20
|
-
})
|
package/vite.config.ts
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from 'vite'
|
|
2
|
-
import react from '@vitejs/plugin-react'
|
|
3
|
-
import tailwindcss from '@tailwindcss/vite'
|
|
4
|
-
import path from 'path'
|
|
5
|
-
import fs from 'fs'
|
|
6
|
-
import { execSync } from 'child_process'
|
|
7
|
-
|
|
8
|
-
// Ensure self-signed cert exists — generate if missing (race condition with server boot)
|
|
9
|
-
const tlsDir = path.resolve(__dirname, '../../server/backend/camstack-data/tls')
|
|
10
|
-
const certPath = path.join(tlsDir, 'camstack.crt')
|
|
11
|
-
const keyPath = path.join(tlsDir, 'camstack.key')
|
|
12
|
-
|
|
13
|
-
if (!fs.existsSync(certPath) || !fs.existsSync(keyPath)) {
|
|
14
|
-
fs.mkdirSync(tlsDir, { recursive: true })
|
|
15
|
-
try {
|
|
16
|
-
execSync(
|
|
17
|
-
`openssl req -x509 -newkey rsa:2048 -keyout "${keyPath}" -out "${certPath}" ` +
|
|
18
|
-
`-days 825 -nodes -subj "/CN=camstack.local" ` +
|
|
19
|
-
`-addext "subjectAltName=DNS:localhost,IP:127.0.0.1"`,
|
|
20
|
-
{ stdio: 'pipe', timeout: 10000 },
|
|
21
|
-
)
|
|
22
|
-
console.log('[vite] Generated self-signed TLS cert at', certPath)
|
|
23
|
-
} catch (e) {
|
|
24
|
-
console.warn('[vite] Failed to generate TLS cert — falling back to HTTP', e)
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const httpsConfig = fs.existsSync(certPath)
|
|
29
|
-
? {
|
|
30
|
-
key: fs.readFileSync(keyPath),
|
|
31
|
-
cert: fs.readFileSync(certPath),
|
|
32
|
-
}
|
|
33
|
-
: undefined
|
|
34
|
-
|
|
35
|
-
export default defineConfig({
|
|
36
|
-
plugins: [react(), tailwindcss()],
|
|
37
|
-
resolve: {
|
|
38
|
-
alias: {
|
|
39
|
-
'@camstack/sdk': path.resolve(__dirname, '../sdk/src/index.ts'),
|
|
40
|
-
'@camstack/ui': path.resolve(__dirname, '../ui-library/src/index.ts'),
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
server: {
|
|
44
|
-
port: 3001,
|
|
45
|
-
https: httpsConfig,
|
|
46
|
-
proxy: {
|
|
47
|
-
'/trpc': {
|
|
48
|
-
target: 'https://localhost:4443',
|
|
49
|
-
changeOrigin: true,
|
|
50
|
-
secure: false,
|
|
51
|
-
ws: true,
|
|
52
|
-
},
|
|
53
|
-
'/api': {
|
|
54
|
-
target: 'https://localhost:4443',
|
|
55
|
-
changeOrigin: true,
|
|
56
|
-
secure: false,
|
|
57
|
-
},
|
|
58
|
-
'/addon': {
|
|
59
|
-
target: 'https://localhost:4443',
|
|
60
|
-
changeOrigin: true,
|
|
61
|
-
secure: false,
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
build: {
|
|
66
|
-
outDir: 'dist',
|
|
67
|
-
},
|
|
68
|
-
})
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|