This repository has been archived by the owner on Jul 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
105 lines (96 loc) · 2.68 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
const express = require("express");
const path = require("path");
const fs = require("fs");
var url = require("url");
const app = express();
const staticDir = "public";
const allow = (req, res, next) => {
res.status(200).links({
"payment-method-manifest":
"https://pr-exploit.glitch.me/pay/pr-manifest.json",
});
if (req.path.endsWith("pr-manifest.json"))
res.set("Content-Type", "application/x-payment-manifest");
res.set("Referrer-Policy", "unsafe-url");
next();
};
app.use(allow);
app.get("/pay_*/", (_req, res) => {
fs.readFile(
path.join(__dirname, staticDir, `pay/index.html`),
(err, data) => {
if (err) res.sendStatus(404);
else {
res.set("Content-Type", "text/html");
res.send(data);
}
}
);
});
app.get("/pay/manifest.json", (req, res) => {
// data: urls can be blocked in the policy, but not in extensions
let iconURL =
"data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==";
// This feature isn't complete
try {
const parsedReferrer = url.parse(req.headers["referrer"], true);
if ("unblocked_image_url_for_manifest" in parsedReferrer)
iconURL = parsedReferrer.query["unblocked_image_url_for_manifest"];
} catch (e) {}
res.set("Content-Type", "application/manifest+json");
res.send(`{
"name": "Unblock",
"short_name": "Unblocker",
"icons": [{
"src": "${iconURL}",
"sizes": "1x1",
"type": "image/png"
}],
"serviceworker": {
"src": "/pay/sw.js",
"use_cache": false
}
}`);
});
// This tech will eventually land itself in Filter Lock
// For GUC
app.get("/index.xml", (_req, res) => {
fs.readFile(path.join(__dirname, staticDir, "index.html"), (err, data) => {
if (err) res.sendStatus(404);
else {
res.set("Content-Type", "application/xml");
res.send(`<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="Exploit"/>
<Content type="html">
<![CDATA[
${data}
]]>
</Content>
</Module>`);
}
});
});
// For JSDelivr
app.get("/index.svg", (_req, res) => {
fs.readFile(path.join(__dirname, staticDir, `index.html`), (err, data) => {
if (err) res.sendStatus(404);
else {
res.set("Content-Type", "image/svg+xml");
res.send(`
<svg xmlns="http://www.w3.org/2000/svg">
<foreignObject width="100%" height="100%">
<meta name="robots" content="noindex, follow" />
<body xmlns="http://www.w3.org/1999/xhtml">
${data}
</body>
</foreignObject>
</svg>`);
}
});
});
app.use(express.static(path.join(__dirname, staticDir)));
const port = process.env.PORT || 3000;
app.listen(port, () => {
console.log(`Server listening on port ${port}`);
});