mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-10 02:54:15 +00:00
use url
This commit is contained in:
parent
394a36886f
commit
bf8fc48e0f
@ -4,7 +4,6 @@ import { Schematized } from "../../lib"
|
|||||||
import { FeaturedWallpaper } from "../../models"
|
import { FeaturedWallpaper } from "../../models"
|
||||||
|
|
||||||
import IndecentPrediction from "../../utils/indecent-prediction"
|
import IndecentPrediction from "../../utils/indecent-prediction"
|
||||||
import downloadFile from "../../utils/download-file"
|
|
||||||
|
|
||||||
export default class PublicController extends Controller {
|
export default class PublicController extends Controller {
|
||||||
static refName = "PublicController"
|
static refName = "PublicController"
|
||||||
@ -17,10 +16,8 @@ export default class PublicController extends Controller {
|
|||||||
}, async (req, res) => {
|
}, async (req, res) => {
|
||||||
const { url } = req.selection
|
const { url } = req.selection
|
||||||
|
|
||||||
const download = await downloadFile({ url })
|
|
||||||
|
|
||||||
const predictions = await IndecentPrediction({
|
const predictions = await IndecentPrediction({
|
||||||
image: download.destination,
|
url,
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
res.status(500).json({
|
res.status(500).json({
|
||||||
error: err.message,
|
error: err.message,
|
||||||
@ -29,9 +26,6 @@ export default class PublicController extends Controller {
|
|||||||
return null
|
return null
|
||||||
})
|
})
|
||||||
|
|
||||||
// delete cached file
|
|
||||||
await download.delete()
|
|
||||||
|
|
||||||
if (predictions) {
|
if (predictions) {
|
||||||
return res.json(predictions)
|
return res.json(predictions)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user