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

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
+ adminUrl: string
25
26
  }
26
27
 
27
28
  const loading = ref(true)
@@ -29,12 +30,8 @@ const panelConfig = ref<PanelConfig | null>(null)
29
30
 
30
31
  const panelEnabled = computed(() => panelConfig.value?.enabled ?? false)
31
32
 
32
- // 构建管理面板 URL(同源,使用当前页面的 origin)
33
- const adminUrl = computed(() => {
34
- if (!panelConfig.value) return ''
35
- const { basePath } = panelConfig.value
36
- return `${basePath}/admin`
37
- })
33
+ // 使用服务端返回的完整 URL
34
+ const adminUrl = computed(() => panelConfig.value?.adminUrl || '')
38
35
 
39
36
  onMounted(async () => {
40
37
  try {
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 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 s,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(n){const t=u(true),o=u(null),a=d(()=>{var e;return((e=o.value)==null?void 0:e.enabled)??false}),i=d(()=>{var e;return((e=o.value)==null?void 0:e.adminUrl)||""});return g(async()=>{try{o.value=await p("onebot-multi/config")}catch(e){console.error("Failed to get panel config:",e)}finally{t.value=false}}),(e,c)=>{const m=y("k-layout");return r(),k(m,null,{default:x(()=>[t.value?(r(),s("div",h,[...c[0]||(c[0]=[l("span",null,"加载中...",-1)])])):a.value?(r(),s("iframe",{key:2,src:i.value,class:"admin-iframe"},null,8,b)):(r(),s("div",w,[...c[1]||(c[1]=[l("h2",null,"面板未启用",-1),l("p",null,"请在插件配置中启用「展示面板」功能",-1)])]))]),_:1})}}}),_=(n,t)=>{const o=n.__vccOpts||n;for(const[a,i]of t)o[a]=i;return o},C=_(B,[["__scopeId","data-v-c05bc3f0"]]),E={},I={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 M(n,t){return r(),s("svg",I,[...t[0]||(t[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 O=_(E,[["render",M]]);f.register("activity:onebot-multi",O);const j=n=>{n.page({name:"OneBot Multi",path:"/onebot-multi",component:C,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-c05bc3f0] .k-layout{background:transparent!important;padding:0!important;margin:0!important}[data-v-c05bc3f0] .k-layout__main{background:transparent!important;padding:0!important;margin:0!important;overflow:hidden!important}[data-v-c05bc3f0] .k-layout__header,[data-v-c05bc3f0] .k-layout__left,[data-v-c05bc3f0] .k-layout__right{display:none!important}.admin-iframe[data-v-c05bc3f0]{width:100%;height:100%;border:none;display:block}.loading-state[data-v-c05bc3f0],.disabled-state[data-v-c05bc3f0]{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;color:var(--k-text-light)}.disabled-state h2[data-v-c05bc3f0]{margin-bottom:.5rem;color:var(--k-text-dark)}.disabled-state p[data-v-c05bc3f0]{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
+ adminUrl: string;
11
12
  };
12
13
  }
13
14
  }
package/lib/index.js CHANGED
@@ -2699,9 +2699,13 @@ 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;
2704
+ const adminUrl = port ? `http://localhost:${port}${basePath}/admin` : `${basePath}/admin`;
2702
2705
  return {
2703
- basePath: config.panel?.basePath || "/status",
2704
- enabled: config.panel?.enabled || false
2706
+ basePath,
2707
+ enabled: config.panel?.enabled || false,
2708
+ adminUrl
2705
2709
  };
2706
2710
  });
2707
2711
  });
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.8",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [