AnonSec Shell
Server IP : 162.213.251.212  /  Your IP : 3.143.4.99   [ Reverse IP ]
Web Server : LiteSpeed
System : Linux business55.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : allssztx ( 535)
PHP Version : 8.1.31
Disable Function : NONE
Domains : 1 Domains
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/allssztx/clarkesmusicservices.com/routes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /home/allssztx/clarkesmusicservices.com/routes/videoSong.js
const express = require("express")
const VideoSong = require('../schema/VideoSong')
const Album = require("../schema/Album")
const router = express.Router()

router.post('/new', async (req, res) => {
    try {
        const { thumbnail, title, album, artist, videoId, tags } = req.body
        var videoSong
        if (album) {
            videoSong = await VideoSong.create({ thumbnail, title, album, artist, videoId, tags })
        } else {
            videoSong = await VideoSong.create({ thumbnail, title, artist, tags, videoId })
        }
        if (album) {
            const albumObj = await Album.findById(album)
            if (!albumObj.songs) {
                albumObj.songs = [videoSong._id]
            } else {
                albumObj.songs.push(videoSong._id)
            }
            await albumObj.save()
        }
        if (videoSong) {
            return res.json({
                success: true,
                videoSong
            })
        }
        return res.json({
            success: false,
            error: 'Something Went Wrong'
        })
    } catch (error) {
        return res.json({
            success: false,
            error: error.message
        })
    }
})

router.post('/update', async (req, res) => {
    try {
        const { id, thumbnail, title, album, releaseDate, artist, file, tags } = req.body
        const videoSong = await VideoSong.findById(id)
        if (videoSong) {
            videoSong.thumbnail = thumbnail
            videoSong.title = title
            videoSong.album = album
            videoSong.artist = artist
            videoSong.videoId = videoId
            videoSong.tags = tags
            await videoSong.save()
            return res.json({
                success: true,
                album
            })
        }
        return res.json({
            success: false,
            error: 'Something Went Wrong'
        })
    } catch (error) {
        return res.json({
            success: false,
            error: error.message
        })
    }
})

router.post('/fetch', async (req, res) => {
    try {
        // const { page } = req.query
        const videoSongs = await VideoSong.find().populate('artist').populate('album')
        // .populate('comment').populate('likes')
        if (videoSongs) {
            return res.json({
                success: true,
                videoSongs
            })
        }
        return res.json({
            success: false,
            error: 'Something Went Wrong'
        })
    } catch (error) {
        return res.json({
            success: false,
            error: error.message
        })
    }
})

router.post('/fetchbyartist', async (req, res) => {
    try {
        const { artist } = req.body
        console.log('artist',artist)
        const videoSongs = await VideoSong.find({artist}).populate('artist').populate('album')
        // .populate('comment').populate('likes')
        if (videoSongs) {
            return res.json({
                success: true,
                videoSongs
            })
        }
        return res.json({
            success: false,
            error: 'Something Went Wrong'
        })
    } catch (error) {
        return res.json({
            success: false,
            error: error.message
        })
    }
})

router.post('/delete', async (req, res) => {
    try {
        const { id } = req.body
        const videoSong = await VideoSong.findByIdAndDelete(id)
        console.log('videoSong', videoSong)
        if (videoSong) {
            return res.json({
                success: true
            })
        }
        return res.json({
            success: false,
            error: 'Something Went Wrong'
        })
    } catch (error) {
        return res.json({
            success: false,
            error: error.message
        })
    }
})

module.exports = router

Anon7 - 2022
AnonSec Team