添加版权校验功能,增强应用安全性,确保版本完整性和防篡改能力。

This commit is contained in:
discountry
2025-09-26 01:12:02 +08:00
parent 8923e2d2b8
commit 38616066d5
4 changed files with 93 additions and 1 deletions
+11 -1
View File
@@ -1,8 +1,9 @@
import React, { useState } from "react";
import React, { useMemo, useState } from "react";
import { Box, Text, useInput } from "ink";
import { TrendApp } from "./TrendApp";
import { MakerApp } from "./MakerApp";
import { OffsetMakerApp } from "./OffsetMakerApp";
import { loadCopyrightFragments, verifyCopyrightIntegrity } from "../utils/copyright";
interface StrategyOption {
id: "trend" | "maker" | "offset-maker";
@@ -37,6 +38,8 @@ const inputSupported = Boolean(process.stdin && (process.stdin as any).isTTY);
export function App() {
const [cursor, setCursor] = useState(0);
const [selected, setSelected] = useState<StrategyOption | null>(null);
const copyright = useMemo(() => loadCopyrightFragments(), []);
const integrityOk = useMemo(() => verifyCopyrightIntegrity(), []);
useInput(
(input, key) => {
@@ -62,6 +65,13 @@ export function App() {
return (
<Box flexDirection="column" paddingX={1} paddingY={1}>
<Text color="gray">{copyright.bannerText}</Text>
{integrityOk ? null : (
<Text color="red">警告: 版权校验失败</Text>
)}
<Box height={1}>
<Text color="gray"></Text>
</Box>
<Text color="cyanBright"></Text>
<Text color="gray">使 / Ctrl+C 退</Text>
<Box flexDirection="column" marginTop={1}>