add 系统下载地址配置cookies配置及

This commit is contained in:
theluyuan 2023-09-03 16:59:13 +08:00
parent f5c666a027
commit 8b7af9535c
8 changed files with 69 additions and 38 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@ node_modules/
view/node_modules/ view/node_modules/
.idea/ .idea/
/db/database.db /db/database.db
/config.json

View File

@ -1,5 +0,0 @@
{
"downloadPath": "",
"vCookies": "e",
"torrentSavePath": ""
}

View File

@ -7,7 +7,8 @@ const { getVideoInfo } = require("../sql/video.js");
const { mkdirRecursions } = require("../markdir.js"); const { mkdirRecursions } = require("../markdir.js");
const { default: axios } = require("axios"); const { default: axios } = require("axios");
const FormData = require('form-data'); const FormData = require('form-data');
let newDir = "K:/zuozhongtest" const { getConfig } = require("../config/config.js");
// let newDir = "K:/zuozhongtest"
function getId(url) { function getId(url) {
// 1; url=download.php?id=10796 // 1; url=download.php?id=10796
return url.split("?")[1].split("=")[1] return url.split("?")[1].split("=")[1]
@ -50,14 +51,14 @@ async function updateSeed(info, desc) {
} }
form.append("standard_sel[4]", fbl[info.fbl]) form.append("standard_sel[4]", fbl[info.fbl])
let instance = axios.create({ let instance = axios.create({
headers: {...form.getHeaders(),Cookie:"c_secure_uid=MTQwMzg%3D; c_secure_pass=166f7662c2f2b83df7bfab6707e1af7d; c_secure_ssl=eWVhaA%3D%3D; c_secure_tracker_ssl=eWVhaA%3D%3D; c_secure_login=bm9wZQ%3D%3D"} headers: { ...form.getHeaders(), Cookie: getConfig().vCookies }
}); });
let res = await instance.post("https://zmpt.cc/takeupload.php", form, { let res = await instance.post("https://zmpt.cc/takeupload.php", form, {
proxy: false proxy: false
}) })
console.log(res.headers.refresh) console.log(res.headers.refresh)
instance = axios.create({ instance = axios.create({
headers: {Cookie:"c_secure_uid=MTQwMzg%3D; c_secure_pass=166f7662c2f2b83df7bfab6707e1af7d; c_secure_ssl=eWVhaA%3D%3D; c_secure_tracker_ssl=eWVhaA%3D%3D; c_secure_login=bm9wZQ%3D%3D"} headers: { Cookie: getConfig().vCookies }
}); });
await instance({ await instance({
method: 'get', method: 'get',
@ -116,6 +117,7 @@ async function sendSeed(info) {
console.log(err) console.log(err)
console.log("发种失败") console.log("发种失败")
} }
let newDir = getConfig().torrentSavePath
// 移动到做种文件夹 // 移动到做种文件夹
mkdirRecursions(newDir + "/" + info.seedName + "/") mkdirRecursions(newDir + "/" + info.seedName + "/")
// fs.renameSync(info.newPath + "/" + info.rname, newDir + "/" + info.seedName + "/" + info.rname); // fs.renameSync(info.newPath + "/" + info.rname, newDir + "/" + info.seedName + "/" + info.rname);

View File

@ -1,7 +1,8 @@
const schedule = require('node-schedule'); const schedule = require('node-schedule');
const { getSub,updateSkip } = require('../sql/video'); const { getSub,updateSkip } = require('../sql/video');
const { getQqListData } = require("../getList/qq.js") const { getQqListData } = require("../getList/qq.js")
const { addDownList } = require("../sql/download.js") const { addDownList } = require("../sql/download.js");
const { getConfig } = require('../config/config');
// 检查更新并将更新推送下载 // 检查更新并将更新推送下载
async function addDown(i) { async function addDown(i) {
@ -20,7 +21,7 @@ async function addDown(i) {
} }
for (let j = i.skip - 1; j < newlist.length; j++) { for (let j = i.skip - 1; j < newlist.length; j++) {
let v = newlist[j] let v = newlist[j]
await addDownList(v.item_params.title, `https://v.qq.com/x/cover/${cid}/${v.item_params.vid}.html`, `k:/dltest/${i.sid}`, new Date().getTime(), 0, i.sid) await addDownList(v.item_params.title, `https://v.qq.com/x/cover/${cid}/${v.item_params.vid}.html`, `${getConfig().downloadPath}/${i.sid}`, new Date().getTime(), 0, i.sid)
} }
await updateSkip(list.length + 1,i.id) await updateSkip(list.length + 1,i.id)
// console.log(JSON.stringify(list)) // console.log(JSON.stringify(list))

View File

@ -63,7 +63,6 @@ async function getVideoInfoById(id){
} }
} }
module.exports = { module.exports = {
addSub, addSub,
getSub, getSub,

10
view/src/api/Config.js Normal file
View File

@ -0,0 +1,10 @@
import {base} from "./base";
export async function setConfig(data){
return await base.post('/config/setConfig',data)
}
export async function getConfig(){
return await base.get('/config/getConfig')
}

View File

@ -1,16 +1,39 @@
<script setup> <script setup>
import { ref } from 'vue';
import {setConfig,getConfig} from "../api/Config.js"
import { ElMessage } from 'element-plus'
const formLabelAlign = ref({})
function submitForm(){
setConfig(formLabelAlign.value).then((res)=>{
ElMessage({
message: '保存成功',
type: 'success',
})
console.log(res)
})
}
getConfig().then((res)=>{
console.log(res)
formLabelAlign.value = res.data.data
})
</script> </script>
<template> <template>
<el-row :gutter="20"> <el-form :label-position="labelPosition" label-width="100px" :model="formLabelAlign" style="max-width: 460px">
<h1 style="padding: 20px">设置页面</h1> <el-form-item label="临时下载地址">
<el-divider /> <el-input v-model="formLabelAlign.downloadPath" />
</el-row> </el-form-item>
<el-form-item label="做种位置">
<el-input v-model="formLabelAlign.torrentSavePath" />
</el-form-item>
<el-form-item label="zmptCookies">
<el-input v-model="formLabelAlign.vCookies" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm()">
保存
</el-button>
</el-form-item>
</el-form>
</template> </template>
<style> <style></style>
</style>

View File

@ -21,7 +21,7 @@ import {onMounted, ref} from "vue";
import {delSubscribe, getSubscribe} from '../../api/Video.js' import {delSubscribe, getSubscribe} from '../../api/Video.js'
import {ElMessage, ElMessageBox} from "element-plus"; import {ElMessage, ElMessageBox} from "element-plus";
const list = ref([]) const list = ref<any>([])
onMounted(async ()=>{ onMounted(async ()=>{
const res = await getSubscribe() const res = await getSubscribe()
list.value = res.data list.value = res.data