koishi-plugin-adapter-onebot-multi 0.0.4 → 0.0.6

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.
@@ -0,0 +1,7 @@
1
+ <template>
2
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
3
+ <rect x="2" y="4" width="20" height="18" rx="3"/>
4
+ <circle cx="8" cy="13" r="2.5"/>
5
+ <circle cx="16" cy="13" r="2.5"/>
6
+ </svg>
7
+ </template>
@@ -0,0 +1,15 @@
1
+ import { Context, icons } from '@koishijs/client'
2
+ import Page from './page.vue'
3
+ import BotIcon from './icons/bot.vue'
4
+
5
+ icons.register('activity:onebot-multi', BotIcon)
6
+
7
+ export default (ctx: Context) => {
8
+ ctx.page({
9
+ name: 'OneBot Multi',
10
+ path: '/onebot-multi',
11
+ component: Page,
12
+ icon: 'activity:onebot-multi',
13
+ order: 600,
14
+ })
15
+ }
@@ -0,0 +1,99 @@
1
+ <template>
2
+ <k-layout>
3
+ <div v-if="loading" class="loading-state">
4
+ <span>加载中...</span>
5
+ </div>
6
+ <div v-else-if="!panelEnabled" class="disabled-state">
7
+ <h2>面板未启用</h2>
8
+ <p>请在插件配置中启用「展示面板」功能</p>
9
+ </div>
10
+ <iframe
11
+ v-else
12
+ :src="adminUrl"
13
+ class="admin-iframe"
14
+ />
15
+ </k-layout>
16
+ </template>
17
+
18
+ <script lang="ts" setup>
19
+ import { ref, computed, onMounted } from 'vue'
20
+ import { send } from '@koishijs/client'
21
+
22
+ interface PanelConfig {
23
+ basePath: string
24
+ enabled: boolean
25
+ }
26
+
27
+ const loading = ref(true)
28
+ const panelConfig = ref<PanelConfig | null>(null)
29
+
30
+ const panelEnabled = computed(() => panelConfig.value?.enabled ?? false)
31
+
32
+ // 构建管理面板 URL(同源,使用当前页面的 origin)
33
+ const adminUrl = computed(() => {
34
+ if (!panelConfig.value) return ''
35
+ const { basePath } = panelConfig.value
36
+ return `${basePath}/admin`
37
+ })
38
+
39
+ onMounted(async () => {
40
+ try {
41
+ panelConfig.value = await (send as any)('onebot-multi/config')
42
+ } catch (e) {
43
+ console.error('Failed to get panel config:', e)
44
+ } finally {
45
+ loading.value = false
46
+ }
47
+ })
48
+ </script>
49
+
50
+ <style scoped lang="scss">
51
+ /* 去除 k-layout 所有默认样式,让 iframe 完全填充 */
52
+ :deep(.k-layout) {
53
+ background: transparent !important;
54
+ padding: 0 !important;
55
+ margin: 0 !important;
56
+ }
57
+
58
+ :deep(.k-layout__main) {
59
+ background: transparent !important;
60
+ padding: 0 !important;
61
+ margin: 0 !important;
62
+ overflow: hidden !important;
63
+ }
64
+
65
+ :deep(.k-layout__header) {
66
+ display: none !important;
67
+ }
68
+
69
+ :deep(.k-layout__left),
70
+ :deep(.k-layout__right) {
71
+ display: none !important;
72
+ }
73
+
74
+ .admin-iframe {
75
+ width: 100%;
76
+ height: 100%;
77
+ border: none;
78
+ display: block;
79
+ }
80
+
81
+ .loading-state,
82
+ .disabled-state {
83
+ display: flex;
84
+ flex-direction: column;
85
+ align-items: center;
86
+ justify-content: center;
87
+ height: 100%;
88
+ color: var(--k-text-light);
89
+ }
90
+
91
+ .disabled-state h2 {
92
+ margin-bottom: 0.5rem;
93
+ color: var(--k-text-dark);
94
+ }
95
+
96
+ .disabled-state p {
97
+ color: var(--k-text-light);
98
+ }
99
+ </style>
@@ -0,0 +1,23 @@
1
+ {
2
+ "compilerOptions": {
3
+ "rootDir": "..",
4
+ "target": "es2022",
5
+ "module": "esnext",
6
+ "declaration": true,
7
+ "jsx": "preserve",
8
+ "noEmit": true,
9
+ "composite": true,
10
+ "incremental": true,
11
+ "skipLibCheck": true,
12
+ "esModuleInterop": true,
13
+ "moduleResolution": "bundler",
14
+ "strictBindCallApply": true,
15
+ "types": [
16
+ "@koishijs/client/global"
17
+ ]
18
+ },
19
+ "include": [
20
+ ".",
21
+ "../src"
22
+ ]
23
+ }
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ import{send as p,icons as f}from"@koishijs/client";import{defineComponent as v,ref as u,computed as d,onMounted as g,resolveComponent as y,createBlock as k,openBlock as r,withCtx as x,createElementBlock as a,createElementVNode as l}from"vue";const h={key:0,class:"loading-state"},w={key:1,class:"disabled-state"},b=["src"],B=v({__name:"page",setup(o){const e=u(true),t=u(null),c=d(()=>{var n;return((n=t.value)==null?void 0:n.enabled)??false}),i=d(()=>{if(!t.value)return"";const{basePath:n}=t.value;return`${n}/admin`});return g(async()=>{try{t.value=await p("onebot-multi/config")}catch(n){console.error("Failed to get panel config:",n)}finally{e.value=false}}),(n,s)=>{const m=y("k-layout");return r(),k(m,null,{default:x(()=>[e.value?(r(),a("div",h,[...s[0]||(s[0]=[l("span",null,"加载中...",-1)])])):c.value?(r(),a("iframe",{key:2,src:i.value,class:"admin-iframe"},null,8,b)):(r(),a("div",w,[...s[1]||(s[1]=[l("h2",null,"面板未启用",-1),l("p",null,"请在插件配置中启用「展示面板」功能",-1)])]))]),_:1})}}}),_=(o,e)=>{const t=o.__vccOpts||o;for(const[c,i]of e)t[c]=i;return t},C=_(B,[["__scopeId","data-v-c08a2848"]]),E={},$={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function I(o,e){return r(),a("svg",$,[...e[0]||(e[0]=[l("rect",{x:"2",y:"4",width:"20",height:"18",rx:"3"},null,-1),l("circle",{cx:"8",cy:"13",r:"2.5"},null,-1),l("circle",{cx:"16",cy:"13",r:"2.5"},null,-1)])])}const M=_(E,[["render",I]]);f.register("activity:onebot-multi",M);const j=o=>{o.page({name:"OneBot Multi",path:"/onebot-multi",component:C,icon:"activity:onebot-multi",order:600})};export{j as default};
package/dist/style.css ADDED
@@ -0,0 +1 @@
1
+ @charset "UTF-8";[data-v-c08a2848] .k-layout{background:transparent!important;padding:0!important;margin:0!important}[data-v-c08a2848] .k-layout__main{background:transparent!important;padding:0!important;margin:0!important;overflow:hidden!important}[data-v-c08a2848] .k-layout__header,[data-v-c08a2848] .k-layout__left,[data-v-c08a2848] .k-layout__right{display:none!important}.admin-iframe[data-v-c08a2848]{width:100%;height:100%;border:none;display:block}.loading-state[data-v-c08a2848],.disabled-state[data-v-c08a2848]{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;color:var(--k-text-light)}.disabled-state h2[data-v-c08a2848]{margin-bottom:.5rem;color:var(--k-text-dark)}.disabled-state p[data-v-c08a2848]{color:var(--k-text-light)}
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "koishi-plugin-adapter-onebot-multi",
3
3
  "description": "奶龙bot定制版onebot适配器,支持自动负载均衡,适配器级黑名单/白名单,提供webui,可指定端口",
4
- "version": "0.0.4",
4
+ "version": "0.0.6",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [
8
8
  "lib",
9
- "dist"
9
+ "dist",
10
+ "client"
10
11
  ],
11
12
  "license": "MIT",
12
13
  "keywords": [
@@ -34,12 +35,15 @@
34
35
  "optional": [
35
36
  "console"
36
37
  ]
37
- }
38
+ },
39
+ "browser": true
38
40
  },
39
41
  "peerDependencies": {
42
+ "@koishijs/plugin-console": "^5.30.0",
40
43
  "koishi": "^4.18.6"
41
44
  },
42
45
  "devDependencies": {
46
+ "@koishijs/client": "^5.30.0",
43
47
  "@koishijs/plugin-console": "^5.30.8",
44
48
  "@koishijs/plugin-server": "^3.2.4",
45
49
  "@types/koa": "^2.15.0",