refactor!: rename the project from Monitor to MoShiro

Namespaces, assemblies, projects and directories, the solution, binaries,
images, systemd units, config paths, environment variables, protocol method
names, the media type and the raw chunk magic all move to MoShiro/moshiro.
Existing data and deployments are not compatible and must be recreated.
Also fix the architecture tests after the solution layout change and make
the update tests independent of their order.
This commit is contained in:
justme committed 2026-10-07 01:49:04 +08:00
1 parent 17b35223aa
commit 83e5120377
309 files changed
+1505 -1499

No files matched your search

+1 -1
View File
@@ -19,7 +19,7 @@ npm run gen:api # 后端接口变了之后,重新生成 shared/
npm run lint:css # 颜色只能写在 shared/theme/tokens.css,其他样式一律引用令牌
```
连别的后端(本机跑前端、连线上的):登录页左边选后端(这个页面自己所在的、保存过的,或者「添加后端」),右边都是用户名和密码;添加后端填地址、用户名、密码,登录成功才保存。跨域用不了 Cookie,所以登录时后端会返回会话令牌(`return_session`),前端存在浏览器里、之后每个请求带上,12 小时过期、退出登录即作废;用户看不到也不需要管它。后端需要放行这个页面的来源(`Monitor__CorsOrigins`)。展示端和管理端侧栏的插头图标是同一个切换器。
连别的后端(本机跑前端、连线上的):登录页左边选后端(这个页面自己所在的、保存过的,或者「添加后端」),右边都是用户名和密码;添加后端填地址、用户名、密码,登录成功才保存。跨域用不了 Cookie,所以登录时后端会返回会话令牌(`return_session`),前端存在浏览器里、之后每个请求带上,12 小时过期、退出登录即作废;用户看不到也不需要管它。后端需要放行这个页面的来源(`MoShiro__CorsOrigins`)。展示端和管理端侧栏的插头图标是同一个切换器。
约定:
- 展示端能拿到的主机数据只有汇总的数字(CPU、内存、磁盘占用,网卡累计流量与瞬时网速,运行时长),**没有 CPU 型号、主机名、网卡名,也没有任何 IP**——后端的公开接口不返回它们,Agent 也根本不采集。展示端不显示 Probe 的版本和来源地址(这些只在管理端)。
+1 -1
View File
@@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>MyMonitor · 管理</title>
<title>MoShiro · 管理</title>
</head>
<body>
<div id="root"></div>
+1 -1
View File
@@ -1,5 +1,5 @@
{
"name": "monitor-admin",
"name": "moshiro-admin",
"private": true,
"version": "0.1.0",
"type": "module",
+2 -2
View File
@@ -54,7 +54,7 @@ function Login() {
<form className="card login-split" onSubmit={submit}>
<aside className="login-side">
<div>
<h1>MyMonitor</h1>
<h1>MoShiro</h1>
<p className="muted">管理端</p>
</div>
<div className="src-list" role="listbox" aria-label="后端">
@@ -132,7 +132,7 @@ export function App() {
<div className="shell">
<aside className="side">
<a className="brand" href="/">
MyMonitor
MoShiro
</a>
{NAV.map((group) => (
<div key={group.section} style={{ display: 'contents' }}>
+1 -1
View File
@@ -48,7 +48,7 @@ function AddAgentDialog({ onClose, onCreated }: { onClose: () => void; onCreated
<div className="notice warn">令牌明文只显示这一次,请现在就复制。</div>
<Field label="在要加入的机器上运行">
<CommandTabs
storageKey="monitor.install_tab"
storageKey="moshiro.install_tab"
initial={guessPlatform()}
tabs={[
{ id: 'linux', label: 'Linux', command: created.install_commands.linux },
+2 -2
View File
@@ -107,8 +107,8 @@ function IdentityDialog({ identity, title, onClose }: { identity: ProbeIdentityD
</button>
<CopyButton text={json} label="复制内容" />
</div>
<Field label="在家宽机器上" hint="保存为 /etc/monitor/probe.json,然后启动 Probe;它会连接 probe.json 里的面板地址,Agent 列表和更新都由面板下发。">
<pre className="code">{`monitor-probe --config /etc/monitor/probe.json`}</pre>
<Field label="在家宽机器上" hint="保存为 /etc/moshiro/probe.json,然后启动 Probe;它会连接 probe.json 里的面板地址,Agent 列表和更新都由面板下发。">
<pre className="code">{`moshiro-probe --config /etc/moshiro/probe.json`}</pre>
</Field>
<details>
<summary className="muted" style={{ cursor: 'pointer' }}>
+4 -4
View File
@@ -3,7 +3,7 @@ import { readFileSync } from 'node:fs'
import { fileURLToPath } from 'node:url'
/**
* 前端自己的构建信息:版本取自 web/package.json,tag 和提交取自 git(环境变量 MONITOR_TAG / MONITOR_COMMIT 优先,CI 里没有 git 历史时用),
* 前端自己的构建信息:版本取自 web/package.json,tag 和提交取自 git(环境变量 MOSHIRO_TAG / MOSHIRO_COMMIT 优先,CI 里没有 git 历史时用),
* 构建时间是这次构建的时刻。开发服务器里 tag 是「dev」,免得每次刷新都变。
*/
function git(args) {
@@ -18,8 +18,8 @@ export function buildDefines(dev) {
const version = JSON.parse(readFileSync(new URL('./package.json', import.meta.url), 'utf8')).version
return {
__APP_VERSION__: JSON.stringify(version),
__APP_TAG__: JSON.stringify(dev ? 'dev' : (process.env.MONITOR_TAG || git('describe --tags --always --dirty'))),
__APP_COMMIT__: JSON.stringify(dev ? '' : (process.env.MONITOR_COMMIT || git('rev-parse --short=10 HEAD'))),
__APP_BUILT_AT__: JSON.stringify(dev ? '' : (process.env.MONITOR_BUILT_AT || new Date().toISOString())),
__APP_TAG__: JSON.stringify(dev ? 'dev' : (process.env.MOSHIRO_TAG || git('describe --tags --always --dirty'))),
__APP_COMMIT__: JSON.stringify(dev ? '' : (process.env.MOSHIRO_COMMIT || git('rev-parse --short=10 HEAD'))),
__APP_BUILT_AT__: JSON.stringify(dev ? '' : (process.env.MOSHIRO_BUILT_AT || new Date().toISOString())),
}
}
+1 -1
View File
@@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>MyMonitor</title>
<title>MoShiro</title>
</head>
<body>
<div id="root"></div>
+1 -1
View File
@@ -1,5 +1,5 @@
{
"name": "monitor-display",
"name": "moshiro-display",
"private": true,
"version": "0.1.0",
"type": "module",
+6 -6
View File
@@ -1,11 +1,11 @@
{
"name": "monitor-web",
"name": "moshiro-web",
"version": "0.1.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "monitor-web",
"name": "moshiro-web",
"version": "0.1.0",
"workspaces": [
"display",
@@ -17,7 +17,7 @@
}
},
"admin": {
"name": "monitor-admin",
"name": "moshiro-admin",
"version": "0.1.0",
"dependencies": {
"lucide-react": "^0.468.0",
@@ -37,7 +37,7 @@
}
},
"display": {
"name": "monitor-display",
"name": "moshiro-display",
"version": "0.1.0",
"dependencies": {
"lucide-react": "^0.468.0",
@@ -1695,11 +1695,11 @@
"node": ">=8.6"
}
},
"node_modules/monitor-admin": {
"node_modules/moshiro-admin": {
"resolved": "admin",
"link": true
},
"node_modules/monitor-display": {
"node_modules/moshiro-display": {
"resolved": "display",
"link": true
},
+1 -1
View File
@@ -1,5 +1,5 @@
{
"name": "monitor-web",
"name": "moshiro-web",
"private": true,
"version": "0.1.0",
"workspaces": [
+1 -1
View File
@@ -685,7 +685,7 @@ export interface paths {
path?: never;
cookie?: never;
};
/** Download a raw chunk (application/vnd.monitor.rawchunk) */
/** Download a raw chunk (application/vnd.moshiro.rawchunk) */
get: operations["raw_chunks_get"];
put?: never;
post?: never;
+3 -3
View File
@@ -1,10 +1,10 @@
/**
* 数据源:前端默认和后端同源(Cookie 会话)。也可以指到别的后端(如本机跑前端、连线上的 `https://mo.oeo.one`):
* 地址和令牌存在浏览器里(每个前端各存一份令牌),也可以用构建时的 `VITE_API_BASE` 给个默认地址。
* 跨域时不带 Cookie,只用 `Authorization: Bearer <API 令牌>`;后端要在 `Monitor__CorsOrigins` 里放行这个前端的来源。
* 跨域时不带 Cookie,只用 `Authorization: Bearer <API 令牌>`;后端要在 `MoShiro__CorsOrigins` 里放行这个前端的来源。
*/
const BASE_KEY = 'monitor.api_base'
const BASE_KEY = 'moshiro.api_base'
let app = 'app'
@@ -48,7 +48,7 @@ export interface SavedSource {
}
// v2:以前保存的是手填的管理 Token,现在是登录后拿到的会话,旧的不再使用
const listKey = () => `monitor.sources.v2.${app}`
const listKey = () => `moshiro.sources.v2.${app}`
function readList(): SavedSource[] {
try {
+2 -2
View File
@@ -65,7 +65,7 @@ export function useTheme(): [Theme, () => void] {
const next: Theme = theme === 'dark' ? 'light' : 'dark'
document.documentElement.dataset.theme = next
try {
localStorage.setItem('monitor-theme', next)
localStorage.setItem('moshiro-theme', next)
} catch {
// 存储不可用时只在本次会话生效
}
@@ -78,7 +78,7 @@ export function useTheme(): [Theme, () => void] {
export function applyStoredTheme() {
let theme: string | null = null
try {
theme = localStorage.getItem('monitor-theme')
theme = localStorage.getItem('moshiro-theme')
} catch {
// 忽略
}
+1 -1
View File
@@ -349,7 +349,7 @@ const shortHost = (base: string) => base.replace(/^https?:\/\//i, '')
/**
* 数据源:默认连这个页面所在的后端(同源);也可以保存几个别的后端(比如本机跑前端、连线上的),在列表里点一下就切换。
* 跨域时不用 Cookie,改用 API 令牌,所以每个后端各存一个令牌(只在浏览器里),后端需要放行这个页面的来源(`Monitor__CorsOrigins`)。
* 跨域时不用 Cookie,改用 API 令牌,所以每个后端各存一个令牌(只在浏览器里),后端需要放行这个页面的来源(`MoShiro__CorsOrigins`)。
*/
export function SourceButton({ variant = 'icon' }: { variant?: 'icon' | 'status' }) {
const [open, setOpen] = useState(false)