whistle.pastekitlab 1.3.8 → 1.4.0

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.
Files changed (2) hide show
  1. package/index.js +10 -20
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1,30 +1,20 @@
1
1
  // index.js
2
- module.exports = (req, res, next) => {
3
- console.log('>>> takeover:', req.fullUrl,next);
4
-
5
- // 主拦截逻辑
2
+ module.exports = (server, options) => {
3
+ console.log('>>> plugin loaded');
4
+ return {
5
+ request: (req, res, next) => {
6
+ console.log('>>> takeover:', req.fullUrl);
7
+ // 继续处理,让 whistle 正常代理
8
+ next();
9
+ }
10
+ }
6
11
  };
7
12
 
8
13
  // 额外暴露 Web UI(可选)
9
14
  module.exports.ui = (server, options) => {
10
15
  server.on('request', (req, res) => {
11
16
  if (req.url === '/plugin/pastekitlab/config') {
12
- res.end(JSON.stringify({ status: 'ok' }));
17
+ res.end(JSON.stringify({status: 'ok'}));
13
18
  }
14
19
  });
15
20
  };
16
-
17
-
18
- // (server, options) => {
19
- // console.log('>>> plugin loaded');
20
- // // server.on('request', (req, res) => {
21
- // // console.log('>>> takeover:', req.fullUrl);
22
- // // // 直接用
23
- // // });
24
- // return {
25
- // request: (req, res) => {
26
- // console.log('>>> takeover:', req.fullUrl,next);
27
- // return next();
28
- // }
29
- // };
30
- // };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whistle.pastekitlab",
3
- "version": "1.3.8",
3
+ "version": "1.4.0",
4
4
  "description": "Whistle plugin for PasteKit Lab - Intercepts requests and sends them to requestlistviewer via WebSocket",
5
5
  "main": "index.js",
6
6
  "scripts": {