Skip to content

Instantly share code, notes, and snippets.

@d1y
Created July 2, 2024 14:39
Show Gist options
  • Save d1y/079d2dc054702a5b6811e1e61fb83e92 to your computer and use it in GitHub Desktop.
Save d1y/079d2dc054702a5b6811e1e61fb83e92 to your computer and use it in GitHub Desktop.
var rs = "/spider";
async function V$(t) {
t.register(async e => {
e.get("/check", async function (r, n) {
n.send({
run: !e.stop
});
});
e.get("/config", async function (r, n) {
n.send({
video: {
sites: [{
key: "node_site1",
name: "Site1",
type: 3,
api: rs + "/site01"
}, {
key: "node_site2",
name: "Site2",
type: 3,
api: rs + "/site02"
}, {
key: "node_site3",
name: "Site3",
type: 3,
api: rs + "/site03"
}]
},
read: {
sites: [{
key: "node_site1",
name: "Site1",
type: 3,
api: rs + "/site01"
}, {
key: "node_site2",
name: "Site2",
type: 3,
api: rs + "/site02"
}, {
key: "node_site3",
name: "Site3",
type: 3,
api: rs + "/site03"
}]
},
comic: {
sites: [{
key: "node_site1",
name: "Site1",
type: 3,
api: rs + "/site01"
}, {
key: "node_site2",
name: "Site2",
type: 3,
api: rs + "/site02"
}, {
key: "node_site3",
name: "Site3",
type: 3,
api: rs + "/site03"
}]
},
pan: {
sites: [{
key: "node_alist",
name: "Alist",
type: 40,
api: rs + "/alist",
ext: []
}]
}
});
});
});
}
var dn = null;
async function _he(t) {
dn = (0, EF.default)({
serverFactory: catServerFactory,
forceCloseConnections: true,
logger: process.env.NODE_ENV !== "development",
maxParamLength: 10240
});
dn.address = function () {
let e = this.server.address();
e.url = `http://${e.address}:${e.port}`;
e.dynamic = "js2p://_WEB_";
return e;
};
dn.addHook("onError", async (e, r, n) => {
console.error(n);
if (!n.statusCode) {
n.statusCode = 500;
}
return n;
});
dn.register(V$);
dn.listen({
port: process.env.DEV_HTTP_PORT || 0,
host: "127.0.0.1"
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment