koishi-plugin-chat-patch 5.6.0 → 5.6.1
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/lib/index.js +8 -5
- package/package.json +1 -1
- package/src/satori.ts +8 -5
- package/src/server.d.ts +7 -6
package/lib/index.js
CHANGED
|
@@ -2105,12 +2105,15 @@ var WebSocket;
|
|
|
2105
2105
|
})(WebSocket || (WebSocket = {}));
|
|
2106
2106
|
|
|
2107
2107
|
// src/satori.ts
|
|
2108
|
+
function getSatoriPath(ctx) {
|
|
2109
|
+
const path5 = ctx.satori?.server?.config?.path ?? "/satori";
|
|
2110
|
+
return path5.startsWith("/") ? path5 : `/${path5}`;
|
|
2111
|
+
}
|
|
2112
|
+
__name(getSatoriPath, "getSatoriPath");
|
|
2108
2113
|
function resolveSatoriEndpoint(ctx) {
|
|
2109
|
-
const
|
|
2110
|
-
const
|
|
2111
|
-
|
|
2112
|
-
const base = ctx.server?.selfUrl ?? ctx.server?.config?.selfUrl ?? "";
|
|
2113
|
-
return `${base}${clean.startsWith("/") ? clean : `/${clean}`}`;
|
|
2114
|
+
const port = ctx.server?.port ?? ctx.server?.config?.port;
|
|
2115
|
+
const base = `http://localhost${port ? `:${port}` : ""}`;
|
|
2116
|
+
return `${base}${getSatoriPath(ctx)}`;
|
|
2114
2117
|
}
|
|
2115
2118
|
__name(resolveSatoriEndpoint, "resolveSatoriEndpoint");
|
|
2116
2119
|
function toSatoriEventUrl(endpoint) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "koishi-plugin-chat-patch",
|
|
3
3
|
"description": "[<ruby>chat-patch<rp>(</rp><rt>点我预览效果</rt><rp>)</rp></ruby>](https://i0.hdslb.com/bfs/openplatform/71074dfc9e5256fc3333d8bd8478bec1af874046.png) 视奸小插件((bushi( (低性能警告)。手机端适配。灵感来自 chat 插件。",
|
|
4
|
-
"version": "5.6.
|
|
4
|
+
"version": "5.6.1",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build:web": "npm --prefix client/web run build",
|
|
7
7
|
"prepack": "npm run build:web",
|
package/src/satori.ts
CHANGED
|
@@ -2,12 +2,15 @@ import { Context } from 'koishi'
|
|
|
2
2
|
import {} from '@koishijs/plugin-server'
|
|
3
3
|
import {} from '@satorijs/plugin-server'
|
|
4
4
|
|
|
5
|
+
function getSatoriPath(ctx: Context): string {
|
|
6
|
+
const path = ctx.satori?.server?.config?.path ?? '/satori'
|
|
7
|
+
return path.startsWith('/') ? path : `/${path}`
|
|
8
|
+
}
|
|
9
|
+
|
|
5
10
|
export function resolveSatoriEndpoint(ctx: Context): string {
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
const base = ctx.server?.selfUrl ?? ctx.server?.config?.selfUrl ?? ''
|
|
10
|
-
return `${base}${clean.startsWith('/') ? clean : `/${clean}`}`
|
|
11
|
+
const port = ctx.server?.port ?? ctx.server?.config?.port
|
|
12
|
+
const base = `http://localhost${port ? `:${port}` : ''}`
|
|
13
|
+
return `${base}${getSatoriPath(ctx)}`
|
|
11
14
|
}
|
|
12
15
|
|
|
13
16
|
export function toSatoriEventUrl(endpoint: string): string {
|
package/src/server.d.ts
CHANGED
|
@@ -4,12 +4,13 @@ type ServerContext = ParameterizedContext<DefaultState, DefaultContext>
|
|
|
4
4
|
|
|
5
5
|
declare module '@satorijs/core' {
|
|
6
6
|
interface Satori {
|
|
7
|
-
server: {
|
|
8
|
-
url: string
|
|
9
|
-
config: {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
server: {
|
|
8
|
+
url: string
|
|
9
|
+
config: {
|
|
10
|
+
path: string
|
|
11
|
+
token?: string
|
|
12
|
+
}
|
|
13
|
+
}
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
16
|
|