chemicaljs 1.3.2 → 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.
- package/LICENSE +661 -21
- package/README.md +72 -6
- package/client/chemical.components.js +116 -0
- package/example/package-lock.json +4 -4
- package/example/package.json +1 -1
- package/example-components/README.md +3 -0
- package/example-components/index.js +14 -0
- package/example-components/package-lock.json +3892 -0
- package/example-components/package.json +24 -0
- package/example-components/public/index.html +33 -0
- package/example-vite/package-lock.json +7 -7
- package/example-vite/package.json +4 -4
- package/index.js +12 -10
- package/package.json +2 -2
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "chemical-example-components",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "This is an example project for Chemical.",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"start": "node index.js"
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/chemicaljs/chemical.git"
|
|
13
|
+
},
|
|
14
|
+
"author": "Nebelung",
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/chemicaljs/chemical/issues"
|
|
18
|
+
},
|
|
19
|
+
"homepage": "https://github.com/chemicaljs/chemical#readme",
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"chemicaljs": "^1.3.3",
|
|
22
|
+
"express": "^4.19.2"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<h1>Chemical Example</h1>
|
|
2
|
+
|
|
3
|
+
<p>Open in current tab</p>
|
|
4
|
+
<input target="_self" placeholder="Enter URL" is="chemical-input">
|
|
5
|
+
<p>Open in new tab</p>
|
|
6
|
+
<input target="_blank" placeholder="Enter URL" is="chemical-input">
|
|
7
|
+
<p>Custom action (console log)</p>
|
|
8
|
+
<input action="logURL" placeholder="Enter URL" is="chemical-input">
|
|
9
|
+
<script>
|
|
10
|
+
function logURL(url) {
|
|
11
|
+
console.log(url)
|
|
12
|
+
}
|
|
13
|
+
</script>
|
|
14
|
+
<p>With button</p>
|
|
15
|
+
<input id="my-input" target="_blank" placeholder="Enter URL" is="chemical-input">
|
|
16
|
+
<button for="my-input" is="chemical-button">Go!</button>
|
|
17
|
+
<p>With iframe</p>
|
|
18
|
+
<input frame="my-iframe" placeholder="Enter URL" is="chemical-input">
|
|
19
|
+
<br>
|
|
20
|
+
<iframe id="my-iframe" is="chemical-iframe"></iframe>
|
|
21
|
+
<p>With iframe and controls</p>
|
|
22
|
+
<input frame="my-iframe-2" placeholder="Enter URL" is="chemical-input">
|
|
23
|
+
<section id="my-controls-2" is="chemical-controls">
|
|
24
|
+
<button onclick="chemicalAction('back', 'my-iframe-2')">←</button>
|
|
25
|
+
<button onclick="chemicalAction('forward', 'my-iframe-2')">→</button>
|
|
26
|
+
<button onclick="chemicalAction('reload', 'my-iframe-2')">⟳</button>
|
|
27
|
+
<button onclick="chemicalAction('close', 'my-iframe-2')">🗙</button>
|
|
28
|
+
</section>
|
|
29
|
+
<br>
|
|
30
|
+
<iframe controls="my-controls-2" id="my-iframe-2" is="chemical-iframe"></iframe>
|
|
31
|
+
|
|
32
|
+
<script src="/chemical.js"></script>
|
|
33
|
+
<script src="/chemical.components.js"></script>
|
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
"": {
|
|
7
7
|
"name": "chemical-example-vite",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"chemicaljs": "^1.3.
|
|
9
|
+
"chemicaljs": "^1.3.3",
|
|
10
10
|
"express": "^4.19.2",
|
|
11
|
-
"preact": "^10.22.
|
|
11
|
+
"preact": "^10.22.1"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
|
-
"@preact/preset-vite": "^2.
|
|
15
|
-
"vite": "^5.3.
|
|
14
|
+
"@preact/preset-vite": "^2.9.0",
|
|
15
|
+
"vite": "^5.3.3"
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
"node_modules/@ampproject/remapping": {
|
|
@@ -1721,9 +1721,9 @@
|
|
|
1721
1721
|
}
|
|
1722
1722
|
},
|
|
1723
1723
|
"node_modules/chemicaljs": {
|
|
1724
|
-
"version": "1.3.
|
|
1725
|
-
"resolved": "https://registry.npmjs.org/chemicaljs/-/chemicaljs-1.3.
|
|
1726
|
-
"integrity": "sha512-
|
|
1724
|
+
"version": "1.3.3",
|
|
1725
|
+
"resolved": "https://registry.npmjs.org/chemicaljs/-/chemicaljs-1.3.3.tgz",
|
|
1726
|
+
"integrity": "sha512-4On6o/E3C5fmrAFBno6zLc1ca3VQZv+tFz+rPP5II1tcka4d14iT2zrxZS96jHgStQBQoihdgPtmGGMPkZ4OAw==",
|
|
1727
1727
|
"dependencies": {
|
|
1728
1728
|
"@mercuryworkshop/bare-mux": "^2.0.1",
|
|
1729
1729
|
"@mercuryworkshop/epoxy-transport": "^2.1.3",
|
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
"build": "vite build"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"chemicaljs": "^1.3.
|
|
11
|
+
"chemicaljs": "^1.3.3",
|
|
12
12
|
"express": "^4.19.2",
|
|
13
|
-
"preact": "^10.22.
|
|
13
|
+
"preact": "^10.22.1"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@preact/preset-vite": "^2.
|
|
17
|
-
"vite": "^5.3.
|
|
16
|
+
"@preact/preset-vite": "^2.9.0",
|
|
17
|
+
"vite": "^5.3.3"
|
|
18
18
|
}
|
|
19
19
|
}
|
package/index.js
CHANGED
|
@@ -10,6 +10,8 @@ import { uvPath } from "@titaniumnetwork-dev/ultraviolet";
|
|
|
10
10
|
import { scramjetPath } from "@mercuryworkshop/scramjet";
|
|
11
11
|
import createRammerhead from "rammerhead/src/server/index.js";
|
|
12
12
|
|
|
13
|
+
const __dirname = new URL(".", import.meta.url).pathname;
|
|
14
|
+
|
|
13
15
|
class ChemicalServer {
|
|
14
16
|
constructor(options) {
|
|
15
17
|
if (options) {
|
|
@@ -73,7 +75,7 @@ class ChemicalServer {
|
|
|
73
75
|
this.server = createServer();
|
|
74
76
|
this.app = express();
|
|
75
77
|
this.app.get("/chemical.js", async function (req, res) {
|
|
76
|
-
let chemicalMain = await readFileSync(resolve(
|
|
78
|
+
let chemicalMain = await readFileSync(resolve(__dirname, "client/chemical.js"), "utf8");
|
|
77
79
|
|
|
78
80
|
if (options.default) {
|
|
79
81
|
if (["uv", "rammerhead", "scramjet"].includes(options.default)) {
|
|
@@ -94,7 +96,7 @@ class ChemicalServer {
|
|
|
94
96
|
return res.send(chemicalMain);
|
|
95
97
|
});
|
|
96
98
|
this.app.get("/chemical.sw.js", async function (req, res) {
|
|
97
|
-
let chemicalSW = await readFileSync(resolve(
|
|
99
|
+
let chemicalSW = await readFileSync(resolve(__dirname, "client/chemical.sw.js"), "utf8");
|
|
98
100
|
|
|
99
101
|
chemicalSW = "const uvEnabled = " + String(options.uv) + ";\n" + chemicalSW
|
|
100
102
|
chemicalSW = "const scramjetEnabled = " + String(options.scramjet) + ";\n" + chemicalSW
|
|
@@ -103,16 +105,16 @@ class ChemicalServer {
|
|
|
103
105
|
res.type("application/javascript");
|
|
104
106
|
return res.send(chemicalSW);
|
|
105
107
|
});
|
|
106
|
-
this.app.use(express.static(resolve(
|
|
108
|
+
this.app.use(express.static(resolve(__dirname, "client")));
|
|
107
109
|
this.app.use("/baremux/", express.static(baremuxPath));
|
|
108
110
|
this.app.use("/libcurl/", express.static(libcurlPath));
|
|
109
111
|
this.app.use("/epoxy/", express.static(epoxyPath));
|
|
110
112
|
if (options.uv) {
|
|
111
|
-
this.app.use("/uv/", express.static(resolve(
|
|
113
|
+
this.app.use("/uv/", express.static(resolve(__dirname, "config/uv")));
|
|
112
114
|
this.app.use("/uv/", express.static(uvPath));
|
|
113
115
|
}
|
|
114
116
|
if (options.scramjet) {
|
|
115
|
-
this.app.use("/scramjet/", express.static(resolve(
|
|
117
|
+
this.app.use("/scramjet/", express.static(resolve(__dirname, "config/scramjet")));
|
|
116
118
|
this.app.use("/scramjet/", express.static(scramjetPath));
|
|
117
119
|
}
|
|
118
120
|
this.server.on("request", (req, res) => {
|
|
@@ -197,7 +199,7 @@ const ChemicalVitePlugin = (options) => ({
|
|
|
197
199
|
|
|
198
200
|
const app = express();
|
|
199
201
|
app.get("/chemical.js", async function (req, res) {
|
|
200
|
-
let chemicalMain = await readFileSync(resolve(
|
|
202
|
+
let chemicalMain = await readFileSync(resolve(__dirname, "client/chemical.js"), "utf8");
|
|
201
203
|
|
|
202
204
|
if (options.default) {
|
|
203
205
|
if (["uv", "rammerhead", "scramjet"].includes(options.default)) {
|
|
@@ -218,7 +220,7 @@ const ChemicalVitePlugin = (options) => ({
|
|
|
218
220
|
return res.send(chemicalMain);
|
|
219
221
|
});
|
|
220
222
|
app.get("/chemical.sw.js", async function (req, res) {
|
|
221
|
-
let chemicalSW = await readFileSync(resolve(
|
|
223
|
+
let chemicalSW = await readFileSync(resolve(__dirname, "client/chemical.sw.js"), "utf8");
|
|
222
224
|
|
|
223
225
|
chemicalSW = "const uvEnabled = " + String(options.uv) + ";\n" + chemicalSW
|
|
224
226
|
chemicalSW = "const scramjetEnabled = " + String(options.scramjet) + ";\n" + chemicalSW
|
|
@@ -227,16 +229,16 @@ const ChemicalVitePlugin = (options) => ({
|
|
|
227
229
|
res.type("application/javascript");
|
|
228
230
|
return res.send(chemicalSW);
|
|
229
231
|
});
|
|
230
|
-
app.use(express.static(resolve(
|
|
232
|
+
app.use(express.static(resolve(__dirname, "client")));
|
|
231
233
|
app.use("/baremux/", express.static(baremuxPath));
|
|
232
234
|
app.use("/libcurl/", express.static(libcurlPath));
|
|
233
235
|
app.use("/epoxy/", express.static(epoxyPath));
|
|
234
236
|
if (options.uv) {
|
|
235
|
-
app.use("/uv/", express.static(resolve(
|
|
237
|
+
app.use("/uv/", express.static(resolve(__dirname, "config/uv")));
|
|
236
238
|
app.use("/uv/", express.static(uvPath));
|
|
237
239
|
}
|
|
238
240
|
if (options.scramjet) {
|
|
239
|
-
app.use("/scramjet/", express.static(resolve(
|
|
241
|
+
app.use("/scramjet/", express.static(resolve(__dirname, "config/scramjet")));
|
|
240
242
|
app.use("/scramjet/", express.static(scramjetPath));
|
|
241
243
|
}
|
|
242
244
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chemicaljs",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Easily create your own web proxy with no experience required.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"main": "index.js",
|
|
10
10
|
"type": "module",
|
|
11
11
|
"author": "Nebelung",
|
|
12
|
-
"license": "
|
|
12
|
+
"license": "AGPL-3.0-only",
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@mercuryworkshop/bare-mux": "^2.0.1",
|
|
15
15
|
"@mercuryworkshop/epoxy-transport": "^2.1.3",
|