Add 'dc3-web/' from commit '0c3c7a157c3f003d5d8a8077c3e3850069d19747'
git-subtree-dir: dc3-web git-subtree-mainline:e133f5a027git-subtree-split:0c3c7a157c
@@ -0,0 +1,5 @@
|
||||
# Standard browserslist configuration
|
||||
# Supports: > 0.5%, last 2 versions, not dead, not IE 11
|
||||
defaults
|
||||
not ie 11
|
||||
not op_mini all
|
||||
@@ -0,0 +1,7 @@
|
||||
# CLAUDE.md
|
||||
|
||||
This file provides guidance to AI coding assistants when working with code in this repository.
|
||||
|
||||
The canonical project instructions live in `../AGENTS.md`. Read and follow it — it covers project architecture,
|
||||
common commands, validation, commit/changelog, and all coding conventions. That single file is shared across
|
||||
AI coding tools (various AI assistants) so everything stays in sync.
|
||||
@@ -0,0 +1,18 @@
|
||||
**/.git
|
||||
**/.idea
|
||||
**/*.iml
|
||||
**/Dockerfile
|
||||
|
||||
node_modules
|
||||
/dist
|
||||
|
||||
**/.vs
|
||||
**/.vscode
|
||||
|
||||
**/.settings
|
||||
**/.project
|
||||
|
||||
**/*.iws
|
||||
**/*.ipr
|
||||
**/*.md
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[Makefile]
|
||||
indent_style = tab
|
||||
@@ -0,0 +1,15 @@
|
||||
# Makefile / Docker Compose defaults for the web project.
|
||||
# Copy to .env only when local overrides are needed.
|
||||
|
||||
REGISTRY=auto
|
||||
DC3_WEB_IMAGE=pnoker/dc3-web
|
||||
DC3_WEB_VERSION=latest
|
||||
DC3_BIND_HOST=127.0.0.1
|
||||
DC3_WEB_HTTP_PORT=8080
|
||||
DC3_WEB_HTTPS_PORT=8443
|
||||
|
||||
APP_API_HOST=dc3-gateway
|
||||
APP_API_PORT=8000
|
||||
|
||||
DC3_LOG_MAX_SIZE=20m
|
||||
DC3_LOG_MAX_FILE=20
|
||||
@@ -0,0 +1,18 @@
|
||||
* text=auto eol=lf
|
||||
|
||||
*.bat text eol=crlf
|
||||
*.cmd text eol=crlf
|
||||
*.ps1 text eol=crlf
|
||||
|
||||
*.png binary
|
||||
*.jpg binary
|
||||
*.jpeg binary
|
||||
*.gif binary
|
||||
*.webp binary
|
||||
*.ico binary
|
||||
*.icns binary
|
||||
*.woff binary
|
||||
*.woff2 binary
|
||||
*.ttf binary
|
||||
*.eot binary
|
||||
*.otf binary
|
||||
@@ -0,0 +1,25 @@
|
||||
---
|
||||
name: Bug Report
|
||||
about: 报告一个缺陷
|
||||
labels: ["bug"]
|
||||
---
|
||||
|
||||
## 环境
|
||||
|
||||
- 前端版本(git tag / Docker 镜像 tag):
|
||||
- 后端版本:
|
||||
- 浏览器 / 系统:
|
||||
- 部署方式(Docker / 源码 / 其他):
|
||||
|
||||
## 复现步骤
|
||||
|
||||
1.
|
||||
|
||||
## 预期 / 实际
|
||||
|
||||
- 预期:
|
||||
- 实际:
|
||||
|
||||
## 日志 / 截图
|
||||
|
||||
(贴出控制台报错或截图。)
|
||||
@@ -0,0 +1,5 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: 讨论 / 提问
|
||||
url: https://github.com/pnoker/iot-dc3-web/discussions
|
||||
about: 使用问题与想法请到 Discussions
|
||||
@@ -0,0 +1,17 @@
|
||||
---
|
||||
name: Feature Request
|
||||
about: 提一个功能建议
|
||||
labels: ["enhancement"]
|
||||
---
|
||||
|
||||
## 场景
|
||||
|
||||
(你想解决什么问题。)
|
||||
|
||||
## 期望
|
||||
|
||||
(你希望前端怎么做。)
|
||||
|
||||
## 替代方案
|
||||
|
||||
(你考虑过的其他做法。)
|
||||
@@ -0,0 +1,22 @@
|
||||
## What & Why
|
||||
|
||||
(这次改动做什么、为什么。1–3 句。)
|
||||
|
||||
## Changes
|
||||
|
||||
- (逐条列关键改动,可追溯到需求 / issue。)
|
||||
|
||||
## Verification
|
||||
|
||||
- [ ] `pnpm run test:impact` 已按推荐检查执行
|
||||
- [ ] 大范围改动通过 `pnpm run test:ci` 覆盖门槛
|
||||
- [ ] API wrapper 改动已更新 `tests/api`
|
||||
- [ ] utility / store / composable / Axios 改动已更新 `tests/unit`
|
||||
- [ ] 可复用组件改动已更新 `tests/component`
|
||||
- [ ] 路由 / 菜单 / 权限 / 页面流程改动已更新 Playwright E2E
|
||||
- [ ] E2E 数据动态创建并清理,无固定业务 ID
|
||||
- [ ] `pnpm lint-check && pnpm check && pnpm build` 通过
|
||||
|
||||
## Impact
|
||||
|
||||
- (影响的模块、是否有 breaking change、是否需要 changelog)
|
||||
@@ -0,0 +1,94 @@
|
||||
name: Web CI
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- develop
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
e2e_base_url:
|
||||
description: 'Optional running web environment URL for Playwright e2e'
|
||||
required: false
|
||||
default: ''
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: web-ci-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
quality:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
|
||||
- name: Set Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
cache: pnpm
|
||||
|
||||
- name: Install
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Lint
|
||||
run: pnpm run lint:check
|
||||
|
||||
- name: Type Check
|
||||
run: pnpm run check
|
||||
|
||||
- name: Guardrails
|
||||
run: pnpm run test:guard
|
||||
|
||||
- name: Test With Coverage
|
||||
run: pnpm run test:ci
|
||||
|
||||
- name: Build
|
||||
run: pnpm build
|
||||
|
||||
e2e:
|
||||
if: ${{ github.event_name == 'workflow_dispatch' && inputs.e2e_base_url != '' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
|
||||
- name: Set Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
cache: pnpm
|
||||
|
||||
- name: Install
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Install Playwright
|
||||
run: pnpm exec playwright install --with-deps chromium
|
||||
|
||||
- name: E2E
|
||||
run: pnpm run test:e2e
|
||||
env:
|
||||
E2E_BASE_URL: ${{ inputs.e2e_base_url }}
|
||||
E2E_START_SERVER: '0'
|
||||
|
||||
- name: Upload Playwright Report
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: playwright-report
|
||||
path: |
|
||||
playwright-report
|
||||
test-results/e2e-results.json
|
||||
test-results/e2e-artifacts
|
||||
if-no-files-found: ignore
|
||||
@@ -0,0 +1,62 @@
|
||||
name: Docker Image
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: docker-image-${{ github.ref }}
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
build-push:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Set Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login DockerHub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ vars.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Login Aliyun Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: registry.cn-beijing.aliyuncs.com
|
||||
username: ${{ vars.ALIYUN_DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.ALIYUN_DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Docker metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: |
|
||||
pnoker/dc3-web
|
||||
registry.cn-beijing.aliyuncs.com/dc3/dc3-web
|
||||
tags: |
|
||||
type=match,pattern=dc3\.release\.(.*),group=1
|
||||
type=raw,value=latest
|
||||
|
||||
- name: Build and Push
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
file: Dockerfile
|
||||
push: true
|
||||
platforms: linux/arm64,linux/amd64
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
@@ -0,0 +1,151 @@
|
||||
# System files
|
||||
.DS_Store
|
||||
.DS_Store?
|
||||
._*
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
ehthumbs.db
|
||||
Thumbs.db
|
||||
|
||||
# Dependencies
|
||||
node_modules/
|
||||
.pnp/
|
||||
.yarn/
|
||||
.yarn-integrity/
|
||||
|
||||
# Build outputs
|
||||
dist/
|
||||
dist-ssr/
|
||||
*.local
|
||||
out/
|
||||
|
||||
# Testing
|
||||
coverage/
|
||||
.nyc_output/
|
||||
|
||||
# Local env files
|
||||
.env
|
||||
.env.local
|
||||
.env.*.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
# Log files
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
*.log
|
||||
|
||||
# Editor directories and files
|
||||
.idea/
|
||||
.vscode/
|
||||
*.swp
|
||||
*.swo
|
||||
*~
|
||||
.project
|
||||
.classpath
|
||||
.settings/
|
||||
.loadpath
|
||||
.factorypath
|
||||
*.sublime-workspace
|
||||
*.sublime-project
|
||||
|
||||
# OS files
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
# IDE
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
.idea/
|
||||
|
||||
# TypeScript
|
||||
*.tsbuildinfo
|
||||
|
||||
# Vue/Vite specific
|
||||
.vite/
|
||||
.temp/
|
||||
.cache/
|
||||
|
||||
# Auto-generated files
|
||||
components.d.ts
|
||||
auto-imports.d.ts
|
||||
*.d.ts.map
|
||||
|
||||
# Package manager lock files (keep pnpm-lock.yaml, ignore others)
|
||||
package-lock.json
|
||||
yarn.lock
|
||||
|
||||
# Claude Code local settings (per-developer, should not be committed)
|
||||
.claude/settings.local.json
|
||||
|
||||
# History
|
||||
.history/
|
||||
.cache/
|
||||
|
||||
# Temporary files
|
||||
tmp/
|
||||
temp/
|
||||
*.tmp
|
||||
*.temp
|
||||
|
||||
# Build artifacts
|
||||
*.tgz
|
||||
*.tar.gz
|
||||
|
||||
# Docker
|
||||
.docker/
|
||||
|
||||
# SSL/Certificates (if not committed)
|
||||
*.pem
|
||||
*.key
|
||||
*.crt
|
||||
*.csr
|
||||
|
||||
# Database
|
||||
*.db
|
||||
*.sqlite
|
||||
*.sqlite3
|
||||
|
||||
# Backup files
|
||||
*.bak
|
||||
*.backup
|
||||
*~
|
||||
|
||||
# OS generated files
|
||||
.DS_Store
|
||||
.DS_Store?
|
||||
._*
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
ehthumbs.db
|
||||
Thumbs.db
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
# Yarn
|
||||
yarn-error.log
|
||||
yarn-debug.log
|
||||
.yarn-integrity
|
||||
|
||||
# Tauri
|
||||
src-tauri/target/
|
||||
src-tauri/Cargo.lock
|
||||
|
||||
# Playwright
|
||||
playwright-report/
|
||||
test-results/
|
||||
@@ -0,0 +1 @@
|
||||
pnpm exec lint-staged
|
||||
@@ -0,0 +1,2 @@
|
||||
auto-install-peers=true
|
||||
strict-peer-dependencies=false
|
||||
@@ -0,0 +1,68 @@
|
||||
# Dependencies
|
||||
node_modules
|
||||
express/node_modules
|
||||
|
||||
# Build output
|
||||
dist
|
||||
|
||||
# Docker and deployment
|
||||
dc3
|
||||
|
||||
# Native code
|
||||
src-tauri
|
||||
|
||||
# Static assets
|
||||
public
|
||||
*.min.js
|
||||
*.min.css
|
||||
*.svg
|
||||
*.png
|
||||
*.jpg
|
||||
*.jpeg
|
||||
*.gif
|
||||
*.ico
|
||||
*.webp
|
||||
*.woff
|
||||
*.woff2
|
||||
*.ttf
|
||||
*.eot
|
||||
*.otf
|
||||
|
||||
# Lock files
|
||||
yarn.lock
|
||||
pnpm-lock.yaml
|
||||
package-lock.json
|
||||
|
||||
# Environment files
|
||||
.env
|
||||
.env.local
|
||||
.env.*.local
|
||||
|
||||
# Log files
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
|
||||
# Editor directories and files
|
||||
.claude
|
||||
.idea
|
||||
.vscode
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
.history
|
||||
|
||||
# GitHub
|
||||
.github
|
||||
.husky
|
||||
|
||||
# Auto-generated files
|
||||
components.d.ts
|
||||
auto-imports.d.ts
|
||||
|
||||
# Other
|
||||
.DS_Store
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright 2016-present the IoT DC3 original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export default {
|
||||
tabWidth: 2,
|
||||
printWidth: 120,
|
||||
semi: true,
|
||||
singleQuote: true,
|
||||
endOfLine: 'auto',
|
||||
trailingComma: 'es5',
|
||||
bracketSpacing: true,
|
||||
arrowParens: 'always',
|
||||
vueIndentScriptAndStyle: true,
|
||||
htmlWhitespaceSensitivity: 'css',
|
||||
embeddedLanguageFormatting: 'auto',
|
||||
proseWrap: 'preserve',
|
||||
};
|
||||
@@ -0,0 +1,246 @@
|
||||
# IoT DC3 Web
|
||||
|
||||
Frontend for the IoT DC3 IoT platform (Vue 3 + Vite + Element Plus + Tauri).
|
||||
|
||||
## Quick Reference
|
||||
|
||||
```bash
|
||||
pnpm install # install deps (pnpm only — no npm/yarn)
|
||||
pnpm dev # Vite dev server on port 8080
|
||||
pnpm build # production build → dist/
|
||||
pnpm check # vue-tsc type check
|
||||
pnpm lint # eslint --fix + prettier --write
|
||||
pnpm lint:check # eslint + prettier check only (no writes)
|
||||
|
||||
# Testing — Vitest
|
||||
pnpm test # vitest run (all suites)
|
||||
pnpm test:unit # vitest run tests/unit
|
||||
pnpm test:api # vitest run tests/api
|
||||
pnpm test:component # vitest run tests/component
|
||||
pnpm test:views # vitest run tests/views
|
||||
pnpm test:ci # vitest run --coverage (CI gate)
|
||||
pnpm test:guard # vitest run tests/guardrails (AI coding guardrails)
|
||||
pnpm test:coverage # vitest run --coverage
|
||||
|
||||
# Testing — Playwright E2E
|
||||
pnpm test:e2e # playwright test (headless chromium)
|
||||
pnpm test:e2e:headed # visible browser (E2E_HEADLESS=false)
|
||||
|
||||
# Full CI gate
|
||||
make ci # lint-check + check + test-guard + test-ci + build
|
||||
```
|
||||
|
||||
The backend API lives at `http://localhost:8000` (see `src/config/env/.env.dev`). The dev server proxies `/api` there
|
||||
via Vite. **The dev server runs without the backend**, but login and data endpoints will fail.
|
||||
|
||||
## Package Manager
|
||||
|
||||
**pnpm** (pinned by `packageManager` field in `package.json` + Corepack).
|
||||
|
||||
- First-time setup: `corepack enable` once.
|
||||
- **Do not use `npm` or `yarn`** — they will generate a second lockfile.
|
||||
- When bumping pnpm, update the `corepack prepare pnpm@X --activate` line in `Dockerfile` in lockstep.
|
||||
|
||||
## Stack
|
||||
|
||||
| Concern | Choice |
|
||||
| ------------ | ------------------------------------------------------------------------------------------- |
|
||||
| Framework | Vue 3.5 (`<script setup>`, Composition API) |
|
||||
| Language | TypeScript 6 (`verbatimModuleSyntax`, strict, noUncheckedIndexedAccess, noImplicitOverride) |
|
||||
| Build | Vite 8 + `@vitejs/plugin-vue` + `@vitejs/plugin-legacy` |
|
||||
| UI Library | Element Plus 2.14 + `@element-plus/icons-vue` |
|
||||
| State | Pinia 3 (setup-function style stores) |
|
||||
| Routing | Vue Router 5 (hash mode) |
|
||||
| HTTP | Axios 1.16 + JSONBigInt (handles 64-bit integer IDs from Java backend) |
|
||||
| i18n | vue-i18n 11 (English + Chinese) |
|
||||
| Charts | @antv/g2, @antv/g6 |
|
||||
| Maps | @amap/amap-jsapi-loader |
|
||||
| Testing | Vitest 4 (happy-dom) + Playwright 1.60 (E2E) |
|
||||
| Auto-imports | `unplugin-auto-import` + `unplugin-vue-components` (declarations in `src/config/ambient/`) |
|
||||
|
||||
## Domain Model: Four-Layer IoT Entity
|
||||
|
||||
The core domain follows a strict hierarchy: **Driver** (protocol adapter) → **Profile** (device template) → **Device** (
|
||||
physical equipment) → **Point** (data signal). This hierarchy is reflected everywhere — API paths, types, dashboard
|
||||
palette colors, routing, entity enums.
|
||||
|
||||
## Project Layout
|
||||
|
||||
```
|
||||
src/
|
||||
├── api/ REST API wrappers (thin, use crud* helpers from common.ts)
|
||||
├── components/ shared components (cards, charts, tags, segmented, agentic)
|
||||
├── composables/ usePagedList<T,Q> (generic paginated list), useEntityNames (ID→name cache)
|
||||
├── config/
|
||||
│ ├── ambient/ auto-generated type declarations (unplugin)
|
||||
│ ├── axios/ axios instance + interceptors (auth headers, JSONBigInt, 401 redirect)
|
||||
│ ├── constant/ enums, API base paths, auth header names, palette, icon map
|
||||
│ ├── env/ dotenv files (NOT at repo root — Vite uses envDir: './src/config/env')
|
||||
│ ├── i18n/ vue-i18n config + locale files
|
||||
│ ├── plugins/ Element Plus + Highlight.js setup
|
||||
│ ├── router/ routes + auth guards (common.ts, views.ts, settings.ts, operate.ts)
|
||||
│ └── types/ all TypeScript interfaces (entity Form/Record pairs, dashboard, agentic)
|
||||
├── store/ Pinia stores (auth, agentic, menu, interval)
|
||||
├── styles/ Global SCSS
|
||||
├── utils/ pure utility functions
|
||||
└── views/ page-level components
|
||||
```
|
||||
|
||||
## Key Conventions
|
||||
|
||||
### 1. `import type` is mandatory for type-only imports
|
||||
|
||||
`tsconfig.json` enables `verbatimModuleSyntax: true`. Any import used only as a type **must** use `import type` —
|
||||
otherwise Vite keeps the import at runtime, the browser can't find the named export, and you get a `SyntaxError` → blank
|
||||
page.
|
||||
|
||||
```ts
|
||||
// ❌ Crashes at runtime
|
||||
import { FormInstance, FormRules } from 'element-plus';
|
||||
|
||||
// ✅
|
||||
import type { FormInstance, FormRules } from 'element-plus';
|
||||
```
|
||||
|
||||
Common type-only names to watch out for:
|
||||
|
||||
- `element-plus`: `FormInstance`, `FormRules`, `UploadProps`, etc.
|
||||
- `@/config/types`: `Order`, `Dictionary`, `Attribute`, `Login` — all plain interfaces.
|
||||
- `vue-router`: `RouteRecordRaw`, `RouteLocationNormalized`, `NavigationGuardNext`, `RouteMeta`.
|
||||
- `axios`: `AxiosInstance`, `AxiosError`, `AxiosResponse`, `InternalAxiosRequestConfig`.
|
||||
|
||||
Icons from `@element-plus/icons-vue` (`Box`, `Edit`, …) are **values (Vue components)** — regular `import { ... }` is
|
||||
correct.
|
||||
|
||||
### 2. API verb convention: `get*` / `list*` / `add*` / `update*` / `delete*`
|
||||
|
||||
Mirrors the backend convention. The verb reflects the **cardinality** of the result:
|
||||
|
||||
```ts
|
||||
// ✅ single record -> get*, /get_*
|
||||
export const getDeviceById = (id: string) =>
|
||||
httpGet<R<DeviceRecord>>(`${API_MANAGER_BASE}/device/get_by_id`, { params: { id } });
|
||||
|
||||
// ✅ collection -> list*, /list_*
|
||||
export const listDevice = <T = R<PageResult<DeviceRecord>>>(query: PageQuery) =>
|
||||
httpPost<T>(`${API_MANAGER_BASE}/device/list`, query);
|
||||
|
||||
export const listDeviceByDriverId = (driverId: string) =>
|
||||
httpGet(`${API_MANAGER_BASE}/device/list_by_driver_id`, { params: { driver_id: driverId } });
|
||||
|
||||
// ❌ Not allowed in src/api/**
|
||||
// getDeviceList, getDriverByIds, /select_by_id, /tree
|
||||
```
|
||||
|
||||
- Function names: `getXxx` returns a single record, `listXxx` returns a collection (list, page or map). `addXxx`/
|
||||
`deleteXxx`/`updateXxx` are for mutations.
|
||||
- HTTP paths use snake*case and mirror the function name (`/get_by_id`, `/list_by_driver_id`, `/list`, `/list_tree`).
|
||||
`/select*\*` paths are no longer accepted.
|
||||
- Use `getXxxCountByYyy` when the endpoint returns a single count value (the backend exposes `/get_count_by_*`).
|
||||
|
||||
API modules use generic helpers from `api/common.ts`: `crudAdd`, `crudUpdate`, `crudDelete`, `crudGetById`, `crudList`.
|
||||
|
||||
### 3. Type naming: Form vs Record
|
||||
|
||||
Every entity has a `<Entity>Form` type (create/update payloads, optional `id`) and a `<Entity>Record` type (read
|
||||
responses, required `id` + timestamps `createTime`, `operateTime`).
|
||||
|
||||
### 4. Router guards must always resolve
|
||||
|
||||
Every branch of `beforeEach` in `src/config/router/index.ts` must eventually call `next()` or return a route/undefined.
|
||||
A missing resolution leaves navigation pending → blank page with NProgress stuck.
|
||||
|
||||
Note: vue-router 5 has deprecated the callback style (`next(...)`) in favor of returning a value. It still works (warn
|
||||
only), but new code should prefer the return style.
|
||||
|
||||
### 5. Auth flow
|
||||
|
||||
Login: `generateSalt` → MD5(password) → `generateToken` → store `{tenant, login, {salt, token}}` in localStorage. Every
|
||||
request includes `X-Auth-Tenant`, `X-Auth-Login`, `X-Auth-Token` headers. The router guard only verifies that a complete
|
||||
local auth payload exists; backend expiry and invalidation are handled by the Axios 401 interceptor.
|
||||
|
||||
### 6. SCSS and element-plus variables
|
||||
|
||||
Global `element-variables.scss` is injected into every component via Vite's `additionalData` (with circular-import
|
||||
guard). Do not add duplicate `@use` directives for Element Plus variables in individual components.
|
||||
|
||||
### 7. `envDir` is under `src/config/env`
|
||||
|
||||
Vite is configured with `envDir: './src/config/env'`, so dotenv files are **not** at the repo root. The env-var prefix
|
||||
is `APP_`.
|
||||
|
||||
## API Gateway Routing
|
||||
|
||||
Frontend calls go through `dc3-gateway` at `/api/v3/{auth|data|manager|agentic}`. The gateway strips the prefix and
|
||||
routes to the appropriate center microservice. Base paths are defined in `src/config/constant/api.ts`:
|
||||
|
||||
- `API_AUTH_BASE = 'api/v3/auth'`
|
||||
- `API_DATA_BASE = 'api/v3/data'`
|
||||
- `API_MANAGER_BASE = 'api/v3/manager'`
|
||||
- `API_AGENTIC_BASE = 'api/v3/agentic'`
|
||||
|
||||
## Testing
|
||||
|
||||
### Vitest (unit / api / component / views)
|
||||
|
||||
- Environment: `happy-dom`, 30s timeout
|
||||
- Coverage: V8 provider, thresholds at 65% branches / 75% functions / 78% lines
|
||||
- Test templates in `tests/_templates/` (api, component, composable, store)
|
||||
- Guardrails in `tests/guardrails/` validate AI coding conventions
|
||||
|
||||
### Playwright (E2E)
|
||||
|
||||
- Chromium only, 60s timeout, `retain-on-failure` traces/screenshots
|
||||
- Auto-starts `pnpm run serve:e2e` as webServer when `E2E_START_SERVER=1` (default). That command builds the app and
|
||||
serves `dist/` through `scripts/testing/e2e-server.mjs`, which proxies `/api` to `http://localhost:8000` by default.
|
||||
- Env vars: `E2E_BASE_URL` (default `http://localhost:8080`), `E2E_HEADLESS` (default `true`)
|
||||
|
||||
## Known Issues
|
||||
|
||||
- **`auto-imports.d.ts`** declarations like `const FormInstance: typeof import(...)` are for TS only — you still must
|
||||
write `import type` in source files; auto-import would inject a runtime import and crash.
|
||||
- **`src/components/particles/particles.vue`**: login page particle background. Under Vue 3.5 `mounted` may fire before
|
||||
the canvas ref is ready. Wrap init in `onMounted(() => nextTick(...))` if fixing.
|
||||
- **Ignored build scripts for `@parcel/watcher` / `core-js`**: disabled by default in pnpm 10 as security hardening.
|
||||
Harmless; run `pnpm approve-builds` to silence the warning.
|
||||
- **Tauri desktop**: `src-tauri/` exists; `@tauri-apps/api` is not currently imported in `src/`.
|
||||
|
||||
## Commit Rules
|
||||
|
||||
Commit messages follow [Conventional Commits](https://www.conventionalcommits.org/):
|
||||
|
||||
```
|
||||
<type>(<scope>): <lowercase imperative description>
|
||||
```
|
||||
|
||||
**Allowed types**: `feat`, `fix`, `perf`, `refactor`, `docs`, `build`, `ci`, `test`, `chore`, `style`, `security`,
|
||||
`revert`. Max 100 chars, English only. Install hooks with `make install-hooks` (from `iot-dc3/`).
|
||||
|
||||
## Cross-Repo References
|
||||
|
||||
The canonical project instructions are in `../AGENTS.md` (shared across AI tools). The backend lives in `../iot-dc3/`;
|
||||
container/compose infrastructure and the parent POM also live under `../iot-dc3/` (see `iot-dc3/dc3/` and
|
||||
`iot-dc3/pom.xml`). See the root `CLAUDE.md` for the full monorepo map.
|
||||
|
||||
### Menu system (frontend ↔ backend)
|
||||
|
||||
Settings sidebar is driven by **both** frontend config and backend database. When renaming/moving a menu item, update
|
||||
ALL layers:
|
||||
|
||||
- Seed data SQL (`menu_code`, `menu_ext.url`, `parent_menu_id`, `menu_index`)
|
||||
- `src/config/settingsNav.ts` (TITLE_KEYS, \*\_CHILDREN, GROUP_OPENERS, BREADCRUMB_PARENTS, FALLBACK_ICON, ACTIVE_ALIAS,
|
||||
ROUTE_ALIAS)
|
||||
- Router (`settings.ts` route name + `operate.ts` detail routes)
|
||||
- i18n (`src/config/i18n/locales/{en,zh}.ts` `nav.*` keys)
|
||||
- `Layout.vue` (nameMap + icon fallback)
|
||||
- `Settings.vue` (hardcoded menu code references)
|
||||
|
||||
### Settings route naming
|
||||
|
||||
All settings route names use the pattern `settings<Group><Item>`, e.g. `settingsAlarmOverview`. Group menu codes:
|
||||
`settingsAlarm`, `settingsEvent`, `settingsCommand`, `settingsModel`.
|
||||
|
||||
## Dockerfile Build
|
||||
|
||||
The `Dockerfile` pins pnpm via `corepack prepare pnpm@11.3.0 --activate`, matching `package.json`'s `packageManager`
|
||||
field. **When bumping pnpm, update both in lockstep** — otherwise CI resolves a different version than local.
|
||||
@@ -0,0 +1,23 @@
|
||||
# Contributor Code of Conduct
|
||||
|
||||
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting
|
||||
issues, posting feature requests, updating documentation,
|
||||
submitting pull requests or patches, and other activities.
|
||||
|
||||
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level
|
||||
of experience, gender, gender identity and expression,
|
||||
sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
|
||||
|
||||
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or
|
||||
personal attacks, trolling, public or private harassment,
|
||||
insults, or other unprofessional conduct.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits,
|
||||
issues, and other contributions that are not aligned to this
|
||||
Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting
|
||||
one or more of the project maintainers.
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available
|
||||
at https://www.contributor-covenant.org/version/1/0/0/code-of-conduct.html
|
||||
@@ -0,0 +1,77 @@
|
||||
# IoT DC3 Contributor’s Guide
|
||||
|
||||
Are you looking for ways to start contributing to IoT DC3? This guide will help you understand how to contribute to the
|
||||
project, giving you an understanding of the types of
|
||||
contributions you can make, the standards for each type of contribution, the overall organization of the IoT DC3
|
||||
project, and the contribution process.
|
||||
|
||||
## Types of Contributions
|
||||
|
||||
While one of the most common ways to contribute to open source software is through code, there are many other ways to
|
||||
participate in the community development and maintenance of
|
||||
IoT DC3. In addition to code pull requests, you can contribute through bug reports, documentation fixes, feature
|
||||
requests, labeling templates, storage backends, and machine
|
||||
learning examples. You can also participate in the IoT DC3 community by engaging with the rest of the community and
|
||||
answering questions. No contribution is too small!
|
||||
|
||||
### Docs Update
|
||||
|
||||
One of the easiest ways to contribute to IoT DC3 is through documentation updates. Documentation is one of the first
|
||||
ways that new users will engage with IoT DC3, and should help
|
||||
to guide users throughout their journey with IoT DC3. Helping to craft clear and correct documentation can have a
|
||||
lasting impact on the experience of the entire user community.
|
||||
|
||||
In addition to the change itself, docs updates should include a description of the documentation problem in the pull
|
||||
request, and how the pull request addresses the issue.
|
||||
|
||||
Use the Docs Update template for your pull request, and prefix your pull request title with `docs:`.
|
||||
|
||||
### Bug Report
|
||||
|
||||
Bug reports help identify issues the development team may have missed in testing, or edge cases that diminish the user
|
||||
experience. A good bug report not only alerts the development
|
||||
team to an issue, but also provides the conditions to reproduce, verify, and fix the bug.
|
||||
|
||||
When filling out a bug report, please include as much of the following information as possible. If the development team
|
||||
can't reproduce your bug, they can’t take the necessary
|
||||
steps to fix it.
|
||||
|
||||
A bug report can enter several different states, including:
|
||||
|
||||
- **verified**: The bug report has been verified and is in the development pipeline to be fixed
|
||||
- **not a bug**: The report does not describe a bug, which might be the result of expected behavior, or misconfiguration
|
||||
of the platform
|
||||
- **needs information**: The development team couldn’t verify the bug, and needs additional information before action
|
||||
can be taken
|
||||
- **fixed**: The bug report describes a bug that has been fixed in the latest version of IoT DC3
|
||||
|
||||
When a bug report enters the “fixed” or “not a bug” states, the issue will be closed.
|
||||
|
||||
Use the Bug Report template for your issue.
|
||||
|
||||
### Bug Fix
|
||||
|
||||
Bug fixes build upon bug reports, and provide code that addresses the issue. Before submitting a bug fix, please submit
|
||||
a bug report to provide the necessary context for the
|
||||
development team. Bug fixes should follow the coding standards for IoT DC3 and include tests. Unit tests are necessary
|
||||
to demonstrate the bug has been fixed, and to also provide a
|
||||
safeguard against future regressions. In addition to unit tests, you should provide acceptance criteria that the QA team
|
||||
can use to verify the application's behavior. Bug fixes
|
||||
must reference the original bug report.
|
||||
|
||||
Use the Bug Fix template for your pull request, and prefix your pull request title with `fix:`.
|
||||
|
||||
## Branches and Releases
|
||||
|
||||
IoT DC3 follows a simplified Git Flow:
|
||||
|
||||
- `develop` — integration branch. Cut `feature/<scope>` branches from `develop` and open pull requests back against `develop`. Full CI (lint / type-check / test / build) runs here.
|
||||
- `main` — production trunk. Verified work is promoted from `develop` to `main` via pull request. Each merge to `main` is a release (a tag is cut and the web image is published).
|
||||
- `hotfix/<scope>` — cut from `main` for production fixes; open the PR back against `main` (then tag), and back-merge to `develop`.
|
||||
- `release` — archived (read-only). It is kept for history only; do not open pull requests against it.
|
||||
|
||||
**Commits** follow Conventional Commits (`feat`, `fix`, `docs`, `refactor`, `test`, `chore`, …), English, specific subjects.
|
||||
|
||||
**Releasing (tagging)**: switch to `main` and run `make tag [patch|minor|major]` (default `patch`). It creates a semver tag `vYYYY.M.P`, pushes it, and opens a GitHub Release; pushing a `v*` tag triggers the Docker image build. `bash bin/tag.sh --dry-run` previews the next tag without pushing. Tagging only runs on `main`.
|
||||
|
||||
**External contributors**: cut feature branches from `develop` and open pull requests against `develop` (not `main` or `release`).
|
||||
@@ -0,0 +1,14 @@
|
||||
Copyright 2016-present the IoT DC3 original author or authors.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
@@ -0,0 +1,46 @@
|
||||
#
|
||||
# Copyright 2016-present the IoT DC3 original author or authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
# builder
|
||||
FROM pnoker/dc3-node:2025.2 AS builder
|
||||
LABEL dc3.author=pnokers
|
||||
LABEL dc3.author.email=pnokers.icloud.com
|
||||
|
||||
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
COPY ./ ./
|
||||
|
||||
RUN corepack enable && corepack prepare pnpm@11.3.0 --activate
|
||||
RUN pnpm install --frozen-lockfile
|
||||
RUN pnpm build
|
||||
|
||||
# runtime
|
||||
FROM pnoker/dc3-nginx:2025.2 AS runtime
|
||||
LABEL dc3.author=pnokers
|
||||
LABEL dc3.author.email=pnokers.icloud.com
|
||||
|
||||
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
|
||||
|
||||
COPY --from=builder /build/dc3/nginx/ /etc/nginx/
|
||||
COPY --from=builder /build/dist/ /usr/share/nginx/html/
|
||||
COPY --from=builder /build/dc3/dependencies/conf.crt/ /etc/letsencrypt/live/
|
||||
|
||||
EXPOSE 80 443
|
||||
VOLUME /var/log/nginx
|
||||
|
||||
CMD envsubst '${APP_API_HOST} ${APP_API_PORT}' < /etc/nginx/location/default.env > /etc/nginx/location/default.conf ; nginx -g "daemon off;"
|
||||
@@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don"t include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@@ -0,0 +1,208 @@
|
||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Copyright © 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you legal permission to copy, distribute and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that improvements made in alternate versions of the program, if they receive widespread use, become available for other developers to incorporate. Many developers of free software are heartened and encouraged by the resulting cooperation. However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License permits making a modified version and letting the public access it on a server without ever releasing its source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified source code becomes available to the community. It requires the operator of a network server to provide the source code of the modified version running there to the users of that server. Therefore, public use of a modified version, on a publicly accessible server, gives the public access to the source code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license, not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
0. Definitions.
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
|
||||
b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices".
|
||||
c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
|
||||
d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
|
||||
A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
|
||||
b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
|
||||
c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
|
||||
d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
|
||||
e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
|
||||
A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
"Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
|
||||
b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
|
||||
c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
|
||||
d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
|
||||
e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
|
||||
f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
|
||||
All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary means of facilitating copying of software. This Corresponding Source shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the work with which it is combined will remain governed by version 3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
The Free Software Foundation may publish revised and/or new versions of the GNU Affero General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU Affero General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU Affero General Public License, you may choose any version ever published by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future versions of the GNU Affero General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If your software can interact with users remotely through a computer network, you should also make sure that it provides a way for users to get its source. For example, if your program is a web application, its interface could display a "Source" link that leads users to an archive of the code. There are many ways you could offer source, and different solutions will be better for different programs; see section 13 for the specific requirements.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU AGPL, see <https://www.gnu.org/licenses/>.
|
||||
@@ -0,0 +1,60 @@
|
||||
IoT DC3 License Agreement
|
||||
|
||||
Version: 2025.6
|
||||
Effective Date: June, 2025
|
||||
|
||||
This License Agreement (hereinafter referred to as the "Agreement") is published by the copyright owner of IoT DC3 (hereinafter referred to as the "Software") to regulate the use of the Software by users.
|
||||
|
||||
1. Definitions
|
||||
|
||||
1.1 Community Edition
|
||||
Refers to the version of IoT DC3 released under the GNU Affero General Public License v3.0 (“AGPL-3.0”).
|
||||
|
||||
1.2 Commercial Edition
|
||||
Refers to the version of IoT DC3 obtained through signing a commercial license agreement.
|
||||
|
||||
1.3 Commercial Plugins
|
||||
Refers to plugins, modules, or extensions developed and licensed separately by the copyright owner, typically designed to enhance the industrial application capabilities of IoT DC3.
|
||||
|
||||
2. Licensing Models
|
||||
|
||||
2.1 Community Edition License
|
||||
- The Community Edition is released under the AGPL-3.0 license.
|
||||
- Users may use, copy, modify, and distribute the Software in compliance with the terms of AGPL-3.0.
|
||||
- Restriction: It is prohibited to directly provide IoT SaaS platforms or commercial services to the public based on the Community Edition.
|
||||
|
||||
2.2 Commercial Edition License
|
||||
- The Commercial Edition requires signing a separate commercial license agreement and paying the license fee.
|
||||
- The Commercial Edition allows closed-source usage. Users may develop derivative products based on the Commercial Edition and deploy or distribute them commercially.
|
||||
- Commercial Edition users are entitled to remove IoT DC3 branding and identification.
|
||||
- The Commercial Edition license is granted only to the authorized party and may not be sublicensed, redistributed, or resold.
|
||||
|
||||
2.3 Commercial Plugins License
|
||||
- Commercial Plugins may only be used after signing a commercial license agreement.
|
||||
- Reverse engineering, decompilation, distribution, or resale of Commercial Plugin source code is strictly prohibited.
|
||||
|
||||
3. Restrictions
|
||||
|
||||
- Without commercial authorization, it is prohibited to use the Community Edition or Commercial Plugins to build, operate, or provide public cloud or SaaS services.
|
||||
- The Software may not be used for illegal or unlawful purposes.
|
||||
- The copyright notice of the Software may not be removed or modified.
|
||||
|
||||
4. Intellectual Property
|
||||
|
||||
- All intellectual property rights of IoT DC3 belong to the copyright owner.
|
||||
- Any rights not expressly granted under this Agreement are reserved by the copyright owner.
|
||||
|
||||
5. Disclaimer
|
||||
|
||||
- The Software is provided “as-is” without warranties of any kind, either express or implied, including but not limited to merchantability, fitness for a particular purpose, or non-infringement.
|
||||
- To the maximum extent permitted by applicable law, the copyright owner shall not be liable for any direct, indirect, incidental, special, or consequential damages arising from the use of the Software.
|
||||
|
||||
6. Termination
|
||||
|
||||
- If the user breaches any terms of this Agreement, the license shall terminate immediately and automatically.
|
||||
- Upon termination, the user must immediately cease using the Software and destroy all copies in their possession.
|
||||
|
||||
7. Governing Law and Dispute Resolution
|
||||
|
||||
- This Agreement shall be governed by the laws of the People’s Republic of China.
|
||||
- Any dispute arising from or in connection with this Agreement shall be submitted to the Beijing Arbitration Commission for arbitration.
|
||||
@@ -0,0 +1,242 @@
|
||||
#
|
||||
# Copyright 2016-present the IoT DC3 original author or authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
SHELL := /usr/bin/bash
|
||||
.DEFAULT_GOAL := help
|
||||
|
||||
PNPM ?= pnpm
|
||||
DC3_DIR ?= dc3
|
||||
COMPOSE_FILE ?= $(DC3_DIR)/docker-compose.yml
|
||||
ENV_FILE ?= $(firstword $(wildcard .env) .env.example)
|
||||
|
||||
ifneq ($(wildcard $(ENV_FILE)),)
|
||||
include $(ENV_FILE)
|
||||
endif
|
||||
export
|
||||
|
||||
DOCKER_COMPOSE ?= $(shell if docker compose version >/dev/null 2>&1; then printf 'docker compose'; elif podman compose version >/dev/null 2>&1; then printf 'podman compose'; else printf 'docker compose'; fi)
|
||||
REGISTRY ?= auto
|
||||
DC3_WEB_VERSION ?= latest
|
||||
DC3_BIND_HOST ?= 127.0.0.1
|
||||
DC3_WEB_HTTP_PORT ?= 8080
|
||||
DC3_WEB_HTTPS_PORT ?= 8443
|
||||
APP_API_HOST ?= dc3-gateway
|
||||
APP_API_PORT ?= 8000
|
||||
DC3_LOG_MAX_SIZE ?= 20m
|
||||
DC3_LOG_MAX_FILE ?= 20
|
||||
|
||||
ifeq ($(REGISTRY),auto)
|
||||
DC3_WEB_IMAGE ?= pnoker/dc3-web
|
||||
else ifeq ($(REGISTRY),global)
|
||||
override DC3_WEB_IMAGE := pnoker/dc3-web
|
||||
else ifeq ($(REGISTRY),cn)
|
||||
override DC3_WEB_IMAGE := registry.cn-beijing.aliyuncs.com/dc3/dc3-web
|
||||
else
|
||||
$(error Unsupported REGISTRY '$(REGISTRY)'. Use REGISTRY=auto|global|cn)
|
||||
endif
|
||||
|
||||
define dc3_compose
|
||||
$(DOCKER_COMPOSE) -f "$(COMPOSE_FILE)"
|
||||
endef
|
||||
|
||||
.PHONY: \
|
||||
help \
|
||||
env \
|
||||
init-env \
|
||||
install \
|
||||
dev \
|
||||
dev-prod \
|
||||
preview \
|
||||
build \
|
||||
build-tauri \
|
||||
check \
|
||||
type-check \
|
||||
lint \
|
||||
lint-check \
|
||||
format \
|
||||
format-check \
|
||||
test \
|
||||
test-unit \
|
||||
test-api \
|
||||
test-component \
|
||||
test-guard \
|
||||
test-impact \
|
||||
test-ci \
|
||||
test-e2e \
|
||||
test-e2e-headed \
|
||||
test-e2e-sweep \
|
||||
test-e2e-sweep-headed \
|
||||
clean \
|
||||
ci \
|
||||
docker-build \
|
||||
docker-up \
|
||||
docker-down \
|
||||
docker-ps \
|
||||
docker-logs \
|
||||
docker-config \
|
||||
docker-restart \
|
||||
tag
|
||||
|
||||
help:
|
||||
@printf '%s\n' \
|
||||
'make install - install dependencies' \
|
||||
'make dev - run Vite dev server (dev mode)' \
|
||||
'make dev-prod - run Vite dev server (production mode)' \
|
||||
'make preview - preview built assets' \
|
||||
'make build - build web assets' \
|
||||
'make build-tauri - build Tauri app' \
|
||||
'make check - run vue-tsc type check' \
|
||||
'make type-check - run vue-tsc type check' \
|
||||
'make lint - run eslint --fix and prettier --write' \
|
||||
'make lint-check - run eslint/prettier checks only' \
|
||||
'make format - run prettier --write' \
|
||||
'make format-check - run prettier --check' \
|
||||
'make test - run Vitest unit/api/component tests' \
|
||||
'make test-unit - run Vitest unit tests' \
|
||||
'make test-api - run API contract tests' \
|
||||
'make test-component - run component tests' \
|
||||
'make test-guard - run AI coding guardrail tests' \
|
||||
'make test-impact - print recommended checks for changed files' \
|
||||
'make test-ci - run Vitest with coverage thresholds' \
|
||||
'make test-e2e - run Playwright e2e tests' \
|
||||
'make test-e2e-headed - run Playwright e2e tests in a visible browser' \
|
||||
'make test-e2e-sweep - run browser sweep against a full environment' \
|
||||
'make test-e2e-sweep-headed - run browser sweep in a visible browser' \
|
||||
'make clean - remove dist output' \
|
||||
'make ci - run lint-check, check, guardrails, test, build' \
|
||||
'make docker-build - build dc3 docker services' \
|
||||
'make docker-up - start dc3 docker services' \
|
||||
'make docker-down - stop dc3 docker services' \
|
||||
'make docker-logs - follow dc3 web logs' \
|
||||
'make env - print effective Make/Compose defaults' \
|
||||
'make tag [patch|minor|major] - create semver release tag on main'
|
||||
|
||||
env:
|
||||
@printf 'ENV_FILE=%s\n' "$(ENV_FILE)"
|
||||
@printf 'DOCKER_COMPOSE=%s\n' "$(DOCKER_COMPOSE)"
|
||||
@printf 'COMPOSE_FILE=%s\n' "$(COMPOSE_FILE)"
|
||||
@printf 'REGISTRY=%s\n' "$(REGISTRY)"
|
||||
@printf 'DC3_WEB_IMAGE=%s\n' "$(DC3_WEB_IMAGE)"
|
||||
@printf 'DC3_WEB_VERSION=%s\n' "$(DC3_WEB_VERSION)"
|
||||
@printf 'DC3_BIND_HOST=%s\n' "$(DC3_BIND_HOST)"
|
||||
@printf 'DC3_WEB_HTTP_PORT=%s\n' "$(DC3_WEB_HTTP_PORT)"
|
||||
@printf 'DC3_WEB_HTTPS_PORT=%s\n' "$(DC3_WEB_HTTPS_PORT)"
|
||||
@printf 'APP_API_HOST=%s\n' "$(APP_API_HOST)"
|
||||
@printf 'APP_API_PORT=%s\n' "$(APP_API_PORT)"
|
||||
|
||||
init-env:
|
||||
@test -f .env || cp .env.example .env
|
||||
@printf '%s\n' 'Using .env'
|
||||
|
||||
install:
|
||||
$(PNPM) install
|
||||
|
||||
dev:
|
||||
$(PNPM) dev
|
||||
|
||||
dev-prod:
|
||||
$(PNPM) run dev:prod
|
||||
|
||||
preview:
|
||||
$(PNPM) preview
|
||||
|
||||
build:
|
||||
$(PNPM) build
|
||||
|
||||
build-tauri:
|
||||
$(PNPM) run build:tauri
|
||||
|
||||
check:
|
||||
$(PNPM) run check
|
||||
|
||||
type-check:
|
||||
$(PNPM) run type-check
|
||||
|
||||
lint:
|
||||
$(PNPM) run lint
|
||||
|
||||
lint-check:
|
||||
$(PNPM) run lint:check
|
||||
|
||||
format:
|
||||
$(PNPM) run format
|
||||
|
||||
format-check:
|
||||
$(PNPM) run format:check
|
||||
|
||||
test:
|
||||
$(PNPM) test
|
||||
|
||||
test-unit:
|
||||
$(PNPM) run test:unit
|
||||
|
||||
test-api:
|
||||
$(PNPM) run test:api
|
||||
|
||||
test-component:
|
||||
$(PNPM) run test:component
|
||||
|
||||
test-guard:
|
||||
$(PNPM) run test:guard
|
||||
|
||||
test-impact:
|
||||
$(PNPM) run test:impact
|
||||
|
||||
test-ci:
|
||||
$(PNPM) run test:ci
|
||||
|
||||
test-e2e:
|
||||
$(PNPM) run test:e2e
|
||||
|
||||
test-e2e-headed:
|
||||
$(PNPM) run test:e2e:headed
|
||||
|
||||
test-e2e-sweep:
|
||||
$(PNPM) run test:e2e:sweep
|
||||
|
||||
test-e2e-sweep-headed:
|
||||
$(PNPM) run test:e2e:sweep:headed
|
||||
|
||||
clean:
|
||||
$(PNPM) run clean
|
||||
|
||||
ci: lint-check check test-guard test-ci build
|
||||
|
||||
docker-build:
|
||||
$(call dc3_compose) build
|
||||
|
||||
docker-up:
|
||||
$(call dc3_compose) up -d
|
||||
|
||||
docker-down:
|
||||
$(call dc3_compose) down
|
||||
|
||||
docker-ps:
|
||||
$(call dc3_compose) ps
|
||||
|
||||
docker-logs:
|
||||
$(call dc3_compose) logs -f --tail=200
|
||||
|
||||
docker-config:
|
||||
$(call dc3_compose) config
|
||||
|
||||
docker-restart:
|
||||
$(call dc3_compose) restart
|
||||
|
||||
tag:
|
||||
@bin/tag.sh $(filter-out $@,$(MAKECMDGOALS))
|
||||
%:
|
||||
@:
|
||||
@@ -0,0 +1,33 @@
|
||||
## 1. Prepare
|
||||
|
||||
- `git`
|
||||
- `Visual Studio Code`
|
||||
- `nodejs` >= 22 (enforced by `engines` in `package.json`)
|
||||
- `pnpm` 11.3.0 (pinned via `packageManager`), install using `corepack enable && corepack prepare pnpm@11.3.0 --activate`
|
||||
|
||||
## 2. Source code
|
||||
|
||||
```bash
|
||||
git clone https://github.com/pnoker/iot-dc3-web.git
|
||||
```
|
||||
|
||||
## 3. Develop
|
||||
|
||||
```bash
|
||||
cd iot-dc3-web
|
||||
|
||||
# install
|
||||
pnpm install
|
||||
|
||||
# run
|
||||
pnpm dev
|
||||
```
|
||||
|
||||
The dev server runs on `http://localhost:8080` and proxies API calls to the backend
|
||||
gateway (`http://localhost:8000`), so start the backend stack first.
|
||||
|
||||
## 4. More
|
||||
|
||||
For the full command surface (build, type-check, lint, unit/component/E2E tests), the
|
||||
tech stack, environment configuration (`src/config/env/`), and project conventions, see
|
||||
[`AGENTS.md`](./AGENTS.md).
|
||||
@@ -0,0 +1,48 @@
|
||||
# Security Policy
|
||||
|
||||
> :lock: **Note:** iot-dc3 is a distributed Internet of Things (IoT) platform that involves device access, data
|
||||
> collection, and command dispatch. Security issues not only affect
|
||||
> system operation but may also cause data or control risks. Please pay close attention to security configuration and
|
||||
> version updates.
|
||||
|
||||
## Supported Versions
|
||||
|
||||
> We usually provide security patches and updates only for the mainline versions that are currently actively maintained.
|
||||
|
||||
The following table lists the iot-dc3 versions that are currently supported with security updates:
|
||||
|
||||
| Version | Supported |
|
||||
| -------- | ------------------ |
|
||||
| 2025.9.x | :white_check_mark: |
|
||||
| 2025.6.x | :white_check_mark: |
|
||||
| 2025.x.x | :white_check_mark: |
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
> We take security issues very seriously.
|
||||
> If a vulnerability is verified, we will fix it as soon as possible and disclose the fix information in the release
|
||||
> notes.
|
||||
|
||||
If you find a potential security vulnerability while using **iot-dc3**, **do not disclose it publicly in issues or
|
||||
discussion areas**, but report it through the following private
|
||||
channels:
|
||||
|
||||
1. **Email report**:
|
||||
Send an email to the project maintenance team, and please include the keyword `Security Vulnerability` in the subject
|
||||
line.
|
||||
|
||||
2. **Direct message report**:
|
||||
You can directly contact the project maintainers through the private message function on Gitee or GitHub.
|
||||
|
||||
## Security Best Practices
|
||||
|
||||
To ensure the security and stability of the iot-dc3 platform in production environments, it is recommended to follow
|
||||
these practices:
|
||||
|
||||
- :white_check_mark: Always use supported versions;
|
||||
- :no_entry_sign: Do not expose core communication ports (such as MQTT, TCP, Modbus gateways) directly to the public
|
||||
network;
|
||||
- :lock: Use secure authentication mechanisms and enable HTTPS / SSL encryption;
|
||||
- :arrows_counterclockwise: Regularly update system dependencies and Docker images;
|
||||
- :jigsaw: Only authorize trusted devices and users to access the system;
|
||||
- :bar_chart: Apply the principle of least privilege and perform access auditing on external interfaces.
|
||||
|
After Width: | Height: | Size: 531 KiB |
|
After Width: | Height: | Size: 110 KiB |
|
After Width: | Height: | Size: 48 KiB |
|
After Width: | Height: | Size: 101 KiB |
|
After Width: | Height: | Size: 89 KiB |
|
After Width: | Height: | Size: 46 KiB |
|
After Width: | Height: | Size: 136 KiB |
|
After Width: | Height: | Size: 83 KiB |
|
After Width: | Height: | Size: 55 KiB |
|
After Width: | Height: | Size: 157 KiB |
|
After Width: | Height: | Size: 44 KiB |
|
After Width: | Height: | Size: 149 KiB |
|
After Width: | Height: | Size: 49 KiB |
|
After Width: | Height: | Size: 61 KiB |
|
After Width: | Height: | Size: 139 KiB |
|
After Width: | Height: | Size: 136 KiB |
|
After Width: | Height: | Size: 64 KiB |
|
After Width: | Height: | Size: 63 KiB |
|
After Width: | Height: | Size: 105 KiB |
|
After Width: | Height: | Size: 48 KiB |
|
After Width: | Height: | Size: 45 KiB |
|
After Width: | Height: | Size: 57 KiB |
|
After Width: | Height: | Size: 64 KiB |
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 146 KiB |
|
After Width: | Height: | Size: 72 KiB |
|
After Width: | Height: | Size: 86 KiB |
|
After Width: | Height: | Size: 51 KiB |
|
After Width: | Height: | Size: 41 KiB |
|
After Width: | Height: | Size: 42 KiB |
|
After Width: | Height: | Size: 77 KiB |
|
After Width: | Height: | Size: 93 KiB |
|
After Width: | Height: | Size: 54 KiB |
|
After Width: | Height: | Size: 41 KiB |
|
After Width: | Height: | Size: 42 KiB |
|
After Width: | Height: | Size: 2.5 MiB |
|
After Width: | Height: | Size: 62 KiB |
|
After Width: | Height: | Size: 42 KiB |
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 209 KiB |
|
After Width: | Height: | Size: 55 KiB |
|
After Width: | Height: | Size: 282 KiB |
|
After Width: | Height: | Size: 50 KiB |
|
After Width: | Height: | Size: 125 KiB |
|
After Width: | Height: | Size: 118 KiB |
|
After Width: | Height: | Size: 116 KiB |
|
After Width: | Height: | Size: 110 KiB |
|
After Width: | Height: | Size: 78 KiB |
|
After Width: | Height: | Size: 103 KiB |
|
After Width: | Height: | Size: 74 KiB |
|
After Width: | Height: | Size: 96 KiB |
|
After Width: | Height: | Size: 233 KiB |
|
After Width: | Height: | Size: 120 KiB |
|
After Width: | Height: | Size: 154 KiB |
|
After Width: | Height: | Size: 121 KiB |
|
After Width: | Height: | Size: 296 KiB |
|
After Width: | Height: | Size: 296 KiB |
|
After Width: | Height: | Size: 190 KiB |
|
After Width: | Height: | Size: 331 KiB |
@@ -0,0 +1,68 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#
|
||||
# Copyright 2016-present the IoT DC3 original author or authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
# Create a semver release tag on main: vYYYY.M.P
|
||||
# Usage: make tag [patch|minor|major] (or: bin/tag.sh <bump> [--dry-run])
|
||||
set -euo pipefail
|
||||
|
||||
bump=""
|
||||
dryrun=0
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
patch|minor|major) bump="$arg" ;;
|
||||
--dry-run) dryrun=1 ;;
|
||||
*) echo "unknown argument: $arg (expected: patch|minor|major|--dry-run)" >&2; exit 1 ;;
|
||||
esac
|
||||
done
|
||||
[ -n "$bump" ] || bump="patch"
|
||||
|
||||
branch=$(git rev-parse --abbrev-ref HEAD)
|
||||
if [ "$branch" != "main" ]; then
|
||||
echo "Tagging is only allowed on 'main' (current: '$branch'). Switch to main first." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
git pull --tags --quiet
|
||||
|
||||
last=$(git tag -l "v*" --sort=-v:refname | head -1)
|
||||
if [ -z "$last" ]; then
|
||||
echo "No 'v*' tag found. Create an initial baseline tag first, e.g.:" >&2
|
||||
echo " git tag v2025.9.3 && git push origin v2025.9.3" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
re='^v([0-9]+)\.([0-9]+)\.([0-9]+)$'
|
||||
if ! [[ $last =~ $re ]]; then
|
||||
echo "Unparseable last tag: $last (expected vYYYY.M.P)" >&2
|
||||
exit 1
|
||||
fi
|
||||
major=${BASH_REMATCH[1]}; minor=${BASH_REMATCH[2]}; patch=${BASH_REMATCH[3]}
|
||||
case "$bump" in
|
||||
patch) patch=$((patch + 1)) ;;
|
||||
minor) minor=$((minor + 1)); patch=0 ;;
|
||||
major) major=$((major + 1)); minor=0; patch=0 ;;
|
||||
esac
|
||||
newtag="v${major}.${minor}.${patch}"
|
||||
|
||||
echo "last: $last -> new: $newtag"
|
||||
[ "$dryrun" = "1" ] && { echo "(dry-run, not tagging)"; exit 0; }
|
||||
|
||||
git tag "$newtag"
|
||||
git push origin "$newtag"
|
||||
gh release create "$newtag" --generate-notes --title "$newtag"
|
||||
echo "Tagged and released $newtag"
|
||||
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"folders": [
|
||||
{
|
||||
"path": "src",
|
||||
"name": "web",
|
||||
},
|
||||
{
|
||||
"path": "dc3",
|
||||
"name": "dc3",
|
||||
},
|
||||
{
|
||||
"path": ".",
|
||||
"name": "root",
|
||||
},
|
||||
],
|
||||
"launch": {
|
||||
"version": "2026.5.22",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"cwd": "${workspaceFolder:web}",
|
||||
"name": "yarn serve",
|
||||
"runtimeExecutable": "yarn",
|
||||
"runtimeArgs": ["serve"],
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
|
||||
#
|
||||
# Copyright 2016-present the IoT DC3 original author or authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
cd ../../
|
||||
|
||||
yarn
|
||||
yarn build
|
||||
cp -r ./dist/* /usr/share/nginx/html/
|
||||
@@ -0,0 +1,44 @@
|
||||
#!/bin/bash
|
||||
|
||||
#
|
||||
# Copyright 2016-present the IoT DC3 original author or authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
branch=$(git rev-parse --abbrev-ref HEAD)
|
||||
|
||||
case "${branch}" in
|
||||
develop)
|
||||
type="develop"
|
||||
;;
|
||||
main | master | release | release/*)
|
||||
type="release"
|
||||
;;
|
||||
*)
|
||||
echo -e "This branch doesn't support tagging, please switch to the \033[31mdevelop\033[0m or \033[31mrelease\033[0m branch."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
git pull --tags
|
||||
|
||||
date=$(date +'%Y%m%d')
|
||||
count=$(git tag -l "dc3.${type}.${date}.*" | wc -l | xargs printf '%02d')
|
||||
tag="dc3.${type}.${date}.${count}"
|
||||
|
||||
echo "${tag}"
|
||||
git tag "${tag}"
|
||||
git push origin "${tag}"
|
||||
@@ -0,0 +1,58 @@
|
||||
# 使用 ACME.SH 申请并安装 LET’S ENCRYPT SSL 证书
|
||||
|
||||
Let’s Encrypt 是一个免费的, 自动化的, 开放的证书颁发机构(CA), 为公众的利益而运行。 它是一项由 Internet Security Research
|
||||
Group(ISRG)提供的服务。
|
||||
acme.sh 则是实现了 acme 协议, 可以从 letsencrypt 生成免费的证书。
|
||||
|
||||
## 安装 ACME.SH
|
||||
|
||||
```bash
|
||||
curl https://get.acme.sh | sh
|
||||
source ~/.bashrc
|
||||
```
|
||||
|
||||
## 申请证书
|
||||
|
||||
这种方式的好处是, 你不需要任何服务器, 不需要任何公网 ip, 只需要 dns 的解析记录即可完成验证, 而且可申请泛域名证书。
|
||||
坏处是, 需要配合DNS解析服务商的API使用, 否则 acme.sh 将无法自动更新证书, 每次都需要手动再次重新解析验证域名所有权。
|
||||
|
||||
### 配置阿里云 AccessKey
|
||||
|
||||
```bash
|
||||
# 阿里云控制台申请 API Token, 并配置环境变量如下
|
||||
# RAM 访问控制 -> 访问凭证管理 -> AccessKey
|
||||
export Ali_Key="AccessKey ID"
|
||||
export Ali_Secret="AccessKey Secret"
|
||||
```
|
||||
|
||||
### 配置阿里云 DNS
|
||||
|
||||
```bash
|
||||
acme.sh --issue --dns dns_ali -d dc3.site -d *.dc3.site
|
||||
```
|
||||
|
||||
## 安装证书
|
||||
|
||||
> reloadcmd: 用于让web服务器重新加载新的证书文件, 例子中使用的是 nginx 服务器, 您也可以定义成其它服务器。
|
||||
|
||||
```bash
|
||||
acme.sh --installcert -d dc3.site --key-file /etc/letsencrypt/live/dc3.site/dc3.site.key --fullchain-file /etc/letsencrypt/live/dc3.site/fullchain.cer --reloadcmd "service nginx force-reload"
|
||||
```
|
||||
|
||||
## 更新证书
|
||||
|
||||
Let’s Encrypt 的证书有效期为3个月, 每3个月得重新申请证书。
|
||||
通过 acme.sh 可以自动管理SSL证书的申请。通过上面步骤的安装后 acme.sh 会定期自动更新SSL证书。
|
||||
|
||||
```bash
|
||||
acme.sh --renew -d dc3.site --force
|
||||
```
|
||||
|
||||
## 取消更新
|
||||
|
||||
有时候你可能需要移除特定域名的自动申请, 这时候可以使用下面的命令让 acme.sh 取消对特定域名的自动续期。当然已申请的证书仍然有效,
|
||||
不会失效。
|
||||
|
||||
```bash
|
||||
acme.sh --remove -d dc3.site
|
||||
```
|
||||
@@ -0,0 +1,5 @@
|
||||
-----BEGIN EC PRIVATE KEY-----
|
||||
MHcCAQEEIFl2dIVmp3A3aAX46Im1vUuwCIYTf1y1pBIVUQBno1B2oAoGCCqGSM49
|
||||
AwEHoUQDQgAE63SlUpy5sp1r1zHDKeeNP3jBPlbwGn3/mK0bKqgXYwUKm+0ZUBP8
|
||||
PIh6eX+FnA7ZFkUvkXFRD3Q8POyzRwMgCA==
|
||||
-----END EC PRIVATE KEY-----
|
||||
@@ -0,0 +1,68 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIEAzCCA4mgAwIBAgIQeI2DNXjLytsxcNNXUoJQujAKBggqhkjOPQQDAzBLMQsw
|
||||
CQYDVQQGEwJBVDEQMA4GA1UEChMHWmVyb1NTTDEqMCgGA1UEAxMhWmVyb1NTTCBF
|
||||
Q0MgRG9tYWluIFNlY3VyZSBTaXRlIENBMB4XDTIzMTIwMzAwMDAwMFoXDTI0MDMw
|
||||
MjIzNTk1OVowEzERMA8GA1UEAxMIZGMzLnNpdGUwWTATBgcqhkjOPQIBBggqhkjO
|
||||
PQMBBwNCAATrdKVSnLmynWvXMcMp540/eME+VvAaff+YrRsqqBdjBQqb7RlQE/w8
|
||||
iHp5f4WcDtkWRS+RcVEPdDw87LNHAyAIo4IChTCCAoEwHwYDVR0jBBgwFoAUD2vm
|
||||
S845R672fpAeefAwkZLIX6MwHQYDVR0OBBYEFH8/OrvWh1jqtQMqWWThvtjsXUf3
|
||||
MA4GA1UdDwEB/wQEAwIHgDAMBgNVHRMBAf8EAjAAMB0GA1UdJQQWMBQGCCsGAQUF
|
||||
BwMBBggrBgEFBQcDAjBJBgNVHSAEQjBAMDQGCysGAQQBsjEBAgJOMCUwIwYIKwYB
|
||||
BQUHAgEWF2h0dHBzOi8vc2VjdGlnby5jb20vQ1BTMAgGBmeBDAECATCBiAYIKwYB
|
||||
BQUHAQEEfDB6MEsGCCsGAQUFBzAChj9odHRwOi8vemVyb3NzbC5jcnQuc2VjdGln
|
||||
by5jb20vWmVyb1NTTEVDQ0RvbWFpblNlY3VyZVNpdGVDQS5jcnQwKwYIKwYBBQUH
|
||||
MAGGH2h0dHA6Ly96ZXJvc3NsLm9jc3Auc2VjdGlnby5jb20wggEGBgorBgEEAdZ5
|
||||
AgQCBIH3BIH0APIAdwB2/4g/Crb7lVHCYcz1h7o0tKTNuyncaEIKn+ZnTFo6dAAA
|
||||
AYwwhSEmAAAEAwBIMEYCIQChVCdnPXDjeYoWLKTe9pYMq7p9OIymvgpl8Q58aRTa
|
||||
ygIhAJ6nsyCMhCMNsTg/1CYbm6upDe2o59pT/pxFoeHbidssAHcAO1N3dT4tuYBO
|
||||
izBbBv5AO2fYT8P0x70ADS1yb+H61BcAAAGMMIUhTwAABAMASDBGAiEArVmP8Sh/
|
||||
vS434SLshIkjQYL+xfrpoiaSWR6UhdjrCQECIQDOwhXO6WADDsXLsl8dd1JyMLX+
|
||||
MMWS/3+5RqGPOHNcsDAiBgNVHREEGzAZgghkYzMuc2l0ZYINZGVtby5kYzMuc2l0
|
||||
ZTAKBggqhkjOPQQDAwNoADBlAjEAn3RPkYdvQsFEOr1X/NXOGuokdL5inC5qm3Sd
|
||||
YDVmuwwec8cetbbAy6vU2p3n5cJYAjAE9JpmhXuz4V3tffWJXb6ALmk2k7CJV0Sd
|
||||
P4v0jq3UpHYZaGdRdKNARK2PhmK0Zfg=
|
||||
-----END CERTIFICATE-----
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIDhTCCAwygAwIBAgIQI7dt48G7KxpRlh4I6rdk6DAKBggqhkjOPQQDAzCBiDEL
|
||||
MAkGA1UEBhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNl
|
||||
eSBDaXR5MR4wHAYDVQQKExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMT
|
||||
JVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMjAwMTMw
|
||||
MDAwMDAwWhcNMzAwMTI5MjM1OTU5WjBLMQswCQYDVQQGEwJBVDEQMA4GA1UEChMH
|
||||
WmVyb1NTTDEqMCgGA1UEAxMhWmVyb1NTTCBFQ0MgRG9tYWluIFNlY3VyZSBTaXRl
|
||||
IENBMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAENkFhFytTJe2qypTk1tpIV+9QuoRk
|
||||
gte7BRvWHwYk9qUznYzn8QtVaGOCMBBfjWXsqqivl8q1hs4wAYl03uNOXgFu7iZ7
|
||||
zFP6I6T3RB0+TR5fZqathfby47yOCZiAJI4go4IBdTCCAXEwHwYDVR0jBBgwFoAU
|
||||
OuEJhtTPGcKWdnRJdtzgNcZjY5owHQYDVR0OBBYEFA9r5kvOOUeu9n6QHnnwMJGS
|
||||
yF+jMA4GA1UdDwEB/wQEAwIBhjASBgNVHRMBAf8ECDAGAQH/AgEAMB0GA1UdJQQW
|
||||
MBQGCCsGAQUFBwMBBggrBgEFBQcDAjAiBgNVHSAEGzAZMA0GCysGAQQBsjEBAgJO
|
||||
MAgGBmeBDAECATBQBgNVHR8ESTBHMEWgQ6BBhj9odHRwOi8vY3JsLnVzZXJ0cnVz
|
||||
dC5jb20vVVNFUlRydXN0RUNDQ2VydGlmaWNhdGlvbkF1dGhvcml0eS5jcmwwdgYI
|
||||
KwYBBQUHAQEEajBoMD8GCCsGAQUFBzAChjNodHRwOi8vY3J0LnVzZXJ0cnVzdC5j
|
||||
b20vVVNFUlRydXN0RUNDQWRkVHJ1c3RDQS5jcnQwJQYIKwYBBQUHMAGGGWh0dHA6
|
||||
Ly9vY3NwLnVzZXJ0cnVzdC5jb20wCgYIKoZIzj0EAwMDZwAwZAIwJHBUDwHJQN3I
|
||||
VNltVMrICMqYQ3TYP/TXqV9t8mG5cAomG2MwqIsxnL937Gewf6WIAjAlrauksO6N
|
||||
UuDdDXyd330druJcZJx0+H5j5cFOYBaGsKdeGW7sCMaR2PsDFKGllas=
|
||||
-----END CERTIFICATE-----
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIID0zCCArugAwIBAgIQVmcdBOpPmUxvEIFHWdJ1lDANBgkqhkiG9w0BAQwFADB7
|
||||
MQswCQYDVQQGEwJHQjEbMBkGA1UECAwSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYD
|
||||
VQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0EgTGltaXRlZDEhMB8GA1UE
|
||||
AwwYQUFBIENlcnRpZmljYXRlIFNlcnZpY2VzMB4XDTE5MDMxMjAwMDAwMFoXDTI4
|
||||
MTIzMTIzNTk1OVowgYgxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpOZXcgSmVyc2V5
|
||||
MRQwEgYDVQQHEwtKZXJzZXkgQ2l0eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBO
|
||||
ZXR3b3JrMS4wLAYDVQQDEyVVU0VSVHJ1c3QgRUNDIENlcnRpZmljYXRpb24gQXV0
|
||||
aG9yaXR5MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEGqxUWqn5aCPnetUkb1PGWthL
|
||||
q8bVttHmc3Gu3ZzWDGH926CJA7gFFOxXzu5dP+Ihs8731Ip54KODfi2X0GHE8Znc
|
||||
JZFjq38wo7Rw4sehM5zzvy5cU7Ffs30yf4o043l5o4HyMIHvMB8GA1UdIwQYMBaA
|
||||
FKARCiM+lvEH7OKvKe+CpX/QMKS0MB0GA1UdDgQWBBQ64QmG1M8ZwpZ2dEl23OA1
|
||||
xmNjmjAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zARBgNVHSAECjAI
|
||||
MAYGBFUdIAAwQwYDVR0fBDwwOjA4oDagNIYyaHR0cDovL2NybC5jb21vZG9jYS5j
|
||||
b20vQUFBQ2VydGlmaWNhdGVTZXJ2aWNlcy5jcmwwNAYIKwYBBQUHAQEEKDAmMCQG
|
||||
CCsGAQUFBzABhhhodHRwOi8vb2NzcC5jb21vZG9jYS5jb20wDQYJKoZIhvcNAQEM
|
||||
BQADggEBABns652JLCALBIAdGN5CmXKZFjK9Dpx1WywV4ilAbe7/ctvbq5AfjJXy
|
||||
ij0IckKJUAfiORVsAYfZFhr1wHUrxeZWEQff2Ji8fJ8ZOd+LygBkc7xGEJuTI42+
|
||||
FsMuCIKchjN0djsoTI0DQoWz4rIjQtUfenVqGtF8qmchxDM6OW1TyaLtYiKou+JV
|
||||
bJlsQ2uRl9EMC5MCHdK8aXdJ5htN978UeAOwproLtOGFfy/cQjutdAFI3tZs4RmY
|
||||
CV4Ks2dH/hzg1cEo70qLRDEmBDeNiXQ2Lu+lIg+DdEmSx/cQwgwp+7e9un/jX9Wf
|
||||
8qn0dNW44bOwgeThpWOjzOoEeJBuv/c=
|
||||
-----END CERTIFICATE-----
|
||||
@@ -0,0 +1,52 @@
|
||||
#
|
||||
# Copyright 2016-present the IoT DC3 original author or authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
services:
|
||||
web:
|
||||
# Switch registry/tag via env:
|
||||
# DC3_WEB_IMAGE=registry.cn-beijing.aliyuncs.com/dc3/dc3-web \
|
||||
# DC3_WEB_VERSION=2026.5.22 docker compose up
|
||||
image: ${DC3_WEB_IMAGE:-pnoker/dc3-web}:${DC3_WEB_VERSION:-latest}
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: Dockerfile
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "${DC3_BIND_HOST:-127.0.0.1}:${DC3_WEB_HTTP_PORT:-8080}:80"
|
||||
- "${DC3_BIND_HOST:-127.0.0.1}:${DC3_WEB_HTTPS_PORT:-8443}:443"
|
||||
environment:
|
||||
- APP_API_HOST=${APP_API_HOST:-dc3-gateway}
|
||||
- APP_API_PORT=${APP_API_PORT:-8000}
|
||||
container_name: dc3-web
|
||||
hostname: dc3-web
|
||||
volumes:
|
||||
- nginx:/var/log/nginx
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: ${DC3_LOG_MAX_SIZE:-20m}
|
||||
max-file: "${DC3_LOG_MAX_FILE:-20}"
|
||||
networks:
|
||||
dc3net:
|
||||
aliases:
|
||||
- dc3-web
|
||||
|
||||
volumes:
|
||||
nginx:
|
||||
|
||||
networks:
|
||||
dc3net:
|
||||
driver: bridge
|
||||
@@ -0,0 +1,63 @@
|
||||
#
|
||||
# Copyright 2016-present the IoT DC3 original author or authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
# HTTP server - redirect to HTTPS
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name _;
|
||||
|
||||
# Security headers for HTTP
|
||||
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
||||
|
||||
# Redirect all HTTP traffic to HTTPS
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
|
||||
# HTTPS server
|
||||
server {
|
||||
listen 443 ssl;
|
||||
listen [::]:443 ssl;
|
||||
http2 on;
|
||||
server_name _;
|
||||
|
||||
# Security headers
|
||||
add_header X-Frame-Options "SAMEORIGIN" always;
|
||||
add_header X-Content-Type-Options "nosniff" always;
|
||||
add_header X-XSS-Protection "1; mode=block" always;
|
||||
add_header Referrer-Policy "no-referrer-when-downgrade" always;
|
||||
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
||||
|
||||
# SSL configuration
|
||||
ssl_prefer_server_ciphers on;
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
|
||||
ssl_certificate /etc/letsencrypt/live/dc3.site/fullchain.cer;
|
||||
ssl_certificate_key /etc/letsencrypt/live/dc3.site/dc3.site.key;
|
||||
ssl_session_timeout 1d;
|
||||
ssl_session_cache shared:SSL:10m;
|
||||
ssl_stapling on;
|
||||
ssl_stapling_verify on;
|
||||
|
||||
# OCSP stapling
|
||||
resolver 8.8.8.8 8.8.4.4 valid=300s;
|
||||
resolver_timeout 5s;
|
||||
|
||||
limit_req_status 429;
|
||||
|
||||
# Include location configurations
|
||||
include /etc/nginx/location/*.conf;
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
#
|
||||
# Copyright 2016-present the IoT DC3 original author or authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
# Static files location
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html index.htm;
|
||||
|
||||
# Cache control for static assets
|
||||
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
||||
expires 1y;
|
||||
add_header Cache-Control "public, immutable";
|
||||
}
|
||||
|
||||
# Cache control for HTML files
|
||||
location ~* \.(html|htm)$ {
|
||||
expires -1;
|
||||
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
||||
}
|
||||
}
|
||||
|
||||
# Nginx stub status for monitoring
|
||||
location /stub_status {
|
||||
stub_status on;
|
||||
access_log off;
|
||||
allow 127.0.0.1;
|
||||
deny all;
|
||||
}
|
||||
|
||||
# API proxy with rate limiting
|
||||
location ^~/api/ {
|
||||
# Apply rate limiting
|
||||
limit_req zone=api burst=20 nodelay;
|
||||
|
||||
# Proxy settings
|
||||
proxy_pass http://${APP_API_HOST}:${APP_API_PORT}/api/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
# Timeouts
|
||||
proxy_connect_timeout 60s;
|
||||
proxy_send_timeout 60s;
|
||||
proxy_read_timeout 60s;
|
||||
|
||||
# Streaming responses, such as the Agentic SSE endpoint, must flush as data arrives.
|
||||
proxy_buffering off;
|
||||
proxy_request_buffering off;
|
||||
proxy_cache off;
|
||||
proxy_buffer_size 4k;
|
||||
proxy_buffers 8 4k;
|
||||
proxy_busy_buffers_size 8k;
|
||||
}
|
||||
|
||||
# Error pages
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /usr/share/nginx/html;
|
||||
internal;
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
#
|
||||
# Copyright 2016-present the IoT DC3 original author or authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
user nginx;
|
||||
worker_processes auto;
|
||||
|
||||
# Error logging configuration
|
||||
error_log /var/log/nginx/error.log warn;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
# Events configuration
|
||||
events {
|
||||
multi_accept on;
|
||||
worker_connections 2048;
|
||||
use epoll;
|
||||
}
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
# Logging configuration
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
access_log /var/log/nginx/access.log main;
|
||||
|
||||
# Basic settings
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
keepalive_timeout 65;
|
||||
types_hash_max_size 4096;
|
||||
client_max_body_size 20m;
|
||||
server_tokens off;
|
||||
limit_req_zone $binary_remote_addr zone=api:10m rate=10r/s;
|
||||
|
||||
# Gzip compression
|
||||
gzip on;
|
||||
gzip_vary on;
|
||||
gzip_proxied any;
|
||||
gzip_comp_level 6;
|
||||
gzip_types text/plain text/css text/xml text/javascript
|
||||
application/json application/javascript application/xml+rss
|
||||
application/rss application/atom+xml image/svg+xml;
|
||||
|
||||
# SSL session cache
|
||||
ssl_session_timeout 10m;
|
||||
ssl_session_cache shared:SSL:10m;
|
||||
ssl_session_tickets off;
|
||||
|
||||
# Include additional configurations
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export const API_MCP_BASE = 'api/v3/auth/mcp';
|
||||
export const API_SERVICE_ACCOUNT_BASE = 'api/v3/auth/service_account';
|
||||
这样不太对
|
||||
@@ -0,0 +1,82 @@
|
||||
# Frontend Testing Guardrails
|
||||
|
||||
This project uses tests as guardrails for AI-assisted development. Every change
|
||||
should make the smallest safe code edit and update the test layer that protects
|
||||
the behavior being changed.
|
||||
|
||||
## Required Test Mapping
|
||||
|
||||
| Change area | Required test layer | Command |
|
||||
| ----------------------------------- | --------------------------------- | ------------------------------- |
|
||||
| `src/api/**` | API contract tests | `pnpm run test:api` |
|
||||
| `src/utils/**` | Unit tests | `pnpm run test:unit` |
|
||||
| `src/config/axios/**` | Unit tests | `pnpm run test:unit` |
|
||||
| `src/store/**` | Unit tests | `pnpm run test:unit` |
|
||||
| `src/composables/**` | Unit tests | `pnpm run test:unit` |
|
||||
| `src/components/**` | Component contract tests | `pnpm run test:component` |
|
||||
| `src/views/**` | Component or Playwright E2E tests | `pnpm run test:e2e` when routed |
|
||||
| `src/config/router/**` | Playwright route/auth smoke tests | `pnpm run test:e2e` |
|
||||
| build, lint, test, CI configuration | Guardrail tests and full quality | `pnpm run test:ci` |
|
||||
|
||||
Run `pnpm run test:impact` before finishing a feature to print the checks that
|
||||
match the current changed files.
|
||||
|
||||
## AI Change Rules
|
||||
|
||||
- Do not change production code without updating or confirming the relevant
|
||||
test layer from the mapping above.
|
||||
- Do not commit focused or disabled tests such as `test.only`, `describe.only`,
|
||||
`test.skip`, or `test.todo`.
|
||||
- Do not add a new API wrapper file unless it is included in
|
||||
`tests/api/api-contracts.test.ts`.
|
||||
- Do not use URL query strings or path interpolation inside API wrapper URLs.
|
||||
Pass dynamic values through Axios `params` or request bodies.
|
||||
- Do not add fixed production IDs to tests. Test data must be discovered or
|
||||
created at runtime.
|
||||
- Do not add new scenarios to `tests/e2e/browser-sweep.mjs`; it is a thin
|
||||
browser sweep entrypoint. Prefer Playwright specs for new browser scenarios.
|
||||
- Do not hide broken coverage by loosening thresholds without a clear reason.
|
||||
|
||||
## E2E Data Rules
|
||||
|
||||
- E2E tests must create missing data instead of skipping scenarios.
|
||||
- Runtime fixture data must use the `e2e_` prefix.
|
||||
- Data created by a test must be registered in the cleanup stack.
|
||||
- Delete checks must target disposable fixture data only.
|
||||
- Playwright tests must report console errors, page errors, and failing
|
||||
business API responses.
|
||||
|
||||
## CI Gates
|
||||
|
||||
Pull requests and pushes run the non-environment-dependent quality gate:
|
||||
|
||||
1. `pnpm run lint:check`
|
||||
2. `pnpm run type-check`
|
||||
3. `pnpm run test:guard`
|
||||
4. `pnpm run test:ci`
|
||||
5. `pnpm build`
|
||||
|
||||
Playwright E2E runs through the manual workflow when a disposable backend URL is
|
||||
provided with `e2e_base_url`.
|
||||
|
||||
## Adding New Features
|
||||
|
||||
1. Add the production code.
|
||||
2. Add or update the matching unit, component, API contract, or E2E test.
|
||||
3. Run `pnpm run test:impact` and the recommended commands.
|
||||
4. Run the full local gate for broad changes:
|
||||
|
||||
```bash
|
||||
pnpm run lint:check
|
||||
pnpm run type-check
|
||||
pnpm run test:guard
|
||||
pnpm run test:ci
|
||||
pnpm run build
|
||||
```
|
||||
|
||||
For route or page changes, also run Playwright against a disposable test
|
||||
environment:
|
||||
|
||||
```bash
|
||||
E2E_BASE_URL=http://localhost:8080 E2E_START_SERVER=0 pnpm run test:e2e
|
||||
```
|
||||