chemicaljs 2.1.1 → 2.2.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.
- package/client/chemical.demo.html +43 -0
- package/client/chemical.js +5 -0
- package/index.js +24 -0
- package/package.json +5 -5
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>Demo Site</title>
|
|
7
|
+
<style>
|
|
8
|
+
*,
|
|
9
|
+
*::before,
|
|
10
|
+
*::after {
|
|
11
|
+
box-sizing: border-box;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
body {
|
|
15
|
+
margin: 0;
|
|
16
|
+
min-height: 100vh;
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: column;
|
|
19
|
+
justify-content: center;
|
|
20
|
+
align-items: center;
|
|
21
|
+
font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji",
|
|
22
|
+
"Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
|
23
|
+
background: #e5e5e5;
|
|
24
|
+
color: black;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@media (prefers-color-scheme: dark) {
|
|
28
|
+
body {
|
|
29
|
+
background: #0a0a0a;
|
|
30
|
+
color: #fafafa;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
h1 {
|
|
35
|
+
margin: 0;
|
|
36
|
+
}
|
|
37
|
+
</style>
|
|
38
|
+
</head>
|
|
39
|
+
<body>
|
|
40
|
+
<h1>Demo Site</h1>
|
|
41
|
+
<p>This is a demo site without proxy functionality.</p>
|
|
42
|
+
</body>
|
|
43
|
+
</html>
|
package/client/chemical.js
CHANGED
|
@@ -2,6 +2,7 @@ const currentScript = document.currentScript;
|
|
|
2
2
|
|
|
3
3
|
window.chemical = {
|
|
4
4
|
loaded: false,
|
|
5
|
+
demoMode,
|
|
5
6
|
transport:
|
|
6
7
|
currentScript.dataset.transportStore !== undefined
|
|
7
8
|
? localStorage.getItem("@chemical/transport") ||
|
|
@@ -264,6 +265,10 @@ window.chemical.encode = async function (url, config) {
|
|
|
264
265
|
config.autoHttps = false;
|
|
265
266
|
}
|
|
266
267
|
|
|
268
|
+
if (demoMode) {
|
|
269
|
+
return "/chemical.demo.html";
|
|
270
|
+
}
|
|
271
|
+
|
|
267
272
|
if (url.match(/^https?:\/\//)) {
|
|
268
273
|
return await encodeService(url, config.service);
|
|
269
274
|
} else if (
|
package/index.js
CHANGED
|
@@ -55,6 +55,10 @@ class ChemicalServer {
|
|
|
55
55
|
options.rammerhead = true;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
if (options.demoMode === undefined) {
|
|
59
|
+
options.demoMode = false;
|
|
60
|
+
}
|
|
61
|
+
|
|
58
62
|
this.options = options;
|
|
59
63
|
this.server = createServer();
|
|
60
64
|
this.app = express();
|
|
@@ -135,6 +139,11 @@ class ChemicalServer {
|
|
|
135
139
|
String(this.options.rammerhead) +
|
|
136
140
|
";\n" +
|
|
137
141
|
chemicalMain;
|
|
142
|
+
chemicalMain =
|
|
143
|
+
"const demoMode = " +
|
|
144
|
+
String(this.options.demoMode) +
|
|
145
|
+
";\n" +
|
|
146
|
+
chemicalMain;
|
|
138
147
|
|
|
139
148
|
chemicalMain = "(async () => {\n" + chemicalMain + "\n})();";
|
|
140
149
|
|
|
@@ -249,6 +258,10 @@ const ChemicalVitePlugin = (options) => ({
|
|
|
249
258
|
options.rammerhead = true;
|
|
250
259
|
}
|
|
251
260
|
|
|
261
|
+
if (options.demoMode === undefined) {
|
|
262
|
+
options.demoMode = false;
|
|
263
|
+
}
|
|
264
|
+
|
|
252
265
|
const rh = createRammerhead();
|
|
253
266
|
const rammerheadScopes = [
|
|
254
267
|
"/rammerhead.js",
|
|
@@ -319,6 +332,8 @@ const ChemicalVitePlugin = (options) => ({
|
|
|
319
332
|
String(options.rammerhead) +
|
|
320
333
|
";\n" +
|
|
321
334
|
chemicalMain;
|
|
335
|
+
chemicalMain =
|
|
336
|
+
"const demoMode = " + String(options.demoMode) + ";\n" + chemicalMain;
|
|
322
337
|
|
|
323
338
|
chemicalMain = "(async () => {\n" + chemicalMain + "\n})();";
|
|
324
339
|
|
|
@@ -450,6 +465,10 @@ class ChemicalBuild {
|
|
|
450
465
|
options.rammerhead = true;
|
|
451
466
|
}
|
|
452
467
|
|
|
468
|
+
if (options.demoMode === undefined) {
|
|
469
|
+
options.demoMode = false;
|
|
470
|
+
}
|
|
471
|
+
|
|
453
472
|
this.options = options;
|
|
454
473
|
}
|
|
455
474
|
async write(deletePath = false) {
|
|
@@ -502,6 +521,11 @@ class ChemicalBuild {
|
|
|
502
521
|
String(this.options.rammerhead) +
|
|
503
522
|
";\n" +
|
|
504
523
|
chemicalMain;
|
|
524
|
+
chemicalMain =
|
|
525
|
+
"const demoMode = " +
|
|
526
|
+
String(this.options.demoMode) +
|
|
527
|
+
";\n" +
|
|
528
|
+
chemicalMain;
|
|
505
529
|
|
|
506
530
|
chemicalMain = "(async () => {\n" + chemicalMain + "\n})();";
|
|
507
531
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chemicaljs",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Easily create your own web proxy with no experience required.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
"update": "npx npm-check-updates -u && npm i"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@mercuryworkshop/bare-mux": "^2.1.
|
|
18
|
-
"@mercuryworkshop/epoxy-transport": "^2.1.
|
|
19
|
-
"@mercuryworkshop/libcurl-transport": "^1.3.
|
|
17
|
+
"@mercuryworkshop/bare-mux": "^2.1.6",
|
|
18
|
+
"@mercuryworkshop/epoxy-transport": "^2.1.25",
|
|
19
|
+
"@mercuryworkshop/libcurl-transport": "^1.3.12",
|
|
20
20
|
"@mercuryworkshop/scramjet": "^1.0.2",
|
|
21
21
|
"@mercuryworkshop/wisp-js": "^0.3.2",
|
|
22
|
-
"@titaniumnetwork-dev/ultraviolet": "^3.2.
|
|
22
|
+
"@titaniumnetwork-dev/ultraviolet": "^3.2.10",
|
|
23
23
|
"express": "^4.21.1",
|
|
24
24
|
"meteorproxy": "^1.0.6-patch.1",
|
|
25
25
|
"rammerhead": "https://github.com/chemicaljs/chemical/raw/main/rammerhead.tgz"
|