Khrisna commited on
Commit
5af4057
·
1 Parent(s): eca6e95

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +8 -1
index.js CHANGED
@@ -126,7 +126,7 @@ app.post('/api/waifu2x', async (req, res) => {
126
  if (!status) return res.json({ success: false, message: 'Required an status text!' })
127
 
128
  if(status !== apikey) return res.json({ success: false, message: 'Invalid status!' })
129
- if (/https:\/\//i.test(images)) {
130
  const data_img = await axios.request({
131
  method: "GET",
132
  url: images,
@@ -290,4 +290,11 @@ async function waifu2x(image, formats) {
290
  responseType: "arraybuffer"
291
  })
292
  return images.data
 
 
 
 
 
 
 
293
  }
 
126
  if (!status) return res.json({ success: false, message: 'Required an status text!' })
127
 
128
  if(status !== apikey) return res.json({ success: false, message: 'Invalid status!' })
129
+ if (/^(https?|http):\/\//i.test(images)) {
130
  const data_img = await axios.request({
131
  method: "GET",
132
  url: images,
 
290
  responseType: "arraybuffer"
291
  })
292
  return images.data
293
+ }
294
+ function isBase64(str) {
295
+ try {
296
+ return btoa(atob(str)) === str
297
+ } catch {
298
+ return false
299
+ }
300
  }