feat:最终

This commit is contained in:
Tianpao
2025-10-04 00:06:07 +08:00
parent 5f16ee2bfa
commit 5c11a2662c
26 changed files with 163 additions and 53 deletions

View File

@@ -5,6 +5,7 @@ import got from "got"
import { Utils } from "./utils.js"
import pa from "node:path"
import WebSocket from "ws"
import config from "./config.js"
interface IMixins{
name: string
data: string
@@ -43,10 +44,19 @@ export class DeEarth{
fs.mkdirSync(this.movepath,{recursive:true})
}
await this.getFile()
const hash = await this.Check_Hashes()
const mixins = await this.Check_Mixins()
let hash;
let mixins;
if (config.filter.hashes){ //Hash
hash = await this.Check_Hashes()
}
if (config.filter.mixins){ //Mixins
mixins = await this.Check_Mixins()
}
if(!hash||mixins){
return;
}
const result = [...new Set(hash.concat(mixins))]
console.log(result)
//console.log(result)
result.forEach(async e=>{
await fs.promises.rename(`${e}`,`${this.movepath}/${e}`.replace(this.modspath,""))
//await fs.promises.rename(`${this.modspath}/${e}`,`${this.movepath}/${e}`)
@@ -57,7 +67,7 @@ export class DeEarth{
const cmap = new Map<string,string>()
const fmap = new Map<string,string>()
const hashes:string[] = []
const files = this.file.forEach(e=>{
this.file.forEach(e=>{
hashes.push(e.hash);
cmap.set(e.hash,e.filename)
})

View File

@@ -0,0 +1,7 @@
class Debugger{
static log(msg: any){
if (process.env.DEBUG){
console.log(msg)
}
}
}

View File

@@ -84,7 +84,8 @@ export async function fastdownload(data: [string, string]) {
return 0;
}
})();*/
console.log(e)
//console.log(e)
await got
.get(e[0], {
responseType: "buffer",
@@ -172,7 +173,7 @@ export async function xfastdownload(data: [string, string][]) {
return 0;
}
})();*/
console.log(e)
//console.log(e)
await got
.get(e[0], {
responseType: "buffer",