From bcfab416dd820ae9f5147d050b98e7ece4916ec4 Mon Sep 17 00:00:00 2001 From: karuo Date: Sun, 22 Feb 2026 05:25:29 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=84=20=E5=8D=A1=E8=8B=A5AI=20=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=202026-02-22=2005:25=20|=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=EF=BC=9A=E9=87=91=E4=BB=93=E3=80=81=E5=8D=A1=E6=9C=A8=E3=80=81?= =?UTF-8?q?=E6=80=BB=E7=B4=A2=E5=BC=95=E4=B8=8E=E5=85=A5=E5=8F=A3=E3=80=81?= =?UTF-8?q?=E8=BF=90=E8=90=A5=E4=B8=AD=E6=9E=A2=E5=B7=A5=E4=BD=9C=E5=8F=B0?= =?UTF-8?q?=20|=20=E6=8E=92=E9=99=A4=20>20MB:=205=20=E4=B8=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../金仓_存储备份/服务器管理/SKILL.md | 11 +- .../服务器管理/references/SSH登录方式与故障排查.md | 32 +++- .../服务器管理/scripts/宝塔_IP封禁解封与优化命令.sh | 48 ++++++ .../服务器管理/scripts/腾讯云_宝塔服务器重启.py | 145 ++++++++++++++++++ .../木叶_视频内容/Remotion程序化视频/SKILL.md | 97 ++++++++++++ .../Remotion程序化视频/参考资料/Remotion速查.md | 29 ++++ SKILL_REGISTRY.md | 3 +- 运营中枢/工作台/gitea_push_log.md | 1 + 运营中枢/工作台/代码管理.md | 1 + 9 files changed, 358 insertions(+), 9 deletions(-) create mode 100644 01_卡资(金)/金仓_存储备份/服务器管理/scripts/宝塔_IP封禁解封与优化命令.sh create mode 100644 01_卡资(金)/金仓_存储备份/服务器管理/scripts/腾讯云_宝塔服务器重启.py create mode 100644 03_卡木(木)/木叶_视频内容/Remotion程序化视频/SKILL.md create mode 100644 03_卡木(木)/木叶_视频内容/Remotion程序化视频/参考资料/Remotion速查.md diff --git a/01_卡资(金)/金仓_存储备份/服务器管理/SKILL.md b/01_卡资(金)/金仓_存储备份/服务器管理/SKILL.md index 35a17fb2..4344a4b9 100644 --- a/01_卡资(金)/金仓_存储备份/服务器管理/SKILL.md +++ b/01_卡资(金)/金仓_存储备份/服务器管理/SKILL.md @@ -51,7 +51,7 @@ kr宝塔: qcWubCdlfFjS2b2DMT1lzPFaDfmv1cBT ### 强制规则(每次执行必守) -1. **SSH 统一配置**:三台宝塔一律用端口 **22022**、账号 **ckb**、密码 **zhiqun1984**;直接连接,无需密钥。 +1. **SSH 统一配置**:账号 **root**、密码 **Zhiqun1984**(Z 大写),端口 22022 或 22;或使用 id_ed25519 密钥。详见 `references/SSH登录方式与故障排查.md`。 2. **经验沉淀**:每次涉及服务器/宝塔/部署的操作结束后,必须把经验写入 `02_卡人(水)/水溪_整理归档/经验库/待沉淀/`,防止同类问题重复出现。 3. **Skill 迭代**:每次有新的配置、教训、流程变更时,必须同步更新本 SKILL.md 或 references,保证下次调用时信息一致。 4. **卡若AI 复盘**:每次任务结束必须用卡若AI 复盘格式收尾(目标·结果·达成率、过程、反思、总结、下一步)。 @@ -75,6 +75,15 @@ kr宝塔: qcWubCdlfFjS2b2DMT1lzPFaDfmv1cBT python3 "/Users/karuo/Documents/个人/卡若AI/01_卡资(金)/金仓_存储备份/服务器管理/脚本/快速检查服务器.py" ``` +### 1.0a 腾讯云 API 重启宝塔 + IP 封禁处理 + +```bash +# 重启存客宝、kr宝塔(会解除 fail2ban 内存封禁) +python3 "01_卡资(金)/金仓_存储备份/服务器管理/scripts/腾讯云_宝塔服务器重启.py" +``` + +IP 解封:见 `references/SSH登录方式与故障排查.md` § 六。优化单行:`IP="公网IP"; for j in sshd ssh-iptables; do fail2ban-client set "$j" unbanip "$IP" 2>/dev/null; done` + ### 1.1 磁盘臃肿 · 全方位检查与清理(SSH/API 不可用时) 当 SSH 或宝塔 API 无法远程连接时,在**宝塔面板 → 终端**执行: diff --git a/01_卡资(金)/金仓_存储备份/服务器管理/references/SSH登录方式与故障排查.md b/01_卡资(金)/金仓_存储备份/服务器管理/references/SSH登录方式与故障排查.md index 27428a0e..752dd6dd 100644 --- a/01_卡资(金)/金仓_存储备份/服务器管理/references/SSH登录方式与故障排查.md +++ b/01_卡资(金)/金仓_存储备份/服务器管理/references/SSH登录方式与故障排查.md @@ -103,14 +103,32 @@ bash "01_卡资(金)/金仓_存储备份/服务器管理/scripts/kr宝塔_SS "01_卡资(金)/金仓_存储备份/服务器管理/scripts/kr宝塔_node项目批量修复.py" ``` -## 六、服务器端可做(解除限流) +## 六、IP 封禁处理(多方案 + 优化命令) -若本机被 fail2ban 封禁,可在**宝塔面板 → 终端**或 VNC 执行: +### 6.1 腾讯云 API 重启(解除 fail2ban 内存封禁) + +重启会清空 fail2ban 等进程内存,封禁自动解除。本机执行: ```bash -# 查看是否被 ban -fail2ban-client status sshd - -# 解封本机 IP(将 211.156.92.72 换成你的公网 IP) -fail2ban-client set sshd unbanip 211.156.92.72 +python3 "01_卡资(金)/金仓_存储备份/服务器管理/scripts/腾讯云_宝塔服务器重启.py" ``` + +### 6.2 宝塔终端解封(SSH 不可用时用面板终端) + +在**宝塔面板 → 终端**粘贴执行。将 `你的公网IP` 替换为本机公网 IP(如 211.156.92.72,可从 https://ip.sb 或本机 `curl ifconfig.me` 获取): + +**优化单行(同时解封 sshd + ssh-iptables):** + +```bash +IP="你的公网IP"; for j in sshd ssh-iptables; do fail2ban-client set "$j" unbanip "$IP" 2>/dev/null && echo "✅ $j 已解封 $IP"; done +``` + +**分步执行:** + +```bash +fail2ban-client status sshd +fail2ban-client set sshd unbanip 你的公网IP +fail2ban-client set ssh-iptables unbanip 你的公网IP +``` + +**一键脚本**:`scripts/宝塔_IP封禁解封与优化命令.sh`,在服务器上执行 `bash 脚本路径 你的公网IP` diff --git a/01_卡资(金)/金仓_存储备份/服务器管理/scripts/宝塔_IP封禁解封与优化命令.sh b/01_卡资(金)/金仓_存储备份/服务器管理/scripts/宝塔_IP封禁解封与优化命令.sh new file mode 100644 index 00000000..5d850543 --- /dev/null +++ b/01_卡资(金)/金仓_存储备份/服务器管理/scripts/宝塔_IP封禁解封与优化命令.sh @@ -0,0 +1,48 @@ +#!/bin/bash +# 宝塔服务器 IP 封禁解封 · 多方案 + 优化命令 +# 用法:在宝塔面板【终端】粘贴执行;或 SSH 登录后执行 +# 本机公网 IP:用 curl ifconfig.me 获取,或替换下面的 MY_IP + +MY_IP="${1:-$(curl -s --connect-timeout 3 ifconfig.me 2>/dev/null || echo '211.156.92.72')}" + +echo "========== 宝塔 IP 封禁解封(本机 IP: $MY_IP)==========" + +# 1. 检查 fail2ban 状态 +echo "" +echo "[1] fail2ban 状态" +if command -v fail2ban-client &>/dev/null; then + fail2ban-client status sshd 2>/dev/null || echo " sshd jail 未启用或无" + fail2ban-client status 2>/dev/null | head -20 +else + echo " fail2ban 未安装" +fi + +# 2. 解封本机 IP +echo "" +echo "[2] 解封本机 IP: $MY_IP" +if command -v fail2ban-client &>/dev/null; then + for jail in sshd ssh-iptables; do + if fail2ban-client status "$jail" &>/dev/null; then + fail2ban-client set "$jail" unbanip "$MY_IP" 2>/dev/null && echo " ✅ $jail 已解封 $MY_IP" || echo " ⚠️ $jail 解封失败或未封" + fi + done +else + echo " 需先安装 fail2ban: apt install fail2ban -y" +fi + +# 3. 宝塔防火墙(若启用) +echo "" +echo "[3] 宝塔防火墙封禁检查" +if [ -x /usr/bin/bt ]; then + /usr/bin/bt 14 2>/dev/null | grep -E "$MY_IP|封禁" | head -5 || true + echo " 若本机 IP 在封禁列表,请到面板【安全】→【系统防火墙】解除" +fi + +# 4. iptables 直查(如有) +echo "" +echo "[4] iptables 含 DROP/REJECT 的规则数" +iptables -L -n 2>/dev/null | grep -c -E "DROP|REJECT" || echo " 0 或无权限" + +echo "" +echo "========== 完成 ==========" +echo "建议:重启服务器可清空 fail2ban 内存封禁;或仅解封后等 10 分钟再试 SSH" diff --git a/01_卡资(金)/金仓_存储备份/服务器管理/scripts/腾讯云_宝塔服务器重启.py b/01_卡资(金)/金仓_存储备份/服务器管理/scripts/腾讯云_宝塔服务器重启.py new file mode 100644 index 00000000..2725b634 --- /dev/null +++ b/01_卡资(金)/金仓_存储备份/服务器管理/scripts/腾讯云_宝塔服务器重启.py @@ -0,0 +1,145 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +腾讯云 API 重启两台宝塔服务器(存客宝、kr宝塔) +凭证:环境变量 TENCENTCLOUD_SECRET_ID/SECRET_KEY,或 00_账号与API索引.md +依赖:pip install tencentcloud-sdk-python-common tencentcloud-sdk-python-cvm +""" +import os +import re +import sys +import time + +# 两台宝塔公网 IP +SERVERS = [ + {"name": "存客宝", "ip": "42.194.245.239"}, + {"name": "kr宝塔", "ip": "43.139.27.93"}, +] +REGIONS = ["ap-guangzhou", "ap-beijing", "ap-shanghai", "ap-chengdu"] + + +def _find_karuo_ai_root(): + d = os.path.dirname(os.path.abspath(__file__)) + for _ in range(6): + if os.path.basename(d) == "卡若AI" or (os.path.isdir(os.path.join(d, "运营中枢")) and os.path.isdir(os.path.join(d, "01_卡资(金)"))): + return d + d = os.path.dirname(d) + return None + + +def _read_creds(): + root = _find_karuo_ai_root() + if not root: + return None, None + path = os.path.join(root, "运营中枢", "工作台", "00_账号与API索引.md") + if not os.path.isfile(path): + return None, None + with open(path, "r", encoding="utf-8") as f: + text = f.read() + secret_id = secret_key = None + in_tencent = False + for line in text.splitlines(): + if "### 腾讯云" in line: + in_tencent = True + continue + if in_tencent and line.strip().startswith("###"): + break + if not in_tencent: + continue + m = re.search(r"\|\s*[^|]*(?:SecretId|密钥)[^|]*\|\s*`([^`]+)`", line, re.I) + if m: + val = m.group(1).strip() + if val.startswith("AKID"): + secret_id = val + m = re.search(r"\|\s*SecretKey\s*\|\s*`([^`]+)`", line, re.I) + if m: + secret_key = m.group(1).strip() + return secret_id or None, secret_key or None + + +def main(): + secret_id = os.environ.get("TENCENTCLOUD_SECRET_ID") + secret_key = os.environ.get("TENCENTCLOUD_SECRET_KEY") + if not secret_id or not secret_key: + sid, skey = _read_creds() + secret_id = secret_id or sid + secret_key = secret_key or skey + if not secret_id or not secret_key: + print("❌ 未配置腾讯云 SecretId/SecretKey(环境变量或 00_账号与API索引.md)") + return 1 + + try: + from tencentcloud.common import credential + from tencentcloud.common.profile.client_profile import ClientProfile + from tencentcloud.cvm.v20170312 import cvm_client, models as cvm_models + except ImportError: + print("请安装: pip install tencentcloud-sdk-python-common tencentcloud-sdk-python-cvm") + return 1 + + cred = credential.Credential(secret_id, secret_key) + to_reboot = [] # [(instance_id, region, name, ip), ...] + + print("=" * 60) + print(" 腾讯云 API · 查找并重启宝塔服务器") + print("=" * 60) + + for srv in SERVERS: + name, ip = srv["name"], srv["ip"] + found = False + for region in REGIONS: + try: + client = cvm_client.CvmClient(cred, region) + req = cvm_models.DescribeInstancesRequest() + req.Limit = 100 + req.Offset = 0 + resp = client.DescribeInstances(req) + instances = getattr(resp, "InstanceSet", None) or [] + for ins in instances: + pub = list(getattr(ins, "PublicIpAddresses", None) or []) + if ip in pub: + iid = getattr(ins, "InstanceId", None) + state = getattr(ins, "InstanceState", "") + print("\n[1/3] 找到 %s %s → 实例 %s 地域 %s 状态 %s" % (name, ip, iid, region, state)) + to_reboot.append((iid, region, name, ip)) + found = True + break + except Exception as e: + continue + if found: + break + if not found: + print("\n⚠️ %s %s 未在腾讯云 CVM 中找到(可能为轻量或其它地域)" % (name, ip)) + + if not to_reboot: + print("\n❌ 无可用实例,退出") + return 1 + + # 按地域分组执行重启 + print("\n" + "=" * 60) + print(" [2/3] 执行重启") + print("=" * 60) + + for iid, region, name, ip in to_reboot: + try: + client = cvm_client.CvmClient(cred, region) + req = cvm_models.RebootInstancesRequest() + req.InstanceIds = [iid] + req.StopType = "SOFT" # 软重启 + resp = client.RebootInstances(req) + print(" ✅ %s (%s) 重启指令已下发" % (name, ip)) + except Exception as e: + print(" ❌ %s (%s) 重启失败: %s" % (name, ip, e)) + + print("\n" + "=" * 60) + print(" [3/3] 重启进度说明") + print("=" * 60) + print(" · 腾讯云 CVM 软重启约 1~3 分钟完成") + print(" · 重启会解除 fail2ban 等内存中的封禁(因进程重启)") + print(" · 建议等待 2~3 分钟后用 SSH 或宝塔面板测试") + print(" · 若仍需解封 IP,在宝塔终端执行下方「IP 解封」命令") + print("=" * 60) + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/03_卡木(木)/木叶_视频内容/Remotion程序化视频/SKILL.md b/03_卡木(木)/木叶_视频内容/Remotion程序化视频/SKILL.md new file mode 100644 index 00000000..9715a276 --- /dev/null +++ b/03_卡木(木)/木叶_视频内容/Remotion程序化视频/SKILL.md @@ -0,0 +1,97 @@ +--- +name: Remotion程序化视频 +description: 用 React 程序化生成视频,支持数据驱动、批量、模板化视频与动效。基于 remotion-dev/remotion。 +group: 木 +triggers: Remotion、程序化视频、React视频、批量生成视频、数据驱动视频、动效模板 +owner: 木叶 +version: "1.0" +updated: "2026-02-17" +--- + +# Remotion 程序化视频 + +## 能做什么(Capabilities) + +- **用 React 写视频**:用 CSS/Canvas/SVG/WebGL 定义每一帧 +- **数据驱动**:变量、API、算法驱动画面变化 +- **批量生成**:同一模板批量产出(邀请函、封面、通知等) +- **动效包装**:片头、转场、图形动画 +- **与切片协同**:切片产出 + Remotion 包装/合成 + +## 怎么用(Usage) + +触发词:**Remotion**、**程序化视频**、**React视频**、**批量生成视频**、**数据驱动视频**、**动效模板** + +## 核心概念速查 + +| 术语 | 含义 | +|:---|:---| +| **Composition** | 视频场景,定义宽高、时长、fps | +| **useCurrentFrame()** | 当前帧号,驱动逐帧动画 | +| **interpolate()** | 帧间数值插值 | +| **Remotion Studio** | 本地预览界面 | +| **Remotion Player** | 浏览器嵌入播放器 | + +## 一键开始 + +```bash +npx create-video@latest +``` + +选模板后: + +```bash +npm run dev # 启动 Remotion Studio 预览 +npx remotion render # CLI 渲染 +``` + +## 主要包(npm) + +| 包名 | 用途 | +|:---|:---| +| `remotion` | 核心 API | +| `@remotion/player` | 浏览器播放 | +| `@remotion/renderer` | Node 渲染 | +| `@remotion/lambda` | AWS Lambda 云端渲染 | +| `@remotion/three` | 3D 视频 | +| `@remotion/lottie` | Lottie 动画 | +| `@remotion/captions` | 字幕 | +| `@remotion/tailwind` | TailwindCSS | + +## 常用模板 + +| 模板 | 用途 | +|:---|:---| +| Hello World | 入门 | +| Audiogram | 音频波形可视化 | +| TikTok | 竖屏短视频 | +| Three | 3D | +| Prompt to Video / Motion | AI 文本→视频/动效 | +| TTS Azure / Google | 语音合成 | +| Music Visualization | 音乐可视化 | + +## 渲染方式 + +| 方式 | 命令/说明 | +|:---|:---| +| 本地 CLI | `npx remotion render` | +| Node 程序 | 使用 `@remotion/renderer` | +| AWS Lambda | 大规模并发 | +| GitHub Actions | CI 内渲染 | +| Vercel | 有专门模板 | + +输出:MP4、图片序列、音频、单帧图。 + +## 相关文件 + +- 参考资料:`参考资料/Remotion速查.md` +- 官方文档:https://www.remotion.dev/docs +- API:https://www.remotion.dev/api +- 仓库:https://github.com/remotion-dev/remotion +- 许可:特殊许可,商用可能需公司授权 + +## 依赖(Dependencies) + +- Node 16+ 或 Bun 1.0.3+ +- React +- 前置技能:可与「视频切片」配合使用(切片 → Remotion 包装) diff --git a/03_卡木(木)/木叶_视频内容/Remotion程序化视频/参考资料/Remotion速查.md b/03_卡木(木)/木叶_视频内容/Remotion程序化视频/参考资料/Remotion速查.md new file mode 100644 index 00000000..1a1897d7 --- /dev/null +++ b/03_卡木(木)/木叶_视频内容/Remotion程序化视频/参考资料/Remotion速查.md @@ -0,0 +1,29 @@ +# Remotion 速查 + +> 来源:remotion-dev/remotion | Stars 37k+ + +## 快速命令 + +```bash +npx create-video@latest +npm run dev +npx remotion render +``` + +## 核心 API + +```tsx +import { useCurrentFrame, interpolate, Composition, Sequence } from 'remotion'; + +// 当前帧号(0-based) +const frame = useCurrentFrame(); + +// 插值:帧 [0,30] → 值 [0,100] +const opacity = interpolate(frame, [0, 30], [0, 1]); +``` + +## 与视频切片协同 + +1. **视频切片**:长视频 → 转录 → 切片 → 字幕烧录 +2. **Remotion**:片头/片尾包装、数据可视化、批量封面 +3. 可把切片产物作为 Remotion 的媒体素材输入 diff --git a/SKILL_REGISTRY.md b/SKILL_REGISTRY.md index e096dc09..898add91 100644 --- a/SKILL_REGISTRY.md +++ b/SKILL_REGISTRY.md @@ -1,7 +1,7 @@ # 卡若AI 技能注册表(Skill Registry) > **一张表查所有技能**。任何 AI 拿到这张表,就能按关键词找到对应技能的 SKILL.md 路径并执行。 -> 47 技能 | 14 成员 | 5 负责人 +> 48 技能 | 14 成员 | 5 负责人 > 版本:5.0 | 更新:2026-02-16 --- @@ -63,6 +63,7 @@ | M03 | 项目生成 | 木果 | 生成项目、五行模板 | `03_卡木(木)/木果_项目模板/项目生成/SKILL.md` | 按五行模板生成新项目 | | M04 | 开发模板 | 木果 | 创建项目、初始化模板 | `03_卡木(木)/木果_项目模板/开发模板/SKILL.md` | 前后端项目模板库 | | M05 | 个人档案生成器 | 木果 | 个人档案、档案生成 | `03_卡木(木)/木果_项目模板/个人档案生成器/SKILL.md` | 自动生成个人介绍档案 | +| M06 | Remotion程序化视频 | 木叶 | **Remotion、程序化视频、React视频、批量生成视频、数据驱动视频、动效模板** | `03_卡木(木)/木叶_视频内容/Remotion程序化视频/SKILL.md` | 用 React 程序化生成视频,数据驱动、批量、动效 | ## 火组 · 卡火(技术研发优化) diff --git a/运营中枢/工作台/gitea_push_log.md b/运营中枢/工作台/gitea_push_log.md index 46c1c8cb..1fee974a 100644 --- a/运营中枢/工作台/gitea_push_log.md +++ b/运营中枢/工作台/gitea_push_log.md @@ -48,3 +48,4 @@ | 2026-02-21 20:30:50 | 🔄 卡若AI 同步 2026-02-21 20:30 | 更新:金仓、水溪整理归档、运营中枢工作台 | 排除 >20MB: 5 个 | | 2026-02-21 21:06:44 | 🔄 卡若AI 同步 2026-02-21 21:06 | 更新:金仓、运营中枢工作台 | 排除 >20MB: 5 个 | | 2026-02-22 05:04:01 | 🔄 卡若AI 同步 2026-02-22 05:03 | 更新:金仓、运营中枢工作台 | 排除 >20MB: 5 个 | +| 2026-02-22 05:11:04 | 🔄 卡若AI 同步 2026-02-22 05:11 | 更新:金仓、水溪整理归档、运营中枢工作台 | 排除 >20MB: 5 个 | diff --git a/运营中枢/工作台/代码管理.md b/运营中枢/工作台/代码管理.md index d7c5344b..97300365 100644 --- a/运营中枢/工作台/代码管理.md +++ b/运营中枢/工作台/代码管理.md @@ -51,3 +51,4 @@ | 2026-02-21 20:30:50 | 成功 | 成功 | 🔄 卡若AI 同步 2026-02-21 20:30 | 更新:金仓、水溪整理归档、运营中枢工作台 | 排除 >20MB: 5 个 | [仓库](http://open.quwanzhi.com:3000/fnvtk/karuo-ai) [百科](http://open.quwanzhi.com:3000/fnvtk/karuo-ai/wiki) | | 2026-02-21 21:06:44 | 成功 | 成功 | 🔄 卡若AI 同步 2026-02-21 21:06 | 更新:金仓、运营中枢工作台 | 排除 >20MB: 5 个 | [仓库](http://open.quwanzhi.com:3000/fnvtk/karuo-ai) [百科](http://open.quwanzhi.com:3000/fnvtk/karuo-ai/wiki) | | 2026-02-22 05:04:01 | 成功 | 成功 | 🔄 卡若AI 同步 2026-02-22 05:03 | 更新:金仓、运营中枢工作台 | 排除 >20MB: 5 个 | [仓库](http://open.quwanzhi.com:3000/fnvtk/karuo-ai) [百科](http://open.quwanzhi.com:3000/fnvtk/karuo-ai/wiki) | +| 2026-02-22 05:11:04 | 成功 | 成功 | 🔄 卡若AI 同步 2026-02-22 05:11 | 更新:金仓、水溪整理归档、运营中枢工作台 | 排除 >20MB: 5 个 | [仓库](http://open.quwanzhi.com:3000/fnvtk/karuo-ai) [百科](http://open.quwanzhi.com:3000/fnvtk/karuo-ai/wiki) |