koishi-plugin-adapter-onebot-multi 0.0.7 → 0.0.9

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/client/page.vue CHANGED
@@ -22,6 +22,7 @@ import { send } from '@koishijs/client'
22
22
  interface PanelConfig {
23
23
  basePath: string
24
24
  enabled: boolean
25
+ port: number | null
25
26
  }
26
27
 
27
28
  const loading = ref(true)
@@ -29,10 +30,14 @@ const panelConfig = ref<PanelConfig | null>(null)
29
30
 
30
31
  const panelEnabled = computed(() => panelConfig.value?.enabled ?? false)
31
32
 
32
- // 构建管理面板 URL(同源,使用当前页面的 origin)
33
+ // 根据当前页面 hostname 动态构建 URL
33
34
  const adminUrl = computed(() => {
34
35
  if (!panelConfig.value) return ''
35
- const { basePath } = panelConfig.value
36
+ const { basePath, port } = panelConfig.value
37
+ if (port) {
38
+ // 使用当前页面的 hostname,支持服务器部署
39
+ return `${window.location.protocol}//${window.location.hostname}:${port}${basePath}/admin`
40
+ }
36
41
  return `${basePath}/admin`
37
42
  })
38
43
 
package/dist/index.js CHANGED
@@ -1 +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};
1
+ import{send as _,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 a,withCtx as w,createElementBlock as s,createElementVNode as r}from"vue";const x={key:0,class:"loading-state"},h={key:1,class:"disabled-state"},b=["src"],$=v({__name:"page",setup(l){const t=u(true),n=u(null),c=d(()=>{var e;return((e=n.value)==null?void 0:e.enabled)??false}),i=d(()=>{if(!n.value)return"";const{basePath:e,port:o}=n.value;return o?`${window.location.protocol}//${window.location.hostname}:${o}${e}/admin`:`${e}/admin`});return g(async()=>{try{n.value=await _("onebot-multi/config")}catch(e){console.error("Failed to get panel config:",e)}finally{t.value=false}}),(e,o)=>{const p=y("k-layout");return a(),k(p,null,{default:w(()=>[t.value?(a(),s("div",x,[...o[0]||(o[0]=[r("span",null,"加载中...",-1)])])):c.value?(a(),s("iframe",{key:2,src:i.value,class:"admin-iframe"},null,8,b)):(a(),s("div",h,[...o[1]||(o[1]=[r("h2",null,"面板未启用",-1),r("p",null,"请在插件配置中启用「展示面板」功能",-1)])]))]),_:1})}}}),m=(l,t)=>{const n=l.__vccOpts||l;for(const[c,i]of t)n[c]=i;return n},B=m($,[["__scopeId","data-v-b3b2932d"]]),C={},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(l,t){return a(),s("svg",E,[...t[0]||(t[0]=[r("rect",{x:"2",y:"4",width:"20",height:"18",rx:"3"},null,-1),r("circle",{cx:"8",cy:"13",r:"2.5"},null,-1),r("circle",{cx:"16",cy:"13",r:"2.5"},null,-1)])])}const M=m(C,[["render",I]]);f.register("activity:onebot-multi",M);const j=l=>{l.page({name:"OneBot Multi",path:"/onebot-multi",component:B,icon:"activity:onebot-multi",order:600})};export{j as default};
package/dist/style.css CHANGED
@@ -1 +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)}
1
+ @charset "UTF-8";[data-v-b3b2932d] .k-layout{background:transparent!important;padding:0!important;margin:0!important}[data-v-b3b2932d] .k-layout__main{background:transparent!important;padding:0!important;margin:0!important;overflow:hidden!important}[data-v-b3b2932d] .k-layout__header,[data-v-b3b2932d] .k-layout__left,[data-v-b3b2932d] .k-layout__right{display:none!important}.admin-iframe[data-v-b3b2932d]{width:100%;height:100%;border:none;display:block}.loading-state[data-v-b3b2932d],.disabled-state[data-v-b3b2932d]{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;color:var(--k-text-light)}.disabled-state h2[data-v-b3b2932d]{margin-bottom:.5rem;color:var(--k-text-dark)}.disabled-state p[data-v-b3b2932d]{color:var(--k-text-light)}
package/lib/index.d.ts CHANGED
@@ -8,6 +8,7 @@ declare module '@koishijs/console' {
8
8
  'onebot-multi/config'(): {
9
9
  basePath: string;
10
10
  enabled: boolean;
11
+ port: number | null;
11
12
  };
12
13
  }
13
14
  }
package/lib/index.js CHANGED
@@ -2699,9 +2699,12 @@ function apply(ctx, config) {
2699
2699
  prod: (0, import_path.resolve)(__dirname, "../dist")
2700
2700
  });
2701
2701
  ctx2.console.addListener("onebot-multi/config", () => {
2702
+ const basePath = config.panel?.basePath || "/status";
2703
+ const port = config.panel?.port;
2702
2704
  return {
2703
- basePath: config.panel?.basePath || "/status",
2704
- enabled: config.panel?.enabled || false
2705
+ basePath,
2706
+ enabled: config.panel?.enabled || false,
2707
+ port: port || null
2705
2708
  };
2706
2709
  });
2707
2710
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-adapter-onebot-multi",
3
3
  "description": "奶龙bot定制版onebot适配器,支持自动负载均衡,适配器级黑名单/白名单,提供webui,可指定端口",
4
- "version": "0.0.7",
4
+ "version": "0.0.9",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [