@ywfe/openclaw-plugin-caryscloud-im 0.0.12 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/install.sh +51 -16
- package/package.json +1 -1
package/README.md
CHANGED
package/install.sh
CHANGED
|
@@ -31,6 +31,7 @@ print_step() {
|
|
|
31
31
|
|
|
32
32
|
PLUGIN_NAME="@ywfe/openclaw-plugin-caryscloud-im"
|
|
33
33
|
PLUGIN_ID="openclaw-plugin-caryscloud-im"
|
|
34
|
+
OPENCLAW_CONFIG_FILE="$HOME/.openclaw/openclaw.json"
|
|
34
35
|
|
|
35
36
|
echo ""
|
|
36
37
|
print_info "OpenClaw CarysCloud IM Plugin 一键安装"
|
|
@@ -45,33 +46,43 @@ fi
|
|
|
45
46
|
print_success "找到 OpenClaw CLI"
|
|
46
47
|
echo ""
|
|
47
48
|
|
|
48
|
-
print_step "
|
|
49
|
-
if
|
|
50
|
-
|
|
51
|
-
openclaw plugins uninstall "$PLUGIN_ID" || true
|
|
52
|
-
|
|
53
|
-
OPENCLAW_CONFIG_FILE="$HOME/.openclaw/openclaw.json"
|
|
54
|
-
if [ -f "$OPENCLAW_CONFIG_FILE" ]; then
|
|
55
|
-
print_step "清理旧的频道配置..."
|
|
56
|
-
node -e "
|
|
49
|
+
print_step "清理无效的插件配置..."
|
|
50
|
+
if [ -f "$OPENCLAW_CONFIG_FILE" ]; then
|
|
51
|
+
node -e "
|
|
57
52
|
const fs = require('fs');
|
|
58
53
|
const configFile = '$OPENCLAW_CONFIG_FILE';
|
|
59
54
|
try {
|
|
60
55
|
const content = fs.readFileSync(configFile, 'utf8');
|
|
61
56
|
const config = JSON.parse(content);
|
|
57
|
+
|
|
58
|
+
// 清理无效的 plugins.allow
|
|
59
|
+
if (config.plugins && config.plugins.allow) {
|
|
60
|
+
const idx = config.plugins.allow.indexOf('$PLUGIN_ID');
|
|
61
|
+
if (idx > -1) {
|
|
62
|
+
config.plugins.allow.splice(idx, 1);
|
|
63
|
+
console.log('已从 plugins.allow 中移除 $PLUGIN_ID');
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// 清理频道配置
|
|
62
68
|
if (config.channels && config.channels['caryscloud-im']) {
|
|
63
69
|
delete config.channels['caryscloud-im'];
|
|
64
|
-
fs.writeFileSync(configFile, JSON.stringify(config, null, 2));
|
|
65
70
|
console.log('已删除旧的 caryscloud-im 频道配置');
|
|
66
71
|
}
|
|
72
|
+
|
|
73
|
+
fs.writeFileSync(configFile, JSON.stringify(config, null, 2));
|
|
74
|
+
console.log('配置清理完成');
|
|
67
75
|
} catch (e) {
|
|
68
|
-
console.error('
|
|
76
|
+
console.error('配置清理失败:', e.message);
|
|
69
77
|
}
|
|
70
78
|
"
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
79
|
+
fi
|
|
80
|
+
|
|
81
|
+
PLUGIN_DIR="$HOME/.openclaw/extensions/openclaw-plugin-caryscloud-im"
|
|
82
|
+
if [ -d "$PLUGIN_DIR" ]; then
|
|
83
|
+
print_step "删除旧的插件目录..."
|
|
84
|
+
rm -rf "$PLUGIN_DIR"
|
|
85
|
+
print_success "已删除旧的插件目录"
|
|
75
86
|
fi
|
|
76
87
|
|
|
77
88
|
print_step "安装插件: $PLUGIN_NAME"
|
|
@@ -84,11 +95,35 @@ if [ $INSTALL_EXIT_CODE -eq 0 ]; then
|
|
|
84
95
|
print_success "插件安装成功!"
|
|
85
96
|
echo ""
|
|
86
97
|
|
|
98
|
+
print_step "配置 OpenClaw 允许加载插件..."
|
|
99
|
+
node -e "
|
|
100
|
+
const fs = require('fs');
|
|
101
|
+
const configFile = '$HOME/.openclaw/openclaw.json';
|
|
102
|
+
try {
|
|
103
|
+
const content = fs.readFileSync(configFile, 'utf8');
|
|
104
|
+
const config = JSON.parse(content);
|
|
105
|
+
if (!config.plugins) config.plugins = {};
|
|
106
|
+
if (!config.plugins.allow) config.plugins.allow = [];
|
|
107
|
+
if (!config.plugins.allow.includes('$PLUGIN_ID')) {
|
|
108
|
+
config.plugins.allow.push('$PLUGIN_ID');
|
|
109
|
+
}
|
|
110
|
+
fs.writeFileSync(configFile, JSON.stringify(config, null, 2));
|
|
111
|
+
console.log('已添加插件到允许列表');
|
|
112
|
+
} catch (e) {
|
|
113
|
+
console.error('配置失败:', e.message);
|
|
114
|
+
}
|
|
115
|
+
"
|
|
116
|
+
echo ""
|
|
117
|
+
|
|
87
118
|
print_step "启动频道配置向导..."
|
|
88
119
|
echo ""
|
|
89
120
|
sleep 1
|
|
90
121
|
|
|
91
|
-
|
|
122
|
+
if [ -t 0 ]; then
|
|
123
|
+
openclaw channels add
|
|
124
|
+
else
|
|
125
|
+
openclaw channels add < /dev/tty
|
|
126
|
+
fi
|
|
92
127
|
|
|
93
128
|
echo ""
|
|
94
129
|
print_success "=========================================="
|