koishi-plugin-adapter-onebot-multi 0.0.8 → 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 +11 -3
- package/dist/index.js +1 -1
- package/dist/style.css +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -2
- package/package.json +1 -1
package/client/page.vue
CHANGED
|
@@ -22,7 +22,7 @@ import { send } from '@koishijs/client'
|
|
|
22
22
|
interface PanelConfig {
|
|
23
23
|
basePath: string
|
|
24
24
|
enabled: boolean
|
|
25
|
-
|
|
25
|
+
port: number | null
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
const loading = ref(true)
|
|
@@ -30,8 +30,16 @@ const panelConfig = ref<PanelConfig | null>(null)
|
|
|
30
30
|
|
|
31
31
|
const panelEnabled = computed(() => panelConfig.value?.enabled ?? false)
|
|
32
32
|
|
|
33
|
-
//
|
|
34
|
-
const adminUrl = computed(() =>
|
|
33
|
+
// 根据当前页面 hostname 动态构建 URL
|
|
34
|
+
const adminUrl = computed(() => {
|
|
35
|
+
if (!panelConfig.value) return ''
|
|
36
|
+
const { basePath, port } = panelConfig.value
|
|
37
|
+
if (port) {
|
|
38
|
+
// 使用当前页面的 hostname,支持服务器部署
|
|
39
|
+
return `${window.location.protocol}//${window.location.hostname}:${port}${basePath}/admin`
|
|
40
|
+
}
|
|
41
|
+
return `${basePath}/admin`
|
|
42
|
+
})
|
|
35
43
|
|
|
36
44
|
onMounted(async () => {
|
|
37
45
|
try {
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{send as
|
|
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-
|
|
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
package/lib/index.js
CHANGED
|
@@ -2701,11 +2701,10 @@ function apply(ctx, config) {
|
|
|
2701
2701
|
ctx2.console.addListener("onebot-multi/config", () => {
|
|
2702
2702
|
const basePath = config.panel?.basePath || "/status";
|
|
2703
2703
|
const port = config.panel?.port;
|
|
2704
|
-
const adminUrl = port ? `http://localhost:${port}${basePath}/admin` : `${basePath}/admin`;
|
|
2705
2704
|
return {
|
|
2706
2705
|
basePath,
|
|
2707
2706
|
enabled: config.panel?.enabled || false,
|
|
2708
|
-
|
|
2707
|
+
port: port || null
|
|
2709
2708
|
};
|
|
2710
2709
|
});
|
|
2711
2710
|
});
|