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" : "" +})