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

5
.gitignore vendored
View File

@@ -25,4 +25,7 @@ dist-ssr
*.zip *.zip
Dex-v3-core.exe Dex-v3-core.exe
core-x86_64-pc-windows-msvc.exe core-x86_64-pc-windows-msvc.exe
config.json config.json
*.exe
*.jar
instance

View File

@@ -22,11 +22,10 @@ export class Dex {
this.ws = e this.ws = e
}) })
this.in = {} this.in = {}
console.log(this.ws) }
}
public async Main(buffer: Buffer) { public async Main(buffer: Buffer) {
const first = new Date().getTime() const first = Date.now()
const info = await this._getinfo(buffer) const info = await this._getinfo(buffer)
const plat = what_platform(info) const plat = what_platform(info)
const mpname = this.in.name const mpname = this.in.name
@@ -46,8 +45,7 @@ export class Dex {
})); //改变状态(DeEarth筛选模组完毕) })); //改变状态(DeEarth筛选模组完毕)
const mlinfo = await platform(plat).getinfo(this.in) const mlinfo = await platform(plat).getinfo(this.in)
await mlsetup(mlinfo.loader,mlinfo.minecraft,mlinfo.loader_version,unpath) //安装服务端 await mlsetup(mlinfo.loader,mlinfo.minecraft,mlinfo.loader_version,unpath) //安装服务端
const latest = new Date().getTime() const latest = Date.now()
console.log(latest - first)
this.ws.send(JSON.stringify({ this.ws.send(JSON.stringify({
status: "finish", status: "finish",
result: latest - first result: latest - first

View File

@@ -40,7 +40,7 @@ export class Fabric{
async install(){ async install(){
await execPromise(`java -jar fabric-installer.jar server -dir . -mcversion ${this.minecraft} -loader ${this.loaderVersion}`,{ await execPromise(`java -jar fabric-installer.jar server -dir . -mcversion ${this.minecraft} -loader ${this.loaderVersion}`,{
cwd:this.path cwd:this.path
}) }).catch(e=>console.log(e))
} }
private async wshell(){ private async wshell(){

View File

@@ -30,7 +30,7 @@ export function modloader(ml:string,mcv:string,mlv:string,path:string){
export async function mlsetup(ml:string,mcv:string,mlv:string,path:string){ export async function mlsetup(ml:string,mcv:string,mlv:string,path:string){
const minecraft = new Minecraft(ml,mcv,mlv,path); const minecraft = new Minecraft(ml,mcv,mlv,path);
console.log(ml) //console.log(ml)
await modloader(ml,mcv,mlv,path).setup() await modloader(ml,mcv,mlv,path).setup()
await minecraft.setup() await minecraft.setup()
} }

View File

@@ -88,7 +88,7 @@ export class Minecraft {
const mcpath = `${this.path}/server.jar` const mcpath = `${this.path}/server.jar`
await fastdownload([`https://bmclapi2.bangbang93.com/version/${this.minecraft}/server`, mcpath]) await fastdownload([`https://bmclapi2.bangbang93.com/version/${this.minecraft}/server`, mcpath])
// 依赖解压 // 依赖解压
const zip = await yauzl_promise(await fs.promises.readFile(mcpath)) /*const zip = await yauzl_promise(await fs.promises.readFile(mcpath))
for await (const entry of zip) { for await (const entry of zip) {
// if (entry.fileName.startsWith("META-INF/libraries/") && entry.fileName.endsWith("/") &&entry.fileName !== "META-INF/libraries/") { // if (entry.fileName.startsWith("META-INF/libraries/") && entry.fileName.endsWith("/") &&entry.fileName !== "META-INF/libraries/") {
// fs.promises.mkdir(`${this.path}/libraries/${entry.fileName.replace("META-INF/libraries/", "")}`,{ // fs.promises.mkdir(`${this.path}/libraries/${entry.fileName.replace("META-INF/libraries/", "")}`,{
@@ -105,16 +105,12 @@ export class Minecraft {
const out = entry.ReadEntrySync const out = entry.ReadEntrySync
await fsExtra.outputFile(`${this.path}/libraries/${entry.fileName.replace("META-INF/libraries/", "")}`,out) await fsExtra.outputFile(`${this.path}/libraries/${entry.fileName.replace("META-INF/libraries/", "")}`,out)
} }
} }*/
// 依赖解压 // 依赖解压
} }
async eula(){ async eula(){
const context = ` const context = `#By changing the setting below to TRUE you are indicating your agreement to our EULA (https://aka.ms/MinecraftEULA).\n#Spawn by DeEarthX(QQgroup:559349662) Tianpao:(https://space.bilibili.com/1728953419)\neula=true`
#By changing the setting below to TRUE you are indicating your agreement to our EULA (https://aka.ms/MinecraftEULA).
#Spawn by DeEarthX(QQgroup:559349662) Tianpao:(https://space.bilibili.com/1728953419)
eula=true
`
await fs.promises.writeFile(`${this.path}/eula.txt`,context) await fs.promises.writeFile(`${this.path}/eula.txt`,context)
} }
} }

View File

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

View File

@@ -12,9 +12,10 @@
"shell:default", "shell:default",
"shell:allow-execute", "shell:allow-execute",
"shell:allow-spawn", "shell:allow-spawn",
"shell:allow-kill",
"shell:allow-open", "shell:allow-open",
{ {
"identifier": "shell:allow-execute", "identifier": "shell:allow-spawn",
"allow": [ "allow": [
{ {
"name": "core", "name": "core",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 974 B

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 974 B

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

View File

@@ -1,3 +1,5 @@
use tauri::Manager;
// Learn more about Tauri commands at https://tauri.app/develop/calling-rust/ // Learn more about Tauri commands at https://tauri.app/develop/calling-rust/
#[tauri::command] #[tauri::command]
fn greet(name: &str) -> String { fn greet(name: &str) -> String {

View File

@@ -1,6 +1,6 @@
{ {
"$schema": "https://schema.tauri.app/config/2", "$schema": "https://schema.tauri.app/config/2",
"productName": "dex-v3-ui", "productName": "DeEarthX-V3",
"version": "0.1.0", "version": "0.1.0",
"identifier": "top.tianpao.dex-v3-ui", "identifier": "top.tianpao.dex-v3-ui",
"build": { "build": {
@@ -15,7 +15,10 @@
"title": "DeEarthX V3", "title": "DeEarthX V3",
"width": 1280, "width": 1280,
"height": 720, "height": 720,
"dragDropEnabled": false "dragDropEnabled": false,
"fullscreen": false,
"resizable": false,
"center": true
} }
], ],
"security": { "security": {
@@ -32,6 +35,19 @@
"icons/icon.icns", "icons/icon.icns",
"icons/icon.ico" "icons/icon.ico"
], ],
"externalBin": ["binaries/core"] "externalBin": ["binaries/core"],
"windows": {
"webviewInstallMode": {
"type": "downloadBootstrapper"
},
"nsis": {
"languages": ["SimpChinese","English"],
"displayLanguageSelector": true,
"installMode": "perMachine"
},
"wix": {
"language": "zh-CN"
}
}
} }
} }

View File

@@ -1,9 +1,43 @@
<script lang="ts" setup> <script lang="ts" setup>
import { h, ref } from 'vue'; import { h, ref } from 'vue';
import { MenuProps } from 'ant-design-vue'; import { MenuProps, message } from 'ant-design-vue';
import { SettingOutlined, UserOutlined, WindowsOutlined } from '@ant-design/icons-vue'; import { SettingOutlined, UserOutlined, WindowsOutlined } from '@ant-design/icons-vue';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import * as shell from '@tauri-apps/plugin-shell'; import * as shell from '@tauri-apps/plugin-shell';
import { invoke } from "@tauri-apps/api/core";
async function contant(){
await invoke("open_url",{url:"https://space.bilibili.com/1728953419"})
}
//屏蔽右键菜单
document.oncontextmenu = function (event: any) {
try {
var the = event.srcElement
if (
!(
(the.tagName == 'INPUT' && the.type.toLowerCase() == 'text') ||
the.tagName == 'TEXTAREA'
)
) {
return false
}
return true
} catch (e) {
return false
}
}
/* 启动后端 */
message.loading("DeEarthX.Core启动中此过程中请勿执行任何操作......").then(()=>{
shell.Command.create("core").spawn().then(()=>{
message.success("DeEarthX.Core 启动成功")
console.log(`DeEarthX V3 Core`)
}).catch((e)=>{
console.log(e)
message.error("DeEarthX.Core 启动失败请检查37019是否被占用")
})
})
const router = useRouter(); const router = useRouter();
const selectedKeys = ref(['main']); const selectedKeys = ref(['main']);
const items: MenuProps['items'] = [ const items: MenuProps['items'] = [
@@ -49,7 +83,14 @@ const handleClick: MenuProps['onClick'] = (e) => {
<template> <template>
<div class="tw:h-screen tw:w-screen"> <div class="tw:h-screen tw:w-screen">
<a-page-header class="tw:fixed tw:h-16" style="border: 1px solid rgb(235, 237, 240)" title="DeEarthX" <a-page-header class="tw:fixed tw:h-16" style="border: 1px solid rgb(235, 237, 240)" title="DeEarthX"
sub-title="V3" /> sub-title="V3"
:avatar="{ src: '../assets/tianpao.jpg' }"
>
<template #extra>
<a-button @click="contant">作者B站</a-button>
</template>
</a-page-header>
<div class="tw:flex tw:full tw:h-89/100"> <div class="tw:flex tw:full tw:h-89/100">
<a-menu id="menu" style="width: 144px;" :selectedKeys="selectedKeys" mode="inline" :items="items" @click="handleClick"/> <a-menu id="menu" style="width: 144px;" :selectedKeys="selectedKeys" mode="inline" :items="items" @click="handleClick"/>
<RouterView /> <RouterView />
@@ -58,4 +99,40 @@ const handleClick: MenuProps['onClick'] = (e) => {
</template> </template>
<style scoped></style> <style>
/* 禁止选择文本的样式 */
h1 {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select:none;
}
li {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select:none;
}
p {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select:none;
}
span {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select:none;
}
/* 禁止拖拽图片 */
img {
-webkit-user-drag: none;
-moz-user-drag: none;
-ms-user-drag: none;
}
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

View File

@@ -15,12 +15,18 @@ async function contant(idc:string){
<template> <template>
<div class="tw:h-full tw:w-full"> <div class="tw:h-full tw:w-full">
<div class="w-full h-64"> <!-- 广告位 --> <div class="tw:w-full tw:h-64"> <!-- 广告位 -->
<h1 class="tw:text-2xl tw:text-center tw:bg-gradient-to-r tw:from-emerald-500 tw:to-cyan-500 tw:bg-clip-text tw:text-transparent">赞助商广告位</h1> <h1 class="tw:text-2xl tw:text-center tw:bg-gradient-to-r tw:from-emerald-500 tw:to-cyan-500 tw:bg-clip-text tw:text-transparent">赞助商广告位</h1>
<div class="tw:flex tw:flex-col tw:w-30 tw:h-30 tw:ml-5 tw:mt-2" @click="contant('elfidc')"> <!-- 亿讯云 --> <div class="tw:flex tw:flex-col tw:w-30 tw:h-30 tw:ml-5 tw:mt-2" @click="contant('elfidc')"> <!-- 亿讯云 -->
<img class="tw:w-24 tw:h-24" src="../assets/elfidc.svg"></img> <img class="tw:w-24 tw:h-24" src="../assets/elfidc.svg"></img>
<h1 class="tw:text-sm tw:text-center tw:text-yellow-400">亿讯云金牌赞助</h1> <h1 class="tw:text-sm tw:text-center tw:text-yellow-400">亿讯云金牌赞助</h1>
</div> </div>
</div> </div>
<!-- <div class="tw:w-full tw:h-64 flex">
<div class="tw:flex tw:flex-col tw:w-30 tw:h-30 tw:ml-5 tw:mt-2">
<a-avatar src="../assets/tianpao.jpg" :size="48" style="background-color: #1e90ff"/>
<h1 class="tw:text-sm tw:text-center tw:text-yellow-400">天泡</h1>
</div>
</div> -->
</div> </div>
</template> </template>

View File

@@ -1,19 +1,15 @@
<script lang="ts" setup> <script lang="ts" setup>
import { nextTick, ref, VNodeRef } from 'vue'; import { ref } from 'vue';
import { InboxOutlined } from '@ant-design/icons-vue'; import { InboxOutlined } from '@ant-design/icons-vue';
import { message, StepsProps } from 'ant-design-vue'; import { message, StepsProps } from 'ant-design-vue';
import type { UploadFile, UploadChangeParam, Upload } from 'ant-design-vue'; import type { UploadFile, UploadChangeParam } from 'ant-design-vue';
import { import {sendNotification,} from '@tauri-apps/plugin-notification';
isPermissionGranted,
requestPermission,
sendNotification,
} from '@tauri-apps/plugin-notification';
interface IWSM { interface IWSM {
status: "unzip"|"finish"|"changed"|"downloading", status: "unzip"|"finish"|"changed"|"downloading",
result: any result: any
} }
/* 进度显示区 */ /* 进度显示区 */
const disp_steps = ref(true); const disp_steps = ref(false);
const setyps_current = ref(0); const setyps_current = ref(0);
const setps_items: StepsProps['items'] = [{ const setps_items: StepsProps['items'] = [{
title: '解压整合包', title: '解压整合包',
@@ -59,17 +55,20 @@ function handleUpload() {
} }
runDeEarthX(FileList.value[0].originFileObj) //获取文件内容 runDeEarthX(FileList.value[0].originFileObj) //获取文件内容
BtnisDisabled.value = true; //禁用按钮 BtnisDisabled.value = true; //禁用按钮
isDisabled.value = true; //禁用上传
disp_steps.value = true; //开始显示进度条 disp_steps.value = true; //开始显示进度条
} }
function reactFL() { function reactFL() {
FileList.value = []; FileList.value = [];
isDisabled.value = false; isDisabled.value = false;
BtnisDisabled.value = false;
disp_steps.value = false; //关闭进度条
} }
/* 获取文件区 */ /* 获取文件区 */
//shell.Command.create('core',['start']).spawn()
function runDeEarthX(data: Blob) { function runDeEarthX(data: Blob) {
//console.log(data) //console.log(data)
message.success("开始制作,请勿切换菜单!");
const fd = new FormData(); const fd = new FormData();
fd.append('file', data); fd.append('file', data);
console.log(fd.getAll('file')) console.log(fd.getAll('file'))
@@ -79,10 +78,6 @@ function runDeEarthX(data: Blob) {
}).then(async res=>res.json()).then(()=>{ }).then(async res=>res.json()).then(()=>{
prews() prews()
}) })
// shell.Command.create('core',['start',new BigUint64Array(data).toString()]).stdout.on('data',(data)=>{
// console.log(data)
// })
reactFL()
} }
const prog = ref({status:"active",percent:0,display:true}) const prog = ref({status:"active",percent:0,display:true})
const dprog = ref({status:"active",percent:0,display:true}) const dprog = ref({status:"active",percent:0,display:true})
@@ -120,22 +115,17 @@ function prews(){
} }
} }
if (_data.status === "finish"){ if (_data.status === "finish"){
const time = Math.round(_data.result / 1000 / 1000) console.log(_data.result)
const time = Math.round(_data.result / 1000)
setyps_current.value ++; setyps_current.value ++;
message.success(`服务端制作完成!共用时${time}秒!`)
sendNotification({ title: 'DeEarthX V3', body: `服务端制作完成!共用时${time}秒!` }); sendNotification({ title: 'DeEarthX V3', body: `服务端制作完成!共用时${time}秒!` });
setTimeout(()=>{ //恢复状态
reactFL()
},8*1000)
} }
}) })
} }
/* 日志区 */
const logs = ref<{message:string}[]>([]);
//logs.value.push({message:"114514"})
const logContainer = ref<HTMLDivElement>();
nextTick(()=>{
if(logContainer.value){
logContainer.value.scrollTop = logContainer.value.scrollHeight;
}
})
</script> </script>
<template> <template>
<div class="tw:h-full tw:w-full tw:relative"> <div class="tw:h-full tw:w-full tw:relative">

3
注意事项.txt Normal file
View File

@@ -0,0 +1,3 @@
安装DeEarthX V3时默认安装至C:\Program Files\DeEarthX-V3 建议不要装在C盘因为权限问题
请自行记好安装目录!!!
QQ群559349662