From e8cd3f20baa02649b7bbbff7b4a13f3dc3346ea0 Mon Sep 17 00:00:00 2001 From: Theluyuan <1162963624@qq.com> Date: Wed, 12 Jul 2023 14:51:00 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E8=B1=86=E7=93=A3=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- router/index.js | 14 ++++++++++++++ util/ptgen/index.js | 1 + view/src/api/base.js | 4 ++-- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/router/index.js b/router/index.js index ed71688..f26f088 100644 --- a/router/index.js +++ b/router/index.js @@ -5,9 +5,23 @@ const KoaSSEStream = require('koa-sse-stream'); const {dowload} = require("../util/download"); const {addDownList, getDownList, setDownState} = require("../util/sql/download"); const {getMediaInfo} = require("../util/utils"); +const axios = require("axios"); const router = new Router() // const download = [] +// 豆瓣img代理 +router.get("/doubanImg",async (ctx)=>{ + let url = ctx.query.url + let res = await axios.get(url,{ + proxy:false, + headers:{ + Referer: "https://movie.douban.com/" + }, + responseType:"stream" + }) + ctx.body = res.data +}) + router.get("/test", async (ctx) => { let res = await utils.uploadImg('C:/Users/11629/Desktop/80032464_p0.jpg') diff --git a/util/ptgen/index.js b/util/ptgen/index.js index b27f170..fdae7f3 100644 --- a/util/ptgen/index.js +++ b/util/ptgen/index.js @@ -7,6 +7,7 @@ async function search(name) { }) return { data: list.data.map(d => { + d.img = "http://127.0.0.1:3050/doubanImg?url=" + d.img return { ...d, link: `https://movie.douban.com/subject/${d.id}/` diff --git a/view/src/api/base.js b/view/src/api/base.js index b9cf519..33fbb6e 100644 --- a/view/src/api/base.js +++ b/view/src/api/base.js @@ -1,5 +1,5 @@ import axios from "axios"; export const base = axios.create({ - baseURL:"http://127.0.0.1:3050" -}) \ No newline at end of file + baseURL:import.meta.env.DEV ? "http://127.0.0.1:3050" : "" +})