Spaces:
Paused
Paused
Update index.js
Browse files
index.js
CHANGED
|
@@ -126,19 +126,8 @@ app.post('/api/waifu2x', async (req, res) => {
|
|
| 126 |
|
| 127 |
if(status !== apikey) return res.json({ success: false, message: 'Invalid status!' })
|
| 128 |
const response = await waifu2x(url, format)
|
| 129 |
-
const images = await axios.request({
|
| 130 |
-
method: "GET",
|
| 131 |
-
url: "https://api.alcaamado.es/api/v2/waifu2x/get?hash=" + response + "&type=jpg",
|
| 132 |
-
headers: {
|
| 133 |
-
"Accept": "image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8",
|
| 134 |
-
"Content-Type": "image/jpg",
|
| 135 |
-
"Referer": "https://waifu2x.pro/",
|
| 136 |
-
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36 Edg/119.0.0.0"
|
| 137 |
-
},
|
| 138 |
-
responseType: "arraybuffer"
|
| 139 |
-
})
|
| 140 |
res.setHeader('Content-Type', 'image/jpg')
|
| 141 |
-
res.send(
|
| 142 |
} catch (e) {
|
| 143 |
console.log(e)
|
| 144 |
e = String(e)
|
|
@@ -250,6 +239,17 @@ async function waifu2x(urls, formats) {
|
|
| 250 |
})
|
| 251 |
|
| 252 |
if(!ress.data.finished) return "Images Not Supported!!"
|
| 253 |
-
|
| 254 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 255 |
}
|
|
|
|
| 126 |
|
| 127 |
if(status !== apikey) return res.json({ success: false, message: 'Invalid status!' })
|
| 128 |
const response = await waifu2x(url, format)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
res.setHeader('Content-Type', 'image/jpg')
|
| 130 |
+
res.send(response)
|
| 131 |
} catch (e) {
|
| 132 |
console.log(e)
|
| 133 |
e = String(e)
|
|
|
|
| 239 |
})
|
| 240 |
|
| 241 |
if(!ress.data.finished) return "Images Not Supported!!"
|
| 242 |
+
|
| 243 |
+
const images = await axios.request({
|
| 244 |
+
method: "GET",
|
| 245 |
+
url: "https://api.alcaamado.es/api/v2/waifu2x/get?hash=" + response + "&type=jpg",
|
| 246 |
+
headers: {
|
| 247 |
+
"Accept": "image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8",
|
| 248 |
+
"Content-Type": "image/jpg",
|
| 249 |
+
"Referer": "https://waifu2x.pro/",
|
| 250 |
+
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36 Edg/119.0.0.0"
|
| 251 |
+
},
|
| 252 |
+
responseType: "arraybuffer"
|
| 253 |
+
})
|
| 254 |
+
return images.data
|
| 255 |
}
|