From d60c80b31b733b5659f4c5c2c97bd72087aa4583 Mon Sep 17 00:00:00 2001 From: Heitor Date: Fri, 14 Aug 2020 12:10:21 -0300 Subject: [PATCH] colocando https no last.fm --- gui/.firebase/hosting.YnVpbGQ.cache | 57 +++++++++++++++++++++++++++++ gui/.firebaserc | 5 +++ gui/firebase.json | 16 ++++++++ gui/src/AlbumInfo.tsx | 2 +- gui/src/requests.ts | 11 ++++-- server/src/index.ts | 11 +++--- server/src/splitVideo.ts | 2 +- 7 files changed, 93 insertions(+), 11 deletions(-) create mode 100644 gui/.firebase/hosting.YnVpbGQ.cache create mode 100644 gui/.firebaserc create mode 100644 gui/firebase.json diff --git a/gui/.firebase/hosting.YnVpbGQ.cache b/gui/.firebase/hosting.YnVpbGQ.cache new file mode 100644 index 0000000..170ac77 --- /dev/null +++ b/gui/.firebase/hosting.YnVpbGQ.cache @@ -0,0 +1,57 @@ +asset-manifest.json,1597416017486,ba96b6e20112325007bf61b4808d1784d1e94becaca18b22f3469f96a234f84d +favicon.ico,1597415998425,d52725447d459e45091e1b11067fae1b25546e108c13e7107747e75bf5bd2569 +index.html,1597416017482,991c85a241bbd93abf245fc18130b55ac71067275e51f1ba3335618ddb7022e4 +logo192.png,1597415998425,76c449ccb9cd117c2f2338f091b18f7050f3210e249b2228f5c81b23f34377cd +logo512.png,1597415998425,7779210d56c1f3741e2e487799fe3092def4fa6ac450a60532b807c3a8971205 +manifest.json,1597415998425,0958a5e0c831126100c8c2d06a6bbaa665a3900f21aaff4130238a6f5a113aa1 +precache-manifest.5af7e2e114bf01760c6891f9a3a11a49.js,1597416017482,1935ed565d3fc89e04e7939287593077e2288f4e7e41b2c83e097335cf681560 +robots.txt,1597415998425,2544ca049f223a42bff01f72ad930a5edba75bbb7199d0f8430a02ff5aca16ec +service-worker.js,1597416017482,1ebe5b074d363f129188e744adb425e23a638cceab1676b40b75da06340f0764 +static/css/2.20981966.chunk.css,1597416017478,b3915336a86902669d21e2dd90f335e99ee32c31dbea8403542bd5d45f09dd42 +static/css/2.20981966.chunk.css.map,1597416017482,cfd9cde86e032c03f377b07f1c10f25bcdecfd247f4627e64536ec2752c54cb5 +static/css/main.5f361e03.chunk.css,1597416017474,1225945381892d813e90efe1c2bf85dad429fb1fce6829657a852a833b2081a3 +static/css/main.5f361e03.chunk.css.map,1597416017482,598f7972010d8f32c864cacf97d3770434b6aaf52e74a00c2e8b1b13faf78d9f +static/js/2.afc5c31b.chunk.js.LICENSE.txt,1597416017482,ae8a54d8149cbb465d0d7e0a0bedafe6841abbf0ee2d87190fee047131a493be +static/js/main.9c432a26.chunk.js,1597416017474,5d15f78f2213107cad8696a6ae562f4341b4d87322f58e738979f4fddfde196d +static/js/runtime-main.b0b4fd9f.js,1597416017478,cc168bdc9a35edc5b35c91a8646b14151f1498045c6a935bb8f556a0695a4545 +static/js/runtime-main.b0b4fd9f.js.map,1597416017486,28c171a19b5c9415cd40dfbffab745b136a2051a242758d1029cc47e5646b312 +static/js/main.9c432a26.chunk.js.map,1597416017482,e54f1fe13cde5c1fb484e27d5c16e923dd936f067935e34ba095aaaa1fd1cbff +static/media/roboto-latin-100-normal.7370c367.woff2,1597416017474,fec1f81d4ad7c52951fa69630695f911167ca2182ee60858664bf3239fc8d3bc +static/media/roboto-latin-300-normal.ef7c6637.woff2,1597416017474,114b542bde3aa86f6fea7a4cf49d463b1e3bcda88a00d4434667af8361270298 +static/media/roboto-latin-400-normal.479970ff.woff2,1597416017474,9055258e9962f719df7bbe9ed52aa8132005255601dde210dd6124f5b449514a +static/media/roboto-latin-500-normal.020c97dc.woff2,1597416017474,094a4ce2dbbc4b1813a386c48bb8fb701fe9f3f40cd105df5ffd696fdfbfefa0 +static/media/roboto-latin-700-normal.2735a3a6.woff2,1597416017474,632a58ff64f17e9214748c60cbc770c559f635014ec22a17de324ba83f28d495 +static/media/roboto-latin-100-italic.f8b1df51.woff2,1597416017470,e32390e627531ef59ed32c7473c58f927c97f3d28cd136961ac4dda2b8b97652 +static/media/roboto-latin-100-italic.f9e8e590.woff,1597416017474,d64942962daed8e4d38eee11ef999167fded841a4b2021b50e895fa5ee0e40c7 +static/media/roboto-latin-100-normal.5cb7edfc.woff,1597416017474,bfdd187beb4585e2823f2fd75eeda9cb86fe41a291f8533d71eaf9ba1b98725e +static/media/roboto-latin-300-italic.14286f3b.woff2,1597416017474,2e0ef454ba011860ed1f3d92b0fcd312b05e09708ecc34157163bf51db1bad3f +static/media/roboto-latin-300-italic.4df32891.woff,1597416017474,b898f53b4d504dea5e7cbae7b658db2b8827aa2cda5b8d3ff0d6f66f7c49a031 +static/media/roboto-latin-100-italic.a90b3053.ttf,1597416017474,73443290a8f77ef8e4ae3b9f3cb1d39e7245ce3c177ab4803e679f06769a6efc +static/media/roboto-latin-100-normal.ff1e90ce.ttf,1597416017474,4799491747e828e3b32e6b7d5ff21d6508b46ac9815323759329aa5d39324dbb +static/media/roboto-latin-300-normal.b00849e0.woff,1597416017474,020782eb2d471746f1ca9efdf1a41f0f837d8d81d7924b44d298acd1e16afc01 +static/media/roboto-latin-400-italic.51521a2a.woff2,1597416017474,be1f6c65d7205341be4c77384e2691dc4a86fbdabb9ae74fbf6814b62183426e +static/media/roboto-latin-400-italic.fe65b833.woff,1597416017474,17272cd004d39375bcaf98c2b5b567078f104936c46235ca156766ccb898be93 +static/media/roboto-latin-300-italic.51c5bffe.ttf,1597416017474,f59efd96fce20fb7af1eb57ed709e2c46ea62a228c6927205518d98caa97357e +static/media/roboto-latin-400-normal.60fa3c06.woff,1597416017474,3461a62ccac1bd91ed5a6b58ac6a2dd9f6a3f02b775735fb9c2afcdb2c5d7c43 +static/media/roboto-latin-300-normal.806854d4.ttf,1597416017474,d56c9e1c0deeb0d35b7991efb8db24a5acb0d2e2b9d1d6704cd9357e3970dfb3 +static/media/roboto-latin-400-normal.329ae1c3.ttf,1597416017474,fe33ef7623205405482522ef2e936e666d655757ea0f2ee1d9157cbc729d53fd +static/media/roboto-latin-400-italic.d4ad1feb.ttf,1597416017474,b498e5a40b84cfb1acee784810b454bfd6b63c2b4c187207f1dcfa106fdca97a +static/media/roboto-latin-500-italic.288ad9c6.woff,1597416017474,9cf7c604f57d195a58ec797ff7a2b900d42203139c75c5a0a4fb1bdac5fc1307 +static/media/roboto-latin-500-italic.db4a2a23.woff2,1597416017474,08c1b0f33fcfa0bae8ff81e98b138e8539fbf25f67919591baa8ea212590922c +static/media/roboto-latin-500-normal.87284894.woff,1597416017474,46d28a430ded7eb1064edea34d60703ce55f8f8ec9c9f19b61529d36c994a77e +static/media/roboto-latin-500-italic.0a36c77f.ttf,1597416017474,fd36d319b3f568dae4e87dc6187ced38415074f8425a40101a276afcfc84bf7a +static/media/roboto-latin-700-italic.81f57861.woff,1597416017474,351d0b02e9f44cad55d01a00963980d31cf020693d18b540ac568be6e08776d0 +static/media/roboto-latin-700-italic.da0e7178.woff2,1597416017474,9683ae99c43ee14b9e9bfb43f8464c425bcac3af98337523a0a993a7c4614b99 +static/media/roboto-latin-700-normal.96559ffb.ttf,1597416017474,a5d74319c45098e8293999c8034b896c571811125ce7473f6b56e79f9fd42092 +static/media/roboto-latin-500-normal.8c608256.ttf,1597416017474,89c98e4526e06a12c403213245061c351809eafbe2488ea2c5685c3088e2ce95 +static/media/roboto-latin-700-italic.4c13d18a.ttf,1597416017474,0f1d6e09ea5eabfd2899a2d9586833d5ae16b7f75e4f1abdd8880f3e42753dac +static/media/roboto-latin-900-normal.9b3766ef.woff2,1597416017478,a54d7bb08369a07ab7e79f0518147f13779033dfb7c99dbf3dbac9badf99bd03 +static/media/roboto-latin-700-normal.adcde98f.woff,1597416017474,5fadec1a270aa87a50eb16ff4b467c2c55b267e7081f05ca4e8669b8dcb1c922 +static/media/roboto-latin-900-italic.28f91510.woff,1597416017478,006196b0dcdd5db5e8b008cf9a6df8213300197caf068e518122266062b090b9 +static/media/roboto-latin-900-italic.ebf6d164.woff2,1597416017474,c53303d6c9a7bfeb19e9721a542d9a86600e4d9ea805a5509a51cc8916eaf8d8 +static/media/roboto-latin-900-normal.bb1e4dc6.woff,1597416017478,3463e8e5358ce304e48621fec7e4a102b24189d8bdbb03a08a05513e82dee018 +static/media/roboto-latin-900-italic.a3f8594c.ttf,1597416017478,73c32d5a2b6f5adebe0caf756e228235deaba3ad3eb8fdc04b36cd298297dbd8 +static/media/roboto-latin-900-normal.22acb397.ttf,1597416017478,ade5923ee1c60925ca74adff8cbd4d0da3f057b3022e51720ed19df14b3d8c01 +static/js/2.afc5c31b.chunk.js,1597416017478,5166373e3fc56d419ed9da335b04d2014dacec8c357e35633ec22671bdbcc2b3 +static/media/error.7b7ac30d.png,1597416017478,7bd2a101ef843c890c2103517238994ce856805e835c38e2016a5f0a64378169 +static/js/2.afc5c31b.chunk.js.map,1597416017486,5b7048606cd0112db970c53bd825413b6d7ae7c964689990befd0c2262d0f5b2 diff --git a/gui/.firebaserc b/gui/.firebaserc new file mode 100644 index 0000000..b99d2d7 --- /dev/null +++ b/gui/.firebaserc @@ -0,0 +1,5 @@ +{ + "projects": { + "default": "yt-album-downloader" + } +} diff --git a/gui/firebase.json b/gui/firebase.json new file mode 100644 index 0000000..340ed5b --- /dev/null +++ b/gui/firebase.json @@ -0,0 +1,16 @@ +{ + "hosting": { + "public": "build", + "ignore": [ + "firebase.json", + "**/.*", + "**/node_modules/**" + ], + "rewrites": [ + { + "source": "**", + "destination": "/index.html" + } + ] + } +} diff --git a/gui/src/AlbumInfo.tsx b/gui/src/AlbumInfo.tsx index 5aeba7e..8b7d596 100644 --- a/gui/src/AlbumInfo.tsx +++ b/gui/src/AlbumInfo.tsx @@ -66,7 +66,7 @@ function AlbumInfo(props: InfoProps) { async function download() { setDownloading(true) setDisabled(true) - io = socket('https://ytadserver.herokuapp.com/') + io = socket('https://corsytad.herokuapp.com/https://ytadserver.herokuapp.com/') io.on('connect',()=>{console.log('conectou')}) io.on('step',(step: string)=>{setStep(step)}) io.on('prdwn',(progress:number)=>progressDownload(progress)) diff --git a/gui/src/requests.ts b/gui/src/requests.ts index 49f2ce2..db9c397 100644 --- a/gui/src/requests.ts +++ b/gui/src/requests.ts @@ -1,20 +1,23 @@ import axios from 'axios' import {Song} from './interfaces' const api = axios.create({ - baseURL: 'https://ytadserver.herokuapp.com/' + baseURL: 'https://corsytad.herokuapp.com/https://ytadserver.herokuapp.com/', + withCredentials: true }); const lastFmApi = axios.create({ - baseURL: 'http://ws.audioscrobbler.com/2.0' + baseURL: 'https://ws.audioscrobbler.com/2.0' }) export const getVideoInfo = async(videoURL:string)=>{ - const resp = await api.get(`/videoinfo?videoURL=${videoURL}`) + console.log('linknv') + const resp = await api.get(`/videoinfo?videoURL=${videoURL}`,{withCredentials:true}) return resp.data } export const downloadAlbum = async(videoURL: string, artist: string, album:string, songs:Song[], linkCover:string)=>{ - + console.log('nova versão') const resp = await api.post(`/download?videoURL=${videoURL}`,{songs,artist,album,linkCover},{ responseType: 'blob', + withCredentials:true }) return resp.data } diff --git a/server/src/index.ts b/server/src/index.ts index 5e66e8c..d25b89c 100644 --- a/server/src/index.ts +++ b/server/src/index.ts @@ -20,20 +20,21 @@ interface song { length: string } const app = express() +app.use('*',cors({origin: 'https://yt-album-downloader.web.app'})) +app.options('*',cors({origin: 'https://yt-album-downloader.web.app'})) app.use(express.json()) app.use(bodyParser.json()) -app.use(cors()) const server = http.createServer(app) const io = socket(server) io.on('connection',(socket)=>{ console.log('conectou') //socket.emit('odio','tbm te odeio') //console.log(socket)oo - app.options('/download', async(req, res)=>{ - res.setHeader('Access-Control-Allow-Origin', 'https://yt-album-downloader.web.app') + /*app.options('/download', async(req, res)=>{ + //res.setHeader('Access-Control-Allow-Origin', 'https://yt-album-downloader.web.app') return res.json('deixa') - }) - app.post('/download', async (req, res) => { + })*/ + app.post('/download', cors({origin: 'https://yt-album-downloader.web.app'}), async (req, res) => { console.log('Começou o download!') try { const songs: song[] = req.body.songs diff --git a/server/src/splitVideo.ts b/server/src/splitVideo.ts index 0579ffc..08f1b58 100644 --- a/server/src/splitVideo.ts +++ b/server/src/splitVideo.ts @@ -96,7 +96,7 @@ function compactAlbum(dir: string, album: string,res:any) { console.log(archive.pointer() + ' total bytes'); console.log('archiver has been finalized and the output file descriptor has closed.'); destroyGarbage(dir) - res.setHeader('Access-Control-Allow-Origin', 'https://yt-album-downloader.web.app'); + // /res.setHeader('Access-Control-Allow-Origin', 'https://yt-album-downloader.web.app'); res.download(`${dir}/${album}.zip`) //return res.json({'oi':'ola'}) });