Update index.js
Browse files
index.js
CHANGED
|
@@ -100,7 +100,7 @@ app.all('/', async (req, res) => {
|
|
| 100 |
}
|
| 101 |
})
|
| 102 |
|
| 103 |
-
app.get('/
|
| 104 |
const { url } = req.query
|
| 105 |
if (!url) return res.redirect('/')
|
| 106 |
const api = format(
|
|
@@ -110,14 +110,25 @@ app.get('/mf', async (req, res) => {
|
|
| 110 |
try {
|
| 111 |
const json = await (await fetch(api)).json()
|
| 112 |
const { result } = json
|
| 113 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
const route = format(
|
| 115 |
-
'
|
| 116 |
result.download,
|
| 117 |
-
|
| 118 |
-
result.
|
| 119 |
-
|
|
|
|
| 120 |
)
|
|
|
|
| 121 |
res.redirect(route)
|
| 122 |
} catch (e) {
|
| 123 |
console.error(e)
|
|
@@ -143,7 +154,11 @@ app.get(
|
|
| 143 |
.cmd
|
| 144 |
.trim()
|
| 145 |
.split(' ')
|
| 146 |
-
const file = format(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 147 |
const log = await fsp.open(file, 'w+')
|
| 148 |
const child = spawn(
|
| 149 |
cmd,
|
|
|
|
| 100 |
}
|
| 101 |
})
|
| 102 |
|
| 103 |
+
app.get('/dl', async (req, res) => {
|
| 104 |
const { url } = req.query
|
| 105 |
if (!url) return res.redirect('/')
|
| 106 |
const api = format(
|
|
|
|
| 110 |
try {
|
| 111 |
const json = await (await fetch(api)).json()
|
| 112 |
const { result } = json
|
| 113 |
+
const target = format(
|
| 114 |
+
'%s/%s',
|
| 115 |
+
tmpDir,
|
| 116 |
+
result.filename
|
| 117 |
+
)
|
| 118 |
+
const cmds = [
|
| 119 |
+
'/shell?cmd=wget', '%s', '-O', '"%s"',
|
| 120 |
+
'--header="cookie: %s"','&&',
|
| 121 |
+
'unzip', '"%s"', '-d', '%s'
|
| 122 |
+
]
|
| 123 |
const route = format(
|
| 124 |
+
cmds.join(' '),
|
| 125 |
result.download,
|
| 126 |
+
target,
|
| 127 |
+
result.cookie,
|
| 128 |
+
target,
|
| 129 |
+
target.replace('.zip', '')
|
| 130 |
)
|
| 131 |
+
res.set('user-agent', env.UA)
|
| 132 |
res.redirect(route)
|
| 133 |
} catch (e) {
|
| 134 |
console.error(e)
|
|
|
|
| 154 |
.cmd
|
| 155 |
.trim()
|
| 156 |
.split(' ')
|
| 157 |
+
const file = format(
|
| 158 |
+
'%s/%s.log',
|
| 159 |
+
tmpDir,
|
| 160 |
+
Date.now()
|
| 161 |
+
)
|
| 162 |
const log = await fsp.open(file, 'w+')
|
| 163 |
const child = spawn(
|
| 164 |
cmd,
|